Version Description
- 8-28-19 =
- Fixed: various functionality problems
- Added: support for upcoming 3rd party extensions
- Added: .htaccess file with custom redirect to rule the MainWP Child plugin directory to hide the plugin from search engines
- Updated: support for the MainWP Dashboard 4.0
- Updated: notifications texts
- Removed: unused code
Download this release
Release Info
Developer | mainwp |
Plugin | MainWP Child |
Version | 4.0 |
Comparing to | |
See all releases |
Code changes from version 3.5.7 to 4.0
- .htaccess +7 -0
- class/class-mainwp-child-branding.php +1 -1
- class/class-mainwp-child-pagespeed.php +13 -11
- class/class-mainwp-child-timecapsule.php +1 -0
- class/class-mainwp-child-updraft-plus-backups.php +54 -35
- class/class-mainwp-child-wp-rocket.php +223 -142
- class/class-mainwp-child-wpvivid-backuprestore.php +305 -0
- class/class-mainwp-child.php +69 -41
- class/class-mainwp-client-report.php +18 -7
- class/class-mainwp-helper.php +4 -1
- mainwp-child.php +1 -1
- readme.txt +16 -3
.htaccess
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# BEGIN MainWP
|
2 |
+
<IfModule mod_rewrite.c>
|
3 |
+
RewriteEngine On
|
4 |
+
RewriteBase /
|
5 |
+
RewriteRule ^(.*)$ \./THIS_PLUGIN_DOES_NOT_EXIST [QSA,L]
|
6 |
+
</IfModule>
|
7 |
+
# END MainWP
|
class/class-mainwp-child-branding.php
CHANGED
@@ -443,7 +443,7 @@ class MainWP_Child_Branding {
|
|
443 |
add_filter( 'gettext', array( &$this, 'custom_gettext' ), 99, 3 );
|
444 |
add_action( 'login_head', array( &$this, 'custom_login_logo' ) );
|
445 |
add_filter( 'login_headerurl', array( &$this, 'custom_login_headerurl' ) );
|
446 |
-
add_filter( '
|
447 |
add_action( 'wp_head', array( &$this, 'custom_favicon_frontend' ) );
|
448 |
if ( isset( $extra_setting['dashboard_footer'] ) && ! empty( $extra_setting['dashboard_footer'] ) ) {
|
449 |
//remove_filter( 'update_footer', 'core_update_footer' );
|
443 |
add_filter( 'gettext', array( &$this, 'custom_gettext' ), 99, 3 );
|
444 |
add_action( 'login_head', array( &$this, 'custom_login_logo' ) );
|
445 |
add_filter( 'login_headerurl', array( &$this, 'custom_login_headerurl' ) );
|
446 |
+
add_filter( 'login_headertext', array( &$this, 'custom_login_headertitle' ) );
|
447 |
add_action( 'wp_head', array( &$this, 'custom_favicon_frontend' ) );
|
448 |
if ( isset( $extra_setting['dashboard_footer'] ) && ! empty( $extra_setting['dashboard_footer'] ) ) {
|
449 |
//remove_filter( 'update_footer', 'core_update_footer' );
|
class/class-mainwp-child-pagespeed.php
CHANGED
@@ -162,6 +162,8 @@ class MainWP_Child_Pagespeed {
|
|
162 |
return array( 'result' => 'RUNNING' );
|
163 |
}
|
164 |
|
|
|
|
|
165 |
$settings = $_POST['settings'];
|
166 |
$settings = maybe_unserialize( base64_decode( $settings ) );
|
167 |
|
@@ -236,17 +238,17 @@ class MainWP_Child_Pagespeed {
|
|
236 |
|
237 |
$result = $this->get_sync_data( $strategy );
|
238 |
|
239 |
-
if ( isset( $_POST['doaction'] ) && ( 'check_new_pages' === $_POST['doaction'] || 'recheck_all_pages' === $_POST['doaction'] ) ) {
|
240 |
-
if ( 'recheck_all_pages' === $_POST['doaction'] ) {
|
241 |
-
$recheck = true;
|
242 |
-
} else {
|
243 |
-
$recheck = false;
|
244 |
-
}
|
245 |
-
|
246 |
-
|
247 |
-
if ($this->do_check_pages($recheck))
|
248 |
-
$information['checked_pages'] = 1;
|
249 |
-
}
|
250 |
$information['data'] = $result['data'];
|
251 |
return $information;
|
252 |
}
|
162 |
return array( 'result' => 'RUNNING' );
|
163 |
}
|
164 |
|
165 |
+
$information = array();
|
166 |
+
|
167 |
$settings = $_POST['settings'];
|
168 |
$settings = maybe_unserialize( base64_decode( $settings ) );
|
169 |
|
238 |
|
239 |
$result = $this->get_sync_data( $strategy );
|
240 |
|
241 |
+
// if ( isset( $_POST['doaction'] ) && ( 'check_new_pages' === $_POST['doaction'] || 'recheck_all_pages' === $_POST['doaction'] ) ) {
|
242 |
+
// if ( 'recheck_all_pages' === $_POST['doaction'] ) {
|
243 |
+
// $recheck = true;
|
244 |
+
// } else {
|
245 |
+
// $recheck = false;
|
246 |
+
// }
|
247 |
+
//
|
248 |
+
//
|
249 |
+
// if ($this->do_check_pages($recheck))
|
250 |
+
// $information['checked_pages'] = 1;
|
251 |
+
// }
|
252 |
$information['data'] = $result['data'];
|
253 |
return $information;
|
254 |
}
|
class/class-mainwp-child-timecapsule.php
CHANGED
@@ -1075,6 +1075,7 @@ function get_sibling_files_callback_wptc() {
|
|
1075 |
$saved = true;
|
1076 |
|
1077 |
} else if ( $tabName == 'staging_opts' ) {
|
|
|
1078 |
$config->set_option('internal_staging_db_rows_copy_limit', $data['internal_staging_db_rows_copy_limit']);
|
1079 |
$config->set_option('internal_staging_file_copy_limit', $data['internal_staging_file_copy_limit']);
|
1080 |
$config->set_option('internal_staging_deep_link_limit', $data['internal_staging_deep_link_limit']);
|
1075 |
$saved = true;
|
1076 |
|
1077 |
} else if ( $tabName == 'staging_opts' ) {
|
1078 |
+
$config->set_option('user_excluded_extenstions_staging', $data['user_excluded_extenstions_staging']);
|
1079 |
$config->set_option('internal_staging_db_rows_copy_limit', $data['internal_staging_db_rows_copy_limit']);
|
1080 |
$config->set_option('internal_staging_file_copy_limit', $data['internal_staging_file_copy_limit']);
|
1081 |
$config->set_option('internal_staging_deep_link_limit', $data['internal_staging_deep_link_limit']);
|
class/class-mainwp-child-updraft-plus-backups.php
CHANGED
@@ -1191,17 +1191,25 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|
1191 |
$current_timegmt = time();
|
1192 |
$current_time = get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $current_timegmt ), 'D, F j, Y H:i' );
|
1193 |
|
1194 |
-
$html = '<table
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1205 |
|
1206 |
$updraft_dir = $updraftplus->backups_dir_location();
|
1207 |
$backup_disabled = (UpdraftPlus_Filesystem_Functions::really_is_writable($updraft_dir)) ? 0 : 1;
|
@@ -3077,7 +3085,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|
3077 |
}
|
3078 |
|
3079 |
if ( empty( $backup_history ) ) {
|
3080 |
-
return '<
|
3081 |
}
|
3082 |
|
3083 |
MainWP_Helper::check_methods($updraftplus, array( 'backups_dir_location', 'get_backupable_file_entities' ));
|
@@ -3090,20 +3098,17 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|
3090 |
$accept = array();
|
3091 |
}
|
3092 |
|
3093 |
-
$ret = '<table
|
3094 |
$nonce_field = wp_nonce_field( 'updraftplus_download', '_wpnonce', true, false );
|
3095 |
|
3096 |
$ret .= '<thead>
|
3097 |
-
|
3098 |
-
<th
|
3099 |
-
<th
|
3100 |
-
<th
|
3101 |
-
|
3102 |
-
|
3103 |
-
|
3104 |
-
</tr>
|
3105 |
-
</thead>
|
3106 |
-
<tbody>';
|
3107 |
|
3108 |
krsort( $backup_history );
|
3109 |
foreach ( $backup_history as $key => $backup ) {
|
@@ -3129,8 +3134,8 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|
3129 |
// }
|
3130 |
// $rawbackup .= '</p></pre>';
|
3131 |
|
3132 |
-
|
3133 |
-
|
3134 |
|
3135 |
$jobdata = $updraftplus->jobdata_getarray( $non );
|
3136 |
|
@@ -3138,11 +3143,27 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|
3138 |
|
3139 |
$date_label = $this->date_label( $pretty_date, $key, $backup, $jobdata, $non );
|
3140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3141 |
$ret .= <<<ENDHERE
|
3142 |
<tr id="updraft_existing_backups_row_$key">
|
3143 |
|
3144 |
-
<td
|
3145 |
-
$date_label
|
3146 |
</td>
|
3147 |
ENDHERE;
|
3148 |
|
@@ -3195,7 +3216,7 @@ ENDHERE;
|
|
3195 |
|
3196 |
$ret .= '</td>';
|
3197 |
|
3198 |
-
$ret .= '<td
|
3199 |
$ret .= $this->restore_button( $backup, $key, $pretty_date, $entities );
|
3200 |
$ret .= $delete_button;
|
3201 |
if ( empty( $backup['meta_foreign'] ) ) {
|
@@ -3205,8 +3226,6 @@ ENDHERE;
|
|
3205 |
|
3206 |
$ret .= '</tr>';
|
3207 |
|
3208 |
-
$ret .= '<tr style="height:2px; padding:1px; margin:0px;"><td colspan="4" style="margin:0; padding:0"><div style="height: 2px; background-color:#aaaaaa;"> </div></td></tr>';
|
3209 |
-
|
3210 |
}
|
3211 |
|
3212 |
$ret .= '</tbody></table>';
|
@@ -3227,7 +3246,7 @@ ENDHERE;
|
|
3227 |
$show_data .= ' ' . __( '(backup set imported from remote storage)', 'updraftplus' );
|
3228 |
}
|
3229 |
# jQuery('#updraft_restore_label_wpcore').html('".esc_js($wpcore_restore_descrip)."');
|
3230 |
-
$ret .= '<button title="' . __( 'Go to Restore', 'updraftplus' ) . '" type="button" class="button
|
3231 |
}
|
3232 |
$ret .= "</form></div>\n";
|
3233 |
|
@@ -3238,7 +3257,7 @@ ENDHERE;
|
|
3238 |
private function delete_button( $key, $nonce, $backup ) {
|
3239 |
$sval = ( ( isset( $backup['service'] ) && 'email' !== $backup['service'] && 'none' !== $backup['service'] ) ) ? '1' : '0';
|
3240 |
|
3241 |
-
return '<a style="float:left;margin-right:6px" class="
|
3242 |
}
|
3243 |
|
3244 |
private function date_label( $pretty_date, $key, $backup, $jobdata, $nonce ) {
|
@@ -3273,7 +3292,7 @@ ENDHERE;
|
|
3273 |
<input type="hidden" name="action" value="mainwp_updraft_download_backup" />
|
3274 |
<input type="hidden" name="type" value="$bkey" />
|
3275 |
<input type="hidden" name="timestamp" value="$key" />
|
3276 |
-
<input type="submit" class="mwp-updraft-backupentitybutton button" value="$dbt" />
|
3277 |
</form>
|
3278 |
</div>
|
3279 |
ENDHERE;
|
@@ -3390,7 +3409,7 @@ ENDHERE;
|
|
3390 |
<input type="hidden" name="type" value="$type" />
|
3391 |
<input type="hidden" name="timestamp" value="$key" />
|
3392 |
<input type="hidden" name="findex" value="$findex" />
|
3393 |
-
<input type="submit" class="mwp-updraft-backupentitybutton button" title="$ide" value="$pdescrip" />
|
3394 |
</form>
|
3395 |
</div>
|
3396 |
ENDHERE;
|
@@ -3412,7 +3431,7 @@ ENDHERE;
|
|
3412 |
<input type="hidden" name="action" value="downloadlog" />
|
3413 |
<input type="hidden" name="page" value="updraftplus" />
|
3414 |
<input type="hidden" name="updraftplus_backup_nonce" value="$nval" />
|
3415 |
-
<input type="submit" value="$lt" class="updraft-log-link button" onclick="event.preventDefault(); mainwp_updraft_popuplog('$nval', this);" />
|
3416 |
</form>
|
3417 |
</div>
|
3418 |
ENDHERE;
|
1191 |
$current_timegmt = time();
|
1192 |
$current_time = get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $current_timegmt ), 'D, F j, Y H:i' );
|
1193 |
|
1194 |
+
$html = '<table class="ui single line table">
|
1195 |
+
<thead>
|
1196 |
+
<tr>
|
1197 |
+
<th>' . __( 'Files', 'mainwp-updraftplus-extension' ) . '</th>
|
1198 |
+
<th>' . __( 'Database', 'mainwp-updraftplus-extension' ) . '</th>
|
1199 |
+
<th>' . __( 'Time now', 'mainwp-updraftplus-extension' ) . '</th>
|
1200 |
+
</tr>
|
1201 |
+
</thead>
|
1202 |
+
<tbody>
|
1203 |
+
<tr>
|
1204 |
+
<td>' . $next_scheduled_backup. '</td>
|
1205 |
+
<td>' . $next_scheduled_backup_database. '</td>
|
1206 |
+
<td>' . $current_time. '</td>
|
1207 |
+
</tr>
|
1208 |
+
</tbody>
|
1209 |
+
</table>';
|
1210 |
+
|
1211 |
+
MainWP_Helper::check_classes_exists( array( 'UpdraftPlus_Filesystem_Functions' ) ) ;
|
1212 |
+
MainWP_Helper::check_methods('UpdraftPlus_Filesystem_Functions', 'really_is_writable');
|
1213 |
|
1214 |
$updraft_dir = $updraftplus->backups_dir_location();
|
1215 |
$backup_disabled = (UpdraftPlus_Filesystem_Functions::really_is_writable($updraft_dir)) ? 0 : 1;
|
3085 |
}
|
3086 |
|
3087 |
if ( empty( $backup_history ) ) {
|
3088 |
+
return '<div class="ui yellow message">' . __( 'You have not yet made any backups.', 'updraftplus' ) . '</div>';
|
3089 |
}
|
3090 |
|
3091 |
MainWP_Helper::check_methods($updraftplus, array( 'backups_dir_location', 'get_backupable_file_entities' ));
|
3098 |
$accept = array();
|
3099 |
}
|
3100 |
|
3101 |
+
$ret = '<table class="ui stackable single line table">';
|
3102 |
$nonce_field = wp_nonce_field( 'updraftplus_download', '_wpnonce', true, false );
|
3103 |
|
3104 |
$ret .= '<thead>
|
3105 |
+
<tr>
|
3106 |
+
<th>' . __( 'Backup date', 'updraftplus' ) . '</th>
|
3107 |
+
<th>' . __( 'Backup data (click to download)', 'updraftplus' ) . '</th>
|
3108 |
+
<th>' . __( 'Actions', 'updraftplus' ) . '</th>
|
3109 |
+
</tr>
|
3110 |
+
</thead>
|
3111 |
+
<tbody>';
|
|
|
|
|
|
|
3112 |
|
3113 |
krsort( $backup_history );
|
3114 |
foreach ( $backup_history as $key => $backup ) {
|
3134 |
// }
|
3135 |
// $rawbackup .= '</p></pre>';
|
3136 |
|
3137 |
+
// to fix
|
3138 |
+
$rawbackup = '' ; //$updraftplus_admin->raw_backup_info($backup_history, $key, $non);
|
3139 |
|
3140 |
$jobdata = $updraftplus->jobdata_getarray( $non );
|
3141 |
|
3143 |
|
3144 |
$date_label = $this->date_label( $pretty_date, $key, $backup, $jobdata, $non );
|
3145 |
|
3146 |
+
$service_title = '';
|
3147 |
+
if (!isset($backup['service'])) $backup['service'] = array();
|
3148 |
+
if (!is_array($backup['service'])) $backup['service'] = array($backup['service']);
|
3149 |
+
foreach ($backup['service'] as $service) {
|
3150 |
+
if ('none' === $service || '' === $service || (is_array($service) && (empty($service) || array('none') === $service || array('') === $service))) {
|
3151 |
+
// Do nothing
|
3152 |
+
} else {
|
3153 |
+
// $image_url = file_exists($image_folder.$service.'.png') ? $image_folder_url.$service.'.png' : $image_folder_url.'folder.png';
|
3154 |
+
|
3155 |
+
$remote_storage = ('remotesend' === $service) ? __('remote site', 'updraftplus') : $updraftplus->backup_methods[$service];
|
3156 |
+
|
3157 |
+
$service_title = '<br>' . esc_attr(sprintf(__('Remote storage: %s', 'updraftplus'), $remote_storage));
|
3158 |
+
}
|
3159 |
+
}
|
3160 |
+
|
3161 |
+
|
3162 |
$ret .= <<<ENDHERE
|
3163 |
<tr id="updraft_existing_backups_row_$key">
|
3164 |
|
3165 |
+
<td class="updraft_existingbackup_date" data-rawbackup="$rawbackup">
|
3166 |
+
$date_label . $service_title
|
3167 |
</td>
|
3168 |
ENDHERE;
|
3169 |
|
3216 |
|
3217 |
$ret .= '</td>';
|
3218 |
|
3219 |
+
$ret .= '<td>';
|
3220 |
$ret .= $this->restore_button( $backup, $key, $pretty_date, $entities );
|
3221 |
$ret .= $delete_button;
|
3222 |
if ( empty( $backup['meta_foreign'] ) ) {
|
3226 |
|
3227 |
$ret .= '</tr>';
|
3228 |
|
|
|
|
|
3229 |
}
|
3230 |
|
3231 |
$ret .= '</tbody></table>';
|
3246 |
$show_data .= ' ' . __( '(backup set imported from remote storage)', 'updraftplus' );
|
3247 |
}
|
3248 |
# jQuery('#updraft_restore_label_wpcore').html('".esc_js($wpcore_restore_descrip)."');
|
3249 |
+
$ret .= '<button title="' . __( 'Go to Restore', 'updraftplus' ) . '" type="button" class="ui green button mwp-updraftplus-restore-btn" >' . __( 'Restore', 'updraftplus' ) . '</button>';
|
3250 |
}
|
3251 |
$ret .= "</form></div>\n";
|
3252 |
|
3257 |
private function delete_button( $key, $nonce, $backup ) {
|
3258 |
$sval = ( ( isset( $backup['service'] ) && 'email' !== $backup['service'] && 'none' !== $backup['service'] ) ) ? '1' : '0';
|
3259 |
|
3260 |
+
return '<a style="float:left;margin-right:6px" class="ui green basic button" href="#" onclick="event.preventDefault();' . "mainwp_updraft_delete('$key', '$nonce', $sval,this);" . '" title="' . esc_attr( __( 'Delete this backup set', 'updraftplus' ) ) . '">' . __( 'Delete', 'updraftplus' ) . '</a>';
|
3261 |
}
|
3262 |
|
3263 |
private function date_label( $pretty_date, $key, $backup, $jobdata, $nonce ) {
|
3292 |
<input type="hidden" name="action" value="mainwp_updraft_download_backup" />
|
3293 |
<input type="hidden" name="type" value="$bkey" />
|
3294 |
<input type="hidden" name="timestamp" value="$key" />
|
3295 |
+
<input type="submit" class="mwp-updraft-backupentitybutton ui button" value="$dbt" />
|
3296 |
</form>
|
3297 |
</div>
|
3298 |
ENDHERE;
|
3409 |
<input type="hidden" name="type" value="$type" />
|
3410 |
<input type="hidden" name="timestamp" value="$key" />
|
3411 |
<input type="hidden" name="findex" value="$findex" />
|
3412 |
+
<input type="submit" class="mwp-updraft-backupentitybutton ui button" title="$ide" value="$pdescrip" />
|
3413 |
</form>
|
3414 |
</div>
|
3415 |
ENDHERE;
|
3431 |
<input type="hidden" name="action" value="downloadlog" />
|
3432 |
<input type="hidden" name="page" value="updraftplus" />
|
3433 |
<input type="hidden" name="updraftplus_backup_nonce" value="$nval" />
|
3434 |
+
<input type="submit" value="$lt" class="updraft-log-link ui button" onclick="event.preventDefault(); mainwp_updraft_popuplog('$nval', this);" />
|
3435 |
</form>
|
3436 |
</div>
|
3437 |
ENDHERE;
|
class/class-mainwp-child-wp-rocket.php
CHANGED
@@ -17,6 +17,7 @@
|
|
17 |
|
18 |
class MainWP_Child_WP_Rocket {
|
19 |
public static $instance = null;
|
|
|
20 |
|
21 |
public static function Instance() {
|
22 |
if ( null === MainWP_Child_WP_Rocket::$instance ) {
|
@@ -27,13 +28,19 @@ class MainWP_Child_WP_Rocket {
|
|
27 |
}
|
28 |
|
29 |
public function __construct() {
|
30 |
-
|
|
|
|
|
31 |
}
|
32 |
|
33 |
public function init() {
|
34 |
-
if ( get_option( 'mainwp_wprocket_ext_enabled' ) !== 'Y' ) {
|
35 |
-
return;
|
36 |
-
}
|
|
|
|
|
|
|
|
|
37 |
|
38 |
add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
|
39 |
|
@@ -47,6 +54,86 @@ class MainWP_Child_WP_Rocket {
|
|
47 |
}
|
48 |
}
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
// ok
|
51 |
public function syncOthersData( $information, $data = array() ) {
|
52 |
if ( isset( $data['syncWPRocketData'] ) && ( 'yes' === $data['syncWPRocketData'] ) ) {
|
@@ -116,10 +203,13 @@ class MainWP_Child_WP_Rocket {
|
|
116 |
return $value;
|
117 |
}
|
118 |
|
119 |
-
public
|
120 |
-
|
121 |
-
|
122 |
-
|
|
|
|
|
|
|
123 |
|
124 |
return true;
|
125 |
}
|
@@ -153,42 +243,53 @@ class MainWP_Child_WP_Rocket {
|
|
153 |
}
|
154 |
|
155 |
public function action() {
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
}
|
|
|
|
|
|
|
|
|
161 |
if ( isset( $_POST['mwp_action'] ) ) {
|
162 |
-
MainWP_Helper::update_option( 'mainwp_wprocket_ext_enabled', 'Y' );
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
}
|
193 |
MainWP_Helper::write( $information );
|
194 |
}
|
@@ -254,13 +355,42 @@ class MainWP_Child_WP_Rocket {
|
|
254 |
}
|
255 |
|
256 |
function preload_cache() {
|
257 |
-
|
258 |
-
|
259 |
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
}
|
265 |
|
266 |
function save_settings() {
|
@@ -277,39 +407,64 @@ class MainWP_Child_WP_Rocket {
|
|
277 |
$options[ $field ] = $value;
|
278 |
}
|
279 |
}
|
280 |
-
|
281 |
-
$_POST['wp_rocket_settings']['submit_optimize'] = 1; // simulate POST
|
282 |
-
}
|
283 |
|
284 |
update_option( WP_ROCKET_SLUG, $options );
|
285 |
|
|
|
|
|
|
|
|
|
286 |
return array( 'result' => 'SUCCESS' );
|
287 |
}
|
288 |
|
289 |
function optimize_database() {
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
}
|
|
|
|
|
295 |
return $return;
|
296 |
}
|
297 |
|
298 |
function get_optimize_info() {
|
299 |
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
313 |
return $information;
|
314 |
}
|
315 |
|
@@ -318,79 +473,5 @@ class MainWP_Child_WP_Rocket {
|
|
318 |
return array('result' => 'SUCCESS', 'options' => $options);
|
319 |
}
|
320 |
|
321 |
-
function get_rocket_default_options() {
|
322 |
-
return array(
|
323 |
-
'cache_mobile' => 1,
|
324 |
-
'do_caching_mobile_files' => 0,
|
325 |
-
'cache_logged_user' => 0,
|
326 |
-
'cache_ssl' => 0,
|
327 |
-
'emoji' => 0,
|
328 |
-
'embeds' => 1,
|
329 |
-
'varnish_auto_purge' => 0,
|
330 |
-
'manual_preload' => 0,
|
331 |
-
'automatic_preload' => 0,
|
332 |
-
'sitemap_preload' => 0,
|
333 |
-
'sitemap_preload_url_crawl' => 500000,
|
334 |
-
'sitemaps' => array(),
|
335 |
-
'database_revisions' => 0,
|
336 |
-
'database_auto_drafts' => 0,
|
337 |
-
'database_trashed_posts' => 0,
|
338 |
-
'database_spam_comments' => 0,
|
339 |
-
'database_trashed_comments' => 0,
|
340 |
-
'database_expired_transients' => 0,
|
341 |
-
'database_all_transients' => 0,
|
342 |
-
'database_optimize_tables' => 0,
|
343 |
-
'schedule_automatic_cleanup' => 0,
|
344 |
-
'automatic_cleanup_frequency' => '',
|
345 |
-
'cache_reject_uri' => array(),
|
346 |
-
'cache_reject_cookies' => array(),
|
347 |
-
'cache_reject_ua' => array(),
|
348 |
-
'cache_query_strings' => array(),
|
349 |
-
'cache_purge_pages' => array(),
|
350 |
-
'purge_cron_interval' => 10,
|
351 |
-
'purge_cron_unit' => 'HOUR_IN_SECONDS',
|
352 |
-
'exclude_css' => array(),
|
353 |
-
'exclude_js' => array(),
|
354 |
-
'async_css' => 0,
|
355 |
-
'defer_all_js' => 0,
|
356 |
-
'defer_all_js_safe' => 1,
|
357 |
-
'critical_css' => '',
|
358 |
-
'deferred_js_files' => array(),
|
359 |
-
'lazyload' => 0,
|
360 |
-
'lazyload_iframes' => 0,
|
361 |
-
'lazyload_youtube' =>0,
|
362 |
-
'minify_css' => 0,
|
363 |
-
// 'minify_css_key' => $minify_css_key,
|
364 |
-
'minify_concatenate_css' => 0,
|
365 |
-
//'minify_css_combine_all' => 0,
|
366 |
-
'minify_css_legacy' => 0,
|
367 |
-
'minify_js' => 0,
|
368 |
-
// 'minify_js_key' => $minify_js_key,
|
369 |
-
'minify_js_in_footer' => array(),
|
370 |
-
'minify_concatenate_js' => 0,
|
371 |
-
'minify_js_combine_all' => 0,
|
372 |
-
//'minify_js_legacy' => 0,
|
373 |
-
'minify_google_fonts' => 0,
|
374 |
-
'minify_html' => 0,
|
375 |
-
'remove_query_strings' => 0,
|
376 |
-
'dns_prefetch' => 0,
|
377 |
-
'cdn' => 0,
|
378 |
-
'cdn_cnames' => array(),
|
379 |
-
'cdn_zone' => array(),
|
380 |
-
//'cdn_ssl' => 0,
|
381 |
-
'cdn_reject_files' => array(),
|
382 |
-
'do_cloudflare' => 0,
|
383 |
-
'cloudflare_email' => '',
|
384 |
-
'cloudflare_api_key' => '',
|
385 |
-
'cloudflare_domain' => '',
|
386 |
-
//'cloudflare_zone_id' => '',
|
387 |
-
'cloudflare_devmode' => 0,
|
388 |
-
'cloudflare_protocol_rewrite' => 0,
|
389 |
-
'cloudflare_auto_settings' => 0,
|
390 |
-
'cloudflare_old_settings' => 0,
|
391 |
-
'do_beta' => 0,
|
392 |
-
'analytics_enabled' => 1,
|
393 |
-
);
|
394 |
-
}
|
395 |
}
|
396 |
|
17 |
|
18 |
class MainWP_Child_WP_Rocket {
|
19 |
public static $instance = null;
|
20 |
+
public $is_plugin_installed = false;
|
21 |
|
22 |
public static function Instance() {
|
23 |
if ( null === MainWP_Child_WP_Rocket::$instance ) {
|
28 |
}
|
29 |
|
30 |
public function __construct() {
|
31 |
+
if ( is_plugin_active( 'wp-rocket/wp-rocket.php' ) ) {
|
32 |
+
$this->is_plugin_installed = true;
|
33 |
+
}
|
34 |
}
|
35 |
|
36 |
public function init() {
|
37 |
+
// if ( get_option( 'mainwp_wprocket_ext_enabled' ) !== 'Y' ) {
|
38 |
+
// return;
|
39 |
+
// }
|
40 |
+
|
41 |
+
if ( ! $this->is_plugin_installed ) {
|
42 |
+
return;
|
43 |
+
}
|
44 |
|
45 |
add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
|
46 |
|
54 |
}
|
55 |
}
|
56 |
|
57 |
+
function get_rocket_default_options() {
|
58 |
+
return array(
|
59 |
+
'cache_mobile' => 1,
|
60 |
+
'do_caching_mobile_files' => 0,
|
61 |
+
'cache_logged_user' => 0,
|
62 |
+
'cache_ssl' => 0,
|
63 |
+
'emoji' => 0,
|
64 |
+
'embeds' => 1,
|
65 |
+
'control_heartbeat' => 0,
|
66 |
+
'heartbeat_site_behavior' => 'reduce_periodicity',
|
67 |
+
'heartbeat_admin_behavior' => 'reduce_periodicity',
|
68 |
+
'heartbeat_editor_behavior' => 'reduce_periodicity',
|
69 |
+
'varnish_auto_purge' => 0,
|
70 |
+
'manual_preload' => 0,
|
71 |
+
'automatic_preload' => 0,
|
72 |
+
'sitemap_preload' => 0,
|
73 |
+
'sitemap_preload_url_crawl' => 500000,
|
74 |
+
'sitemaps' => array(),
|
75 |
+
'database_revisions' => 0,
|
76 |
+
'database_auto_drafts' => 0,
|
77 |
+
'database_trashed_posts' => 0,
|
78 |
+
'database_spam_comments' => 0,
|
79 |
+
'database_trashed_comments' => 0,
|
80 |
+
'database_expired_transients' => 0,
|
81 |
+
'database_all_transients' => 0,
|
82 |
+
'database_optimize_tables' => 0,
|
83 |
+
'schedule_automatic_cleanup' => 0,
|
84 |
+
'automatic_cleanup_frequency' => '',
|
85 |
+
'cache_reject_uri' => array(),
|
86 |
+
'cache_reject_cookies' => array(),
|
87 |
+
'cache_reject_ua' => array(),
|
88 |
+
'cache_query_strings' => array(),
|
89 |
+
'cache_purge_pages' => array(),
|
90 |
+
'purge_cron_interval' => 10,
|
91 |
+
'purge_cron_unit' => 'HOUR_IN_SECONDS',
|
92 |
+
'exclude_css' => array(),
|
93 |
+
'exclude_js' => array(),
|
94 |
+
'exclude_inline_js' => array(),
|
95 |
+
'async_css' => 0,
|
96 |
+
'defer_all_js' => 0,
|
97 |
+
'defer_all_js_safe' => 1,
|
98 |
+
'critical_css' => '',
|
99 |
+
'deferred_js_files' => array(),
|
100 |
+
'lazyload' => 0,
|
101 |
+
'lazyload_iframes' => 0,
|
102 |
+
'lazyload_youtube' =>0,
|
103 |
+
'minify_css' => 0,
|
104 |
+
// 'minify_css_key' => $minify_css_key,
|
105 |
+
'minify_concatenate_css' => 0,
|
106 |
+
//'minify_css_combine_all' => 0,
|
107 |
+
'minify_css_legacy' => 0,
|
108 |
+
'minify_js' => 0,
|
109 |
+
// 'minify_js_key' => $minify_js_key,
|
110 |
+
'minify_js_in_footer' => array(),
|
111 |
+
'minify_concatenate_js' => 0,
|
112 |
+
'minify_js_combine_all' => 0,
|
113 |
+
//'minify_js_legacy' => 0,
|
114 |
+
'minify_google_fonts' => 0,
|
115 |
+
'minify_html' => 0,
|
116 |
+
'remove_query_strings' => 0,
|
117 |
+
'dns_prefetch' => 0,
|
118 |
+
'cdn' => 0,
|
119 |
+
'cdn_cnames' => array(),
|
120 |
+
'cdn_zone' => array(),
|
121 |
+
//'cdn_ssl' => 0,
|
122 |
+
'cdn_reject_files' => array(),
|
123 |
+
'do_cloudflare' => 0,
|
124 |
+
'cloudflare_email' => '',
|
125 |
+
'cloudflare_api_key' => '',
|
126 |
+
'cloudflare_domain' => '',
|
127 |
+
//'cloudflare_zone_id' => '',
|
128 |
+
'cloudflare_devmode' => 0,
|
129 |
+
'cloudflare_protocol_rewrite' => 0,
|
130 |
+
'cloudflare_auto_settings' => 0,
|
131 |
+
'cloudflare_old_settings' => 0,
|
132 |
+
'do_beta' => 0,
|
133 |
+
'analytics_enabled' => 1,
|
134 |
+
);
|
135 |
+
}
|
136 |
+
|
137 |
// ok
|
138 |
public function syncOthersData( $information, $data = array() ) {
|
139 |
if ( isset( $data['syncWPRocketData'] ) && ( 'yes' === $data['syncWPRocketData'] ) ) {
|
203 |
return $value;
|
204 |
}
|
205 |
|
206 |
+
public function isActivated() {
|
207 |
+
if ( ! $this->is_plugin_installed ) {
|
208 |
+
return false;
|
209 |
+
}
|
210 |
+
// if ( ! defined( 'WP_ROCKET_VERSION' ) || ! defined( 'WP_ROCKET_SLUG' ) ) {
|
211 |
+
// return false;
|
212 |
+
// }
|
213 |
|
214 |
return true;
|
215 |
}
|
243 |
}
|
244 |
|
245 |
public function action() {
|
246 |
+
|
247 |
+
if ( ! $this->is_plugin_installed ) {
|
248 |
+
MainWP_Helper::write( array( 'error' => __( 'Please install WP Rocket plugin on child website', $this->plugin_translate ) ) );
|
249 |
+
return;
|
250 |
}
|
251 |
+
|
252 |
+
$information = array();
|
253 |
+
|
254 |
+
|
255 |
if ( isset( $_POST['mwp_action'] ) ) {
|
256 |
+
// MainWP_Helper::update_option( 'mainwp_wprocket_ext_enabled', 'Y' );
|
257 |
+
try {
|
258 |
+
switch ( $_POST['mwp_action'] ) {
|
259 |
+
case 'set_showhide':
|
260 |
+
$information = $this->set_showhide();
|
261 |
+
break;
|
262 |
+
case 'purge_cloudflare':
|
263 |
+
$information = $this->purge_cloudflare();
|
264 |
+
break;
|
265 |
+
case 'purge_all':
|
266 |
+
$information = $this->purge_cache_all();
|
267 |
+
break;
|
268 |
+
case 'preload_cache':
|
269 |
+
$information = $this->preload_cache();
|
270 |
+
break;
|
271 |
+
case 'generate_critical_css':
|
272 |
+
$information = $this->generate_critical_css();
|
273 |
+
break;
|
274 |
+
case 'save_settings':
|
275 |
+
$information = $this->save_settings();
|
276 |
+
break;
|
277 |
+
case "load_existing_settings":
|
278 |
+
$information = $this->load_existing_settings();
|
279 |
+
break;
|
280 |
+
case 'optimize_database':
|
281 |
+
$information = $this->optimize_database();
|
282 |
+
break;
|
283 |
+
case 'get_optimize_info':
|
284 |
+
$information = $this->get_optimize_info();
|
285 |
+
break;
|
286 |
+
case 'purge_opcache':
|
287 |
+
$information = $this->do_admin_post_rocket_purge_opcache();
|
288 |
+
break;
|
289 |
+
}
|
290 |
+
} catch(Exception $e) {
|
291 |
+
$information = array( 'error' => $e->getMessage() );
|
292 |
+
}
|
293 |
}
|
294 |
MainWP_Helper::write( $information );
|
295 |
}
|
355 |
}
|
356 |
|
357 |
function preload_cache() {
|
358 |
+
MainWP_Helper::check_functions( array( 'run_rocket_sitemap_preload', 'run_rocket_bot' ) );
|
359 |
+
MainWP_Helper::check_classes_exists('WP_Rocket\Preload\Full_Process');
|
360 |
|
361 |
+
$preload_process = new WP_Rocket\Preload\Full_Process();
|
362 |
+
MainWP_Helper::check_methods($preload_process, array( 'is_process_running'));
|
363 |
+
|
364 |
+
if ( $preload_process->is_process_running() ) {
|
365 |
+
return array( 'result' => 'RUNNING' );
|
366 |
+
}
|
367 |
+
|
368 |
+
delete_transient( 'rocket_preload_errors' );
|
369 |
+
run_rocket_bot( 'cache-preload', '' );
|
370 |
+
run_rocket_sitemap_preload();
|
371 |
+
return array( 'result' => 'SUCCESS' );
|
372 |
+
}
|
373 |
+
|
374 |
+
function generate_critical_css() {
|
375 |
+
MainWP_Helper::check_classes_exists( array( 'WP_Rocket\Subscriber\Optimization\Critical_CSS_Subscriber',
|
376 |
+
'WP_Rocket\Optimization\CSS\Critical_CSS',
|
377 |
+
'WP_Rocket\Optimization\CSS\Critical_CSS_Generation',
|
378 |
+
'WP_Rocket\Admin\Options',
|
379 |
+
'WP_Rocket\Admin\Options_Data'
|
380 |
+
));
|
381 |
+
|
382 |
+
$critical_css = new WP_Rocket\Optimization\CSS\Critical_CSS( new WP_Rocket\Optimization\CSS\Critical_CSS_Generation() );
|
383 |
+
$options_api = new WP_Rocket\Admin\Options( 'wp_rocket_' );
|
384 |
+
$options = new WP_Rocket\Admin\Options_Data( $options_api->get( 'settings', array() ) );
|
385 |
+
|
386 |
+
$sitemap_preload = new WP_Rocket\Subscriber\Optimization\Critical_CSS_Subscriber( $critical_css, $options );
|
387 |
+
|
388 |
+
MainWP_Helper::check_properties($sitemap_preload, 'critical_css');
|
389 |
+
MainWP_Helper::check_methods($sitemap_preload->critical_css, 'process_handler');
|
390 |
+
|
391 |
+
$sitemap_preload->critical_css->process_handler();
|
392 |
+
|
393 |
+
return array( 'result' => 'SUCCESS' );
|
394 |
}
|
395 |
|
396 |
function save_settings() {
|
407 |
$options[ $field ] = $value;
|
408 |
}
|
409 |
}
|
410 |
+
|
|
|
|
|
411 |
|
412 |
update_option( WP_ROCKET_SLUG, $options );
|
413 |
|
414 |
+
if (isset($_POST['do_database_optimization']) && !empty($_POST['do_database_optimization'])) {
|
415 |
+
$this->optimize_database();
|
416 |
+
}
|
417 |
+
|
418 |
return array( 'result' => 'SUCCESS' );
|
419 |
}
|
420 |
|
421 |
function optimize_database() {
|
422 |
+
|
423 |
+
MainWP_Helper::check_classes_exists( array( 'WP_Rocket\Admin\Database\Optimization',
|
424 |
+
'WP_Rocket\Admin\Database\Optimization_Process',
|
425 |
+
'WP_Rocket\Admin\Options',
|
426 |
+
'WP_Rocket\Admin\Options_Data'
|
427 |
+
));
|
428 |
+
|
429 |
+
$process = new WP_Rocket\Admin\Database\Optimization_Process();
|
430 |
+
$optimization = new WP_Rocket\Admin\Database\Optimization( $process );
|
431 |
+
MainWP_Helper::check_methods( $optimization, array( 'process_handler', 'get_options' ) );
|
432 |
+
|
433 |
+
$options_api = new WP_Rocket\Admin\Options( 'wp_rocket_' );
|
434 |
+
$options = new WP_Rocket\Admin\Options_Data( $options_api->get( 'settings', array() ) );
|
435 |
+
|
436 |
+
$items = array_filter( array_keys( $optimization->get_options() ), [ $options, 'get' ] );
|
437 |
+
|
438 |
+
if ( !empty( $items ) ) {
|
439 |
+
$optimization->process_handler( $items );
|
440 |
}
|
441 |
+
|
442 |
+
$return['result'] = 'SUCCESS';
|
443 |
return $return;
|
444 |
}
|
445 |
|
446 |
function get_optimize_info() {
|
447 |
|
448 |
+
MainWP_Helper::check_classes_exists( array( 'WP_Rocket\Admin\Database\Optimization',
|
449 |
+
'WP_Rocket\Admin\Database\Optimization_Process'
|
450 |
+
));
|
451 |
+
|
452 |
+
$process = new WP_Rocket\Admin\Database\Optimization_Process();
|
453 |
+
$optimization = new WP_Rocket\Admin\Database\Optimization( $process );
|
454 |
+
MainWP_Helper::check_methods($optimization, 'count_cleanup_items');
|
455 |
+
|
456 |
+
$information['optimize_info'] = array(
|
457 |
+
'total_revisions' => $optimization->count_cleanup_items( 'database_revisions' ),
|
458 |
+
'total_auto_draft' => $optimization->count_cleanup_items( 'database_auto_drafts' ),
|
459 |
+
'total_trashed_posts' => $optimization->count_cleanup_items( 'database_trashed_posts' ),
|
460 |
+
'total_spam_comments' => $optimization->count_cleanup_items( 'database_spam_comments' ),
|
461 |
+
'total_trashed_comments' => $optimization->count_cleanup_items( 'database_trashed_comments' ),
|
462 |
+
'total_expired_transients' => $optimization->count_cleanup_items( 'database_expired_transients' ),
|
463 |
+
'total_all_transients' => $optimization->count_cleanup_items( 'database_all_transients' ),
|
464 |
+
'total_optimize_tables' => $optimization->count_cleanup_items( 'database_optimize_tables' )
|
465 |
+
);
|
466 |
+
|
467 |
+
$information['result'] = 'SUCCESS';
|
468 |
return $information;
|
469 |
}
|
470 |
|
473 |
return array('result' => 'SUCCESS', 'options' => $options);
|
474 |
}
|
475 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
476 |
}
|
477 |
|
class/class-mainwp-child-wpvivid-backuprestore.php
ADDED
@@ -0,0 +1,305 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: alienware`x
|
5 |
+
* Date: 2019/4/30
|
6 |
+
* Time: 10:26
|
7 |
+
*/
|
8 |
+
|
9 |
+
class MainWP_Child_WPvivid_BackupRestore
|
10 |
+
{
|
11 |
+
public static $instance = null;
|
12 |
+
public $is_plugin_installed = false;
|
13 |
+
public $public_intetface;
|
14 |
+
static function Instance()
|
15 |
+
{
|
16 |
+
if ( null === MainWP_Child_WPvivid_BackupRestore::$instance )
|
17 |
+
{
|
18 |
+
MainWP_Child_WPvivid_BackupRestore::$instance = new MainWP_Child_WPvivid_BackupRestore();
|
19 |
+
}
|
20 |
+
|
21 |
+
return MainWP_Child_WPvivid_BackupRestore::$instance;
|
22 |
+
}
|
23 |
+
|
24 |
+
public function __construct()
|
25 |
+
{
|
26 |
+
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
27 |
+
if ( is_plugin_active( 'wpvivid-backuprestore/wpvivid-backuprestore.php' ) && defined('WPVIVID_PLUGIN_DIR'))
|
28 |
+
{
|
29 |
+
$this->is_plugin_installed = true;
|
30 |
+
}
|
31 |
+
|
32 |
+
if (!$this->is_plugin_installed)
|
33 |
+
return;
|
34 |
+
|
35 |
+
add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
|
36 |
+
$this->public_intetface = new WPvivid_Public_Interface();
|
37 |
+
}
|
38 |
+
|
39 |
+
public function init()
|
40 |
+
{
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
function syncOthersData( $information, $data = array() )
|
45 |
+
{
|
46 |
+
try{
|
47 |
+
|
48 |
+
if ( isset( $data['syncWPvividData'] ))
|
49 |
+
{
|
50 |
+
$information['syncWPvividData']=1;
|
51 |
+
$data = WPvivid_Setting::get_sync_data();
|
52 |
+
$information['syncWPvividSettingData']=$data['setting'];
|
53 |
+
$information['syncWPvividRemoteData']=$data['remote'];
|
54 |
+
$information['syncWPvividScheduleData']=$data['schedule'];
|
55 |
+
}
|
56 |
+
|
57 |
+
} catch(Exception $e) {
|
58 |
+
|
59 |
+
}
|
60 |
+
|
61 |
+
return $information;
|
62 |
+
}
|
63 |
+
|
64 |
+
public function action()
|
65 |
+
{
|
66 |
+
$information = array();
|
67 |
+
if ( ! $this->is_plugin_installed )
|
68 |
+
{
|
69 |
+
$information['error'] = 'NO_WPVIVIDBACKUP';
|
70 |
+
MainWP_Helper::write( $information );
|
71 |
+
}
|
72 |
+
|
73 |
+
if ( isset( $_POST['mwp_action'] ) )
|
74 |
+
{
|
75 |
+
try {
|
76 |
+
switch ($_POST['mwp_action']) {
|
77 |
+
case 'prepare_backup':
|
78 |
+
$information = $this->prepare_backup();
|
79 |
+
break;
|
80 |
+
case 'backup_now':
|
81 |
+
$information = $this->backup_now();
|
82 |
+
break;
|
83 |
+
case 'get_status':
|
84 |
+
$information = $this->get_status();
|
85 |
+
break;
|
86 |
+
case 'get_backup_schedule':
|
87 |
+
$information = $this->get_backup_schedule();
|
88 |
+
break;
|
89 |
+
case 'get_backup_list':
|
90 |
+
$information = $this->get_backup_list();
|
91 |
+
break;
|
92 |
+
case 'get_default_remote':
|
93 |
+
$information = $this->get_default_remote();
|
94 |
+
break;
|
95 |
+
case 'delete_backup':
|
96 |
+
$information = $this->delete_backup();
|
97 |
+
break;
|
98 |
+
case 'delete_backup_array':
|
99 |
+
$information = $this->delete_backup_array();
|
100 |
+
break;
|
101 |
+
case 'set_security_lock':
|
102 |
+
$information = $this->set_security_lock();
|
103 |
+
break;
|
104 |
+
case 'view_log':
|
105 |
+
$information = $this->view_log();
|
106 |
+
break;
|
107 |
+
case 'read_last_backup_log':
|
108 |
+
$information = $this->read_last_backup_log();
|
109 |
+
break;
|
110 |
+
case 'view_backup_task_log':
|
111 |
+
$information = $this->view_backup_task_log();
|
112 |
+
break;
|
113 |
+
case 'backup_cancel':
|
114 |
+
$information = $this->backup_cancel();
|
115 |
+
break;
|
116 |
+
case 'init_download_page':
|
117 |
+
$information = $this->init_download_page();
|
118 |
+
break;
|
119 |
+
case 'prepare_download_backup':
|
120 |
+
$information = $this->prepare_download_backup();
|
121 |
+
break;
|
122 |
+
case 'get_download_task':
|
123 |
+
$information = $this->get_download_task();
|
124 |
+
break;
|
125 |
+
case 'download_backup':
|
126 |
+
$information = $this->download_backup();
|
127 |
+
break;
|
128 |
+
case 'set_general_setting':
|
129 |
+
$information = $this->set_general_setting();
|
130 |
+
break;
|
131 |
+
case 'set_schedule':
|
132 |
+
$information = $this->set_schedule();
|
133 |
+
break;
|
134 |
+
case 'set_remote':
|
135 |
+
$information = $this->set_remote();
|
136 |
+
break;
|
137 |
+
}
|
138 |
+
} catch (Exception $e) {
|
139 |
+
$information = array('error' => $e->getMessage());
|
140 |
+
}
|
141 |
+
|
142 |
+
MainWP_Helper::write($information);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
public function prepare_backup()
|
147 |
+
{
|
148 |
+
global $wpvivid_plugin;
|
149 |
+
$wpvivid_plugin->ajax_check_security();
|
150 |
+
$ret = $this->public_intetface->prepare_backup($_POST['backup']);
|
151 |
+
return $ret;
|
152 |
+
}
|
153 |
+
|
154 |
+
public function backup_now()
|
155 |
+
{
|
156 |
+
global $wpvivid_plugin;
|
157 |
+
$wpvivid_plugin->ajax_check_security();
|
158 |
+
$ret = $this->public_intetface->backup_now($_POST['task_id']);
|
159 |
+
return $ret;
|
160 |
+
}
|
161 |
+
|
162 |
+
public function get_status()
|
163 |
+
{
|
164 |
+
global $wpvivid_plugin;
|
165 |
+
$wpvivid_plugin->ajax_check_security();
|
166 |
+
$ret = $this->public_intetface->get_status();
|
167 |
+
return $ret;
|
168 |
+
}
|
169 |
+
|
170 |
+
public function get_backup_schedule()
|
171 |
+
{
|
172 |
+
global $wpvivid_plugin;
|
173 |
+
$wpvivid_plugin->ajax_check_security();
|
174 |
+
$ret = $this->public_intetface->get_backup_schedule();
|
175 |
+
return $ret;
|
176 |
+
}
|
177 |
+
|
178 |
+
public function get_backup_list()
|
179 |
+
{
|
180 |
+
global $wpvivid_plugin;
|
181 |
+
$wpvivid_plugin->ajax_check_security();
|
182 |
+
$ret = $this->public_intetface->get_backup_list();
|
183 |
+
return $ret;
|
184 |
+
}
|
185 |
+
|
186 |
+
public function get_default_remote()
|
187 |
+
{
|
188 |
+
global $wpvivid_plugin;
|
189 |
+
$wpvivid_plugin->ajax_check_security();
|
190 |
+
$ret = $this->public_intetface->get_default_remote();
|
191 |
+
return $ret;
|
192 |
+
}
|
193 |
+
|
194 |
+
public function delete_backup()
|
195 |
+
{
|
196 |
+
global $wpvivid_plugin;
|
197 |
+
$wpvivid_plugin->ajax_check_security();
|
198 |
+
$ret = $this->public_intetface->delete_backup($_POST['backup_id'], $_POST['force']);
|
199 |
+
return $ret;
|
200 |
+
}
|
201 |
+
|
202 |
+
public function delete_backup_array()
|
203 |
+
{
|
204 |
+
global $wpvivid_plugin;
|
205 |
+
$wpvivid_plugin->ajax_check_security();
|
206 |
+
$ret = $this->public_intetface->delete_backup_array($_POST['backup_id']);
|
207 |
+
return $ret;
|
208 |
+
}
|
209 |
+
|
210 |
+
public function set_security_lock()
|
211 |
+
{
|
212 |
+
global $wpvivid_plugin;
|
213 |
+
$wpvivid_plugin->ajax_check_security();
|
214 |
+
$ret = $this->public_intetface->set_security_lock($_POST['backup_id'], $_POST['lock']);
|
215 |
+
return $ret;
|
216 |
+
}
|
217 |
+
|
218 |
+
public function view_log()
|
219 |
+
{
|
220 |
+
global $wpvivid_plugin;
|
221 |
+
$wpvivid_plugin->ajax_check_security();
|
222 |
+
$ret = $this->public_intetface->view_log($_POST['id']);
|
223 |
+
return $ret;
|
224 |
+
}
|
225 |
+
|
226 |
+
public function read_last_backup_log()
|
227 |
+
{
|
228 |
+
global $wpvivid_plugin;
|
229 |
+
$wpvivid_plugin->ajax_check_security();
|
230 |
+
$ret = $this->public_intetface->read_last_backup_log($_POST['log_file_name']);
|
231 |
+
return $ret;
|
232 |
+
}
|
233 |
+
|
234 |
+
public function view_backup_task_log()
|
235 |
+
{
|
236 |
+
global $wpvivid_plugin;
|
237 |
+
$wpvivid_plugin->ajax_check_security();
|
238 |
+
$ret = $this->public_intetface->view_backup_task_log($_POST['id']);
|
239 |
+
return $ret;
|
240 |
+
}
|
241 |
+
|
242 |
+
public function backup_cancel()
|
243 |
+
{
|
244 |
+
global $wpvivid_plugin;
|
245 |
+
$wpvivid_plugin->ajax_check_security();
|
246 |
+
$ret = $this->public_intetface->backup_cancel($_POST['task_id']);
|
247 |
+
return $ret;
|
248 |
+
}
|
249 |
+
|
250 |
+
public function init_download_page()
|
251 |
+
{
|
252 |
+
global $wpvivid_plugin;
|
253 |
+
$wpvivid_plugin->ajax_check_security();
|
254 |
+
$ret = $this->public_intetface->init_download_page($_POST['backup_id']);
|
255 |
+
return $ret;
|
256 |
+
}
|
257 |
+
|
258 |
+
public function prepare_download_backup()
|
259 |
+
{
|
260 |
+
global $wpvivid_plugin;
|
261 |
+
$wpvivid_plugin->ajax_check_security();
|
262 |
+
$ret = $this->public_intetface->prepare_download_backup($_POST['backup_id'], $_POST['file_name']);
|
263 |
+
return $ret;
|
264 |
+
}
|
265 |
+
|
266 |
+
public function get_download_task()
|
267 |
+
{
|
268 |
+
global $wpvivid_plugin;
|
269 |
+
$wpvivid_plugin->ajax_check_security();
|
270 |
+
$ret = $this->public_intetface->get_download_task($_POST['backup_id']);
|
271 |
+
return $ret;
|
272 |
+
}
|
273 |
+
|
274 |
+
public function download_backup()
|
275 |
+
{
|
276 |
+
global $wpvivid_plugin;
|
277 |
+
$wpvivid_plugin->ajax_check_security();
|
278 |
+
$ret = $this->public_intetface->download_backup($_POST['backup_id'], $_POST['file_name']);
|
279 |
+
return $ret;
|
280 |
+
}
|
281 |
+
|
282 |
+
public function set_general_setting()
|
283 |
+
{
|
284 |
+
global $wpvivid_plugin;
|
285 |
+
$wpvivid_plugin->ajax_check_security();
|
286 |
+
$ret = $this->public_intetface->set_general_setting($_POST['setting']);
|
287 |
+
return $ret;
|
288 |
+
}
|
289 |
+
|
290 |
+
public function set_schedule()
|
291 |
+
{
|
292 |
+
global $wpvivid_plugin;
|
293 |
+
$wpvivid_plugin->ajax_check_security();
|
294 |
+
$ret = $this->public_intetface->set_schedule($_POST['schedule']);
|
295 |
+
return $ret;
|
296 |
+
}
|
297 |
+
|
298 |
+
public function set_remote()
|
299 |
+
{
|
300 |
+
global $wpvivid_plugin;
|
301 |
+
$wpvivid_plugin->ajax_check_security();
|
302 |
+
$ret = $this->public_intetface->set_remote($_POST['remote']);
|
303 |
+
return $ret;
|
304 |
+
}
|
305 |
+
}
|
class/class-mainwp-child.php
CHANGED
@@ -115,7 +115,7 @@ if ( isset( $_GET['skeleton_keyuse_nonce_key'] ) && isset( $_GET['skeleton_keyus
|
|
115 |
}
|
116 |
|
117 |
class MainWP_Child {
|
118 |
-
public static $version = '
|
119 |
private $update_version = '1.5';
|
120 |
|
121 |
private $callableFunctions = array(
|
@@ -185,7 +185,8 @@ class MainWP_Child {
|
|
185 |
'disconnect' => 'disconnect',
|
186 |
'time_capsule' => 'time_capsule',
|
187 |
'extra_excution' => 'extra_execution', // deprecated
|
188 |
-
'extra_execution' => 'extra_execution'
|
|
|
189 |
);
|
190 |
|
191 |
private $FTP_ERROR = 'Failed! Please, add FTP details for automatic updates.';
|
@@ -304,7 +305,7 @@ class MainWP_Child {
|
|
304 |
'mainwp_child_nossl',
|
305 |
'mainwp_security',
|
306 |
'mainwp_backupwordpress_ext_enabled',
|
307 |
-
'mainwp_wprocket_ext_enabled',
|
308 |
//'mainwp_wordfence_ext_enabled',
|
309 |
'mainwp_branding_button_contact_label',
|
310 |
'mainwp_branding_extra_settings',
|
@@ -1086,40 +1087,44 @@ class MainWP_Child {
|
|
1086 |
return;
|
1087 |
}
|
1088 |
|
1089 |
-
if ( 'hidden' === ( get_option( 'mainwp_child_pluginDir' ) ) && ( $hard || 'yes' !== ( get_option( 'mainwp_child_htaccess_set' ) ) ) ) {
|
1090 |
-
include_once( ABSPATH . '/wp-admin/includes/misc.php' );
|
1091 |
-
|
1092 |
-
$snPluginDir = basename( $this->plugin_dir );
|
1093 |
-
|
1094 |
-
$rules = null;
|
1095 |
-
if ( ( '1' !== get_option( 'heatMapsIndividualOverrideSetting' ) && '0' !== get_option( 'heatMapEnabled' ) ) ||
|
1096 |
-
( '1' === get_option( 'heatMapsIndividualOverrideSetting' ) && '1' !== get_option( 'heatMapsIndividualDisable' ) ) ||
|
1097 |
-
get_option( 'mainwp_kwl_enable_statistic' )
|
1098 |
-
) {
|
1099 |
-
//Heatmap enabled
|
1100 |
-
//Make the plugin invisible, except heatmap
|
1101 |
-
$rules = $this->mod_rewrite_rules( array( 'wp-content/plugins/' . $snPluginDir . '/([^js\/]*)$' => 'wp-content/plugins/THIS_PLUGIN_DOES_NOT_EXIST' ) );
|
1102 |
-
} else {
|
1103 |
-
//Make the plugin invisible
|
1104 |
-
$rules = $this->mod_rewrite_rules( array( 'wp-content/plugins/' . $snPluginDir . '/(.*)$' => 'wp-content/plugins/THIS_PLUGIN_DOES_NOT_EXIST' ) );
|
1105 |
-
}
|
1106 |
-
|
1107 |
-
$home_path = ABSPATH;
|
1108 |
-
$htaccess_file = $home_path . '.htaccess';
|
1109 |
-
if ( function_exists( 'save_mod_rewrite_rules' ) ) {
|
1110 |
-
$rules = explode( "\n", $rules );
|
1111 |
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1119 |
|
1120 |
-
|
1121 |
-
MainWP_Helper::update_option( 'mainwp_child_htaccess_set', 'yes', 'yes' );
|
1122 |
-
} else if ( $hard ) {
|
1123 |
include_once( ABSPATH . '/wp-admin/includes/misc.php' );
|
1124 |
|
1125 |
$home_path = ABSPATH;
|
@@ -1566,7 +1571,7 @@ class MainWP_Child {
|
|
1566 |
MainWP_Client_Report::Instance()->creport_init();
|
1567 |
MainWP_Child_Pagespeed::Instance()->init();
|
1568 |
MainWP_Child_Links_Checker::Instance()->init();
|
1569 |
-
|
1570 |
global $_wp_submenu_nopriv;
|
1571 |
if ($_wp_submenu_nopriv === null)
|
1572 |
$_wp_submenu_nopriv = array(); // fix warning
|
@@ -1589,11 +1594,11 @@ class MainWP_Child {
|
|
1589 |
MainWP_Helper::error( __( 'Required version has not been detected. Please, make sure that you are using the latest version of the MainWP Child plugin on your site.', 'mainwp-child' ) );
|
1590 |
}
|
1591 |
|
1592 |
-
|
1593 |
if ( 1 === (int) get_option( 'mainwpKeywordLinks' ) ) {
|
1594 |
new MainWP_Keyword_Links();
|
1595 |
if ( ! is_admin() ) {
|
1596 |
-
|
1597 |
}
|
1598 |
MainWP_Keyword_Links::Instance()->update_htaccess(); // if needed
|
1599 |
MainWP_Keyword_Links::Instance()->redirect_cloak();
|
@@ -1987,7 +1992,8 @@ class MainWP_Child {
|
|
1987 |
}
|
1988 |
}
|
1989 |
} else {
|
1990 |
-
MainWP_Helper::error( __( 'Invalid request!', 'mainwp-child' ) );
|
|
|
1991 |
}
|
1992 |
|
1993 |
$information['sync'] = $this->getSiteStats( array(), false );
|
@@ -3692,6 +3698,7 @@ class MainWP_Child {
|
|
3692 |
|
3693 |
$information['site_info'] = array(
|
3694 |
'wpversion' => $wp_version,
|
|
|
3695 |
'phpversion' => phpversion(),
|
3696 |
'child_version' => self::$version,
|
3697 |
'memory_limit' => MainWP_Child_Server_Information::getPHPMemoryLimit(),
|
@@ -3920,14 +3927,30 @@ class MainWP_Child {
|
|
3920 |
}
|
3921 |
|
3922 |
$information['recent_comments'] = $this->get_recent_comments( array( 'approve', 'hold' ), 5 );
|
3923 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3924 |
$information['recent_pages'] = $this->get_recent_posts( array(
|
3925 |
'publish',
|
3926 |
'draft',
|
3927 |
'pending',
|
3928 |
'trash',
|
3929 |
'future'
|
3930 |
-
),
|
3931 |
|
3932 |
$securityIssuess = 0;
|
3933 |
if ( ! MainWP_Security::prevent_listing_ok() ) {
|
@@ -5708,6 +5731,11 @@ class MainWP_Child {
|
|
5708 |
MainWP_Child_Updraft_Plus_Backups::Instance()->action();
|
5709 |
}
|
5710 |
|
|
|
|
|
|
|
|
|
|
|
5711 |
function backup_wp() {
|
5712 |
if ( ! version_compare( phpversion(), '5.3', '>=' ) ) {
|
5713 |
$error = sprintf( __( 'PHP Version %s is unsupported.', 'mainwp-child' ), phpversion() );
|
115 |
}
|
116 |
|
117 |
class MainWP_Child {
|
118 |
+
public static $version = '4.0';
|
119 |
private $update_version = '1.5';
|
120 |
|
121 |
private $callableFunctions = array(
|
185 |
'disconnect' => 'disconnect',
|
186 |
'time_capsule' => 'time_capsule',
|
187 |
'extra_excution' => 'extra_execution', // deprecated
|
188 |
+
'extra_execution' => 'extra_execution',
|
189 |
+
'wpvivid_backuprestore'=>'wpvivid_backuprestore'
|
190 |
);
|
191 |
|
192 |
private $FTP_ERROR = 'Failed! Please, add FTP details for automatic updates.';
|
305 |
'mainwp_child_nossl',
|
306 |
'mainwp_security',
|
307 |
'mainwp_backupwordpress_ext_enabled',
|
308 |
+
// 'mainwp_wprocket_ext_enabled',
|
309 |
//'mainwp_wordfence_ext_enabled',
|
310 |
'mainwp_branding_button_contact_label',
|
311 |
'mainwp_branding_extra_settings',
|
1087 |
return;
|
1088 |
}
|
1089 |
|
1090 |
+
// if ( 'hidden' === ( get_option( 'mainwp_child_pluginDir' ) ) && ( $hard || 'yes' !== ( get_option( 'mainwp_child_htaccess_set' ) ) ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1091 |
|
1092 |
+
// include_once( ABSPATH . '/wp-admin/includes/misc.php' );
|
1093 |
+
//
|
1094 |
+
// $snPluginDir = basename( $this->plugin_dir );
|
1095 |
+
//
|
1096 |
+
// $rules = null;
|
1097 |
+
// if ( ( '1' !== get_option( 'heatMapsIndividualOverrideSetting' ) && '0' !== get_option( 'heatMapEnabled' ) ) ||
|
1098 |
+
// ( '1' === get_option( 'heatMapsIndividualOverrideSetting' ) && '1' !== get_option( 'heatMapsIndividualDisable' ) ) ||
|
1099 |
+
// get_option( 'mainwp_kwl_enable_statistic' )
|
1100 |
+
// ) {
|
1101 |
+
// //Heatmap enabled
|
1102 |
+
// //Make the plugin invisible, except heatmap
|
1103 |
+
// $rules = $this->mod_rewrite_rules( array( 'wp-content/plugins/' . $snPluginDir . '/([^js\/]*)$' => 'wp-content/plugins/THIS_PLUGIN_DOES_NOT_EXIST' ) );
|
1104 |
+
// } else {
|
1105 |
+
// //Make the plugin invisible
|
1106 |
+
// $rules = $this->mod_rewrite_rules( array( 'wp-content/plugins/' . $snPluginDir . '/(.*)$' => 'wp-content/plugins/THIS_PLUGIN_DOES_NOT_EXIST' ) );
|
1107 |
+
// }
|
1108 |
+
//
|
1109 |
+
// $home_path = ABSPATH;
|
1110 |
+
// $htaccess_file = $home_path . '.htaccess';
|
1111 |
+
// if ( function_exists( 'save_mod_rewrite_rules' ) ) {
|
1112 |
+
// $rules = explode( "\n", $rules );
|
1113 |
+
//
|
1114 |
+
// // $ch = @fopen($htaccess_file,'w');
|
1115 |
+
// // if (@flock($ch, LOCK_EX))
|
1116 |
+
// // {
|
1117 |
+
// insert_with_markers( $htaccess_file, 'MainWP', $rules );
|
1118 |
+
// // }
|
1119 |
+
// // @flock($ch, LOCK_UN);
|
1120 |
+
// // @fclose($ch);
|
1121 |
+
//
|
1122 |
+
// }
|
1123 |
+
// MainWP_Helper::update_option( 'mainwp_child_htaccess_set', 'yes', 'yes' );
|
1124 |
+
//
|
1125 |
+
// } else
|
1126 |
|
1127 |
+
if ( $hard ) {
|
|
|
|
|
1128 |
include_once( ABSPATH . '/wp-admin/includes/misc.php' );
|
1129 |
|
1130 |
$home_path = ABSPATH;
|
1571 |
MainWP_Client_Report::Instance()->creport_init();
|
1572 |
MainWP_Child_Pagespeed::Instance()->init();
|
1573 |
MainWP_Child_Links_Checker::Instance()->init();
|
1574 |
+
MainWP_Child_WPvivid_BackupRestore::Instance()->init();
|
1575 |
global $_wp_submenu_nopriv;
|
1576 |
if ($_wp_submenu_nopriv === null)
|
1577 |
$_wp_submenu_nopriv = array(); // fix warning
|
1594 |
MainWP_Helper::error( __( 'Required version has not been detected. Please, make sure that you are using the latest version of the MainWP Child plugin on your site.', 'mainwp-child' ) );
|
1595 |
}
|
1596 |
|
1597 |
+
|
1598 |
if ( 1 === (int) get_option( 'mainwpKeywordLinks' ) ) {
|
1599 |
new MainWP_Keyword_Links();
|
1600 |
if ( ! is_admin() ) {
|
1601 |
+
add_filter( 'the_content', array( MainWP_Keyword_Links::Instance(), 'filter_content' ), 100 );
|
1602 |
}
|
1603 |
MainWP_Keyword_Links::Instance()->update_htaccess(); // if needed
|
1604 |
MainWP_Keyword_Links::Instance()->redirect_cloak();
|
1992 |
}
|
1993 |
}
|
1994 |
} else {
|
1995 |
+
//MainWP_Helper::error( __( 'Invalid request!', 'mainwp-child' ) );
|
1996 |
+
$information['upgrades'] = array(); // to fix error message when translations updated
|
1997 |
}
|
1998 |
|
1999 |
$information['sync'] = $this->getSiteStats( array(), false );
|
3698 |
|
3699 |
$information['site_info'] = array(
|
3700 |
'wpversion' => $wp_version,
|
3701 |
+
'debug_mode' => (defined('WP_DEBUG') && true === WP_DEBUG) ? true : false,
|
3702 |
'phpversion' => phpversion(),
|
3703 |
'child_version' => self::$version,
|
3704 |
'memory_limit' => MainWP_Child_Server_Information::getPHPMemoryLimit(),
|
3927 |
}
|
3928 |
|
3929 |
$information['recent_comments'] = $this->get_recent_comments( array( 'approve', 'hold' ), 5 );
|
3930 |
+
|
3931 |
+
$recent_number = 5;
|
3932 |
+
|
3933 |
+
if (isset($_POST) && isset( $_POST['recent_number'] )) {
|
3934 |
+
$recent_number = $_POST['recent_number'];
|
3935 |
+
if ($recent_number != get_option('mainwp_child_recent_number', 5)) {
|
3936 |
+
update_option( 'mainwp_child_recent_number', $recent_number );
|
3937 |
+
}
|
3938 |
+
} else {
|
3939 |
+
$recent_number = get_option('mainwp_child_recent_number', 5);
|
3940 |
+
}
|
3941 |
+
|
3942 |
+
if ($recent_number <= 0 || $recent_number > 30) {
|
3943 |
+
$recent_number = 5;
|
3944 |
+
}
|
3945 |
+
|
3946 |
+
$information['recent_posts'] = $this->get_recent_posts( array( 'publish', 'draft', 'pending', 'trash', 'future' ), $recent_number );
|
3947 |
$information['recent_pages'] = $this->get_recent_posts( array(
|
3948 |
'publish',
|
3949 |
'draft',
|
3950 |
'pending',
|
3951 |
'trash',
|
3952 |
'future'
|
3953 |
+
), $recent_number, 'page' );
|
3954 |
|
3955 |
$securityIssuess = 0;
|
3956 |
if ( ! MainWP_Security::prevent_listing_ok() ) {
|
5731 |
MainWP_Child_Updraft_Plus_Backups::Instance()->action();
|
5732 |
}
|
5733 |
|
5734 |
+
function wpvivid_backuprestore()
|
5735 |
+
{
|
5736 |
+
MainWP_Child_WPvivid_BackupRestore::Instance()->action();
|
5737 |
+
}
|
5738 |
+
|
5739 |
function backup_wp() {
|
5740 |
if ( ! version_compare( phpversion(), '5.3', '>=' ) ) {
|
5741 |
$error = sprintf( __( 'PHP Version %s is unsupported.', 'mainwp-child' ), phpversion() );
|
class/class-mainwp-client-report.php
CHANGED
@@ -186,7 +186,7 @@ class MainWP_Client_Report {
|
|
186 |
$exclude_connector_posts = true;
|
187 |
if ( isset( $sections['body'] ) && isset( $sections['body']['section_token'] ) && is_array($sections['body']['section_token']) ) {
|
188 |
foreach ($sections['body']['section_token'] as $sec) {
|
189 |
-
if (strpos($sec, "[section.posts") !== false) {
|
190 |
$exclude_connector_posts = false;
|
191 |
break;
|
192 |
}
|
@@ -195,7 +195,7 @@ class MainWP_Client_Report {
|
|
195 |
if ($exclude_connector_posts) {
|
196 |
if ( isset( $sections['header'] ) && isset( $sections['header']['section_token'] ) && is_array($sections['header']['section_token']) ) {
|
197 |
foreach ($sections['header']['section_token'] as $sec) {
|
198 |
-
if (strpos($sec, "[section.posts") !== false) {
|
199 |
$exclude_connector_posts = false;
|
200 |
break;
|
201 |
}
|
@@ -205,7 +205,7 @@ class MainWP_Client_Report {
|
|
205 |
if ($exclude_connector_posts) {
|
206 |
if ( isset( $sections['footer'] ) && isset( $sections['footer']['section_token'] ) && is_array($sections['footer']['section_token']) ) {
|
207 |
foreach ($sections['footer']['section_token'] as $sec) {
|
208 |
-
if (strpos($sec, "[section.posts") !== false) {
|
209 |
$exclude_connector_posts = false;
|
210 |
break;
|
211 |
}
|
@@ -215,7 +215,7 @@ class MainWP_Client_Report {
|
|
215 |
if ($exclude_connector_posts) {
|
216 |
if ( isset( $other_tokens['body'] ) && is_array( $other_tokens['body'] ) ) {
|
217 |
foreach ( $other_tokens['body'] as $sec ) {
|
218 |
-
if ( strpos( $sec, "[post." ) !== false ) {
|
219 |
$exclude_connector_posts = false;
|
220 |
break;
|
221 |
}
|
@@ -225,7 +225,7 @@ class MainWP_Client_Report {
|
|
225 |
if ($exclude_connector_posts) {
|
226 |
if ( isset( $other_tokens['header'] ) && is_array($other_tokens['header']) ) {
|
227 |
foreach ($other_tokens['header'] as $sec) {
|
228 |
-
if (strpos($sec, "[post.") !== false) {
|
229 |
$exclude_connector_posts = false;
|
230 |
break;
|
231 |
}
|
@@ -235,7 +235,7 @@ class MainWP_Client_Report {
|
|
235 |
if ($exclude_connector_posts) {
|
236 |
if ( isset( $other_tokens['footer'] ) && is_array($other_tokens['footer']) ) {
|
237 |
foreach ($other_tokens['footer'] as $sec) {
|
238 |
-
if (strpos($sec, "[post.") !== false) {
|
239 |
$exclude_connector_posts = false;
|
240 |
break;
|
241 |
}
|
@@ -354,6 +354,7 @@ class MainWP_Client_Report {
|
|
354 |
$tokens = array();
|
355 |
}
|
356 |
|
|
|
357 |
foreach ( $tokens as $token ) {
|
358 |
$str_tmp = str_replace( array( '[', ']' ), '', $token );
|
359 |
$array_tmp = explode( '.', $str_tmp );
|
@@ -386,6 +387,17 @@ class MainWP_Client_Report {
|
|
386 |
if ( $record->context !== 'mainwp_backups' && $record->context !== 'backwpup_backups' && $record->context !== 'updraftplus_backups' && $record->context !== 'backupwordpress_backups' && $record->context !== 'backupbuddy_backups' && $record->context !== 'wptimecapsule_backups') {
|
387 |
continue;
|
388 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
} else if ( 'mainwp_sucuri' === $context ) {
|
390 |
if ( $record->context !== 'mainwp_sucuri' ) {
|
391 |
continue;
|
@@ -454,7 +466,6 @@ class MainWP_Client_Report {
|
|
454 |
}
|
455 |
}
|
456 |
|
457 |
-
|
458 |
}
|
459 |
|
460 |
$count ++;
|
186 |
$exclude_connector_posts = true;
|
187 |
if ( isset( $sections['body'] ) && isset( $sections['body']['section_token'] ) && is_array($sections['body']['section_token']) ) {
|
188 |
foreach ($sections['body']['section_token'] as $sec) {
|
189 |
+
if (strpos($sec, "[section.posts") !== false || strpos($sec, "[section.pages") !== false) {
|
190 |
$exclude_connector_posts = false;
|
191 |
break;
|
192 |
}
|
195 |
if ($exclude_connector_posts) {
|
196 |
if ( isset( $sections['header'] ) && isset( $sections['header']['section_token'] ) && is_array($sections['header']['section_token']) ) {
|
197 |
foreach ($sections['header']['section_token'] as $sec) {
|
198 |
+
if (strpos($sec, "[section.posts") !== false || strpos($sec, "[section.pages") !== false) {
|
199 |
$exclude_connector_posts = false;
|
200 |
break;
|
201 |
}
|
205 |
if ($exclude_connector_posts) {
|
206 |
if ( isset( $sections['footer'] ) && isset( $sections['footer']['section_token'] ) && is_array($sections['footer']['section_token']) ) {
|
207 |
foreach ($sections['footer']['section_token'] as $sec) {
|
208 |
+
if (strpos($sec, "[section.posts") !== false || strpos($sec, "[section.pages") !== false) {
|
209 |
$exclude_connector_posts = false;
|
210 |
break;
|
211 |
}
|
215 |
if ($exclude_connector_posts) {
|
216 |
if ( isset( $other_tokens['body'] ) && is_array( $other_tokens['body'] ) ) {
|
217 |
foreach ( $other_tokens['body'] as $sec ) {
|
218 |
+
if ( strpos( $sec, "[post." ) !== false || strpos($sec, "[page.") !== false) {
|
219 |
$exclude_connector_posts = false;
|
220 |
break;
|
221 |
}
|
225 |
if ($exclude_connector_posts) {
|
226 |
if ( isset( $other_tokens['header'] ) && is_array($other_tokens['header']) ) {
|
227 |
foreach ($other_tokens['header'] as $sec) {
|
228 |
+
if (strpos($sec, "[post.") !== false || strpos($sec, "[page.") !== false) {
|
229 |
$exclude_connector_posts = false;
|
230 |
break;
|
231 |
}
|
235 |
if ($exclude_connector_posts) {
|
236 |
if ( isset( $other_tokens['footer'] ) && is_array($other_tokens['footer']) ) {
|
237 |
foreach ($other_tokens['footer'] as $sec) {
|
238 |
+
if (strpos($sec, "[post.") !== false || strpos($sec, "[page.") !== false) {
|
239 |
$exclude_connector_posts = false;
|
240 |
break;
|
241 |
}
|
354 |
$tokens = array();
|
355 |
}
|
356 |
|
357 |
+
$backups_created_time_to_fix = array();
|
358 |
foreach ( $tokens as $token ) {
|
359 |
$str_tmp = str_replace( array( '[', ']' ), '', $token );
|
360 |
$array_tmp = explode( '.', $str_tmp );
|
387 |
if ( $record->context !== 'mainwp_backups' && $record->context !== 'backwpup_backups' && $record->context !== 'updraftplus_backups' && $record->context !== 'backupwordpress_backups' && $record->context !== 'backupbuddy_backups' && $record->context !== 'wptimecapsule_backups') {
|
388 |
continue;
|
389 |
}
|
390 |
+
|
391 |
+
$created = strtotime( $record->created );
|
392 |
+
if ( in_array( $created, $backups_created_time_to_fix ) ) {
|
393 |
+
if ( !in_array($record->ID, $skip_records) ) {
|
394 |
+
$skip_records[] = $record->ID;
|
395 |
+
}
|
396 |
+
continue;
|
397 |
+
} else {
|
398 |
+
$backups_created_time_to_fix[] = $created;
|
399 |
+
}
|
400 |
+
|
401 |
} else if ( 'mainwp_sucuri' === $context ) {
|
402 |
if ( $record->context !== 'mainwp_sucuri' ) {
|
403 |
continue;
|
466 |
}
|
467 |
}
|
468 |
|
|
|
469 |
}
|
470 |
|
471 |
$count ++;
|
class/class-mainwp-helper.php
CHANGED
@@ -297,7 +297,7 @@ class MainWP_Helper {
|
|
297 |
);
|
298 |
|
299 |
$wprocket_activated = false;
|
300 |
-
if ( MainWP_Child_WP_Rocket::isActivated() ) {
|
301 |
if ( function_exists( 'get_rocket_option' ) ) {
|
302 |
$wprocket_activated = true;
|
303 |
foreach ( $wprocket_fields as $field ) {
|
@@ -576,6 +576,9 @@ class MainWP_Helper {
|
|
576 |
'_categories',
|
577 |
'_edit_last',
|
578 |
'_sticky',
|
|
|
|
|
|
|
579 |
);
|
580 |
$not_allowed[] = '_mainwp_boilerplate_sites_posts';
|
581 |
$not_allowed[] = '_ezine_post_keyword';
|
297 |
);
|
298 |
|
299 |
$wprocket_activated = false;
|
300 |
+
if ( MainWP_Child_WP_Rocket::Instance()->isActivated() ) {
|
301 |
if ( function_exists( 'get_rocket_option' ) ) {
|
302 |
$wprocket_activated = true;
|
303 |
foreach ( $wprocket_fields as $field ) {
|
576 |
'_categories',
|
577 |
'_edit_last',
|
578 |
'_sticky',
|
579 |
+
'_mainwp_post_dripper',
|
580 |
+
'_bulkpost_do_not_del',
|
581 |
+
'_mainwp_spin_me'
|
582 |
);
|
583 |
$not_allowed[] = '_mainwp_boilerplate_sites_posts';
|
584 |
$not_allowed[] = '_ezine_post_keyword';
|
mainwp-child.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
Author: MainWP
|
7 |
Author URI: https://mainwp.com
|
8 |
Text Domain: mainwp-child
|
9 |
-
Version:
|
10 |
*/
|
11 |
//if ( ( isset( $_REQUEST['heatmap'] ) && '1' === $_REQUEST['heatmap'] ) || ( isset( $_REQUEST['mainwpsignature'] ) && ( ! empty( $_REQUEST['mainwpsignature'] ) ) ) ) {
|
12 |
// header( 'X-Frame-Options: ALLOWALL' );
|
6 |
Author: MainWP
|
7 |
Author URI: https://mainwp.com
|
8 |
Text Domain: mainwp-child
|
9 |
+
Version: 4.0
|
10 |
*/
|
11 |
//if ( ( isset( $_REQUEST['heatmap'] ) && '1' === $_REQUEST['heatmap'] ) || ( isset( $_REQUEST['mainwpsignature'] ) && ( ! empty( $_REQUEST['mainwpsignature'] ) ) ) ) {
|
12 |
// header( 'X-Frame-Options: ALLOWALL' );
|
readme.txt
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
=== MainWP Child ===
|
2 |
Contributors: mainwp
|
3 |
-
Donate link:
|
4 |
Tags: WordPress management, management, manager, manage, WordPress controller, network, MainWP, updates, admin, administration, multiple, multisite, plugin updates, theme updates, login, remote, backups
|
5 |
Author: mainwp
|
6 |
Author URI: https://mainwp.com
|
7 |
Plugin URI: https://mainwp.com
|
8 |
Requires at least: 3.6
|
9 |
-
Tested up to: 5.2
|
10 |
-
|
|
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
@@ -71,6 +71,14 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
|
|
71 |
|
72 |
== Changelog ==
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
= 3.5.7 - 5-6-19 =
|
75 |
* Fixed: multiple PHP Warnings
|
76 |
* Fixed: multiple conflicts with 3rd party products
|
@@ -828,3 +836,8 @@ Fixed cloning issue with custom prefix
|
|
828 |
|
829 |
= 0.1 =
|
830 |
* Initial version
|
|
|
|
|
|
|
|
|
|
1 |
=== MainWP Child ===
|
2 |
Contributors: mainwp
|
|
|
3 |
Tags: WordPress management, management, manager, manage, WordPress controller, network, MainWP, updates, admin, administration, multiple, multisite, plugin updates, theme updates, login, remote, backups
|
4 |
Author: mainwp
|
5 |
Author URI: https://mainwp.com
|
6 |
Plugin URI: https://mainwp.com
|
7 |
Requires at least: 3.6
|
8 |
+
Tested up to: 5.2.2
|
9 |
+
Requires PHP: 5.6
|
10 |
+
Stable tag: 4.0
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
71 |
|
72 |
== Changelog ==
|
73 |
|
74 |
+
= 4.0 - 8-28-19 =
|
75 |
+
* Fixed: various functionality problems
|
76 |
+
* Added: support for upcoming 3rd party extensions
|
77 |
+
* Added: .htaccess file with custom redirect to rule the MainWP Child plugin directory to hide the plugin from search engines
|
78 |
+
* Updated: support for the MainWP Dashboard 4.0
|
79 |
+
* Updated: notifications texts
|
80 |
+
* Removed: unused code
|
81 |
+
|
82 |
= 3.5.7 - 5-6-19 =
|
83 |
* Fixed: multiple PHP Warnings
|
84 |
* Fixed: multiple conflicts with 3rd party products
|
836 |
|
837 |
= 0.1 =
|
838 |
* Initial version
|
839 |
+
|
840 |
+
== Upgrade Notice ==
|
841 |
+
|
842 |
+
= 4.0 =
|
843 |
+
This is a major upgrade please check the [MainWP Upgrade FAQ](https://mainwp.com/help/docs/faq-on-upgrading-from-mainwp-version-3-to-mainwp-version-4/)
|