PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 4.4.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v4.4.1
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 4.4.1, at class/class-mainwp-system-view.php

1,055 lines 57.0 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 mainwpAddTranslation()
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 mainwpAddTranslation( &$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 mainwpAddTranslation( $mainwpTranslations, 'Update settings.', esc_html__( 'Update settings.', 'mainwp' ) );
56 mainwpAddTranslation( $mainwpTranslations, 'Settings have been updated.', esc_html__( 'Settings have been updated.', 'mainwp' ) );
57 mainwpAddTranslation( $mainwpTranslations, 'An error occured.', esc_html__( 'An error occured.', 'mainwp' ) );
58 mainwpAddTranslation( $mainwpTranslations, 'Testing login.', esc_html__( 'Testing login.', 'mainwp' ) );
59 mainwpAddTranslation( $mainwpTranslations, 'Your login is valid.', esc_html__( 'Your login is valid.', 'mainwp' ) );
60 mainwpAddTranslation( $mainwpTranslations, 'Your login is invalid.', esc_html__( 'Your login is invalid.', 'mainwp' ) );
61 mainwpAddTranslation( $mainwpTranslations, 'An error occured, please contact us.', esc_html__( 'An error occured, please contact us.', 'mainwp' ) );
62 mainwpAddTranslation( $mainwpTranslations, 'more', esc_html__( 'more', 'mainwp' ) );
63 mainwpAddTranslation( $mainwpTranslations, 'less', esc_html__( 'less', 'mainwp' ) );
64 mainwpAddTranslation( $mainwpTranslations, 'An error occured: ', esc_html__( 'An error occured: ', 'mainwp' ) );
65 mainwpAddTranslation( $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 mainwpAddTranslation( $mainwpTranslations, 'Undefined error.', esc_html__( 'Undefined error.', 'mainwp' ) );
67 mainwpAddTranslation( $mainwpTranslations, 'PENDING', esc_html__( 'PENDING', 'mainwp' ) );
68 mainwpAddTranslation( $mainwpTranslations, 'UPDATING', esc_html__( 'UPDATING', 'mainwp' ) );
69 mainwpAddTranslation( $mainwpTranslations, 'UPGRADING', esc_html__( 'UPGRADING', 'mainwp' ) );
70 mainwpAddTranslation( $mainwpTranslations, 'FAILED', esc_html__( 'FAILED', 'mainwp' ) );
71 mainwpAddTranslation( $mainwpTranslations, 'DONE', esc_html__( 'DONE', 'mainwp' ) );
72 mainwpAddTranslation( $mainwpTranslations, 'SYNCING', esc_html__( 'SYNCING', 'mainwp' ) );
73 mainwpAddTranslation( $mainwpTranslations, 'DISCONNECTED', esc_html__( 'DISCONNECTED', 'mainwp' ) );
74 mainwpAddTranslation( $mainwpTranslations, 'TIMEOUT', esc_html__( 'TIMEOUT', 'mainwp' ) );
75 mainwpAddTranslation( $mainwpTranslations, 'Ignored', esc_html__( 'Ignored', 'mainwp' ) );
76 mainwpAddTranslation( $mainwpTranslations, 'No ignored %1s', esc_html__( 'No ignored %1s', 'mainwp' ) );
77 mainwpAddTranslation( $mainwpTranslations, 'No ignored %1 conflicts', esc_html__( 'No ignored %1 conflicts', 'mainwp' ) );
78 mainwpAddTranslation( $mainwpTranslations, 'No ignored plugins', esc_html__( 'No ignored plugins', 'mainwp' ) );
79 mainwpAddTranslation( $mainwpTranslations, 'No ignored themes', esc_html__( 'No ignored themes', 'mainwp' ) );
80 mainwpAddTranslation( $mainwpTranslations, 'Upgrading..', esc_html__( 'Upgrading..', 'mainwp' ) );
81 mainwpAddTranslation( $mainwpTranslations, 'Update successful', esc_html__( 'Update successful', 'mainwp' ) );
82 mainwpAddTranslation( $mainwpTranslations, 'Update failed', esc_html__( 'Update failed', 'mainwp' ) );
83 mainwpAddTranslation( $mainwpTranslations, 'Show All', esc_html__( 'Show All', 'mainwp' ) );
84 mainwpAddTranslation( $mainwpTranslations, 'Show', esc_html__( 'Show', 'mainwp' ) );
85 mainwpAddTranslation( $mainwpTranslations, 'Hide All', esc_html__( 'Hide All', 'mainwp' ) );
86 mainwpAddTranslation( $mainwpTranslations, 'Hide', esc_html__( 'Hide', 'mainwp' ) );
87 mainwpAddTranslation( $mainwpTranslations, 'Testing ...', esc_html__( 'Testing ...', 'mainwp' ) );
88 mainwpAddTranslation( $mainwpTranslations, 'Test Settings', esc_html__( 'Test Settings', 'mainwp' ) );
89 mainwpAddTranslation( $mainwpTranslations, 'Received wrong response from the server.', esc_html__( 'Received wrong response from the server.', 'mainwp' ) );
90 mainwpAddTranslation( $mainwpTranslations, 'Untitled', esc_html__( 'Untitled', 'mainwp' ) );
91 mainwpAddTranslation( $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 mainwpAddTranslation( $mainwpTranslations, 'Starting backup task.', esc_html__( 'Starting backup task.', 'mainwp' ) );
93 mainwpAddTranslation( $mainwpTranslations, 'Cancel', esc_html__( 'Cancel', 'mainwp' ) );
94 mainwpAddTranslation( $mainwpTranslations, 'Backup task complete', esc_html__( 'Backup task complete', 'mainwp' ) );
95 mainwpAddTranslation( $mainwpTranslations, 'with errors', esc_html__( 'with errors', 'mainwp' ) );
96 mainwpAddTranslation( $mainwpTranslations, 'Close', esc_html__( 'Close', 'mainwp' ) );
97 mainwpAddTranslation( $mainwpTranslations, 'Creating backupfile.', esc_html__( 'Creating backupfile.', 'mainwp' ) );
98 mainwpAddTranslation( $mainwpTranslations, 'Backupfile created successfully.', esc_html__( 'Backupfile created successfully.', 'mainwp' ) );
99 mainwpAddTranslation( $mainwpTranslations, 'Download from child site completed.', esc_html__( 'Download from child site completed.', 'mainwp' ) );
100 mainwpAddTranslation( $mainwpTranslations, 'Uploading to remote destinations..', esc_html__( 'Uploading to remote destinations..', 'mainwp' ) );
101 mainwpAddTranslation( $mainwpTranslations, 'Backup complete.', esc_html__( 'Backup complete.', 'mainwp' ) );
102 mainwpAddTranslation( $mainwpTranslations, 'Upload to %1 (%2) failed:', esc_html__( 'Upload to %1 (%2) failed:', 'mainwp' ) );
103 mainwpAddTranslation( $mainwpTranslations, 'Upload to %1 (%2) succesful', esc_html__( 'Upload to %1 (%2) succesful', 'mainwp' ) );
104 mainwpAddTranslation( $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 mainwpAddTranslation( $mainwpTranslations, 'Adding the task to MainWP', esc_html__( 'Adding the task to MainWP', 'mainwp' ) );
106 mainwpAddTranslation( $mainwpTranslations, 'Please select websites or tags.', esc_html__( 'Please select websites or tags.', 'mainwp' ) );
107 mainwpAddTranslation( $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 mainwpAddTranslation( $mainwpTranslations, 'Removing the task..', esc_html__( 'Removing the task..', 'mainwp' ) );
109 mainwpAddTranslation( $mainwpTranslations, 'The task has been removed', esc_html__( 'The task has been removed', 'mainwp' ) );
110 mainwpAddTranslation( $mainwpTranslations, 'An unspecified error occured', esc_html__( 'An unspecified error occured', 'mainwp' ) );
111 mainwpAddTranslation( $mainwpTranslations, 'Connection test failed.', esc_html__( 'Connection test failed.', 'mainwp' ) );
112 mainwpAddTranslation( $mainwpTranslations, 'Error message:', esc_html__( 'Error message:', 'mainwp' ) );
113 mainwpAddTranslation( $mainwpTranslations, 'Received HTTP-code:', esc_html__( 'Received HTTP-code:', 'mainwp' ) );
114 mainwpAddTranslation( $mainwpTranslations, 'Connection test successful.', esc_html__( 'Connection test successful.', 'mainwp' ) );
115 mainwpAddTranslation( $mainwpTranslations, 'Invalid response from the server, please try again.', esc_html__( 'Invalid response from the server, please try again.', 'mainwp' ) );
116 mainwpAddTranslation( $mainwpTranslations, 'Please enter csv file for upload.', esc_html__( 'Please enter csv file for upload.', 'mainwp' ) );
117 mainwpAddTranslation( $mainwpTranslations, 'Please enter a name for the website', esc_html__( 'Please enter a name for the website', 'mainwp' ) );
118 mainwpAddTranslation( $mainwpTranslations, 'Please enter a valid URL for your site', esc_html__( 'Please enter a valid URL for your site', 'mainwp' ) );
119 mainwpAddTranslation( $mainwpTranslations, 'Please enter a username for the administrator', esc_html__( 'Please enter a username for the administrator', 'mainwp' ) );
120 mainwpAddTranslation( $mainwpTranslations, 'Adding the site to MainWP', esc_html__( 'Adding the site to MainWP', 'mainwp' ) );
121 mainwpAddTranslation( $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> plugin (do not forget to activate it after installation).', 'mainwp' ) );
122 mainwpAddTranslation( $mainwpTranslations, 'Testing the connection', esc_html__( 'Testing the connection', 'mainwp' ) );
123 mainwpAddTranslation( $mainwpTranslations, 'Are you sure you want to delete this site?', esc_html__( 'Are you sure you want to delete this site?', 'mainwp' ) );
124 mainwpAddTranslation( $mainwpTranslations, 'Removing and deactivating the MainWP Child plugin..', esc_html__( 'Removing and deactivating the MainWP Child plugin..', 'mainwp' ) );
125 mainwpAddTranslation( $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 mainwpAddTranslation( $mainwpTranslations, 'The requested site has not been found', esc_html__( 'The requested site has not been found', 'mainwp' ) );
127 mainwpAddTranslation( $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 mainwpAddTranslation( $mainwpTranslations, 'Paused import by user.', esc_html__( 'Paused import by user.', 'mainwp' ) );
129 mainwpAddTranslation( $mainwpTranslations, 'Continue', esc_html__( 'Continue', 'mainwp' ) );
130 mainwpAddTranslation( $mainwpTranslations, 'Continue import.', esc_html__( 'Continue import.', 'mainwp' ) );
131 mainwpAddTranslation( $mainwpTranslations, 'Pause', esc_html__( 'Pause', 'mainwp' ) );
132 mainwpAddTranslation( $mainwpTranslations, 'Finished', esc_html__( 'Finished', 'mainwp' ) );
133 mainwpAddTranslation( $mainwpTranslations, 'Please enter the Site name.', esc_html__( 'Please enter the Site name.', 'mainwp' ) );
134 mainwpAddTranslation( $mainwpTranslations, 'Please enter the Site url.', esc_html__( 'Please enter the Site url.', 'mainwp' ) );
135 mainwpAddTranslation( $mainwpTranslations, 'Please enter Admin name of the site.', esc_html__( 'Please enter Admin name of the site.', 'mainwp' ) );
136 mainwpAddTranslation( $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 mainwpAddTranslation( $mainwpTranslations, 'HTTP error - website does not exist', esc_html__( 'HTTP error - website does not exist', 'mainwp' ) );
138 mainwpAddTranslation( $mainwpTranslations, 'No selected Categories', esc_html__( 'No selected Categories', 'mainwp' ) );
139 mainwpAddTranslation( $mainwpTranslations, 'Please select websites or tags to add a user.', esc_html__( 'Please select websites or tags to add a user.', 'mainwp' ) );
140 mainwpAddTranslation( $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 mainwpAddTranslation( $mainwpTranslations, 'Please enter the username.', esc_html__( 'Please enter the username.', 'mainwp' ) );
142 mainwpAddTranslation( $mainwpTranslations, 'Please enter the email.', esc_html__( 'Please enter the email.', 'mainwp' ) );
143 mainwpAddTranslation( $mainwpTranslations, 'Please enter the password.', esc_html__( 'Please enter the password.', 'mainwp' ) );
144 mainwpAddTranslation( $mainwpTranslations, 'Please select a valid role.', esc_html__( 'Please select a valid role.', 'mainwp' ) );
145 mainwpAddTranslation( $mainwpTranslations, 'Loading previous page..', esc_html__( 'Loading previous page..', 'mainwp' ) );
146 mainwpAddTranslation( $mainwpTranslations, 'Loading next page..', esc_html__( 'Loading next page..', 'mainwp' ) );
147 mainwpAddTranslation( $mainwpTranslations, 'Searching the WordPress repository..', esc_html__( 'Searching the WordPress repository..', 'mainwp' ) );
148 mainwpAddTranslation( $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 mainwpAddTranslation( $mainwpTranslations, 'Queued', esc_html__( 'Queued', 'mainwp' ) );
150 mainwpAddTranslation( $mainwpTranslations, 'In progress', esc_html__( 'In progress', 'mainwp' ) );
151 mainwpAddTranslation( $mainwpTranslations, 'Preparing %1 installation.', esc_html__( 'Preparing %1 installation.', 'mainwp' ) );
152 mainwpAddTranslation( $mainwpTranslations, 'Installation successful', esc_html__( 'Installation successful', 'mainwp' ) );
153 mainwpAddTranslation( $mainwpTranslations, 'Installation failed', esc_html__( 'Installation failed', 'mainwp' ) );
154 mainwpAddTranslation( $mainwpTranslations, 'Please select websites or tags to install files.', esc_html__( 'Please select websites or tags to install files.', 'mainwp' ) );
155 mainwpAddTranslation( $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 mainwpAddTranslation( $mainwpTranslations, 'Backupfile on child site created successfully.', esc_html__( 'Backupfile on child site created successfully.', 'mainwp' ) );
157 mainwpAddTranslation( $mainwpTranslations, 'Downloading the file.', esc_html__( 'Downloading the file.', 'mainwp' ) );
158 mainwpAddTranslation( $mainwpTranslations, 'Download from child completed.', esc_html__( 'Download from child completed.', 'mainwp' ) );
159 mainwpAddTranslation( $mainwpTranslations, 'Please wait while we are saving your note', esc_html__( 'Please wait while we are saving your note', 'mainwp' ) );
160 mainwpAddTranslation( $mainwpTranslations, 'Note saved.', esc_html__( 'Note saved.', 'mainwp' ) );
161 mainwpAddTranslation( $mainwpTranslations, 'An error occured while saving your message.', esc_html__( 'An error occured while saving your message.', 'mainwp' ) );
162 mainwpAddTranslation( $mainwpTranslations, 'Please search and select users for update password.', esc_html__( 'Please search and select users for update password.', 'mainwp' ) );
163 mainwpAddTranslation( $mainwpTranslations, 'All', esc_html__( 'All', 'mainwp' ) );
164 mainwpAddTranslation( $mainwpTranslations, 'Any', esc_html__( 'Any', 'mainwp' ) );
165 mainwpAddTranslation( $mainwpTranslations, 'HTTP error', esc_html__( 'HTTP error', 'mainwp' ) );
166 mainwpAddTranslation( $mainwpTranslations, 'Error on your child WordPress', esc_html__( 'Error on your child WordPress', 'mainwp' ) );
167 mainwpAddTranslation( $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 mainwpAddTranslation( $mainwpTranslations, 'Remove', esc_html__( 'Remove', 'mainwp' ) );
169 mainwpAddTranslation( $mainwpTranslations, 'Please reconnect to Dropbox', esc_html__( 'Please reconnect to Dropbox', 'mainwp' ) );
170 mainwpAddTranslation( $mainwpTranslations, 'Please wait', esc_html__( 'Please wait', 'mainwp' ) );
171 mainwpAddTranslation( $mainwpTranslations, 'Upgrading all', esc_html__( 'Upgrading all', 'mainwp' ) );
172 mainwpAddTranslation( $mainwpTranslations, 'Upgrading %1', esc_html__( 'Upgrading %1', 'mainwp' ) );
173 mainwpAddTranslation( $mainwpTranslations, 'Updating your plan...', esc_html__( 'Updating your plan...', 'mainwp' ) );
174 mainwpAddTranslation( $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 mainwpAddTranslation( $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 mainwpAddTranslation( $mainwpTranslations, 'Starting required backup(s).', esc_html__( 'Starting required backup(s).', 'mainwp' ) );
181 mainwpAddTranslation( $mainwpTranslations, 'Required backup(s) complete', esc_html__( 'Required backup(s) complete', 'mainwp' ) );
182 mainwpAddTranslation( $mainwpTranslations, 'Continue update anyway', esc_html__( 'Continue update anyway', 'mainwp' ) );
183 mainwpAddTranslation( $mainwpTranslations, 'Continue update', esc_html__( 'Continue update', 'mainwp' ) );
184 mainwpAddTranslation( $mainwpTranslations, 'Pause', esc_html__( 'Pause', 'mainwp' ) );
185 mainwpAddTranslation( $mainwpTranslations, 'Resume', esc_html__( 'Resume', 'mainwp' ) );
186 mainwpAddTranslation( $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 mainwpAddTranslation( $mainwpTranslations, 'Full backup required', esc_html__( 'Full backup required', 'mainwp' ) );
188 mainwpAddTranslation( $mainwpTranslations, 'Checking backup settings', esc_html__( 'Checking backup settings', 'mainwp' ) );
189 mainwpAddTranslation( $mainwpTranslations, 'Hide Shortcuts', esc_html__( 'Hide Shortcuts', 'mainwp' ) );
190 mainwpAddTranslation( $mainwpTranslations, 'Show Shortcuts', esc_html__( 'Show Shortcuts', 'mainwp' ) );
191 mainwpAddTranslation( $mainwpTranslations, 'Are you sure?', esc_html__( 'Are you sure?', 'mainwp' ) );
192 mainwpAddTranslation( $mainwpTranslations, 'Bulk reconnect finished.', esc_html__( 'Bulk reconnect finished.', 'mainwp' ) );
193 mainwpAddTranslation( $mainwpTranslations, 'Note Saved', esc_html__( 'Note Saved', 'mainwp' ) );
194 mainwpAddTranslation( $mainwpTranslations, 'An error occured while saving your message', esc_html__( 'An error occured while saving your message', 'mainwp' ) );
195 mainwpAddTranslation( $mainwpTranslations, 'Download from child site completed.', esc_html__( 'Download from child site completed.', 'mainwp' ) );
196 mainwpAddTranslation( $mainwpTranslations, 'Please wait while we are saving your note', esc_html__( 'Please wait while we are saving your note', 'mainwp' ) );
197 mainwpAddTranslation( $mainwpTranslations, 'Installation Successful', esc_html__( 'Installation Successful', 'mainwp' ) );
198 mainwpAddTranslation( $mainwpTranslations, 'Upload to %1 (%2) successful.', esc_html__( 'Upload to %1 (%2) successful.', 'mainwp' ) );
199 mainwpAddTranslation( $mainwpTranslations, 'Upload to %1 (%2) failed:', esc_html__( 'Upload to %1 (%2) failed:', 'mainwp' ) );
200 mainwpAddTranslation( $mainwpTranslations, 'Updating Themes', esc_html__( 'Updating Themes', 'mainwp' ) );
201 mainwpAddTranslation( $mainwpTranslations, 'Updating Plugins', esc_html__( 'Updating Plugins', 'mainwp' ) );
202 mainwpAddTranslation( $mainwpTranslations, 'Updating WordPress', esc_html__( 'Updating WordPress', 'mainwp' ) );
203 mainwpAddTranslation( $mainwpTranslations, 'updated', esc_html__( 'updated', 'mainwp' ) );
204 mainwpAddTranslation( $mainwpTranslations, 'Updating', esc_html__( 'Updating', 'mainwp' ) );
205 mainwpAddTranslation( $mainwpTranslations, 'Please enter a valid name for your backup task', esc_html__( 'Please enter a valid name for your backup task', 'mainwp' ) );
206 mainwpAddTranslation( $mainwpTranslations, 'The backup task was added successfully', esc_html__( 'The backup task was added successfully', 'mainwp' ) );
207 mainwpAddTranslation( $mainwpTranslations, 'Bulk test connection finished', esc_html__( 'Bulk test connection finished', 'mainwp' ) );
208 mainwpAddTranslation( $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 mainwpAddTranslation( $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 mainwpAddTranslation( $mainwpTranslations, 'No ignored abandoned plugins', esc_html__( 'No ignored abandoned plugins', 'mainwp' ) );
211 mainwpAddTranslation( $mainwpTranslations, 'Please upload plugins to install.', esc_html__( 'Please upload plugins to install.', 'mainwp' ) );
212 mainwpAddTranslation( $mainwpTranslations, 'Please upload themes to install.', esc_html__( 'Please upload themes to install.', 'mainwp' ) );
213 mainwpAddTranslation( $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 mainwpAddTranslation( $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 mainwpAddTranslation( $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 mainwpAddTranslation( $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 mainwpAddTranslation( $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 mainwpAddTranslation( $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 mainwpAddTranslation( $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 mainwpAddTranslation( $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 mainwpAddTranslation( $mainwpTranslations, 'is_activated_parent', esc_html__( '%1 could not be deleted. This theme is parent theme for the currently active theme.', 'mainwp' ) );
222 mainwpAddTranslation( $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 * @param mixed $plugin_data Plugin Data.
232 * @param mixed $status Status of plugin activation.
233 *
234 * @return string Activation warning message.
235 *
236 * @uses \MainWP\Dashboard\MainWP_Extensions_Handler::get_indexed_extensions_infor()
237 */
238 public static function after_extensions_plugin_row( $plugin_slug, $plugin_data, $status ) {
239 $extensions = MainWP_Extensions_Handler::get_indexed_extensions_infor();
240 if ( ! isset( $extensions[ $plugin_slug ] ) ) {
241 return;
242 }
243
244 if ( ! isset( $extensions[ $plugin_slug ]['apiManager'] ) || ! $extensions[ $plugin_slug ]['apiManager'] ) {
245 return;
246 }
247
248 if ( isset( $extensions[ $plugin_slug ]['activated_key'] ) && 'Activated' == $extensions[ $plugin_slug ]['activated_key'] ) {
249 return;
250 }
251
252 $slug = basename( $plugin_slug, '.php' );
253
254 $activate_notices = get_user_option( 'mainwp_hide_activate_notices' );
255 if ( is_array( $activate_notices ) ) {
256 if ( isset( $activate_notices[ $slug ] ) ) {
257 return;
258 }
259 }
260 ?>
261 <style type="text/css">
262 tr[data-plugin="<?php echo esc_attr( $plugin_slug ); ?>"] {
263 box-shadow: none;
264 }
265 </style>
266 <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">
267 <?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>' ); ?>
268 <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>
269 </div></td></tr>
270 <?php
271 }
272
273 /**
274 * MainWP Version 4 update Notice.
275 *
276 * @uses \MainWP\Dashboard\MainWP_Utility::show_mainwp_message()
277 */
278 public static function mainwp_4_update_notice() {
279 if ( MainWP_Utility::show_mainwp_message( 'notice', 'upgrade_4' ) ) {
280 ?>
281 <div class="ui icon message yellow" style="margin-bottom: 0; border-radius: 0;">
282 <i class="exclamation circle icon"></i>
283 <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>' ); ?>
284 <i class="close icon mainwp-notice-dismiss" notice-id="upgrade_4"></i>
285 </div>
286 <?php
287 }
288 }
289
290 /**
291 * Render Administration Notice.
292 *
293 * @uses \MainWP\Dashboard\MainWP_System::is_mainwp_pages()
294 * @uses \MainWP\Dashboard\MainWP_Plugins_Handler::check_auto_update_plugin()
295 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::is_openssl_config_warning()
296 */
297 public static function admin_notices() {
298
299 $current_options = get_option( 'mainwp_showhide_events_notice' );
300 if ( ! is_array( $current_options ) ) {
301 $current_options = array();
302 }
303
304 self::render_notice_version();
305
306 self::render_notice_config_warning();
307
308 if ( is_multisite() && ( ! isset( $current_options['hide_multi_site_notice'] ) || empty( $current_options['hide_multi_site_notice'] ) ) ) {
309 self::render_notice_multi_sites();
310 }
311
312 if ( ! isset( $current_options['trust_child'] ) || empty( $current_options['trust_child'] ) ) {
313 if ( MainWP_System::is_mainwp_pages() ) {
314 if ( ! MainWP_Plugins_Handler::check_auto_update_plugin( 'mainwp-child/mainwp-child.php' ) ) {
315 self::render_notice_trust_update();
316 }
317 }
318 }
319
320 self::render_trours_notice();
321
322 self::check_rating_notice( $current_options );
323
324 self::render_wp_mail_warning();
325 }
326
327 /**
328 * Renders wp_mail warning.
329 */
330 public static function render_wp_mail_warning() {
331 $mail_failed = get_option( 'mainwp_notice_wp_mail_failed' );
332 if ( 'yes' == $mail_failed ) {
333 ?>
334 <div class="ui yellow message" style="margin-bottom: 0; border-radius: 0;">
335 <?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' ); ?>
336 <i class="close icon mainwp-notice-dismiss" notice-id="mail_failed"></i>
337 </div>
338 <?php
339 }
340 }
341
342 /**
343 * Renders PHP Version Notice.
344 *
345 * @uses \MainWP\Dashboard\MainWP_Utility::show_mainwp_message()
346 */
347 public static function render_notice_version() {
348 $phpver = phpversion();
349 if ( version_compare( $phpver, '5.5', '<' ) ) {
350 if ( MainWP_Utility::show_mainwp_message( 'notice', 'phpver_5_5' ) ) {
351 ?>
352 <div class="ui icon yellow message" style="margin-bottom: 0; border-radius: 0;">
353 <i class="exclamation circle icon"></i>
354 <?php printf( esc_html__( 'Your server is currently running PHP version %1$s. In the next few months your MainWP Dashboard will require PHP 5.6 as a minimum. Please upgrade your server to at least 5.6 but we recommend PHP 7 or newer. You can find a template email to send your host %2$shere%3$s.', 'mainwp' ), $phpver, '<a href="https://wordpress.org/about/requirements/" target="_blank">', '</a>' ); ?>
355 <i class="close icon mainwp-notice-dismiss" notice-id="phpver_5_5"></i>
356 </div>
357 <?php
358 }
359 }
360 }
361
362 /**
363 * Renders Guided Tours Notice.
364 *
365 * @uses \MainWP\Dashboard\MainWP_Utility::show_mainwp_message()
366 */
367 public static function render_trours_notice() {
368 if ( 0 == get_option( 'mainwp_enable_guided_tours', 0 ) ) {
369 if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp_guided_tours_notice' ) ) {
370 ?>
371 <div class="ui info message" style="margin-bottom: 0; border-radius: 0;">
372 <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>
373 <div><?php esc_html_e( 'MainWP guided tours are designed to provide information about all essential features on each MainWP Dashboard page.', 'mainwp' ); ?></div>
374 <div class="ui form">
375 <div class="field">
376 <div class="ui hidden divider"></div>
377 <div class="ui toggle checkbox">
378 <input type="checkbox" name="mainwp-select-guided-tours-option" onchange="mainwp_guidedtours_onchange(this);" id="mainwp-select-guided-tours-option" <?php echo ( ( 1 == get_option( 'mainwp_enable_guided_tours', 0 ) ) ? 'checked="true"' : '' ); ?>>
379 <label for="mainwp-select-guided-tours-option"><?php esc_html_e( 'Select to enable the MainWP Guided Tours.', 'mainwp' ); ?></label>
380 </div>
381 </div>
382 </div>
383 <i class="close icon mainwp-notice-dismiss" notice-id="mainwp_guided_tours_notice"></i>
384 </div>
385 <?php
386 }
387 }
388 }
389
390 /**
391 * Renders OpenSSL Error message.
392 *
393 * @uses \MainWP\Dashboard\MainWP_Utility::show_mainwp_message()
394 */
395 public static function render_notice_config_warning() {
396 if ( MainWP_Server_Information_Handler::is_openssl_config_warning() ) {
397 if ( isset( $_GET['page'] ) && 'SettingsAdvanced' != $_GET['page'] ) {
398 if ( MainWP_Utility::show_mainwp_message( 'notice', 'ssl_warn' ) ) {
399 ?>
400 <div class="ui yellow message" style="margin-bottom: 0; border-radius: 0;">
401 <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>
402 <div><?php echo sprintf( 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>
403 <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>
404 </div>
405 <?php
406 }
407 }
408 }
409 }
410
411 /** Renders WP Multisite Error Message. */
412 public static function render_notice_multi_sites() {
413 ?>
414 <div class="ui icon red message" style="margin-bottom: 0; border-radius: 0;">
415 <i class="exclamation circle icon"></i>
416 <?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' ); ?>
417 <i class="close icon mainwp-notice-dismiss" notice-id="multi_site"></i>
418 </div>
419 <?php
420 }
421
422 /**
423 * Renders MainWP Review Request.
424 *
425 * @param bool $current_options false|true Weather or not to display request.
426 *
427 * @uses \MainWP\Dashboard\MainWP_Extensions_Handler::get_extensions()
428 */
429 public static function check_rating_notice( $current_options ) {
430 $display_request1 = false;
431 $display_request2 = false;
432
433 if ( isset( $current_options['request_reviews1'] ) ) {
434 if ( 'forever' == $current_options['request_reviews1'] ) {
435 $display_request1 = false;
436 } else {
437 $days = intval( $current_options['request_reviews1'] );
438 $start_time = $current_options['request_reviews1_starttime'];
439 $display_request1 = ( ( time() - $start_time ) > $days * 24 * 3600 ) ? true : false;
440 }
441 } else {
442 $current_options['request_reviews1'] = 30;
443 $current_options['request_reviews1_starttime'] = time();
444 update_option( 'mainwp_showhide_events_notice', $current_options );
445 }
446
447 if ( isset( $current_options['request_reviews2'] ) ) {
448 if ( 'forever' == $current_options['request_reviews2'] ) {
449 $display_request2 = false;
450 } else {
451 $days = intval( $current_options['request_reviews2'] );
452 $start_time = $current_options['request_reviews2_starttime'];
453 $display_request2 = ( ( time() - $start_time ) > $days * 24 * 3600 ) ? true : false;
454 }
455 } else {
456 $currentExtensions = MainWP_Extensions_Handler::get_extensions();
457 if ( is_array( $currentExtensions ) && count( $currentExtensions ) > 10 ) {
458 $display_request2 = true;
459 }
460 }
461
462 if ( $display_request1 ) {
463 self::render_rating_notice_1();
464 } elseif ( $display_request2 ) {
465 self::render_rating_notice_2();
466 }
467 }
468
469 /** Renders MainWP Dashboard & Child Plugin auto update Alert. */
470 public static function render_notice_trust_update() {
471 ?>
472 <div class="ui icon yellow message" style="margin-bottom: 0; border-radius: 0;">
473 <i class="info circle icon"></i>
474 <div class="content">
475 <?php esc_html_e( 'You have not set your MainWP Child plugins for auto updates, this is highly recommended!', 'mainwp' ); ?> <a id="mainwp_btn_autoupdate_and_trust" class="ui mini yellow button" href="#"><?php esc_html_e( 'Turn On', 'mainwp' ); ?></a>
476 </div>
477 <i class="close icon mainwp-events-notice-dismiss" notice="trust_child"></i>
478 </div>
479 <?php
480 }
481
482 /** Renders MainWP 30 day review request. */
483 public static function render_rating_notice_1() {
484 ?>
485 <div class="ui green icon message" style="margin-bottom: 0; border-radius: 0;">
486 <i class="star icon"></i>
487 <div class="content">
488 <p><?php esc_html_e( 'Hi, I noticed you have been using MainWP for over 30 days and that\'s awesome!', 'mainwp' ); ?></p>
489 <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>
490 <div class="ui green floating mini labeled icon dropdown button">
491 <i class="star icon"></i>
492 <span class="text">Rate MainWP</span>
493 <div class="menu">
494 <a href="https://wordpress.org/support/plugin/mainwp/reviews/#new-post" class="item" target="_blank">
495 <span class="text">WordPress.org</span>
496 </a>
497 <a href="https://www.trustpilot.com/review/mainwp.com" class="item" target="_blank">
498 <span class="text">Trustpilot</span>
499 </a>
500 <a href="https://www.g2.com/products/mainwp/reviews" class="item" target="_blank">
501 <span class="text">G2</span>
502 </a>
503 </div>
504 </div>
505 <a href="" class="ui mini green basic button mainwp-events-notice-dismiss" notice="request_reviews1"><?php esc_html_e( 'Nope, maybe later.', 'mainwp' ); ?></a>
506 <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>
507 </div>
508 <i class="close icon mainwp-events-notice-dismiss" notice="request_reviews1_forever"></i>
509 </div>
510 <?php
511 }
512
513 /** Renders MainWP review notice after a few extensions have been installed. */
514 public static function render_rating_notice_2() {
515 ?>
516 <div class="ui green icon message" style="margin-bottom: 0; border-radius: 0;">
517 <i class="star icon"></i>
518 <div class="content">
519 <p><?php esc_html_e( 'Hi, I noticed you have a few MainWP Extensions installed and that\'s awesome!', 'mainwp' ); ?></p>
520 <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>
521 <div class="ui green floating mini labeled icon dropdown button">
522 <i class="star icon"></i>
523 <span class="text">Rate MainWP</span>
524 <div class="menu">
525 <a href="https://wordpress.org/support/plugin/mainwp/reviews/#new-post" class="item" target="_blank">
526 <span class="text">WordPress.org</span>
527 </a>
528 <a href="https://www.trustpilot.com/review/mainwp.com" class="item" target="_blank">
529 <span class="text">Trustpilot</span>
530 </a>
531 <a href="https://www.g2.com/products/mainwp/reviews" class="item" target="_blank">
532 <span class="text">G2</span>
533 </a>
534 </div>
535 </div>
536 <a href="" class="ui mini green basic button mainwp-events-notice-dismiss" notice="request_reviews2"><?php esc_html_e( 'Nope, maybe later.', 'mainwp' ); ?></a>
537 <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>
538 </div>
539 <i class="close icon mainwp-events-notice-dismiss" notice="request_reviews2_forever"></i>
540 </div>
541 <?php
542 }
543
544 /** Renders Send Mail Function may have failed error. */
545 public static function wp_admin_notices() {
546
547 /**
548 * Current pagenow.
549 *
550 * @global string
551 */
552 global $pagenow;
553
554 if ( 'plugins.php' !== $pagenow ) {
555 return;
556 }
557
558 $deactivated_exts = get_transient( 'mainwp_transient_deactivated_incomtible_exts' );
559 if ( $deactivated_exts && is_array( $deactivated_exts ) && count( $deactivated_exts ) > 0 ) {
560 ?>
561 <div class='notice notice-error my-dismiss-notice is-dismissible'>
562 <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>
563 </div>
564 <?php
565 }
566 }
567
568
569 /**
570 * Method admin_footer()
571 *
572 * Renders admin footer.
573 */
574 public static function admin_footer() {
575 $disabled_confirm = get_option( 'mainwp_disable_update_confirmations', 0 );
576 ?>
577 <input type="hidden" id="mainwp-disable-update-confirmations" value="<?php echo intval( $disabled_confirm ); ?>">
578
579 <script type="text/javascript">
580 jQuery( document ).ready(
581 function ()
582 {
583 jQuery( '#adminmenu #collapse-menu' ).hide();
584 }
585 );
586 </script>
587 <?php
588 /**
589 * Filter: mainwp_open_hide_referrer
590 *
591 * Filters whether the MainWP should hide referrer when going to child site.
592 *
593 * @since Unknown
594 */
595 $hide_ref = apply_filters( 'mainwp_open_hide_referrer', false );
596 if ( $hide_ref ) {
597 ?>
598 <script type="text/javascript">
599 jQuery( document ).on( 'click', 'a.mainwp-may-hide-referrer', function ( e ) {
600 e.preventDefault();
601 mainwp_open_hide_referrer( e.target.href );
602 } );
603
604 function mainwp_open_hide_referrer( url ) {
605 var ran = Math.floor( Math.random() * 100 ) + 1;
606 var site = window.open( "", "mainwp_hide_referrer_" + ran );
607 var meta = site.document.createElement( 'meta' );
608 meta.name = "referrer";
609 meta.content = "no-referrer";
610 site.document.getElementsByTagName( 'head' )[0].appendChild( meta );
611 site.document.open();
612 site.document.writeln( '<script type="text/javascript">window.location = "' + url + '";<\/script>' );
613 site.document.close();
614 }
615 </script>
616 <?php
617 }
618 }
619
620 /**
621 * Admin print styles.
622 *
623 * @uses \MainWP\Dashboard\MainWP_System::is_mainwp_pages()
624 */
625 public static function admin_print_styles() {
626 ?>
627 <style>
628 <?php
629 if ( MainWP_System::is_mainwp_pages() ) {
630 ?>
631 #wpbody-content > div.update-nag,
632 #wpbody-content > div.updated {
633 margin-left: 190px;
634 }
635 html.wp-toolbar{
636 padding-top: 0 !important;
637 }
638 <?php
639 }
640 ?>
641 .mainwp-checkbox:before {
642 content: '<?php esc_html_e( 'YES', 'mainwp' ); ?>';
643 }
644 .mainwp-checkbox:after {
645 content: '<?php esc_html_e( 'NO', 'mainwp' ); ?>';
646 }
647 </style>
648 <?php
649 }
650
651
652 /**
653 * MainWP Productions Site warning.
654 *
655 * @uses \MainWP\Dashboard\MainWP_DB::get_websites_count()
656 */
657 public static function mainwp_warning_notice() {
658
659 if ( get_option( 'mainwp_installation_warning_hide_the_notice' ) == 'yes' ) {
660 return;
661 }
662 if ( MainWP_DB::instance()->get_websites_count() > 0 ) {
663 return;
664 } else {
665 $plugins = get_plugins();
666 if ( ! is_array( $plugins ) || count( $plugins ) <= 4 ) {
667 return;
668 }
669 }
670 ?>
671 <div class="ui red icon message" style="margin-bottom: 0; border-radius: 0;">
672 <i class="info circle icon"></i>
673 <div class="content">
674 <div class="header"><?php esc_html_e( 'This appears to be a production site', 'mainwp' ); ?></div>
675 <?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>")' ); ?>
676 <br /><br />
677 <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>
678 </div>
679 </div>
680 <?php
681 }
682
683 /** Render Admin Header */
684 public static function admin_head() {
685 ?>
686 <script type="text/javascript">var mainwp_ajax_nonce = "<?php echo wp_create_nonce( 'mainwp_ajax' ); ?>", mainwp_js_nonce = "<?php echo wp_create_nonce( 'mainwp_nonce' ); ?>";</script>
687 <?php
688 if ( MainWP_System::is_mainwp_pages() || ( isset( $_GET['page'] ) && 'mainwp-setup' == $_GET['page'] ) ) {
689 if ( get_option( 'mainwp_enable_guided_tours', 0 ) ) {
690 self::mainwp_usetiful_tours();
691 }
692 }
693 }
694
695 /**
696 * Render usetiful tours.
697 */
698 public static function mainwp_usetiful_tours() {
699 echo "
700 <script>
701 (function (w, d, s) {
702 var a = d.getElementsByTagName('head')[0];
703 var r = d.createElement('script');
704 r.async = 1;
705 r.src = s;
706 r.setAttribute('id', 'usetifulScript');
707 r.dataset.token = '480fa17b0507a1c60abba94bfdadd0a7';
708 a.appendChild(r);
709 })(window, document, 'https://www.usetiful.com/dist/usetiful.js');</script>
710 ";
711 }
712
713 /**
714 * MainWP Admin body CSS class attributes.
715 *
716 * @param mixed $class_string MainWP CSS Class attributes.
717 *
718 * @return string $class_string The CSS attributes to add to the page.
719 *
720 * @uses \MainWP\Dashboard\MainWP_System::is_mainwp_pages()
721 */
722 public static function admin_body_class( $class_string ) {
723 if ( MainWP_System::is_mainwp_pages() ) {
724 $class_string .= ' mainwp-ui mainwp-ui-page ';
725 $class_string .= ' mainwp-ui-leftmenu ';
726
727 $selected_theme = MainWP_Settings::get_instance()->get_selected_theme();
728 if ( ! empty( $selected_theme ) ) {
729 $class_string .= ' mainwp-custom-theme ';
730 }
731
732 $siteViewMode = MainWP_Utility::get_siteview_mode();
733 if ( 'grid' == $siteViewMode ) {
734 $class_string .= ' mainwp-sites-grid-view ';
735 } else {
736 $class_string .= ' mainwp-sites-table-view ';
737 }
738 }
739 return $class_string;
740 }
741
742 /**
743 * Method render_footer_content()
744 *
745 * Render footer content.
746 *
747 * @param mixed $websites The websites object.
748 * @param int $current_wpid The current website id.
749 *
750 * @uses \MainWP\Dashboard\MainWP_DB::fetch_object()
751 * @uses \MainWP\Dashboard\MainWP_DB::data_seek()
752 * @uses \MainWP\Dashboard\MainWP_Utility::get_nice_url()
753 */
754 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.
755 $cntr = 0;
756 if ( is_array( $websites ) ) {
757 $count = count( $websites );
758 for ( $i = 0; $i < $count; $i ++ ) {
759 $website = $websites[ $i ];
760 if ( '' == $website->sync_errors ) {
761 $cntr ++;
762 echo '<input type="hidden" name="dashboard_wp_ids[]" class="dashboard_wp_id" value="' . intval( $website->id ) . '" />';
763 }
764 }
765 } elseif ( false !== $websites ) {
766 while ( $website = MainWP_DB::fetch_object( $websites ) ) {
767 if ( '' == $website->sync_errors ) {
768 $cntr ++;
769 echo '<input type="hidden" name="dashboard_wp_ids[]" class="dashboard_wp_id" value="' . intval( $website->id ) . '" />';
770 }
771 }
772 }
773 /**
774 * Action: mainwp_admin_footer
775 *
776 * Fires at the bottom of MainWP content.
777 *
778 * @since Unknown
779 */
780 do_action( 'mainwp_admin_footer' );
781 MainWP_UI::render_select_mainwp_themes_modal();
782 ?>
783 <div class="ui longer modal" id="mainwp-sync-sites-modal" current-wpid="<?php echo intval( $current_wpid ); ?>">
784 <div class="header"><?php esc_html_e( 'Data Synchronization', 'mainwp' ); ?></div>
785 <div class="ui green progress mainwp-modal-progress">
786 <div class="bar"><div class="progress"></div></div>
787 <div class="label"></div>
788 </div>
789 <div class="scrolling content mainwp-modal-content">
790 <div class="ui middle aligned divided selection list" id="sync-sites-status">
791 <?php
792 if ( is_array( $websites ) ) {
793 $count = count( $websites );
794 for ( $i = 0; $i < $count; $i ++ ) {
795 $site_name = $website->name;
796 $website = $websites[ $i ];
797 $is_sync_err = ( '' != $website->sync_errors ) ? true : false;
798 ?>
799 <div class="item <?php echo $is_sync_err ? 'disconnected-site' : ''; ?>">
800 <div class="right floated content">
801 <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>
802 </div>
803 <div class="content">
804 <?php echo esc_html( $site_name ); ?>
805 <?php do_action( 'mainwp_sync_popup_content', $website ); ?>
806 </div>
807 </div>
808 <?php
809 }
810 } else {
811 MainWP_DB::data_seek( $websites, 0 );
812 while ( $website = MainWP_DB::fetch_object( $websites ) ) {
813 $site_name = $website->name;
814 $is_sync_err = ( '' != $website->sync_errors ) ? true : false;
815 ?>
816 <div class="item <?php echo $is_sync_err ? 'disconnected-site' : ''; ?>">
817 <div class="right floated content">
818 <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>
819 </div>
820 <div class="content">
821 <?php echo esc_html( $site_name ); ?>
822 <?php do_action( 'mainwp_sync_popup_content', $website ); ?>
823 </div>
824 </div>
825 <?php
826 }
827 }
828 ?>
829 </div>
830 </div>
831 <div class="actions mainwp-modal-actions">
832 <div class="mainwp-modal-close ui cancel button"><?php esc_html_e( 'Close', 'mainwp' ); ?></div>
833 </div>
834 </div>
835 <input type="hidden" id="sync_selected_site_ids" value="" />
836 <div class="ui tiny modal" id="mainwp-modal-confirm">
837 <div class="header"><?php esc_html_e( 'Confirmation', 'mainwp' ); ?></div>
838 <div class="content">
839 <div class="content-massage"></div>
840 <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>
841 <div class="ui form hidden" id="mainwp-confirm-form">
842 <div class="ui divider"></div>
843 <div class="field">
844 <label></label>
845 <input type="text" id="mainwp-confirm-input" name="mainwp-confirm-input">
846 </div>
847 </div>
848 </div>
849 <div class="actions">
850 <div class="ui two columns grid">
851 <div class="ui left aligned column">
852 <div class="ui green positive button"><?php esc_html_e( 'Yes, proceed!', 'mainwp' ); ?></div>
853 </div>
854 <div class="ui right aligned column">
855 <div class="ui cancel button"><?php esc_html_e( 'Cancel', 'mainwp' ); ?></div>
856 </div>
857 </div>
858 </div>
859 </div>
860 <div class="ui tiny modal" id="mainwp-modal-confirm-select">
861 <div class="header"><?php esc_html_e( 'Confirmation', 'mainwp' ); ?></div>
862 <div class="content">
863 <div class="content-massage"></div>
864 </div>
865 <div class="actions">
866 <div class="ui cancel button"><?php esc_html_e( 'Close', 'mainwp' ); ?></div>
867 </div>
868 </div>
869 <?php
870 }
871
872 /**
873 * Method get_plugins_install_check()
874 *
875 * Get plugins for install checking.
876 */
877 public static function get_plugins_install_check() {
878 $plugins = array(
879 array(
880 'page' => 'Extensions-Mainwp-Backwpup-Extension',
881 'slug' => 'backwpup/backwpup.php',
882 'name' => 'BackWPup',
883 ),
884 array(
885 'page' => 'Extensions-Mainwp-Ithemes-Security-Extension',
886 'slug' => 'better-wp-security/better-wp-security.php',
887 'slug_pro' => 'ithemes-security-pro/ithemes-security-pro.php',
888 'name' => 'iThemes Security',
889 ),
890 array(
891 'page' => 'Extensions-Mainwp-Updraftplus-Extension',
892 'slug' => 'updraftplus/updraftplus.php',
893 'name' => 'UpdraftPlus',
894 ),
895 array(
896 'page' => 'Extensions-Mainwp-Wordfence-Extension',
897 'slug' => 'wordfence/wordfence.php',
898 'name' => 'Wordfence',
899 ),
900 array(
901 'page' => 'Extensions-Wordpress-Seo-Extension',
902 'slug' => 'wordpress-seo/wp-seo.php',
903 'name' => 'Yoast SEO',
904 ),
905 array(
906 'page' => 'Extensions-Mainwp-Jetpack-Protect-Extension',
907 'slug' => 'jetpack-protect/jetpack-protect.php',
908 'name' => 'Jetpack Protect',
909 ),
910 array(
911 'page' => 'Extensions-Mainwp-Jetpack-Scan-Extension',
912 'slug' => 'jetpack-protect/jetpack-protect.php', // tweaked: to requires install the JP protect plugin.
913 'slug_pro' => 'jetpack/jetpack.php',
914 'name' => 'Jetpack Protect',
915 ),
916 );
917 return apply_filters( 'mainwp_plugins_install_checks', $plugins );
918 }
919
920 /**
921 * Render plugins install check modal.
922 * for the exntesion overview page with the missing install plugin only.
923 */
924 public static function render_plugins_install_check() { // phpcs:ignore -- complex function.
925
926 $install_check = get_option( 'mainwp_hide_plugins_install_check_notice', 0 );
927
928 $plugins_to_checks = self::get_plugins_install_check();
929
930 $page = sanitize_text_field( wp_unslash( $_GET['page'] ) );
931
932 $plugin_check = MainWP_Utility::get_sub_array_having( $plugins_to_checks, 'page', $page );
933
934 if ( ! empty( $plugin_check ) ) {
935 $plugin_check = current( $plugin_check );
936 }
937
938 if ( empty( $plugin_check ) ) {
939 return;
940 }
941
942 // if is not overview extension page return.
943 if ( isset( $_GET['tab'] ) && 'overview' !== $_GET['tab'] && 'dashboard' !== $_GET['tab'] ) {
944 return;
945 }
946
947 $plugin_slug = isset( $plugin_check['slug'] ) ? $plugin_check['slug'] : '';
948 $slug_pro = isset( $plugin_check['slug_pro'] ) ? $plugin_check['slug_pro'] : '';
949 $plugin_name = isset( $plugin_check['name'] ) ? $plugin_check['name'] : '';
950
951 if ( empty( $plugin_slug ) || empty( $plugin_name ) ) {
952 return;
953 }
954
955 $check_slug = 'install_check_' . sanitize_text_field( wp_unslash( dirname( $plugin_slug ) ) );
956 $check_hidetime = MainWP_Utility::get_hide_notice_status( $check_slug );
957
958 if ( $check_hidetime && time() < $check_hidetime + 30 * DAY_IN_SECONDS ) {
959 return;
960 }
961
962 $websites = MainWP_DB::instance()->query( MainWP_DB::instance()->get_sql_websites_for_current_user() );
963
964 if ( empty( $websites ) ) {
965 return;
966 }
967
968 $missing_installed = array();
969
970 while ( $websites && $website = MainWP_DB::fetch_object( $websites ) ) {
971 $site_name = $website->name;
972 if ( '' != $website->sync_errors ) {
973 continue;
974 }
975 $not_found = true;
976 if ( '' != $website->plugins ) {
977 $plugins = json_decode( $website->plugins, 1 );
978 if ( is_array( $plugins ) && count( $plugins ) > 0 ) {
979 foreach ( $plugins as $plugin ) {
980 if ( isset( $plugin['slug'] ) && ( $plugin_slug === $plugin['slug'] || ( '' !== $slug_pro && $slug_pro === $plugin['slug'] ) ) ) {
981 $not_found = false;
982 break; // foreach.
983 }
984 }
985 }
986 }
987
988 if ( $not_found ) {
989 $missing_installed[ $website->id ] = $website->name;
990 }
991 }
992
993 if ( empty( $missing_installed ) ) {
994 return;
995 }
996
997 ?>
998 <div class="ui modal" id="mainwp-install-check-modal" noti-slug="<?php echo esc_html( $check_slug ); ?>">
999 <div class="header"><?php esc_html_e( 'Plugin Install Check', 'mainwp' ); ?></div>
1000 <div class="scrolling content mainwp-modal-content">
1001 <div class="ui message" id="mainwp-message-zone-install" style="display:none;"></div>
1002 <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' ), $plugin_name ); ?></div>
1003 <div class="ui middle aligned divided selection list" id="sync-sites-status">
1004 <?php foreach ( $missing_installed as $siteid => $site_name ) : ?>
1005 <div class="item siteBulkInstall" siteid="<?php echo intval( $siteid ); ?>" status="">
1006 <div class="right floated content">
1007 <span class="queue" data-inverted="" data-position="left center" data-tooltip="<?php echo esc_html__( 'Queued', 'mainwp' ); ?>"><i class="clock outline icon"></i></span>
1008 <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>
1009 <span class="status"></span>
1010 </div>
1011 <div class="content">
1012 <div class="ui checkbox checked">
1013 <input type="checkbox" checked="" id="install-check-<?php echo intval( $siteid ); ?>" name="install_checker[]"/>
1014 </div>
1015 <?php echo esc_html( $site_name ); ?>
1016 </div>
1017 </div>
1018 <?php endforeach; ?>
1019 </div>
1020 </div>
1021 <div class="actions mainwp-modal-actions">
1022 <div class="ui two columns grid">
1023 <div class="left aligned column">
1024 <input type="button" class="ui green button" id="mainwp-install-check-btn" value="<?php esc_html_e( 'Install Plugin', 'mainwp' ); ?>">
1025 </div>
1026 <div class="ui right aligned column">
1027 <div class="mainwp-modal-close ui cancel button"><?php esc_html_e( 'Close', 'mainwp' ); ?></div>
1028 </div>
1029 </div>
1030
1031 </div>
1032 </div>
1033 <script type="text/javascript">
1034 jQuery( document ).ready( function () {
1035 jQuery('#mainwp-install-check-modal').modal({
1036 allowMultiple: false,
1037 closable: false,
1038 onHide: function () {
1039 var noti_id = jQuery('#mainwp-install-check-modal').attr('noti-slug');
1040 mainwp_notice_dismiss(noti_id, 1);
1041 setTimeout(function () {
1042 window.location.href = location.href;
1043 }, 1000);
1044 },
1045 }).modal('show');
1046 jQuery(document).on('click', '#mainwp-install-check-btn', function () {
1047 mainwp_install_check_plugin_prepare( '<?php echo rawurlencode( dirname( $plugin_slug ) ); ?>' );
1048 return false;
1049 });
1050 });
1051 </script>
1052 <?php
1053 }
1054 }
1055