PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 5.0
MainWP Dashboard: Self-hosted WordPress Management for Agencies v5.0
6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 5.2.2 5.3 All 153 releases
mainwp / class / class-mainwp-system-view.php

class-mainwp-system-view.php in MainWP Dashboard: Self-hosted WordPress Management for Agencies 5.0, at class/class-mainwp-system-view.php

1,248 lines 66.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * MainWP System View.
4 *
5 * @package MainWP/Dashboard
6 */
7
8 namespace MainWP\Dashboard;
9
10 /**
11 * Class MainWP_System_View
12 *
13 * @package MainWP\Dashboard
14 */
15 class MainWP_System_View {
16
17 /**
18 * Get Class Name
19 *
20 * @return string __CLASS__
21 */
22 public static function get_class_name() {
23 return __CLASS__;
24 }
25
26 /**
27 * Method get_mainwp_translations()
28 * Build Translations Array.
29 *
30 * @return array $mainwpTranslations.
31 */
32 public static function get_mainwp_translations() {
33
34 /**
35 * Method mainwp_add_translation()
36 *
37 * Grab info needed to build array and strip chartacters "/[^A-Za-z0-9_]/".
38 *
39 * @param mixed $pArray Array of tranlatable text.
40 * @param mixed $pKey Key for each array enty.
41 * @param mixed $pText Text for each array entry.
42 */
43 function mainwp_add_translation( &$pArray, $pKey, $pText ) {
44 if ( ! is_array( $pArray ) ) {
45 $pArray = array();
46 }
47
48 $strippedText = str_replace( ' ', '_', $pKey );
49 $strippedText = preg_replace( '/[^A-Za-z0-9_]/', '', $strippedText );
50
51 $pArray[ $strippedText ] = $pText;
52 }
53
54 $mainwpTranslations = array();
55 mainwp_add_translation( $mainwpTranslations, 'Update settings.', esc_html__( 'Update settings.', 'mainwp' ) );
56 mainwp_add_translation( $mainwpTranslations, 'Settings have been updated.', esc_html__( 'Settings have been updated.', 'mainwp' ) );
57 mainwp_add_translation( $mainwpTranslations, 'An error occured.', esc_html__( 'An error occured.', 'mainwp' ) );
58 mainwp_add_translation( $mainwpTranslations, 'Testing login.', esc_html__( 'Testing login.', 'mainwp' ) );
59 mainwp_add_translation( $mainwpTranslations, 'Your login is valid.', esc_html__( 'Your login is valid.', 'mainwp' ) );
60 mainwp_add_translation( $mainwpTranslations, 'Your login is invalid.', esc_html__( 'Your login is invalid.', 'mainwp' ) );
61 mainwp_add_translation( $mainwpTranslations, 'An error occured, please contact us.', esc_html__( 'An error occured, please contact us.', 'mainwp' ) );
62 mainwp_add_translation( $mainwpTranslations, 'more', esc_html__( 'more', 'mainwp' ) );
63 mainwp_add_translation( $mainwpTranslations, 'less', esc_html__( 'less', 'mainwp' ) );
64 mainwp_add_translation( $mainwpTranslations, 'An error occured: ', esc_html__( 'An error occured: ', 'mainwp' ) );
65 mainwp_add_translation( $mainwpTranslations, 'No data available. Connect your sites using the Settings submenu.', esc_html__( 'No data available. Connect your sites using the Settings submenu.', 'mainwp' ) );
66 mainwp_add_translation( $mainwpTranslations, 'Undefined error.', esc_html__( 'Undefined error.', 'mainwp' ) );
67 mainwp_add_translation( $mainwpTranslations, 'PENDING', esc_html__( 'PENDING', 'mainwp' ) );
68 mainwp_add_translation( $mainwpTranslations, 'UPDATING', esc_html__( 'UPDATING', 'mainwp' ) );
69 mainwp_add_translation( $mainwpTranslations, 'UPGRADING', esc_html__( 'UPGRADING', 'mainwp' ) );
70 mainwp_add_translation( $mainwpTranslations, 'FAILED', esc_html__( 'FAILED', 'mainwp' ) );
71 mainwp_add_translation( $mainwpTranslations, 'DONE', esc_html__( 'DONE', 'mainwp' ) );
72 mainwp_add_translation( $mainwpTranslations, 'SYNCING', esc_html__( 'SYNCING', 'mainwp' ) );
73 mainwp_add_translation( $mainwpTranslations, 'DISCONNECTED', esc_html__( 'DISCONNECTED', 'mainwp' ) );
74 mainwp_add_translation( $mainwpTranslations, 'TIMEOUT', esc_html__( 'TIMEOUT', 'mainwp' ) );
75 mainwp_add_translation( $mainwpTranslations, 'Ignored', esc_html__( 'Ignored', 'mainwp' ) );
76 mainwp_add_translation( $mainwpTranslations, 'No ignored %1s', esc_html__( 'No ignored %1s', 'mainwp' ) );
77 mainwp_add_translation( $mainwpTranslations, 'No ignored %1 conflicts', esc_html__( 'No ignored %1 conflicts', 'mainwp' ) );
78 mainwp_add_translation( $mainwpTranslations, 'No ignored plugins', esc_html__( 'No ignored plugins', 'mainwp' ) );
79 mainwp_add_translation( $mainwpTranslations, 'No ignored themes', esc_html__( 'No ignored themes', 'mainwp' ) );
80 mainwp_add_translation( $mainwpTranslations, 'Upgrading..', esc_html__( 'Upgrading..', 'mainwp' ) );
81 mainwp_add_translation( $mainwpTranslations, 'Update successful', esc_html__( 'Update successful', 'mainwp' ) );
82 mainwp_add_translation( $mainwpTranslations, 'Update failed', esc_html__( 'Update failed', 'mainwp' ) );
83 mainwp_add_translation( $mainwpTranslations, 'Show All', esc_html__( 'Show All', 'mainwp' ) );
84 mainwp_add_translation( $mainwpTranslations, 'Show', esc_html__( 'Show', 'mainwp' ) );
85 mainwp_add_translation( $mainwpTranslations, 'Hide All', esc_html__( 'Hide All', 'mainwp' ) );
86 mainwp_add_translation( $mainwpTranslations, 'Hide', esc_html__( 'Hide', 'mainwp' ) );
87 mainwp_add_translation( $mainwpTranslations, 'Testing ...', esc_html__( 'Testing ...', 'mainwp' ) );
88 mainwp_add_translation( $mainwpTranslations, 'Test Settings', esc_html__( 'Test Settings', 'mainwp' ) );
89 mainwp_add_translation( $mainwpTranslations, 'Received wrong response from the server.', esc_html__( 'Received wrong response from the server.', 'mainwp' ) );
90 mainwp_add_translation( $mainwpTranslations, 'Untitled', esc_html__( 'Untitled', 'mainwp' ) );
91 mainwp_add_translation( $mainwpTranslations, 'Are you sure you want to remove this destination. This could make some of the backup tasks invalid.', esc_html__( 'Are you sure you want to remove this destination. This could make some of the backup tasks invalid.', 'mainwp' ) );
92 mainwp_add_translation( $mainwpTranslations, 'Starting backup task.', esc_html__( 'Starting backup task.', 'mainwp' ) );
93 mainwp_add_translation( $mainwpTranslations, 'Cancel', esc_html__( 'Cancel', 'mainwp' ) );
94 mainwp_add_translation( $mainwpTranslations, 'Backup task complete', esc_html__( 'Backup task complete', 'mainwp' ) );
95 mainwp_add_translation( $mainwpTranslations, 'with errors', esc_html__( 'with errors', 'mainwp' ) );
96 mainwp_add_translation( $mainwpTranslations, 'Close', esc_html__( 'Close', 'mainwp' ) );
97 mainwp_add_translation( $mainwpTranslations, 'Creating backupfile.', esc_html__( 'Creating backupfile.', 'mainwp' ) );
98 mainwp_add_translation( $mainwpTranslations, 'Backupfile created successfully.', esc_html__( 'Backupfile created successfully.', 'mainwp' ) );
99 mainwp_add_translation( $mainwpTranslations, 'Download from child site completed.', esc_html__( 'Download from child site completed.', 'mainwp' ) );
100 mainwp_add_translation( $mainwpTranslations, 'Uploading to remote destinations..', esc_html__( 'Uploading to remote destinations..', 'mainwp' ) );
101 mainwp_add_translation( $mainwpTranslations, 'Backup complete.', esc_html__( 'Backup complete.', 'mainwp' ) );
102 mainwp_add_translation( $mainwpTranslations, 'Upload to %1 (%2) failed:', esc_html__( 'Upload to %1 (%2) failed:', 'mainwp' ) );
103 mainwp_add_translation( $mainwpTranslations, 'Upload to %1 (%2) succesful', esc_html__( 'Upload to %1 (%2) succesful', 'mainwp' ) );
104 mainwp_add_translation( $mainwpTranslations, 'Please select websites or tags to add a backup task.', esc_html__( 'Please select websites or tags to add a backup task.', 'mainwp' ) );
105 mainwp_add_translation( $mainwpTranslations, 'Adding the task to MainWP', esc_html__( 'Adding the task to MainWP', 'mainwp' ) );
106 mainwp_add_translation( $mainwpTranslations, 'Please select websites or tags.', esc_html__( 'Please select websites or tags.', 'mainwp' ) );
107 mainwp_add_translation( $mainwpTranslations, 'Are you sure you want to delete this backup task?', esc_html__( 'Are you sure you want to delete this backup task?', 'mainwp' ) );
108 mainwp_add_translation( $mainwpTranslations, 'Removing the task..', esc_html__( 'Removing the task..', 'mainwp' ) );
109 mainwp_add_translation( $mainwpTranslations, 'The task has been removed', esc_html__( 'The task has been removed', 'mainwp' ) );
110 mainwp_add_translation( $mainwpTranslations, 'An unspecified error occured', esc_html__( 'An unspecified error occured', 'mainwp' ) );
111 mainwp_add_translation( $mainwpTranslations, 'Connection test failed.', esc_html__( 'Connection test failed.', 'mainwp' ) );
112 mainwp_add_translation( $mainwpTranslations, 'Error message:', esc_html__( 'Error message:', 'mainwp' ) );
113 mainwp_add_translation( $mainwpTranslations, 'Received HTTP-code:', esc_html__( 'Received HTTP-code:', 'mainwp' ) );
114 mainwp_add_translation( $mainwpTranslations, 'Connection test successful.', esc_html__( 'Connection test successful.', 'mainwp' ) );
115 mainwp_add_translation( $mainwpTranslations, 'Invalid response from the server, please try again.', esc_html__( 'Invalid response from the server, please try again.', 'mainwp' ) );
116 mainwp_add_translation( $mainwpTranslations, 'Please enter csv file for upload.', esc_html__( 'Please enter csv file for upload.', 'mainwp' ) );
117 mainwp_add_translation( $mainwpTranslations, 'Please enter a name for the website', esc_html__( 'Please enter a name for the website', 'mainwp' ) );
118 mainwp_add_translation( $mainwpTranslations, 'Please enter a valid URL for your site', esc_html__( 'Please enter a valid URL for your site', 'mainwp' ) );
119 mainwp_add_translation( $mainwpTranslations, 'Please enter a username for the administrator', esc_html__( 'Please enter a username for the administrator', 'mainwp' ) );
120 mainwp_add_translation( $mainwpTranslations, 'Adding the site to MainWP', esc_html__( 'Adding the site to MainWP', 'mainwp' ) );
121 mainwp_add_translation( $mainwpTranslations, 'No MainWP Child plugin detected, first install and activate the plugin and add your site to MainWP afterwards. Click <a href="%1" target="_blank">here</a> to install <a href="%2" target="_blank">MainWP</a> plugin (do not forget to activate it after installation).', esc_html__( 'No MainWP Child plugin detected, first install and activate the plugin and add your site to MainWP afterwards. Click <a href="%1" target="_blank">here</a> to install <a href="%2" target="_blank">MainWP</a> <i class="external alternate icon"></i> plugin (do not forget to activate it after installation).', 'mainwp' ) );
122 mainwp_add_translation( $mainwpTranslations, 'Testing the connection', esc_html__( 'Testing the connection', 'mainwp' ) );
123 mainwp_add_translation( $mainwpTranslations, 'Are you sure you want to delete this site?', esc_html__( 'Are you sure you want to delete this site?', 'mainwp' ) );
124 mainwp_add_translation( $mainwpTranslations, 'Removing and deactivating the MainWP Child plugin..', esc_html__( 'Removing and deactivating the MainWP Child plugin..', 'mainwp' ) );
125 mainwp_add_translation( $mainwpTranslations, 'The site has been removed and the MainWP Child plugin has been disabled.', esc_html__( 'The site has been removed and the MainWP Child plugin has been disabled.', 'mainwp' ) );
126 mainwp_add_translation( $mainwpTranslations, 'The requested site has not been found', esc_html__( 'The requested site has not been found', 'mainwp' ) );
127 mainwp_add_translation( $mainwpTranslations, 'The site has been removed but the MainWP Child plugin could not be disabled', esc_html__( 'The site has been removed but the MainWP Child plugin could not be disabled', 'mainwp' ) );
128 mainwp_add_translation( $mainwpTranslations, 'Paused import by user.', esc_html__( 'Paused import by user.', 'mainwp' ) );
129 mainwp_add_translation( $mainwpTranslations, 'Continue', esc_html__( 'Continue', 'mainwp' ) );
130 mainwp_add_translation( $mainwpTranslations, 'Continue import.', esc_html__( 'Continue import.', 'mainwp' ) );
131 mainwp_add_translation( $mainwpTranslations, 'Pause', esc_html__( 'Pause', 'mainwp' ) );
132 mainwp_add_translation( $mainwpTranslations, 'Finished', esc_html__( 'Finished', 'mainwp' ) );
133 mainwp_add_translation( $mainwpTranslations, 'Please enter the Site name.', esc_html__( 'Please enter the Site name.', 'mainwp' ) );
134 mainwp_add_translation( $mainwpTranslations, 'Please enter the Site url.', esc_html__( 'Please enter the Site url.', 'mainwp' ) );
135 mainwp_add_translation( $mainwpTranslations, 'Please enter Admin name of the site.', esc_html__( 'Please enter Admin name of the site.', 'mainwp' ) );
136 mainwp_add_translation( $mainwpTranslations, 'Number of sites to Import: %1 Created sites: %2 Failed: %3', esc_html__( 'Number of sites to Import: %1 Created sites: %2 Failed: %3', 'mainwp' ) );
137 mainwp_add_translation( $mainwpTranslations, 'HTTP error - website does not exist', esc_html__( 'HTTP error - website does not exist', 'mainwp' ) );
138 mainwp_add_translation( $mainwpTranslations, 'No selected Categories', esc_html__( 'No selected Categories', 'mainwp' ) );
139 mainwp_add_translation( $mainwpTranslations, 'Please select websites or tags to add a user.', esc_html__( 'Please select websites or tags to add a user.', 'mainwp' ) );
140 mainwp_add_translation( $mainwpTranslations, 'Number of Users to Import: %1 Created users: %2 Failed: %3', esc_html__( 'Number of Users to Import: %1 Created users: %2 Failed: %3', 'mainwp' ) );
141 mainwp_add_translation( $mainwpTranslations, 'Please enter the username.', esc_html__( 'Please enter the username.', 'mainwp' ) );
142 mainwp_add_translation( $mainwpTranslations, 'Please enter the email.', esc_html__( 'Please enter the email.', 'mainwp' ) );
143 mainwp_add_translation( $mainwpTranslations, 'Please enter the password.', esc_html__( 'Please enter the password.', 'mainwp' ) );
144 mainwp_add_translation( $mainwpTranslations, 'Please select a valid role.', esc_html__( 'Please select a valid role.', 'mainwp' ) );
145 mainwp_add_translation( $mainwpTranslations, 'Loading previous page..', esc_html__( 'Loading previous page..', 'mainwp' ) );
146 mainwp_add_translation( $mainwpTranslations, 'Loading next page..', esc_html__( 'Loading next page..', 'mainwp' ) );
147 mainwp_add_translation( $mainwpTranslations, 'Searching the WordPress repository..', esc_html__( 'Searching the WordPress repository..', 'mainwp' ) );
148 mainwp_add_translation( $mainwpTranslations, 'Please select websites or tags on the right side to install files.', esc_html__( 'Please select websites or tags on the right side to install files.', 'mainwp' ) );
149 mainwp_add_translation( $mainwpTranslations, 'Queued', esc_html__( 'Queued', 'mainwp' ) );
150 mainwp_add_translation( $mainwpTranslations, 'In progress', esc_html__( 'In progress', 'mainwp' ) );
151 mainwp_add_translation( $mainwpTranslations, 'Preparing %1 installation.', esc_html__( 'Preparing %1 installation.', 'mainwp' ) );
152 mainwp_add_translation( $mainwpTranslations, 'Installation successful', esc_html__( 'Installation successful', 'mainwp' ) );
153 mainwp_add_translation( $mainwpTranslations, 'Installation failed', esc_html__( 'Installation failed', 'mainwp' ) );
154 mainwp_add_translation( $mainwpTranslations, 'Please select websites or tags to install files.', esc_html__( 'Please select websites or tags to install files.', 'mainwp' ) );
155 mainwp_add_translation( $mainwpTranslations, 'Creating the backupfile on the child installation, this might take a while depending on the size. Please be patient.', esc_html__( 'Creating the backupfile on the child installation, this might take a while depending on the size. Please be patient.', 'mainwp' ) );
156 mainwp_add_translation( $mainwpTranslations, 'Backupfile on child site created successfully.', esc_html__( 'Backupfile on child site created successfully.', 'mainwp' ) );
157 mainwp_add_translation( $mainwpTranslations, 'Downloading the file.', esc_html__( 'Downloading the file.', 'mainwp' ) );
158 mainwp_add_translation( $mainwpTranslations, 'Download from child completed.', esc_html__( 'Download from child completed.', 'mainwp' ) );
159 mainwp_add_translation( $mainwpTranslations, 'Please wait while we are saving your note', esc_html__( 'Please wait while we are saving your note', 'mainwp' ) );
160 mainwp_add_translation( $mainwpTranslations, 'Note saved.', esc_html__( 'Note saved.', 'mainwp' ) );
161 mainwp_add_translation( $mainwpTranslations, 'An error occured while saving your message.', esc_html__( 'An error occured while saving your message.', 'mainwp' ) );
162 mainwp_add_translation( $mainwpTranslations, 'Please search and select users for update password.', esc_html__( 'Please search and select users for update password.', 'mainwp' ) );
163 mainwp_add_translation( $mainwpTranslations, 'All', esc_html__( 'All', 'mainwp' ) );
164 mainwp_add_translation( $mainwpTranslations, 'Any', esc_html__( 'Any', 'mainwp' ) );
165 mainwp_add_translation( $mainwpTranslations, 'HTTP error', esc_html__( 'HTTP error', 'mainwp' ) );
166 mainwp_add_translation( $mainwpTranslations, 'Error on your child WordPress', esc_html__( 'Error on your child WordPress', 'mainwp' ) );
167 mainwp_add_translation( $mainwpTranslations, 'MainWP Child plugin not detected. First, install and activate the plugin and add your site to MainWP afterwards. If you continue experiencing this issue, Please review MainWP Knowledgebase, and if you still have issues, please let us know in the MainWP Community.', esc_html__( 'MainWP Child plugin not detected. First, install and activate the plugin and add your site to MainWP afterwards. If you continue experiencing this issue, Please review MainWP Knowledgebase, and if you still have issues, please let us know in the MainWP Community.', 'mainwp' ) );
168 mainwp_add_translation( $mainwpTranslations, 'Remove', esc_html__( 'Remove', 'mainwp' ) );
169 mainwp_add_translation( $mainwpTranslations, 'Please reconnect to Dropbox', esc_html__( 'Please reconnect to Dropbox', 'mainwp' ) );
170 mainwp_add_translation( $mainwpTranslations, 'Please wait', esc_html__( 'Please wait', 'mainwp' ) );
171 mainwp_add_translation( $mainwpTranslations, 'Upgrading all', esc_html__( 'Upgrading all', 'mainwp' ) );
172 mainwp_add_translation( $mainwpTranslations, 'Upgrading %1', esc_html__( 'Upgrading %1', 'mainwp' ) );
173 mainwp_add_translation( $mainwpTranslations, 'Updating your plan...', esc_html__( 'Updating your plan...', 'mainwp' ) );
174 mainwp_add_translation( $mainwpTranslations, 'Updated your plan', esc_html__( 'Updated your plan', 'mainwp' ) );
175 $mainwp_backup_before_upgrade_days = get_option( 'mainwp_backup_before_upgrade_days' );
176 if ( empty( $mainwp_backup_before_upgrade_days ) || ! ctype_digit( $mainwp_backup_before_upgrade_days ) ) {
177 $mainwp_backup_before_upgrade_days = 7;
178 }
179 mainwp_add_translation( $mainwpTranslations, 'A full backup has not been taken in the last days for the following sites:', str_replace( '%1', '' . $mainwp_backup_before_upgrade_days, esc_html__( 'A full backup has not been taken in the last %1 days for the following sites:', 'mainwp' ) ) );
180 mainwp_add_translation( $mainwpTranslations, 'Starting required backup(s).', esc_html__( 'Starting required backup(s).', 'mainwp' ) );
181 mainwp_add_translation( $mainwpTranslations, 'Required backup(s) complete', esc_html__( 'Required backup(s) complete', 'mainwp' ) );
182 mainwp_add_translation( $mainwpTranslations, 'Continue update anyway', esc_html__( 'Continue update anyway', 'mainwp' ) );
183 mainwp_add_translation( $mainwpTranslations, 'Continue update', esc_html__( 'Continue update', 'mainwp' ) );
184 mainwp_add_translation( $mainwpTranslations, 'Pause', esc_html__( 'Pause', 'mainwp' ) );
185 mainwp_add_translation( $mainwpTranslations, 'Resume', esc_html__( 'Resume', 'mainwp' ) );
186 mainwp_add_translation( $mainwpTranslations, 'Checking if a backup is required for the selected updates...', esc_html__( 'Checking if a backup is required for the selected updates...', 'mainwp' ) );
187 mainwp_add_translation( $mainwpTranslations, 'Full backup required', esc_html__( 'Full backup required', 'mainwp' ) );
188 mainwp_add_translation( $mainwpTranslations, 'Checking backup settings', esc_html__( 'Checking backup settings', 'mainwp' ) );
189 mainwp_add_translation( $mainwpTranslations, 'Hide Shortcuts', esc_html__( 'Hide Shortcuts', 'mainwp' ) );
190 mainwp_add_translation( $mainwpTranslations, 'Show Shortcuts', esc_html__( 'Show Shortcuts', 'mainwp' ) );
191 mainwp_add_translation( $mainwpTranslations, 'Are you sure?', esc_html__( 'Are you sure?', 'mainwp' ) );
192 mainwp_add_translation( $mainwpTranslations, 'Bulk reconnect finished.', esc_html__( 'Bulk reconnect finished.', 'mainwp' ) );
193 mainwp_add_translation( $mainwpTranslations, 'Note Saved', esc_html__( 'Note Saved', 'mainwp' ) );
194 mainwp_add_translation( $mainwpTranslations, 'An error occured while saving your message', esc_html__( 'An error occured while saving your message', 'mainwp' ) );
195 mainwp_add_translation( $mainwpTranslations, 'Download from child site completed.', esc_html__( 'Download from child site completed.', 'mainwp' ) );
196 mainwp_add_translation( $mainwpTranslations, 'Please wait while we are saving your note', esc_html__( 'Please wait while we are saving your note', 'mainwp' ) );
197 mainwp_add_translation( $mainwpTranslations, 'Installation Successful', esc_html__( 'Installation Successful', 'mainwp' ) );
198 mainwp_add_translation( $mainwpTranslations, 'Upload to %1 (%2) successful.', esc_html__( 'Upload to %1 (%2) successful.', 'mainwp' ) );
199 mainwp_add_translation( $mainwpTranslations, 'Upload to %1 (%2) failed:', esc_html__( 'Upload to %1 (%2) failed:', 'mainwp' ) );
200 mainwp_add_translation( $mainwpTranslations, 'Updating Themes', esc_html__( 'Updating Themes', 'mainwp' ) );
201 mainwp_add_translation( $mainwpTranslations, 'Updating Plugins', esc_html__( 'Updating Plugins', 'mainwp' ) );
202 mainwp_add_translation( $mainwpTranslations, 'Updating WordPress', esc_html__( 'Updating WordPress', 'mainwp' ) );
203 mainwp_add_translation( $mainwpTranslations, 'updated', esc_html__( 'updated', 'mainwp' ) );
204 mainwp_add_translation( $mainwpTranslations, 'Updating', esc_html__( 'Updating', 'mainwp' ) );
205 mainwp_add_translation( $mainwpTranslations, 'Please enter a valid name for your backup task', esc_html__( 'Please enter a valid name for your backup task', 'mainwp' ) );
206 mainwp_add_translation( $mainwpTranslations, 'The backup task was added successfully', esc_html__( 'The backup task was added successfully', 'mainwp' ) );
207 mainwp_add_translation( $mainwpTranslations, 'Bulk test connection finished', esc_html__( 'Bulk test connection finished', 'mainwp' ) );
208 mainwp_add_translation( $mainwpTranslations, 'To find out more about what your HTTP status code means please %1click here%2 to locate your number (%3)', esc_html__( 'To find out more about what your HTTP status code means please %1click here%2 to locate your number (%3)', 'mainwp' ) );
209 mainwp_add_translation( $mainwpTranslations, 'Refreshing the page for Step 3 "Grab API Keys" in 5 seconds... if refresh fails please %1click here%2.', esc_html__( 'Refreshing the page for Step 3 "Grab API Keys" in 5 seconds... if refresh fails please %1click here%2.', 'mainwp' ) );
210 mainwp_add_translation( $mainwpTranslations, 'No ignored abandoned plugins', esc_html__( 'No ignored abandoned plugins', 'mainwp' ) );
211 mainwp_add_translation( $mainwpTranslations, 'Please upload plugins to install.', esc_html__( 'Please upload plugins to install.', 'mainwp' ) );
212 mainwp_add_translation( $mainwpTranslations, 'Please upload themes to install.', esc_html__( 'Please upload themes to install.', 'mainwp' ) );
213 mainwp_add_translation( $mainwpTranslations, 'Did you know with the %1 you can control the settings of this plugin directly from your MainWP Dashboard?', esc_html__( 'Did you know with the %1 you can control the settings of this plugin directly from your MainWP Dashboard?', 'mainwp' ) );
214 mainwp_add_translation( $mainwpTranslations, 'Did you know with the %1 you can control the settings of these plugins directly from your MainWP Dashboard?', esc_html__( 'Did you know with the %1 you can control the settings of these plugins directly from your MainWP Dashboard?', 'mainwp' ) );
215 mainwp_add_translation( $mainwpTranslations, 'Did you know with the %1 you can control the settings of this theme directly from your MainWP Dashboard?', esc_html__( 'Did you know with the %1 you can control the settings of this theme directly from your MainWP Dashboard?', 'mainwp' ) );
216 mainwp_add_translation( $mainwpTranslations, 'Did you know with the %1 you can control the settings of these themes directly from your MainWP Dashboard?', esc_html__( 'Did you know with the %1 you can control the settings of these themes directly from your MainWP Dashboard?', 'mainwp' ) );
217 mainwp_add_translation( $mainwpTranslations, 'Would you like to use the Bulk Settings Manager with this plugin? Check out the %1Documentation%2.', esc_html__( 'Would you like to use the Bulk Settings Manager with this plugin? Check out the %1Documentation%2.', 'mainwp' ) );
218 mainwp_add_translation( $mainwpTranslations, 'Would you like to use the Bulk Settings Manager with these plugin? Check out the %1Documentation%2.', esc_html__( 'Would you like to use the Bulk Settings Manager with these plugin? Check out the %1Documentation%2.', 'mainwp' ) );
219 mainwp_add_translation( $mainwpTranslations, 'Would you like to use the Bulk Settings Manager with this theme? Check out the %1Documentation%2.', esc_html__( 'Would you like to use the Bulk Settings Manager with this theme? Check out the %1Documentation%2.', 'mainwp' ) );
220 mainwp_add_translation( $mainwpTranslations, 'Would you like to use the Bulk Settings Manager with these themes? Check out the %1Documentation%2.', esc_html__( 'Would you like to use the Bulk Settings Manager with these themes? Check out the %1Documentation%2.', 'mainwp' ) );
221 mainwp_add_translation( $mainwpTranslations, 'is_activated_parent', esc_html__( '%1 could not be deleted. This theme is parent theme for the currently active theme.', 'mainwp' ) );
222 mainwp_add_translation( $mainwpTranslations, 'is_activated_theme', esc_html__( '%1 could not be deleted. This theme is active theme.', 'mainwp' ) );
223
224 return $mainwpTranslations;
225 }
226
227 /**
228 * Check if MainWP Extensions are Activated or not.
229 *
230 * @param mixed $plugin_slug Plugin Slug.
231 *
232 * @return string Activation warning message.
233 *
234 * @uses \MainWP\Dashboard\MainWP_Extensions_Handler::get_indexed_extensions_infor()
235 */
236 public static function after_extensions_plugin_row( $plugin_slug ) {
237 $extensions = MainWP_Extensions_Handler::get_indexed_extensions_infor();
238 if ( ! isset( $extensions[ $plugin_slug ] ) ) {
239 return;
240 }
241
242 if ( ! isset( $extensions[ $plugin_slug ]['apiManager'] ) || ! $extensions[ $plugin_slug ]['apiManager'] ) {
243 return;
244 }
245
246 if ( isset( $extensions[ $plugin_slug ]['activated_key'] ) && 'Activated' === $extensions[ $plugin_slug ]['activated_key'] ) {
247 return;
248 }
249
250 $slug = basename( $plugin_slug, '.php' );
251
252 $activate_notices = get_user_option( 'mainwp_hide_activate_notices' );
253 if ( is_array( $activate_notices ) ) {
254 if ( isset( $activate_notices[ $slug ] ) ) {
255 return;
256 }
257 }
258 ?>
259 <style type="text/css">
260 tr[data-plugin="<?php echo esc_attr( $plugin_slug ); ?>"] {
261 box-shadow: none;
262 }
263 </style>
264 <tr class="plugin-update-tr active" slug="<?php echo esc_attr( $slug ); ?>"><td colspan="3" class="plugin-update colspanchange"><div class="update-message api-deactivate">
265 <?php printf( esc_html__( 'You have a MainWP Extension that does not have an active API entered. This means you will not receive updates or support. Please visit the %1$sExtensions%2$s page and enter your API.', 'mainwp' ), '<a href="admin.php?page=Extensions">', '</a>' ); ?>
266 <span class="mainwp-right"><a href="#" class="mainwp-activate-notice-dismiss" ><i class="times circle icon"></i> <?php esc_html_e( 'Dismiss', 'mainwp' ); ?></a></span>
267 </div></td></tr>
268 <?php
269 }
270
271 /**
272 * MainWP Version 4 update Notice.
273 *
274 * @uses \MainWP\Dashboard\MainWP_Utility::show_mainwp_message()
275 */
276 public static function mainwp_4_update_notice() {
277 if ( MainWP_Utility::show_mainwp_message( 'notice', 'upgrade_4' ) ) {
278 ?>
279 <div class="ui icon message yellow" style="margin-bottom: 0; border-radius: 0;">
280 <i class="exclamation circle icon"></i>
281 <strong><?php echo esc_html__( 'Important Notice: ', 'mainwp' ); ?></strong>&nbsp;<?php printf( esc_html__( 'MainWP Version 4 is a major upgrade from MainWP Version 3. Please, read this&nbsp; %1$supdating FAQ%2$s.', 'mainwp' ), '<a href="https://kb.mainwp.com/docs/faq-on-upgrading-from-mainwp-version-3-to-mainwp-version-4/" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?>
282 <i class="close icon mainwp-notice-dismiss" notice-id="upgrade_4"></i>
283 </div>
284 <?php
285 }
286 }
287
288 /**
289 * MainWP Version ver 5 update Notice.
290 *
291 * @uses \MainWP\Dashboard\MainWP_Utility::show_mainwp_message()
292 */
293 public static function mainwp_ver5_update_notice() {
294 if ( MainWP_Utility::show_mainwp_message( 'notice', 'upgrade_version5' ) ) {
295 ?>
296 <div class="ui modal" id="mainwp-v5-update-notice-modal">
297 <i class="close icon mainwp-notice-dismiss" notice-id="upgrade_version5"></i>
298 <div class="header">
299 <?php echo esc_html__( 'MainWP 5.0 Update Notice', 'mainwp' ); ?>
300 </div>
301 <div class="content">
302 <h3 class="ui header">
303 <i class="sync alternate icon"></i>
304 <div class="content">
305 <?php echo esc_html__( 'Hard Refresh Required', 'mainwp' ); ?>
306
307 </div>
308 </h3>
309 <div class="ui hidden divider"></div>
310 <div><?php echo esc_html__( 'Please perform a hard refresh of your browser to ensure optimal performance and access to all new features.', 'mainwp' ); ?></div>
311 <br/>
312 <div><?php echo esc_html__( 'This step is crucial for loading the latest updates effectively.', 'mainwp' ); ?></div>
313 <div class="ui list">
314 <div class="item"><i class="windows icon"></i> <?php echo esc_html__( 'Windows users: Press `Ctrl + F5`', 'mainwp' ); ?></div>
315 <div class="item"><i class="apple icon"></i> <?php echo esc_html__( 'Mac users: Press `Command + R`', 'mainwp' ); ?></div>
316 <div class="item"><i class="linux icon"></i> <?php echo esc_html__( 'Linux users: Press `F5`', 'mainwp' ); ?></div>
317 </div>
318
319 <div class="ui divider"></div>
320
321 <h3 class="ui header">
322 <i class="linkify icon"></i>
323 <div class="content">
324 <?php echo esc_html__( 'Extensions License Reactivation Required', 'mainwp' ); ?>
325
326 </div>
327 </h3>
328 <div class="ui hidden divider"></div>
329 <div><?php echo esc_html__( 'As part of our upgrade to MainWP Dashboard version 5, we\'ve deactivated extension licenses to verify their validity and ensure everything is up to date.', 'mainwp' ); ?></div>
330 <br/>
331 <div><?php echo esc_html__( 'Simply click the "Activate Extensions" button on the Extensions page to reactivate all your Pro extension licenses in one go. It\'s quick and easy!', 'mainwp' ); ?></div>
332
333 <div class="ui divider"></div>
334
335 <div><?php echo esc_html__( 'We appreciate your understanding and cooperation in keeping your MainWP ecosystem secure and efficient. Need help? Reach out to our support team', 'mainwp' ); ?></div>
336 <div class="ui hidden divider"></div>
337 <div><?php echo esc_html__( 'Thank you for using MainWP!', 'mainwp' ); ?></div>
338 </div>
339 </div>
340 <script type="text/javascript">
341 jQuery( document ).ready( function() {
342 jQuery( '#mainwp-v5-update-notice-modal' ).modal({
343 onHidden: function () {
344 var notice_id = jQuery( '#mainwp-v5-update-notice-modal' ).find('.mainwp-notice-dismiss').attr('notice-id');
345 var data = {
346 action: 'mainwp_notice_status_update'
347 };
348 data['notice_id'] = notice_id;
349 jQuery.post(ajaxurl, mainwp_secure_data(data), function () { });
350 },
351 }).modal('show');
352 });
353 </script>
354 <?php
355 }
356 }
357
358 /**
359 * MainWP Version ver 5 update Notice.
360 *
361 * @uses \MainWP\Dashboard\MainWP_Utility::show_mainwp_message()
362 */
363 public static function mainwp_ver5_update_clear_cache_notice() {
364 if ( MainWP_Utility::show_mainwp_message( 'notice', 'upgrade_ver5_clear_cache' ) ) {
365 ?>
366 <div class="ui message info" style="margin-bottom: 0; border-radius: 0;">
367 <div><?php echo esc_html__( 'Please perform a hard refresh of your browser to ensure optimal performance and access to all new features. This step is crucial for loading the latest updates effectively.', 'mainwp' ); ?></div>
368 <div class="ui list">
369 <div class="item"><?php echo esc_html__( 'Windows users: Press `Ctrl + F5`', 'mainwp' ); ?></div>
370 <div class="item"><?php echo esc_html__( 'Mac users: Press `Command + R`', 'mainwp' ); ?></div>
371 <div class="item"><?php echo esc_html__( 'Linux users: Press `F5`', 'mainwp' ); ?></div>
372 </div>
373 <i class="close icon mainwp-notice-dismiss" notice-id="upgrade_ver5_clear_cache"></i>
374 </div>
375 <?php
376 }
377 }
378
379
380 /**
381 * Render Administration Notice.
382 *
383 * @uses \MainWP\Dashboard\MainWP_System::is_mainwp_pages()
384 * @uses \MainWP\Dashboard\MainWP_Plugins_Handler::check_auto_update_plugin()
385 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::is_openssl_config_warning()
386 */
387 public static function admin_notices() {
388
389 $current_options = get_option( 'mainwp_showhide_events_notice' );
390 if ( ! is_array( $current_options ) ) {
391 $current_options = array();
392 }
393
394 self::render_notice_version();
395
396 self::render_notice_config_warning();
397
398 if ( is_multisite() && ( ! isset( $current_options['hide_multi_site_notice'] ) || empty( $current_options['hide_multi_site_notice'] ) ) ) {
399 self::render_notice_multi_sites();
400 }
401
402 if ( ! isset( $current_options['trust_child'] ) || empty( $current_options['trust_child'] ) ) {
403 if ( MainWP_System::is_mainwp_pages() ) {
404 if ( ! MainWP_Plugins_Handler::check_auto_update_plugin( 'mainwp-child/mainwp-child.php' ) ) {
405 self::render_notice_trust_update();
406 }
407 }
408 }
409
410 self::render_trours_notice();
411
412 self::check_rating_notice( $current_options );
413
414 self::render_wp_mail_warning();
415
416 self::render_browser_extensions_notice();
417
418 self::mainwp_tmpfile_check();
419 }
420
421 /**
422 * Method mainwp_tmpfile_check()
423 *
424 * Checks if the `tmpfile()` PHP function is disabled.
425 */
426 public static function mainwp_tmpfile_check() {
427 if ( MainWP_Demo_Handle::is_instawp_site() ) {
428 return;
429 }
430 $disabled_functions = ini_get( 'disable_functions' );
431 if ( '' !== $disabled_functions ) {
432 $disabled_functions_array = explode( ',', $disabled_functions );
433 if ( in_array( 'tmpfile', $disabled_functions_array ) ) {
434 if ( MainWP_Utility::show_mainwp_message( 'notice', 'tmpfile_notice' ) ) {
435 ?>
436 <div class="ui red message" style="margin-bottom: 0; border-radius: 0;">
437 <i class="close icon mainwp-notice-dismiss" notice-id="tmpfile_notice"></i>
438 <div><?php esc_html_e( 'tmpfile() function is currently disabled on your server.', 'mainwp' ); ?></div>
439 <div><?php esc_html_e( 'This function is essential for creating temporary files, and its unavailability may affect certain functionalities of your MainWP Dashboard.', 'mainwp' ); ?></div>
440 <div><?php esc_html_e( 'If you are unsure how to enable it, please contact your host support and have them do it for you.', 'mainwp' ); ?></div>
441 </div>
442 <?php
443 }
444 }
445 }
446 }
447
448
449 /**
450 * Renders Browsers extensions notice.
451 *
452 * @uses \MainWP\Dashboard\MainWP_Utility::show_mainwp_message()
453 */
454 public static function render_browser_extensions_notice() {
455 $is_demo = MainWP_Demo_Handle::is_demo_mode();
456 if ( MainWP_DB::instance()->get_websites_count() > 4 && ! $is_demo ) {
457 if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp_browser_extensions_notice' ) ) {
458 ?>
459 <div class="ui info message" style="margin-bottom: 0; border-radius: 0;">
460 <h3><?php esc_html_e( 'Track Updates and Non-MainWP Changes from Your Browser!', 'mainwp' ); ?></h3>
461 <div><?php esc_html_e( 'The MainWP Browser Extension helps you easily track available updates across all your connected Child Sites, including changes to your plugins and themes status made outside your MainWP Dashboard.', 'mainwp' ); ?></div>
462 <div><?php esc_html_e( 'The extension quickly connects to your MainWP Dashboard via MainWP REST API, eliminating the need to log in to your MainWP Dashboard repeatedly to check available updates and non-MainWP changes.', 'mainwp' ); ?></div>
463 <br/>
464 <div>
465 <a href="https://chrome.google.com/webstore/detail/mainwp-browser-extension/kjlehednpnfgplekjminjpocdechbnge" target="_blank" class="ui green tiny button"><i class="chrome icon"></i> <?php echo esc_html__( 'Get Chrome Extension', 'mainwp' ); ?></a>
466 <a href="https://addons.mozilla.org/en-US/firefox/addon/mainwp-browser-extension/" target="_blank" class="ui green tiny button"><i class="firefox icon"></i> <?php echo esc_html__( 'Get Firefox Extension', 'mainwp' ); ?></a>
467 <a href="https://mainwp.com/mainwp-browser-extension/" target="_blank" class="ui tiny button"><?php echo esc_html__( 'Read More', 'mainwp' ); ?></a>
468 </div>
469 <i class="close icon mainwp-notice-dismiss" notice-id="mainwp_browser_extensions_notice"></i>
470 </div>
471 <?php
472 }
473 }
474 }
475
476 /**
477 * Renders wp_mail warning.
478 */
479 public static function render_wp_mail_warning() {
480 $mail_failed = get_option( 'mainwp_notice_wp_mail_failed' );
481 if ( 'yes' === $mail_failed ) {
482 ?>
483 <div class="ui yellow message" style="margin-bottom: 0; border-radius: 0;">
484 <?php echo esc_html__( 'wp_mail() error detected! It is more than likely that your MainWP Dashboard will fail to send any email. Please check for possible plugin conflicts with your Dashboard or contact your host support to determine why the wp_mail() function fails.', 'mainwp' ); ?>
485 <i class="close icon mainwp-notice-dismiss" notice-id="mail_failed"></i>
486 </div>
487 <?php
488 }
489 }
490
491 /**
492 * Renders PHP Version Notice.
493 *
494 * @uses \MainWP\Dashboard\MainWP_Utility::show_mainwp_message()
495 */
496 public static function render_notice_version() {
497 $phpver = phpversion();
498 if ( version_compare( $phpver, '7.0', '<' ) ) {
499 if ( MainWP_Utility::show_mainwp_message( 'notice', 'phpver_5_5' ) ) {
500 ?>
501 <div class="ui icon yellow message" style="margin-bottom: 0; border-radius: 0;">
502 <i class="exclamation circle icon"></i>
503 <?php printf( esc_html__( 'Your server is currently running PHP version %1$s. In the next few months your MainWP Dashboard will require PHP 7.4 as a minimum. Please upgrade your server to at least 7.4 but we recommend PHP 8 or newer. You can find a template email to send your host %2$shere%3$s.', 'mainwp' ), esc_html( $phpver ), '<a href="https://wordpress.org/about/requirements/" target="_blank">', '</a>' ); ?>
504 <i class="close icon mainwp-notice-dismiss" notice-id="phpver_5_5"></i>
505 </div>
506 <?php
507 }
508 }
509 }
510
511 /**
512 * Renders Guided Tours Notice.
513 *
514 * @uses \MainWP\Dashboard\MainWP_Utility::show_mainwp_message()
515 */
516 public static function render_trours_notice() {
517 if ( 0 === (int) get_option( 'mainwp_enable_guided_tours', 0 ) ) {
518 if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp_guided_tours_notice' ) ) {
519 ?>
520 <div class="ui info message" style="margin-bottom: 0; border-radius: 0;">
521 <h3><?php esc_html_e( 'Would you like to turn on guided tours?', 'mainwp' ); ?> <span class="ui green mini label"><?php esc_html_e( 'RECOMMENDED', 'mainwp' ); ?></span></h3>
522 <div><?php esc_html_e( 'MainWP guided tours are designed to provide information about all essential features on each MainWP Dashboard page.', 'mainwp' ); ?></div>
523 <div class="ui form">
524 <div class="field">
525 <div class="ui hidden divider"></div>
526 <div class="ui toggle checkbox">
527 <input type="checkbox" name="mainwp-select-guided-tours-option" onchange="mainwp_guidedtours_onchange(this);" id="mainwp-select-guided-tours-option" <?php echo ( ( 1 === (int) get_option( 'mainwp_enable_guided_tours', 0 ) ) ? 'checked="true"' : '' ); ?>>
528 <label for="mainwp-select-guided-tours-option"><?php esc_html_e( 'Select to enable the MainWP Guided Tours.', 'mainwp' ); ?></label>
529 </div>
530 </div>
531 </div>
532 <i class="close icon mainwp-notice-dismiss" notice-id="mainwp_guided_tours_notice"></i>
533 </div>
534 <?php
535 }
536 }
537 }
538
539 /**
540 * Renders OpenSSL Error message.
541 *
542 * @uses \MainWP\Dashboard\MainWP_Utility::show_mainwp_message()
543 */
544 public static function render_notice_config_warning() {
545 if ( MainWP_Server_Information_Handler::is_openssl_config_warning() ) {
546 if ( isset( $_GET['page'] ) && 'SettingsAdvanced' !== $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
547 if ( MainWP_Utility::show_mainwp_message( 'notice', 'ssl_warn' ) ) {
548 ?>
549 <div class="ui yellow message" style="margin-bottom: 0; border-radius: 0;">
550 <button class="ui mini button yellow close icon mainwp-notice-dismiss" style="top:30%;margin-right:10px !important" notice-id="ssl_warn"><?php echo esc_html__( 'Error Fixed', 'mainwp' ); ?></button>
551 <div><?php printf( esc_html__( 'MainWP has detected that the&nbsp;%1$sOpenSSL.cnf%2$s&nbsp;file is not configured properly. It is required to configure this so you can start connecting your child sites. Please,&nbsp;%3$sclick here to configure it!%4$s', 'mainwp' ), '<strong>', '</strong>', '<a href="admin.php?page=SettingsAdvanced">', '</a>' ); ?></div>
552 <div><?php echo esc_html__( 'If your MainWP Dashboard has no issues with connecting child sites, you can dismiss this warning by clicking the Error Fixed button.', 'mainwp' ); ?></div>
553 </div>
554 <?php
555 }
556 }
557 }
558 }
559
560 /** Renders WP Multisite Error Message. */
561 public static function render_notice_multi_sites() {
562 ?>
563 <div class="ui icon red message" style="margin-bottom: 0; border-radius: 0;">
564 <i class="exclamation circle icon"></i>
565 <?php esc_html_e( 'MainWP plugin is not designed nor fully tested on WordPress Multisite installations. Various features may not work properly. We highly recommend installing it on a single site installation!', 'mainwp' ); ?>
566 <i class="close icon mainwp-notice-dismiss" notice-id="multi_site"></i>
567 </div>
568 <?php
569 }
570
571 /**
572 * Renders MainWP Review Request.
573 *
574 * @param bool $current_options false|true Weather or not to display request.
575 *
576 * @uses \MainWP\Dashboard\MainWP_Extensions_Handler::get_extensions()
577 */
578 public static function check_rating_notice( $current_options ) {
579 $display_request1 = false;
580 $display_request2 = false;
581
582 if ( isset( $current_options['request_reviews1'] ) ) {
583 if ( 'forever' === $current_options['request_reviews1'] ) {
584 $display_request1 = false;
585 } else {
586 $days = intval( $current_options['request_reviews1'] );
587 $start_time = $current_options['request_reviews1_starttime'];
588 $display_request1 = ( ( time() - $start_time ) > $days * 24 * 3600 ) ? true : false;
589 }
590 } else {
591 $current_options['request_reviews1'] = 30;
592 $current_options['request_reviews1_starttime'] = time();
593 update_option( 'mainwp_showhide_events_notice', $current_options );
594 }
595
596 if ( isset( $current_options['request_reviews2'] ) ) {
597 if ( 'forever' === $current_options['request_reviews2'] ) {
598 $display_request2 = false;
599 } else {
600 $days = intval( $current_options['request_reviews2'] );
601 $start_time = $current_options['request_reviews2_starttime'];
602 $display_request2 = ( ( time() - $start_time ) > $days * 24 * 3600 ) ? true : false;
603 }
604 } else {
605 $currentExtensions = MainWP_Extensions_Handler::get_extensions();
606 if ( is_array( $currentExtensions ) && count( $currentExtensions ) > 10 ) {
607 $display_request2 = true;
608 }
609 }
610
611 if ( $display_request1 ) {
612 self::render_rating_notice_1();
613 } elseif ( $display_request2 ) {
614 self::render_rating_notice_2();
615 }
616 }
617
618 /** Renders MainWP Dashboard & Child Plugin auto update Alert. */
619 public static function render_notice_trust_update() {
620 $is_demo = MainWP_Demo_Handle::is_demo_mode();
621 if ( ! $is_demo ) {
622 ?>
623 <div class="ui blue message" style="margin-bottom: 0; border-radius: 0;">
624 <?php esc_html_e( 'Do you want MainWP Child to be updated automatically on your websites? This is highly recommended!', 'mainwp' ); ?>
625 <div class="ui hidden divider"></div>
626 <a id="mainwp_btn_autoupdate_and_trust" class="ui mini green button" href="#"><?php esc_html_e( 'Update MainWP Child Plugin Automatically', 'mainwp' ); ?></a>
627 <i class="close icon mainwp-events-notice-dismiss" notice="trust_child"></i>
628 </div>
629 <?php
630 }
631 }
632
633 /** Renders MainWP 30 day review request. */
634 public static function render_rating_notice_1() {
635 ?>
636 <div class="ui green icon message" style="margin-bottom: 0; border-radius: 0;">
637 <i class="star icon"></i>
638 <div class="content">
639 <p><?php esc_html_e( 'Hi, I noticed you have been using MainWP for over 30 days and that\'s awesome!', 'mainwp' ); ?></p>
640 <p><?php esc_html_e( 'Could you please do me a BIG favor and give it a 5-star rating? Reviews from users like YOU really help the MainWP community to grow.', 'mainwp' ); ?></p>
641 <div class="ui green floating mini labeled icon dropdown button">
642 <i class="star icon"></i>
643 <span class="text">Rate MainWP</span>
644 <div class="menu">
645 <a href="https://wordpress.org/support/plugin/mainwp/reviews/#new-post" class="item" target="_blank">
646 <span class="text">WordPress.org</span>
647 </a>
648 <a href="https://www.trustpilot.com/review/mainwp.com" class="item" target="_blank">
649 <span class="text">Trustpilot</span>
650 </a>
651 <a href="https://www.g2.com/products/mainwp/reviews" class="item" target="_blank">
652 <span class="text">G2</span>
653 </a>
654 </div>
655 </div>
656 <a href="" class="ui mini green basic button mainwp-events-notice-dismiss" notice="request_reviews1"><?php esc_html_e( 'Nope, maybe later.', 'mainwp' ); ?></a>
657 <a href="" class="ui mini green basic button mainwp-events-notice-dismiss" notice="request_reviews1_forever"><?php esc_html_e( 'I already did.', 'mainwp' ); ?></a>
658 </div>
659 <i class="close icon mainwp-events-notice-dismiss" notice="request_reviews1_forever"></i>
660 </div>
661 <?php
662 }
663
664 /** Renders MainWP review notice after a few extensions have been installed. */
665 public static function render_rating_notice_2() {
666 ?>
667 <div class="ui green icon message" style="margin-bottom: 0; border-radius: 0;">
668 <i class="star icon"></i>
669 <div class="content">
670 <p><?php esc_html_e( 'Hi, I noticed you have a few MainWP Extensions installed and that\'s awesome!', 'mainwp' ); ?></p>
671 <p><?php esc_html_e( 'Could you please do me a BIG favor and give it a 5-star rating? Reviews from users like YOU really help the MainWP community to grow.', 'mainwp' ); ?></p>
672 <div class="ui green floating mini labeled icon dropdown button">
673 <i class="star icon"></i>
674 <span class="text">Rate MainWP</span>
675 <div class="menu">
676 <a href="https://wordpress.org/support/plugin/mainwp/reviews/#new-post" class="item" target="_blank">
677 <span class="text">WordPress.org</span>
678 </a>
679 <a href="https://www.trustpilot.com/review/mainwp.com" class="item" target="_blank">
680 <span class="text">Trustpilot</span>
681 </a>
682 <a href="https://www.g2.com/products/mainwp/reviews" class="item" target="_blank">
683 <span class="text">G2</span>
684 </a>
685 </div>
686 </div>
687 <a href="" class="ui mini green basic button mainwp-events-notice-dismiss" notice="request_reviews2"><?php esc_html_e( 'Nope, maybe later.', 'mainwp' ); ?></a>
688 <a href="" class="ui mini green basic button mainwp-events-notice-dismiss" notice="request_reviews2_forever"><?php esc_html_e( 'I already did.', 'mainwp' ); ?></a>
689 </div>
690 <i class="close icon mainwp-events-notice-dismiss" notice="request_reviews2_forever"></i>
691 </div>
692 <?php
693 }
694
695 /** Renders Send Mail Function may have failed error. */
696 public static function wp_admin_notices() {
697
698 /**
699 * Current pagenow.
700 *
701 * @global string
702 */
703 global $pagenow;
704
705 if ( 'plugins.php' !== $pagenow ) {
706 return;
707 }
708
709 $deactivated_exts = get_transient( 'mainwp_transient_deactivated_incomtible_exts' );
710 if ( $deactivated_exts && is_array( $deactivated_exts ) && count( $deactivated_exts ) > 0 ) {
711 ?>
712 <div class='notice notice-error my-dismiss-notice is-dismissible'>
713 <p><?php echo esc_html__( 'MainWP Dashboard 4.0 or newer requires Extensions 4.0 or newer. MainWP will automatically deactivate older versions of MainWP Extensions in order to prevent compatibility problems.', 'mainwp' ); ?></p>
714 </div>
715 <?php
716 }
717 }
718
719
720 /**
721 * Method admin_footer()
722 *
723 * Renders admin footer.
724 */
725 public static function admin_footer() {
726 $disabled_confirm = get_option( 'mainwp_disable_update_confirmations', 0 );
727 ?>
728 <input type="hidden" id="mainwp-disable-update-confirmations" value="<?php echo intval( $disabled_confirm ); ?>">
729
730 <script type="text/javascript">
731 jQuery( document ).ready(
732 function ()
733 {
734 jQuery( '#adminmenu #collapse-menu' ).hide();
735 }
736 );
737 </script>
738 <?php
739 /**
740 * Filter: mainwp_open_hide_referrer
741 *
742 * Filters whether the MainWP should hide referrer when going to child site.
743 *
744 * @since Unknown
745 */
746 $hide_ref = apply_filters( 'mainwp_open_hide_referrer', false );
747 if ( $hide_ref ) {
748 ?>
749 <script type="text/javascript">
750 jQuery( document ).on( 'click', 'a.mainwp-may-hide-referrer', function ( e ) {
751 e.preventDefault();
752 mainwp_open_hide_referrer( e.target.href );
753 } );
754
755 function mainwp_open_hide_referrer( url ) {
756 var ran = Math.floor( Math.random() * 100 ) + 1;
757 var site = window.open( "", "mainwp_hide_referrer_" + ran );
758 var meta = site.document.createElement( 'meta' );
759 meta.name = "referrer";
760 meta.content = "no-referrer";
761 site.document.getElementsByTagName( 'head' )[0].appendChild( meta );
762 site.document.open();
763 site.document.writeln( '<script type="text/javascript">window.location = "' + url + '";<\/script>' );
764 site.document.close();
765 }
766 </script>
767 <?php
768 }
769 }
770
771 /**
772 * Admin print styles.
773 *
774 * @uses \MainWP\Dashboard\MainWP_System::is_mainwp_pages()
775 */
776 public static function admin_print_styles() {
777 ?>
778 <style>
779 <?php
780 if ( MainWP_System::is_mainwp_pages() ) {
781 ?>
782 #wpbody-content > div.update-nag,
783 #wpbody-content > div.updated {
784 margin-left: 190px;
785 }
786 html.wp-toolbar{
787 padding-top: 0 !important;
788 }
789 <?php
790 }
791 ?>
792 .mainwp-checkbox:before {
793 content: '<?php esc_html_e( 'YES', 'mainwp' ); ?>';
794 }
795 .mainwp-checkbox:after {
796 content: '<?php esc_html_e( 'NO', 'mainwp' ); ?>';
797 }
798 </style>
799 <?php
800 }
801
802
803 /**
804 * Productions site warning.
805 *
806 * Renders the warning if the production site is detected.
807 *
808 * @uses \MainWP\Dashboard\MainWP_DB::get_websites_count()
809 */
810 public static function mainwp_warning_notice() {
811 if ( 'yes' === get_option( 'mainwp_installation_warning_hide_the_notice' ) ) {
812 return;
813 }
814 if ( MainWP_DB::instance()->get_websites_count() > 0 ) {
815 return;
816 } else {
817 $plugins = get_plugins();
818 if ( ! is_array( $plugins ) || count( $plugins ) <= 4 ) {
819 return;
820 }
821 }
822 ?>
823 <div class="ui red message" style="margin-bottom: 0; border-radius: 0;">
824 <h4><?php esc_html_e( 'This appears to be a production site', 'mainwp' ); ?></h4>
825 <?php esc_html_e( 'We HIGHLY recommend a NEW WordPress install for your MainWP Dashboard.', 'mainwp' ); ?> <?php printf( esc_html__( 'Using a new WordPress install will help to cut down on plugin conflicts and other issues that can be caused by trying to run your MainWP Dashboard off an active site. Most hosting companies provide free subdomains %s and we recommend creating one if you do not have a specific dedicated domain to run your MainWP Dashboard.', 'mainwp' ), '("<strong>demo.yourdomain.com</strong>")' ); ?>
826 <br /><br />
827 <a href="#" class="ui red mini button" id="remove-mainwp-installation-warning"><?php esc_html_e( 'I have read the warning and I want to proceed', 'mainwp' ); ?></a>
828 </div>
829 <?php
830 }
831
832 /** Render Admin Header */
833 public static function admin_head() {
834 ?>
835 <script type="text/javascript">var mainwp_ajax_nonce = "<?php echo esc_js( wp_create_nonce( 'mainwp_ajax' ) ); ?>", mainwp_js_nonce = "<?php echo esc_js( wp_create_nonce( 'mainwp_nonce' ) ); ?>";</script>
836 <?php
837 if ( MainWP_System::is_mainwp_pages() || ( isset( $_GET['page'] ) && 'mainwp-setup' === $_GET['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
838 if ( get_option( 'mainwp_enable_guided_tours', 0 ) ) {
839 self::mainwp_usetiful_tours();
840 }
841 }
842 }
843
844 /**
845 * Render usetiful tours.
846 */
847 public static function mainwp_usetiful_tours() {
848 echo "
849 <script>
850 (function (w, d, s) {
851 var a = d.getElementsByTagName('head')[0];
852 var r = d.createElement('script');
853 r.async = 1;
854 r.src = s;
855 r.setAttribute('id', 'usetifulScript');
856 r.dataset.token = '480fa17b0507a1c60abba94bfdadd0a7';
857 a.appendChild(r);
858 })(window, document, 'https://www.usetiful.com/dist/usetiful.js');</script>
859 ";
860 }
861
862 /**
863 * MainWP Admin body CSS class attributes.
864 *
865 * @param mixed $class_string MainWP CSS Class attributes.
866 *
867 * @return string $class_string The CSS attributes to add to the page.
868 *
869 * @uses \MainWP\Dashboard\MainWP_System::is_mainwp_pages()
870 */
871 public static function admin_body_class( $class_string ) {
872 if ( MainWP_System::is_mainwp_pages() ) {
873 $class_string .= ' mainwp-ui mainwp-ui-page ';
874 $class_string .= ' mainwp-ui-leftmenu ';
875
876 $selected_theme = MainWP_Settings::get_instance()->get_selected_theme();
877 if ( ! empty( $selected_theme ) ) {
878 $class_string .= ' mainwp-custom-theme ';
879 }
880
881 $siteViewMode = MainWP_Utility::get_siteview_mode();
882 if ( 'grid' === $siteViewMode ) {
883 $class_string .= ' mainwp-sites-grid-view ';
884 } else {
885 $class_string .= ' mainwp-sites-table-view ';
886 }
887
888 // phpcs:disable WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
889 if ( isset( $_GET['page'] ) && 'managesites' === $_GET['page'] ) {
890 if ( isset( $_GET['dashboard'] ) && ! empty( $_GET['dashboard'] ) ) {
891 $class_string .= ' mainwp-individual-site-overview ';
892 }
893 }
894
895 if ( isset( $_GET['page'] ) && 'ManageClients' === $_GET['page'] ) {
896 if ( isset( $_GET['client_id'] ) && ! empty( $_GET['client_id'] ) ) {
897 $class_string .= ' mainwp-individual-client-overview ';
898 }
899 }
900 if ( isset( $_GET['page'] ) && ( 'ServerInformation' === $_GET['page'] || 'ServerInformationCron' === $_GET['page'] || 'ErrorLog' === $_GET['page'] || 'ActionLogs' === $_GET['page'] || 'PluginPrivacy' === $_GET['page'] || 'Settings' === $_GET['page'] || 'SettingsAdvanced' === $_GET['page'] || 'SettingsEmail' === $_GET['page'] || 'MainWPTools' === $_GET['page'] || 'SettingsInsights' === $_GET['page'] || 'SettingsApiBackups' === $_GET['page'] ) ) {
901 $class_string .= ' mainwp-individual-site-view ';
902 }
903 if ( isset( $_GET['page'] ) && 'CostTrackerAdd' !== $_GET['page'] ) {
904 if ( ( isset( $_GET['id'] ) && ! empty( $_GET['id'] ) ) || ( isset( $_GET['dashboard'] ) && ! empty( $_GET['dashboard'] ) ) || ( isset( $_GET['updateid'] ) && ! empty( $_GET['updateid'] ) ) || ( isset( $_GET['emailsettingsid'] ) && ! empty( $_GET['emailsettingsid'] ) ) || ( isset( $_GET['scanid'] ) && ! empty( $_GET['scanid'] ) ) ) {
905 $class_string .= ' mainwp-individual-site-view ';
906 }
907 }
908 // phpcs:enable
909 $class_string = apply_filters( 'mainwp_page_admin_body_class', $class_string );
910 }
911 return $class_string;
912 }
913
914 /**
915 * Method render_footer_content()
916 *
917 * Render footer content.
918 *
919 * @param mixed $websites The websites object.
920 * @param int $current_wpid The current website id.
921 *
922 * @uses \MainWP\Dashboard\MainWP_DB::fetch_object()
923 * @uses \MainWP\Dashboard\MainWP_DB::data_seek()
924 * @uses \MainWP\Dashboard\MainWP_Utility::get_nice_url()
925 */
926 public static function render_footer_content( $websites, $current_wpid = false ) { // phpcs:ignore -- Current complexity is the only way to achieve desired results, pull request solutions appreciated.
927 $cntr = 0;
928 if ( is_array( $websites ) ) {
929 $count = count( $websites );
930 for ( $i = 0; $i < $count; $i++ ) {
931 $website = $websites[ $i ];
932 if ( empty( $website->sync_errors ) ) {
933 ++$cntr;
934 echo '<input type="hidden" name="dashboard_wp_ids[]" class="dashboard_wp_id" value="' . intval( $website->id ) . '" />';
935 }
936 }
937 } elseif ( false !== $websites ) {
938 while ( $website = MainWP_DB::fetch_object( $websites ) ) {
939 if ( empty( $website->sync_errors ) ) {
940 ++$cntr;
941 echo '<input type="hidden" name="dashboard_wp_ids[]" class="dashboard_wp_id" value="' . intval( $website->id ) . '" />';
942 }
943 }
944 }
945 /**
946 * Action: mainwp_admin_footer
947 *
948 * Fires at the bottom of MainWP content.
949 *
950 * @since Unknown
951 */
952 do_action( 'mainwp_admin_footer' );
953 MainWP_UI::render_select_mainwp_themes_modal();
954 MainWP_UI::render_install_extensions_promo_modal();
955 ?>
956 <div class="ui modal" id="mainwp-sync-sites-modal" current-wpid="<?php echo intval( $current_wpid ); ?>">
957 <i class="mainwp-modal-close close icon"></i>
958 <div class="header"><?php esc_html_e( 'Data Synchronization', 'mainwp' ); ?></div>
959 <div class="ui green progress mainwp-modal-progress">
960 <div class="bar"><div class="progress"></div></div>
961 <div class="label"></div>
962 </div>
963 <div class="scrolling content mainwp-modal-content">
964 <div class="ui middle aligned divided selection list" id="sync-sites-status">
965 <?php
966 if ( is_array( $websites ) ) {
967 $count = count( $websites );
968 for ( $i = 0; $i < $count; $i++ ) {
969 $site_name = $website->name;
970 $website = $websites[ $i ];
971 $is_sync_err = ( '' !== $website->sync_errors ) ? true : false;
972 ?>
973 <div class="item <?php echo $is_sync_err ? 'disconnected-site' : ''; ?>">
974 <div class="right floated content">
975 <div class="sync-site-status" niceurl="<?php echo esc_html( $site_name ); ?>" siteid="<?php echo intval( $website->id ); ?>"><span data-position="left center" data-inverted="" data-tooltip="<?php echo $is_sync_err ? esc_html__( 'Site disconnected', 'mainwp' ) : esc_html__( 'Pending', 'mainwp' ); ?>"><i class="<?php echo $is_sync_err ? 'exclamation red icon' : 'clock outline icon'; ?>"></i></span></div>
976 </div>
977 <div class="content">
978 <?php echo esc_html( $site_name ); ?>
979 <?php do_action( 'mainwp_sync_popup_content', $website ); ?>
980 </div>
981 </div>
982 <?php
983 }
984 } else {
985 MainWP_DB::data_seek( $websites, 0 );
986 while ( $website = MainWP_DB::fetch_object( $websites ) ) {
987 $site_name = $website->name;
988 $is_sync_err = ( '' !== $website->sync_errors ) ? true : false;
989 ?>
990 <div class="item <?php echo $is_sync_err ? 'disconnected-site' : ''; ?>">
991 <div class="right floated content">
992 <div class="sync-site-status" niceurl="<?php echo esc_html( $site_name ); ?>" siteid="<?php echo intval( $website->id ); ?>"><span data-position="left center" data-inverted="" data-tooltip="<?php echo $is_sync_err ? esc_html__( 'Site disconnected', 'mainwp' ) : esc_html__( 'Pending', 'mainwp' ); ?>"><i class="<?php echo $is_sync_err ? 'exclamation red icon' : 'clock outline icon'; ?>"></i></span></div>
993 </div>
994 <div class="content">
995 <?php echo esc_html( $site_name ); ?>
996 <?php do_action( 'mainwp_sync_popup_content', $website ); ?>
997 </div>
998 </div>
999 <?php
1000 }
1001 }
1002 ?>
1003 </div>
1004 </div>
1005 </div>
1006 <input type="hidden" id="sync_selected_site_ids" value="" />
1007 <div class="ui tiny modal" id="mainwp-modal-confirm-select">
1008 <i class="close icon"></i>
1009 <div class="header"><?php esc_html_e( 'Confirmation', 'mainwp' ); ?></div>
1010 <div class="content">
1011 <div class="content-massage"></div>
1012 </div>
1013 <div class="actions">
1014 </div>
1015 </div>
1016 <?php
1017 self::render_comfirm_modal();
1018 }
1019
1020 /**
1021 * Method render_comfirm_modal()
1022 *
1023 * Render comfirm modal box.
1024 */
1025 public static function render_comfirm_modal() {
1026 ?>
1027 <div class="ui tiny modal" id="mainwp-modal-confirm">
1028 <i class="close icon"></i>
1029 <div class="header"><?php esc_html_e( 'Confirmation', 'mainwp' ); ?></div>
1030 <div class="content">
1031 <div class="content-massage"></div>
1032 <div class="ui mini yellow message hidden update-confirm-notice" ><?php printf( esc_html__( 'To disable update confirmations, go to the %1$sSettings%2$s page and disable the "Disable update confirmations" option', 'mainwp' ), '<a href="admin.php?page=Settings">', '</a>' ); ?></div>
1033 <div class="ui form hidden" id="mainwp-confirm-form" style="display:none;">
1034 <div class="ui divider"></div>
1035 <div class="field">
1036 <label></label>
1037 <input type="text" id="mainwp-confirm-input" name="mainwp-confirm-input">
1038 </div>
1039 </div>
1040 </div>
1041 <div class="actions">
1042 <div class="ui two columns grid">
1043 <div class="ui left aligned column">
1044 </div>
1045 <div class="ui right aligned column">
1046 <div class="ui green positive button"><?php esc_html_e( 'Yes, proceed!', 'mainwp' ); ?></div>
1047 </div>
1048 </div>
1049 </div>
1050 </div>
1051 <?php
1052 }
1053
1054 /**
1055 * Method get_plugins_install_check()
1056 *
1057 * Get plugins for install checking.
1058 */
1059 public static function get_plugins_install_check() {
1060 $plugins = array(
1061 array(
1062 'page' => 'Extensions-Mainwp-Pro-Reports-Extension',
1063 'slug' => 'mainwp-child-reports/mainwp-child-reports.php',
1064 'name' => 'MainWP Child Reports',
1065 ),
1066 array(
1067 'page' => 'Extensions-Mainwp-Client-Reports-Extension',
1068 'slug' => 'mainwp-child-reports/mainwp-child-reports.php',
1069 'name' => 'MainWP Child Reports',
1070 ),
1071 array(
1072 'page' => 'Extensions-Mainwp-Backwpup-Extension',
1073 'slug' => 'backwpup/backwpup.php',
1074 'name' => 'BackWPup',
1075 ),
1076 array(
1077 'page' => 'Extensions-Mainwp-Ithemes-Security-Extension',
1078 'slug' => 'better-wp-security/better-wp-security.php',
1079 'slug_pro' => 'ithemes-security-pro/ithemes-security-pro.php',
1080 'name' => 'iThemes Security',
1081 ),
1082 array(
1083 'page' => 'Extensions-Mainwp-Updraftplus-Extension',
1084 'slug' => 'updraftplus/updraftplus.php',
1085 'name' => 'UpdraftPlus',
1086 ),
1087 array(
1088 'page' => 'Extensions-Mainwp-Wordfence-Extension',
1089 'slug' => 'wordfence/wordfence.php',
1090 'name' => 'Wordfence',
1091 ),
1092 array(
1093 'page' => 'Extensions-Wordpress-Seo-Extension',
1094 'slug' => 'wordpress-seo/wp-seo.php',
1095 'name' => 'Yoast SEO',
1096 ),
1097 array(
1098 'page' => 'Extensions-Mainwp-Jetpack-Protect-Extension',
1099 'slug' => 'jetpack-protect/jetpack-protect.php',
1100 'name' => 'Jetpack Protect',
1101 ),
1102 array(
1103 'page' => 'Extensions-Mainwp-Jetpack-Scan-Extension',
1104 'slug' => 'jetpack-protect/jetpack-protect.php', // tweaked: to requires install the JP protect plugin.
1105 'slug_pro' => 'jetpack/jetpack.php',
1106 'name' => 'Jetpack Protect',
1107 ),
1108 );
1109 return apply_filters( 'mainwp_plugins_install_checks', $plugins );
1110 }
1111
1112 /**
1113 * Render plugins install check modal.
1114 * for the exntesion overview page with the missing install plugin only.
1115 */
1116 public static function render_plugins_install_check() { // phpcs:ignore -- complex function.
1117
1118 $install_check = get_option( 'mainwp_hide_plugins_install_check_notice', 0 );
1119
1120 $plugins_to_checks = self::get_plugins_install_check();
1121
1122 $page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1123
1124 $plugin_check = MainWP_Utility::get_sub_array_having( $plugins_to_checks, 'page', $page );
1125
1126 if ( ! empty( $plugin_check ) ) {
1127 $plugin_check = current( $plugin_check );
1128 }
1129
1130 if ( empty( $plugin_check ) ) {
1131 return;
1132 }
1133
1134 // if is not overview extension page return.
1135 if ( isset( $_GET['tab'] ) && 'overview' !== $_GET['tab'] && 'dashboard' !== $_GET['tab'] ) { // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1136 return;
1137 }
1138
1139 $plugin_slug = isset( $plugin_check['slug'] ) ? $plugin_check['slug'] : '';
1140 $slug_pro = isset( $plugin_check['slug_pro'] ) ? $plugin_check['slug_pro'] : '';
1141 $plugin_name = isset( $plugin_check['name'] ) ? $plugin_check['name'] : '';
1142
1143 if ( empty( $plugin_slug ) || empty( $plugin_name ) ) {
1144 return;
1145 }
1146
1147 $check_slug = 'install_check_' . sanitize_text_field( wp_unslash( dirname( $plugin_slug ) ) );
1148 $check_hidetime = MainWP_Utility::get_hide_notice_status( $check_slug );
1149
1150 if ( $check_hidetime && time() < $check_hidetime + 30 * DAY_IN_SECONDS ) {
1151 return;
1152 }
1153
1154 $websites = MainWP_DB::instance()->query( MainWP_DB::instance()->get_sql_websites_for_current_user() );
1155
1156 if ( empty( $websites ) ) {
1157 return;
1158 }
1159
1160 $missing_installed = array();
1161
1162 while ( $websites && $website = MainWP_DB::fetch_object( $websites ) ) {
1163 $site_name = $website->name;
1164 if ( '' !== $website->sync_errors ) {
1165 continue;
1166 }
1167 $not_found = true;
1168 if ( '' !== $website->plugins ) {
1169 $plugins = json_decode( $website->plugins, 1 );
1170 if ( is_array( $plugins ) && count( $plugins ) > 0 ) {
1171 foreach ( $plugins as $plugin ) {
1172 if ( isset( $plugin['slug'] ) && ( $plugin_slug === $plugin['slug'] || ( '' !== $slug_pro && $slug_pro === $plugin['slug'] ) ) ) {
1173 $not_found = false;
1174 break; // foreach.
1175 }
1176 }
1177 }
1178 }
1179
1180 if ( $not_found ) {
1181 $missing_installed[ $website->id ] = $website->name;
1182 }
1183 }
1184
1185 if ( empty( $missing_installed ) ) {
1186 return;
1187 }
1188
1189 ?>
1190 <div class="ui modal" id="mainwp-install-check-modal" noti-slug="<?php echo esc_html( $check_slug ); ?>">
1191 <i class="mainwp-modal-close close icon"></i>
1192 <div class="header"><?php esc_html_e( 'Plugin Install Check', 'mainwp' ); ?></div>
1193 <div class="scrolling content mainwp-modal-content">
1194 <div class="ui message" id="mainwp-message-zone-install" style="display:none;"></div>
1195 <div class="ui message blue"><?php printf( esc_html__( 'We have detected the following sites do not have the %s plugin installed. This plugin is required to be installed on your Child Sites for the Extension to work on those sites. Please select sites where you want to install it and click the Install Plugin button. Uncheck any site you don\'t want to add the plugin to or cancel to skip this step. After the installation process, resync your sites to see sites with the newly installed plugin.', 'mainwp' ), esc_html( $plugin_name ) ); ?></div>
1196 <div class="ui middle aligned divided selection list" id="sync-sites-status">
1197 <?php foreach ( $missing_installed as $siteid => $site_name ) : ?>
1198 <div class="item siteBulkInstall" siteid="<?php echo intval( $siteid ); ?>" status="">
1199 <div class="right floated content">
1200 <span class="queue" data-inverted="" data-position="left center" data-tooltip="<?php echo esc_html__( 'Queued', 'mainwp' ); ?>"><i class="clock outline icon"></i></span>
1201 <span class="progress" data-inverted="" data-position="left center" data-tooltip="<?php echo esc_html__( 'Installing...', 'mainwp' ); ?>" style="display:none"><i class="notched circle loading icon"></i></span>
1202 <span class="status"></span>
1203 </div>
1204 <div class="content">
1205 <div class="ui checkbox checked">
1206 <input type="checkbox" checked="" id="install-check-<?php echo intval( $siteid ); ?>" name="install_checker[]"/>
1207 </div>
1208 <?php echo esc_html( $site_name ); ?>
1209 </div>
1210 </div>
1211 <?php endforeach; ?>
1212 </div>
1213 </div>
1214 <div class="actions mainwp-modal-actions">
1215 <div class="ui two columns grid">
1216 <div class="left aligned column">
1217
1218 </div>
1219 <div class="ui right aligned column">
1220 <input type="button" class="ui green button" id="mainwp-install-check-btn" value="<?php esc_html_e( 'Install Plugin', 'mainwp' ); ?>">
1221 </div>
1222 </div>
1223
1224 </div>
1225 </div>
1226 <script type="text/javascript">
1227 jQuery( document ).ready( function () {
1228 jQuery('#mainwp-install-check-modal').modal({
1229 allowMultiple: false,
1230 closable: false,
1231 onHide: function () {
1232 var noti_id = jQuery('#mainwp-install-check-modal').attr('noti-slug');
1233 mainwp_notice_dismiss(noti_id, 1);
1234 setTimeout(function () {
1235 window.location.href = location.href;
1236 }, 1000);
1237 },
1238 }).modal('show');
1239 jQuery(document).on('click', '#mainwp-install-check-btn', function () {
1240 mainwp_install_check_plugin_prepare( '<?php echo esc_js( rawurlencode( dirname( $plugin_slug ) ) ); ?>' );
1241 return false;
1242 });
1243 });
1244 </script>
1245 <?php
1246 }
1247 }
1248