mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-08-30 02:32:07 +08:00
* Fixed: various functionality problems
* Added: support for ucoming 3rd party extensions * Added: .htaccess file with custom redirect to rule the MainWP Child plugin directory to hide the plugin from serach engines * Updated: support for the MainWP Dashboard 4.0 * Updated: notifications texts * Removed: unused code
This commit is contained in:
parent
c3795a16a0
commit
095253a517
12 changed files with 711 additions and 241 deletions
7
.htaccess
Normal file
7
.htaccess
Normal file
|
@ -0,0 +1,7 @@
|
|||
# BEGIN MainWP
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteBase /
|
||||
RewriteRule ^(.*)$ \./THIS_PLUGIN_DOES_NOT_EXIST [QSA,L]
|
||||
</IfModule>
|
||||
# END MainWP
|
|
@ -443,7 +443,7 @@ class MainWP_Child_Branding {
|
|||
add_filter( 'gettext', array( &$this, 'custom_gettext' ), 99, 3 );
|
||||
add_action( 'login_head', array( &$this, 'custom_login_logo' ) );
|
||||
add_filter( 'login_headerurl', array( &$this, 'custom_login_headerurl' ) );
|
||||
add_filter( 'login_headertitle', array( &$this, 'custom_login_headertitle' ) );
|
||||
add_filter( 'login_headertext', array( &$this, 'custom_login_headertitle' ) );
|
||||
add_action( 'wp_head', array( &$this, 'custom_favicon_frontend' ) );
|
||||
if ( isset( $extra_setting['dashboard_footer'] ) && ! empty( $extra_setting['dashboard_footer'] ) ) {
|
||||
//remove_filter( 'update_footer', 'core_update_footer' );
|
||||
|
|
|
@ -162,6 +162,8 @@ class MainWP_Child_Pagespeed {
|
|||
return array( 'result' => 'RUNNING' );
|
||||
}
|
||||
|
||||
$information = array();
|
||||
|
||||
$settings = $_POST['settings'];
|
||||
$settings = maybe_unserialize( base64_decode( $settings ) );
|
||||
|
||||
|
@ -236,17 +238,17 @@ class MainWP_Child_Pagespeed {
|
|||
|
||||
$result = $this->get_sync_data( $strategy );
|
||||
|
||||
if ( isset( $_POST['doaction'] ) && ( 'check_new_pages' === $_POST['doaction'] || 'recheck_all_pages' === $_POST['doaction'] ) ) {
|
||||
if ( 'recheck_all_pages' === $_POST['doaction'] ) {
|
||||
$recheck = true;
|
||||
} else {
|
||||
$recheck = false;
|
||||
}
|
||||
|
||||
|
||||
if ($this->do_check_pages($recheck))
|
||||
$information['checked_pages'] = 1;
|
||||
}
|
||||
// if ( isset( $_POST['doaction'] ) && ( 'check_new_pages' === $_POST['doaction'] || 'recheck_all_pages' === $_POST['doaction'] ) ) {
|
||||
// if ( 'recheck_all_pages' === $_POST['doaction'] ) {
|
||||
// $recheck = true;
|
||||
// } else {
|
||||
// $recheck = false;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if ($this->do_check_pages($recheck))
|
||||
// $information['checked_pages'] = 1;
|
||||
// }
|
||||
$information['data'] = $result['data'];
|
||||
return $information;
|
||||
}
|
||||
|
|
|
@ -1075,6 +1075,7 @@ function get_sibling_files_callback_wptc() {
|
|||
$saved = true;
|
||||
|
||||
} else if ( $tabName == 'staging_opts' ) {
|
||||
$config->set_option('user_excluded_extenstions_staging', $data['user_excluded_extenstions_staging']);
|
||||
$config->set_option('internal_staging_db_rows_copy_limit', $data['internal_staging_db_rows_copy_limit']);
|
||||
$config->set_option('internal_staging_file_copy_limit', $data['internal_staging_file_copy_limit']);
|
||||
$config->set_option('internal_staging_deep_link_limit', $data['internal_staging_deep_link_limit']);
|
||||
|
|
|
@ -1191,17 +1191,25 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
$current_timegmt = time();
|
||||
$current_time = get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $current_timegmt ), 'D, F j, Y H:i' );
|
||||
|
||||
$html = '<table style="border: 0px; padding: 0px; margin: 0 10px 0 0;">
|
||||
<tr>
|
||||
<td style="width: 124px; vertical-align:top; margin: 0px; padding: 0px;">' . __( 'Files', 'updraftplus' ) . ': </td><td style="color:blue; margin: 0px; padding: 0px;">' . $next_scheduled_backup . '</td>
|
||||
</tr><tr>
|
||||
<td style="width: 124px; vertical-align:top; margin: 0px; padding: 0px;">' . __( 'Database', 'updraftplus' ) . ': </td><td style="color:blue; margin: 0px; padding: 0px;">' . $next_scheduled_backup_database . '</td>
|
||||
</tr><tr>
|
||||
<td style="width: 124px; vertical-align:top; margin: 0px; padding: 0px;">' . __( 'Time now', 'updraftplus' ) . ': </td><td style="color:blue; margin: 0px; padding: 0px;">' . $current_time . '</td>
|
||||
</table>';
|
||||
$html = '<table class="ui single line table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>' . __( 'Files', 'mainwp-updraftplus-extension' ) . '</th>
|
||||
<th>' . __( 'Database', 'mainwp-updraftplus-extension' ) . '</th>
|
||||
<th>' . __( 'Time now', 'mainwp-updraftplus-extension' ) . '</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>' . $next_scheduled_backup. '</td>
|
||||
<td>' . $next_scheduled_backup_database. '</td>
|
||||
<td>' . $current_time. '</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>';
|
||||
|
||||
MainWP_Helper::check_classes_exists( array( 'UpdraftPlus_Filesystem_Functions' ) ) ;
|
||||
MainWP_Helper::check_methods('UpdraftPlus_Filesystem_Functions', 'really_is_writable');
|
||||
MainWP_Helper::check_classes_exists( array( 'UpdraftPlus_Filesystem_Functions' ) ) ;
|
||||
MainWP_Helper::check_methods('UpdraftPlus_Filesystem_Functions', 'really_is_writable');
|
||||
|
||||
$updraft_dir = $updraftplus->backups_dir_location();
|
||||
$backup_disabled = (UpdraftPlus_Filesystem_Functions::really_is_writable($updraft_dir)) ? 0 : 1;
|
||||
|
@ -3077,7 +3085,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
}
|
||||
|
||||
if ( empty( $backup_history ) ) {
|
||||
return '<p><em>' . __( 'You have not yet made any backups.', 'updraftplus' ) . '</em></p>';
|
||||
return '<div class="ui yellow message">' . __( 'You have not yet made any backups.', 'updraftplus' ) . '</div>';
|
||||
}
|
||||
|
||||
MainWP_Helper::check_methods($updraftplus, array( 'backups_dir_location', 'get_backupable_file_entities' ));
|
||||
|
@ -3090,20 +3098,17 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
$accept = array();
|
||||
}
|
||||
|
||||
$ret = '<table style="margin-top: 20px; margin-left: 20px;">';
|
||||
$ret = '<table class="ui stackable single line table">';
|
||||
$nonce_field = wp_nonce_field( 'updraftplus_download', '_wpnonce', true, false );
|
||||
|
||||
$ret .= '<thead>
|
||||
<tr style="margin-bottom: 4px;">
|
||||
<th style="padding:0px 10px 6px; width: 172px;">' . __( 'Backup date', 'updraftplus' ) . '</th>
|
||||
<th style="padding:0px 16px 6px; width: 426px;">' . __( 'Backup data (click to download)', 'updraftplus' ) . '</th>
|
||||
<th style="padding:0px 0px 6px 1px; width: 272px;">' . __( 'Actions', 'updraftplus' ) . '</th>
|
||||
</tr>
|
||||
<tr style="height:2px; padding:1px; margin:0px;">
|
||||
<td colspan="4" style="margin:0; padding:0"><div style="height: 2px; background-color:#888888;"> </div></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
<tr>
|
||||
<th>' . __( 'Backup date', 'updraftplus' ) . '</th>
|
||||
<th>' . __( 'Backup data (click to download)', 'updraftplus' ) . '</th>
|
||||
<th>' . __( 'Actions', 'updraftplus' ) . '</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
|
||||
krsort( $backup_history );
|
||||
foreach ( $backup_history as $key => $backup ) {
|
||||
|
@ -3129,8 +3134,8 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
// }
|
||||
// $rawbackup .= '</p></pre>';
|
||||
|
||||
// to fix
|
||||
$rawbackup = '' ; //$updraftplus_admin->raw_backup_info($backup_history, $key, $non);
|
||||
// to fix
|
||||
$rawbackup = '' ; //$updraftplus_admin->raw_backup_info($backup_history, $key, $non);
|
||||
|
||||
$jobdata = $updraftplus->jobdata_getarray( $non );
|
||||
|
||||
|
@ -3138,11 +3143,27 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
|
||||
$date_label = $this->date_label( $pretty_date, $key, $backup, $jobdata, $non );
|
||||
|
||||
$service_title = '';
|
||||
if (!isset($backup['service'])) $backup['service'] = array();
|
||||
if (!is_array($backup['service'])) $backup['service'] = array($backup['service']);
|
||||
foreach ($backup['service'] as $service) {
|
||||
if ('none' === $service || '' === $service || (is_array($service) && (empty($service) || array('none') === $service || array('') === $service))) {
|
||||
// Do nothing
|
||||
} else {
|
||||
// $image_url = file_exists($image_folder.$service.'.png') ? $image_folder_url.$service.'.png' : $image_folder_url.'folder.png';
|
||||
|
||||
$remote_storage = ('remotesend' === $service) ? __('remote site', 'updraftplus') : $updraftplus->backup_methods[$service];
|
||||
|
||||
$service_title = '<br>' . esc_attr(sprintf(__('Remote storage: %s', 'updraftplus'), $remote_storage));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$ret .= <<<ENDHERE
|
||||
<tr id="updraft_existing_backups_row_$key">
|
||||
|
||||
<td style="max-width: 140px;" class="updraft_existingbackup_date" data-rawbackup="$rawbackup">
|
||||
$date_label
|
||||
<td class="updraft_existingbackup_date" data-rawbackup="$rawbackup">
|
||||
$date_label . $service_title
|
||||
</td>
|
||||
ENDHERE;
|
||||
|
||||
|
@ -3195,7 +3216,7 @@ ENDHERE;
|
|||
|
||||
$ret .= '</td>';
|
||||
|
||||
$ret .= '<td style="padding: 1px; margin:0px;">';
|
||||
$ret .= '<td>';
|
||||
$ret .= $this->restore_button( $backup, $key, $pretty_date, $entities );
|
||||
$ret .= $delete_button;
|
||||
if ( empty( $backup['meta_foreign'] ) ) {
|
||||
|
@ -3205,8 +3226,6 @@ ENDHERE;
|
|||
|
||||
$ret .= '</tr>';
|
||||
|
||||
$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>';
|
||||
|
||||
}
|
||||
|
||||
$ret .= '</tbody></table>';
|
||||
|
@ -3227,7 +3246,7 @@ ENDHERE;
|
|||
$show_data .= ' ' . __( '(backup set imported from remote storage)', 'updraftplus' );
|
||||
}
|
||||
# jQuery('#updraft_restore_label_wpcore').html('".esc_js($wpcore_restore_descrip)."');
|
||||
$ret .= '<button title="' . __( 'Go to Restore', 'updraftplus' ) . '" type="button" class="button-primary mwp-updraftplus-restore-btn" >' . __( 'Restore', 'updraftplus' ) . '</button>';
|
||||
$ret .= '<button title="' . __( 'Go to Restore', 'updraftplus' ) . '" type="button" class="ui green button mwp-updraftplus-restore-btn" >' . __( 'Restore', 'updraftplus' ) . '</button>';
|
||||
}
|
||||
$ret .= "</form></div>\n";
|
||||
|
||||
|
@ -3238,7 +3257,7 @@ ENDHERE;
|
|||
private function delete_button( $key, $nonce, $backup ) {
|
||||
$sval = ( ( isset( $backup['service'] ) && 'email' !== $backup['service'] && 'none' !== $backup['service'] ) ) ? '1' : '0';
|
||||
|
||||
return '<a style="float:left;margin-right:6px" class="mainwp-button-red button-primary button" href="#" onclick="event.preventDefault();' . "mainwp_updraft_delete('$key', '$nonce', $sval,this);" . '" title="' . esc_attr( __( 'Delete this backup set', 'updraftplus' ) ) . '">' . __( 'Delete', 'updraftplus' ) . '</a>';
|
||||
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>';
|
||||
}
|
||||
|
||||
private function date_label( $pretty_date, $key, $backup, $jobdata, $nonce ) {
|
||||
|
@ -3273,7 +3292,7 @@ ENDHERE;
|
|||
<input type="hidden" name="action" value="mainwp_updraft_download_backup" />
|
||||
<input type="hidden" name="type" value="$bkey" />
|
||||
<input type="hidden" name="timestamp" value="$key" />
|
||||
<input type="submit" class="mwp-updraft-backupentitybutton button" value="$dbt" />
|
||||
<input type="submit" class="mwp-updraft-backupentitybutton ui button" value="$dbt" />
|
||||
</form>
|
||||
</div>
|
||||
ENDHERE;
|
||||
|
@ -3390,7 +3409,7 @@ ENDHERE;
|
|||
<input type="hidden" name="type" value="$type" />
|
||||
<input type="hidden" name="timestamp" value="$key" />
|
||||
<input type="hidden" name="findex" value="$findex" />
|
||||
<input type="submit" class="mwp-updraft-backupentitybutton button" title="$ide" value="$pdescrip" />
|
||||
<input type="submit" class="mwp-updraft-backupentitybutton ui button" title="$ide" value="$pdescrip" />
|
||||
</form>
|
||||
</div>
|
||||
ENDHERE;
|
||||
|
@ -3412,7 +3431,7 @@ ENDHERE;
|
|||
<input type="hidden" name="action" value="downloadlog" />
|
||||
<input type="hidden" name="page" value="updraftplus" />
|
||||
<input type="hidden" name="updraftplus_backup_nonce" value="$nval" />
|
||||
<input type="submit" value="$lt" class="updraft-log-link button" onclick="event.preventDefault(); mainwp_updraft_popuplog('$nval', this);" />
|
||||
<input type="submit" value="$lt" class="updraft-log-link ui button" onclick="event.preventDefault(); mainwp_updraft_popuplog('$nval', this);" />
|
||||
</form>
|
||||
</div>
|
||||
ENDHERE;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
class MainWP_Child_WP_Rocket {
|
||||
public static $instance = null;
|
||||
public $is_plugin_installed = false;
|
||||
|
||||
public static function Instance() {
|
||||
if ( null === MainWP_Child_WP_Rocket::$instance ) {
|
||||
|
@ -27,13 +28,19 @@ class MainWP_Child_WP_Rocket {
|
|||
}
|
||||
|
||||
public function __construct() {
|
||||
|
||||
if ( is_plugin_active( 'wp-rocket/wp-rocket.php' ) ) {
|
||||
$this->is_plugin_installed = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function init() {
|
||||
if ( get_option( 'mainwp_wprocket_ext_enabled' ) !== 'Y' ) {
|
||||
return;
|
||||
}
|
||||
// if ( get_option( 'mainwp_wprocket_ext_enabled' ) !== 'Y' ) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
if ( ! $this->is_plugin_installed ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
|
||||
|
||||
|
@ -47,6 +54,86 @@ class MainWP_Child_WP_Rocket {
|
|||
}
|
||||
}
|
||||
|
||||
function get_rocket_default_options() {
|
||||
return array(
|
||||
'cache_mobile' => 1,
|
||||
'do_caching_mobile_files' => 0,
|
||||
'cache_logged_user' => 0,
|
||||
'cache_ssl' => 0,
|
||||
'emoji' => 0,
|
||||
'embeds' => 1,
|
||||
'control_heartbeat' => 0,
|
||||
'heartbeat_site_behavior' => 'reduce_periodicity',
|
||||
'heartbeat_admin_behavior' => 'reduce_periodicity',
|
||||
'heartbeat_editor_behavior' => 'reduce_periodicity',
|
||||
'varnish_auto_purge' => 0,
|
||||
'manual_preload' => 0,
|
||||
'automatic_preload' => 0,
|
||||
'sitemap_preload' => 0,
|
||||
'sitemap_preload_url_crawl' => 500000,
|
||||
'sitemaps' => array(),
|
||||
'database_revisions' => 0,
|
||||
'database_auto_drafts' => 0,
|
||||
'database_trashed_posts' => 0,
|
||||
'database_spam_comments' => 0,
|
||||
'database_trashed_comments' => 0,
|
||||
'database_expired_transients' => 0,
|
||||
'database_all_transients' => 0,
|
||||
'database_optimize_tables' => 0,
|
||||
'schedule_automatic_cleanup' => 0,
|
||||
'automatic_cleanup_frequency' => '',
|
||||
'cache_reject_uri' => array(),
|
||||
'cache_reject_cookies' => array(),
|
||||
'cache_reject_ua' => array(),
|
||||
'cache_query_strings' => array(),
|
||||
'cache_purge_pages' => array(),
|
||||
'purge_cron_interval' => 10,
|
||||
'purge_cron_unit' => 'HOUR_IN_SECONDS',
|
||||
'exclude_css' => array(),
|
||||
'exclude_js' => array(),
|
||||
'exclude_inline_js' => array(),
|
||||
'async_css' => 0,
|
||||
'defer_all_js' => 0,
|
||||
'defer_all_js_safe' => 1,
|
||||
'critical_css' => '',
|
||||
'deferred_js_files' => array(),
|
||||
'lazyload' => 0,
|
||||
'lazyload_iframes' => 0,
|
||||
'lazyload_youtube' =>0,
|
||||
'minify_css' => 0,
|
||||
// 'minify_css_key' => $minify_css_key,
|
||||
'minify_concatenate_css' => 0,
|
||||
//'minify_css_combine_all' => 0,
|
||||
'minify_css_legacy' => 0,
|
||||
'minify_js' => 0,
|
||||
// 'minify_js_key' => $minify_js_key,
|
||||
'minify_js_in_footer' => array(),
|
||||
'minify_concatenate_js' => 0,
|
||||
'minify_js_combine_all' => 0,
|
||||
//'minify_js_legacy' => 0,
|
||||
'minify_google_fonts' => 0,
|
||||
'minify_html' => 0,
|
||||
'remove_query_strings' => 0,
|
||||
'dns_prefetch' => 0,
|
||||
'cdn' => 0,
|
||||
'cdn_cnames' => array(),
|
||||
'cdn_zone' => array(),
|
||||
//'cdn_ssl' => 0,
|
||||
'cdn_reject_files' => array(),
|
||||
'do_cloudflare' => 0,
|
||||
'cloudflare_email' => '',
|
||||
'cloudflare_api_key' => '',
|
||||
'cloudflare_domain' => '',
|
||||
//'cloudflare_zone_id' => '',
|
||||
'cloudflare_devmode' => 0,
|
||||
'cloudflare_protocol_rewrite' => 0,
|
||||
'cloudflare_auto_settings' => 0,
|
||||
'cloudflare_old_settings' => 0,
|
||||
'do_beta' => 0,
|
||||
'analytics_enabled' => 1,
|
||||
);
|
||||
}
|
||||
|
||||
// ok
|
||||
public function syncOthersData( $information, $data = array() ) {
|
||||
if ( isset( $data['syncWPRocketData'] ) && ( 'yes' === $data['syncWPRocketData'] ) ) {
|
||||
|
@ -116,10 +203,13 @@ class MainWP_Child_WP_Rocket {
|
|||
return $value;
|
||||
}
|
||||
|
||||
public static function isActivated() {
|
||||
if ( ! defined( 'WP_ROCKET_VERSION' ) || ! defined( 'WP_ROCKET_SLUG' ) ) {
|
||||
return false;
|
||||
}
|
||||
public function isActivated() {
|
||||
if ( ! $this->is_plugin_installed ) {
|
||||
return false;
|
||||
}
|
||||
// if ( ! defined( 'WP_ROCKET_VERSION' ) || ! defined( 'WP_ROCKET_SLUG' ) ) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -153,42 +243,53 @@ class MainWP_Child_WP_Rocket {
|
|||
}
|
||||
|
||||
public function action() {
|
||||
$information = array();
|
||||
if ( ! self::isActivated() ) {
|
||||
$information['error'] = 'NO_WPROCKET';
|
||||
MainWP_Helper::write( $information );
|
||||
|
||||
if ( ! $this->is_plugin_installed ) {
|
||||
MainWP_Helper::write( array( 'error' => __( 'Please install WP Rocket plugin on child website', $this->plugin_translate ) ) );
|
||||
return;
|
||||
}
|
||||
|
||||
$information = array();
|
||||
|
||||
|
||||
if ( isset( $_POST['mwp_action'] ) ) {
|
||||
MainWP_Helper::update_option( 'mainwp_wprocket_ext_enabled', 'Y' );
|
||||
switch ( $_POST['mwp_action'] ) {
|
||||
case 'set_showhide':
|
||||
$information = $this->set_showhide();
|
||||
break;
|
||||
case 'purge_cloudflare':
|
||||
$information = $this->purge_cloudflare();
|
||||
break;
|
||||
case 'purge_all':
|
||||
$information = $this->purge_cache_all();
|
||||
break;
|
||||
case 'preload_cache':
|
||||
$information = $this->preload_cache();
|
||||
break;
|
||||
case 'save_settings':
|
||||
$information = $this->save_settings();
|
||||
break;
|
||||
case "load_existing_settings":
|
||||
$information = $this->load_existing_settings();
|
||||
break;
|
||||
case 'optimize_database':
|
||||
$information = $this->optimize_database();
|
||||
break;
|
||||
case 'get_optimize_info':
|
||||
$information = $this->get_optimize_info();
|
||||
break;
|
||||
case 'purge_opcache':
|
||||
$information = $this->do_admin_post_rocket_purge_opcache();
|
||||
break;
|
||||
}
|
||||
// MainWP_Helper::update_option( 'mainwp_wprocket_ext_enabled', 'Y' );
|
||||
try {
|
||||
switch ( $_POST['mwp_action'] ) {
|
||||
case 'set_showhide':
|
||||
$information = $this->set_showhide();
|
||||
break;
|
||||
case 'purge_cloudflare':
|
||||
$information = $this->purge_cloudflare();
|
||||
break;
|
||||
case 'purge_all':
|
||||
$information = $this->purge_cache_all();
|
||||
break;
|
||||
case 'preload_cache':
|
||||
$information = $this->preload_cache();
|
||||
break;
|
||||
case 'generate_critical_css':
|
||||
$information = $this->generate_critical_css();
|
||||
break;
|
||||
case 'save_settings':
|
||||
$information = $this->save_settings();
|
||||
break;
|
||||
case "load_existing_settings":
|
||||
$information = $this->load_existing_settings();
|
||||
break;
|
||||
case 'optimize_database':
|
||||
$information = $this->optimize_database();
|
||||
break;
|
||||
case 'get_optimize_info':
|
||||
$information = $this->get_optimize_info();
|
||||
break;
|
||||
case 'purge_opcache':
|
||||
$information = $this->do_admin_post_rocket_purge_opcache();
|
||||
break;
|
||||
}
|
||||
} catch(Exception $e) {
|
||||
$information = array( 'error' => $e->getMessage() );
|
||||
}
|
||||
}
|
||||
MainWP_Helper::write( $information );
|
||||
}
|
||||
|
@ -254,13 +355,42 @@ class MainWP_Child_WP_Rocket {
|
|||
}
|
||||
|
||||
function preload_cache() {
|
||||
if ( function_exists( 'run_rocket_bot' ) ) {
|
||||
run_rocket_bot( 'cache-preload', '' );
|
||||
MainWP_Helper::check_functions( array( 'run_rocket_sitemap_preload', 'run_rocket_bot' ) );
|
||||
MainWP_Helper::check_classes_exists('WP_Rocket\Preload\Full_Process');
|
||||
|
||||
return array( 'result' => 'SUCCESS' );
|
||||
} else {
|
||||
return array( 'error' => 'function_not_exist' );
|
||||
}
|
||||
$preload_process = new WP_Rocket\Preload\Full_Process();
|
||||
MainWP_Helper::check_methods($preload_process, array( 'is_process_running'));
|
||||
|
||||
if ( $preload_process->is_process_running() ) {
|
||||
return array( 'result' => 'RUNNING' );
|
||||
}
|
||||
|
||||
delete_transient( 'rocket_preload_errors' );
|
||||
run_rocket_bot( 'cache-preload', '' );
|
||||
run_rocket_sitemap_preload();
|
||||
return array( 'result' => 'SUCCESS' );
|
||||
}
|
||||
|
||||
function generate_critical_css() {
|
||||
MainWP_Helper::check_classes_exists( array( 'WP_Rocket\Subscriber\Optimization\Critical_CSS_Subscriber',
|
||||
'WP_Rocket\Optimization\CSS\Critical_CSS',
|
||||
'WP_Rocket\Optimization\CSS\Critical_CSS_Generation',
|
||||
'WP_Rocket\Admin\Options',
|
||||
'WP_Rocket\Admin\Options_Data'
|
||||
));
|
||||
|
||||
$critical_css = new WP_Rocket\Optimization\CSS\Critical_CSS( new WP_Rocket\Optimization\CSS\Critical_CSS_Generation() );
|
||||
$options_api = new WP_Rocket\Admin\Options( 'wp_rocket_' );
|
||||
$options = new WP_Rocket\Admin\Options_Data( $options_api->get( 'settings', array() ) );
|
||||
|
||||
$sitemap_preload = new WP_Rocket\Subscriber\Optimization\Critical_CSS_Subscriber( $critical_css, $options );
|
||||
|
||||
MainWP_Helper::check_properties($sitemap_preload, 'critical_css');
|
||||
MainWP_Helper::check_methods($sitemap_preload->critical_css, 'process_handler');
|
||||
|
||||
$sitemap_preload->critical_css->process_handler();
|
||||
|
||||
return array( 'result' => 'SUCCESS' );
|
||||
}
|
||||
|
||||
function save_settings() {
|
||||
|
@ -277,39 +407,64 @@ class MainWP_Child_WP_Rocket {
|
|||
$options[ $field ] = $value;
|
||||
}
|
||||
}
|
||||
if (isset($_POST['do_database_optimization']) && !empty($_POST['do_database_optimization'])) {
|
||||
$_POST['wp_rocket_settings']['submit_optimize'] = 1; // simulate POST
|
||||
}
|
||||
|
||||
|
||||
update_option( WP_ROCKET_SLUG, $options );
|
||||
|
||||
if (isset($_POST['do_database_optimization']) && !empty($_POST['do_database_optimization'])) {
|
||||
$this->optimize_database();
|
||||
}
|
||||
|
||||
return array( 'result' => 'SUCCESS' );
|
||||
}
|
||||
|
||||
function optimize_database() {
|
||||
$return = array();
|
||||
if (function_exists('do_rocket_database_optimization')) {
|
||||
do_rocket_database_optimization();
|
||||
$return['result'] = 'SUCCESS';
|
||||
|
||||
MainWP_Helper::check_classes_exists( array( 'WP_Rocket\Admin\Database\Optimization',
|
||||
'WP_Rocket\Admin\Database\Optimization_Process',
|
||||
'WP_Rocket\Admin\Options',
|
||||
'WP_Rocket\Admin\Options_Data'
|
||||
));
|
||||
|
||||
$process = new WP_Rocket\Admin\Database\Optimization_Process();
|
||||
$optimization = new WP_Rocket\Admin\Database\Optimization( $process );
|
||||
MainWP_Helper::check_methods( $optimization, array( 'process_handler', 'get_options' ) );
|
||||
|
||||
$options_api = new WP_Rocket\Admin\Options( 'wp_rocket_' );
|
||||
$options = new WP_Rocket\Admin\Options_Data( $options_api->get( 'settings', array() ) );
|
||||
|
||||
$items = array_filter( array_keys( $optimization->get_options() ), [ $options, 'get' ] );
|
||||
|
||||
if ( !empty( $items ) ) {
|
||||
$optimization->process_handler( $items );
|
||||
}
|
||||
|
||||
$return['result'] = 'SUCCESS';
|
||||
return $return;
|
||||
}
|
||||
|
||||
function get_optimize_info() {
|
||||
|
||||
if (function_exists('rocket_database_count_cleanup_items')) {
|
||||
$information['optimize_info'] = array(
|
||||
'total_revisions' => rocket_database_count_cleanup_items( 'revisions' ),
|
||||
'total_auto_draft' => rocket_database_count_cleanup_items( 'auto_drafts' ),
|
||||
'total_trashed_posts' => rocket_database_count_cleanup_items( 'trashed_posts' ),
|
||||
'total_spam_comments' => rocket_database_count_cleanup_items( 'spam_comments' ),
|
||||
'total_trashed_comments' => rocket_database_count_cleanup_items( 'trashed_comments' ),
|
||||
'total_expired_transients' => rocket_database_count_cleanup_items( 'expired_transients' ),
|
||||
'total_all_transients' => rocket_database_count_cleanup_items( 'all_transients' ),
|
||||
'total_optimize_tables' => rocket_database_count_cleanup_items( 'optimize_tables' )
|
||||
);
|
||||
$information['result'] = 'SUCCESS';
|
||||
}
|
||||
MainWP_Helper::check_classes_exists( array( 'WP_Rocket\Admin\Database\Optimization',
|
||||
'WP_Rocket\Admin\Database\Optimization_Process'
|
||||
));
|
||||
|
||||
$process = new WP_Rocket\Admin\Database\Optimization_Process();
|
||||
$optimization = new WP_Rocket\Admin\Database\Optimization( $process );
|
||||
MainWP_Helper::check_methods($optimization, 'count_cleanup_items');
|
||||
|
||||
$information['optimize_info'] = array(
|
||||
'total_revisions' => $optimization->count_cleanup_items( 'database_revisions' ),
|
||||
'total_auto_draft' => $optimization->count_cleanup_items( 'database_auto_drafts' ),
|
||||
'total_trashed_posts' => $optimization->count_cleanup_items( 'database_trashed_posts' ),
|
||||
'total_spam_comments' => $optimization->count_cleanup_items( 'database_spam_comments' ),
|
||||
'total_trashed_comments' => $optimization->count_cleanup_items( 'database_trashed_comments' ),
|
||||
'total_expired_transients' => $optimization->count_cleanup_items( 'database_expired_transients' ),
|
||||
'total_all_transients' => $optimization->count_cleanup_items( 'database_all_transients' ),
|
||||
'total_optimize_tables' => $optimization->count_cleanup_items( 'database_optimize_tables' )
|
||||
);
|
||||
|
||||
$information['result'] = 'SUCCESS';
|
||||
return $information;
|
||||
}
|
||||
|
||||
|
@ -318,79 +473,5 @@ class MainWP_Child_WP_Rocket {
|
|||
return array('result' => 'SUCCESS', 'options' => $options);
|
||||
}
|
||||
|
||||
function get_rocket_default_options() {
|
||||
return array(
|
||||
'cache_mobile' => 1,
|
||||
'do_caching_mobile_files' => 0,
|
||||
'cache_logged_user' => 0,
|
||||
'cache_ssl' => 0,
|
||||
'emoji' => 0,
|
||||
'embeds' => 1,
|
||||
'varnish_auto_purge' => 0,
|
||||
'manual_preload' => 0,
|
||||
'automatic_preload' => 0,
|
||||
'sitemap_preload' => 0,
|
||||
'sitemap_preload_url_crawl' => 500000,
|
||||
'sitemaps' => array(),
|
||||
'database_revisions' => 0,
|
||||
'database_auto_drafts' => 0,
|
||||
'database_trashed_posts' => 0,
|
||||
'database_spam_comments' => 0,
|
||||
'database_trashed_comments' => 0,
|
||||
'database_expired_transients' => 0,
|
||||
'database_all_transients' => 0,
|
||||
'database_optimize_tables' => 0,
|
||||
'schedule_automatic_cleanup' => 0,
|
||||
'automatic_cleanup_frequency' => '',
|
||||
'cache_reject_uri' => array(),
|
||||
'cache_reject_cookies' => array(),
|
||||
'cache_reject_ua' => array(),
|
||||
'cache_query_strings' => array(),
|
||||
'cache_purge_pages' => array(),
|
||||
'purge_cron_interval' => 10,
|
||||
'purge_cron_unit' => 'HOUR_IN_SECONDS',
|
||||
'exclude_css' => array(),
|
||||
'exclude_js' => array(),
|
||||
'async_css' => 0,
|
||||
'defer_all_js' => 0,
|
||||
'defer_all_js_safe' => 1,
|
||||
'critical_css' => '',
|
||||
'deferred_js_files' => array(),
|
||||
'lazyload' => 0,
|
||||
'lazyload_iframes' => 0,
|
||||
'lazyload_youtube' =>0,
|
||||
'minify_css' => 0,
|
||||
// 'minify_css_key' => $minify_css_key,
|
||||
'minify_concatenate_css' => 0,
|
||||
//'minify_css_combine_all' => 0,
|
||||
'minify_css_legacy' => 0,
|
||||
'minify_js' => 0,
|
||||
// 'minify_js_key' => $minify_js_key,
|
||||
'minify_js_in_footer' => array(),
|
||||
'minify_concatenate_js' => 0,
|
||||
'minify_js_combine_all' => 0,
|
||||
//'minify_js_legacy' => 0,
|
||||
'minify_google_fonts' => 0,
|
||||
'minify_html' => 0,
|
||||
'remove_query_strings' => 0,
|
||||
'dns_prefetch' => 0,
|
||||
'cdn' => 0,
|
||||
'cdn_cnames' => array(),
|
||||
'cdn_zone' => array(),
|
||||
//'cdn_ssl' => 0,
|
||||
'cdn_reject_files' => array(),
|
||||
'do_cloudflare' => 0,
|
||||
'cloudflare_email' => '',
|
||||
'cloudflare_api_key' => '',
|
||||
'cloudflare_domain' => '',
|
||||
//'cloudflare_zone_id' => '',
|
||||
'cloudflare_devmode' => 0,
|
||||
'cloudflare_protocol_rewrite' => 0,
|
||||
'cloudflare_auto_settings' => 0,
|
||||
'cloudflare_old_settings' => 0,
|
||||
'do_beta' => 0,
|
||||
'analytics_enabled' => 1,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
305
class/class-mainwp-child-wpvivid-backuprestore.php
Normal file
305
class/class-mainwp-child-wpvivid-backuprestore.php
Normal file
|
@ -0,0 +1,305 @@
|
|||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: alienware`x
|
||||
* Date: 2019/4/30
|
||||
* Time: 10:26
|
||||
*/
|
||||
|
||||
class MainWP_Child_WPvivid_BackupRestore
|
||||
{
|
||||
public static $instance = null;
|
||||
public $is_plugin_installed = false;
|
||||
public $public_intetface;
|
||||
static function Instance()
|
||||
{
|
||||
if ( null === MainWP_Child_WPvivid_BackupRestore::$instance )
|
||||
{
|
||||
MainWP_Child_WPvivid_BackupRestore::$instance = new MainWP_Child_WPvivid_BackupRestore();
|
||||
}
|
||||
|
||||
return MainWP_Child_WPvivid_BackupRestore::$instance;
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
||||
if ( is_plugin_active( 'wpvivid-backuprestore/wpvivid-backuprestore.php' ) && defined('WPVIVID_PLUGIN_DIR'))
|
||||
{
|
||||
$this->is_plugin_installed = true;
|
||||
}
|
||||
|
||||
if (!$this->is_plugin_installed)
|
||||
return;
|
||||
|
||||
add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
|
||||
$this->public_intetface = new WPvivid_Public_Interface();
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function syncOthersData( $information, $data = array() )
|
||||
{
|
||||
try{
|
||||
|
||||
if ( isset( $data['syncWPvividData'] ))
|
||||
{
|
||||
$information['syncWPvividData']=1;
|
||||
$data = WPvivid_Setting::get_sync_data();
|
||||
$information['syncWPvividSettingData']=$data['setting'];
|
||||
$information['syncWPvividRemoteData']=$data['remote'];
|
||||
$information['syncWPvividScheduleData']=$data['schedule'];
|
||||
}
|
||||
|
||||
} catch(Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return $information;
|
||||
}
|
||||
|
||||
public function action()
|
||||
{
|
||||
$information = array();
|
||||
if ( ! $this->is_plugin_installed )
|
||||
{
|
||||
$information['error'] = 'NO_WPVIVIDBACKUP';
|
||||
MainWP_Helper::write( $information );
|
||||
}
|
||||
|
||||
if ( isset( $_POST['mwp_action'] ) )
|
||||
{
|
||||
try {
|
||||
switch ($_POST['mwp_action']) {
|
||||
case 'prepare_backup':
|
||||
$information = $this->prepare_backup();
|
||||
break;
|
||||
case 'backup_now':
|
||||
$information = $this->backup_now();
|
||||
break;
|
||||
case 'get_status':
|
||||
$information = $this->get_status();
|
||||
break;
|
||||
case 'get_backup_schedule':
|
||||
$information = $this->get_backup_schedule();
|
||||
break;
|
||||
case 'get_backup_list':
|
||||
$information = $this->get_backup_list();
|
||||
break;
|
||||
case 'get_default_remote':
|
||||
$information = $this->get_default_remote();
|
||||
break;
|
||||
case 'delete_backup':
|
||||
$information = $this->delete_backup();
|
||||
break;
|
||||
case 'delete_backup_array':
|
||||
$information = $this->delete_backup_array();
|
||||
break;
|
||||
case 'set_security_lock':
|
||||
$information = $this->set_security_lock();
|
||||
break;
|
||||
case 'view_log':
|
||||
$information = $this->view_log();
|
||||
break;
|
||||
case 'read_last_backup_log':
|
||||
$information = $this->read_last_backup_log();
|
||||
break;
|
||||
case 'view_backup_task_log':
|
||||
$information = $this->view_backup_task_log();
|
||||
break;
|
||||
case 'backup_cancel':
|
||||
$information = $this->backup_cancel();
|
||||
break;
|
||||
case 'init_download_page':
|
||||
$information = $this->init_download_page();
|
||||
break;
|
||||
case 'prepare_download_backup':
|
||||
$information = $this->prepare_download_backup();
|
||||
break;
|
||||
case 'get_download_task':
|
||||
$information = $this->get_download_task();
|
||||
break;
|
||||
case 'download_backup':
|
||||
$information = $this->download_backup();
|
||||
break;
|
||||
case 'set_general_setting':
|
||||
$information = $this->set_general_setting();
|
||||
break;
|
||||
case 'set_schedule':
|
||||
$information = $this->set_schedule();
|
||||
break;
|
||||
case 'set_remote':
|
||||
$information = $this->set_remote();
|
||||
break;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$information = array('error' => $e->getMessage());
|
||||
}
|
||||
|
||||
MainWP_Helper::write($information);
|
||||
}
|
||||
}
|
||||
|
||||
public function prepare_backup()
|
||||
{
|
||||
global $wpvivid_plugin;
|
||||
$wpvivid_plugin->ajax_check_security();
|
||||
$ret = $this->public_intetface->prepare_backup($_POST['backup']);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function backup_now()
|
||||
{
|
||||
global $wpvivid_plugin;
|
||||
$wpvivid_plugin->ajax_check_security();
|
||||
$ret = $this->public_intetface->backup_now($_POST['task_id']);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function get_status()
|
||||
{
|
||||
global $wpvivid_plugin;
|
||||
$wpvivid_plugin->ajax_check_security();
|
||||
$ret = $this->public_intetface->get_status();
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function get_backup_schedule()
|
||||
{
|
||||
global $wpvivid_plugin;
|
||||
$wpvivid_plugin->ajax_check_security();
|
||||
$ret = $this->public_intetface->get_backup_schedule();
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function get_backup_list()
|
||||
{
|
||||
global $wpvivid_plugin;
|
||||
$wpvivid_plugin->ajax_check_security();
|
||||
$ret = $this->public_intetface->get_backup_list();
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function get_default_remote()
|
||||
{
|
||||
global $wpvivid_plugin;
|
||||
$wpvivid_plugin->ajax_check_security();
|
||||
$ret = $this->public_intetface->get_default_remote();
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function delete_backup()
|
||||
{
|
||||
global $wpvivid_plugin;
|
||||
$wpvivid_plugin->ajax_check_security();
|
||||
$ret = $this->public_intetface->delete_backup($_POST['backup_id'], $_POST['force']);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function delete_backup_array()
|
||||
{
|
||||
global $wpvivid_plugin;
|
||||
$wpvivid_plugin->ajax_check_security();
|
||||
$ret = $this->public_intetface->delete_backup_array($_POST['backup_id']);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function set_security_lock()
|
||||
{
|
||||
global $wpvivid_plugin;
|
||||
$wpvivid_plugin->ajax_check_security();
|
||||
$ret = $this->public_intetface->set_security_lock($_POST['backup_id'], $_POST['lock']);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function view_log()
|
||||
{
|
||||
global $wpvivid_plugin;
|
||||
$wpvivid_plugin->ajax_check_security();
|
||||
$ret = $this->public_intetface->view_log($_POST['id']);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function read_last_backup_log()
|
||||
{
|
||||
global $wpvivid_plugin;
|
||||
$wpvivid_plugin->ajax_check_security();
|
||||
$ret = $this->public_intetface->read_last_backup_log($_POST['log_file_name']);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function view_backup_task_log()
|
||||
{
|
||||
global $wpvivid_plugin;
|
||||
$wpvivid_plugin->ajax_check_security();
|
||||
$ret = $this->public_intetface->view_backup_task_log($_POST['id']);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function backup_cancel()
|
||||
{
|
||||
global $wpvivid_plugin;
|
||||
$wpvivid_plugin->ajax_check_security();
|
||||
$ret = $this->public_intetface->backup_cancel($_POST['task_id']);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function init_download_page()
|
||||
{
|
||||
global $wpvivid_plugin;
|
||||
$wpvivid_plugin->ajax_check_security();
|
||||
$ret = $this->public_intetface->init_download_page($_POST['backup_id']);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function prepare_download_backup()
|
||||
{
|
||||
global $wpvivid_plugin;
|
||||
$wpvivid_plugin->ajax_check_security();
|
||||
$ret = $this->public_intetface->prepare_download_backup($_POST['backup_id'], $_POST['file_name']);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function get_download_task()
|
||||
{
|
||||
global $wpvivid_plugin;
|
||||
$wpvivid_plugin->ajax_check_security();
|
||||
$ret = $this->public_intetface->get_download_task($_POST['backup_id']);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function download_backup()
|
||||
{
|
||||
global $wpvivid_plugin;
|
||||
$wpvivid_plugin->ajax_check_security();
|
||||
$ret = $this->public_intetface->download_backup($_POST['backup_id'], $_POST['file_name']);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function set_general_setting()
|
||||
{
|
||||
global $wpvivid_plugin;
|
||||
$wpvivid_plugin->ajax_check_security();
|
||||
$ret = $this->public_intetface->set_general_setting($_POST['setting']);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function set_schedule()
|
||||
{
|
||||
global $wpvivid_plugin;
|
||||
$wpvivid_plugin->ajax_check_security();
|
||||
$ret = $this->public_intetface->set_schedule($_POST['schedule']);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function set_remote()
|
||||
{
|
||||
global $wpvivid_plugin;
|
||||
$wpvivid_plugin->ajax_check_security();
|
||||
$ret = $this->public_intetface->set_remote($_POST['remote']);
|
||||
return $ret;
|
||||
}
|
||||
}
|
|
@ -115,7 +115,7 @@ if ( isset( $_GET['skeleton_keyuse_nonce_key'] ) && isset( $_GET['skeleton_keyus
|
|||
}
|
||||
|
||||
class MainWP_Child {
|
||||
public static $version = '3.5.7';
|
||||
public static $version = '4.0';
|
||||
private $update_version = '1.5';
|
||||
|
||||
private $callableFunctions = array(
|
||||
|
@ -185,7 +185,8 @@ class MainWP_Child {
|
|||
'disconnect' => 'disconnect',
|
||||
'time_capsule' => 'time_capsule',
|
||||
'extra_excution' => 'extra_execution', // deprecated
|
||||
'extra_execution' => 'extra_execution'
|
||||
'extra_execution' => 'extra_execution',
|
||||
'wpvivid_backuprestore'=>'wpvivid_backuprestore'
|
||||
);
|
||||
|
||||
private $FTP_ERROR = 'Failed! Please, add FTP details for automatic updates.';
|
||||
|
@ -304,7 +305,7 @@ class MainWP_Child {
|
|||
'mainwp_child_nossl',
|
||||
'mainwp_security',
|
||||
'mainwp_backupwordpress_ext_enabled',
|
||||
'mainwp_wprocket_ext_enabled',
|
||||
// 'mainwp_wprocket_ext_enabled',
|
||||
//'mainwp_wordfence_ext_enabled',
|
||||
'mainwp_branding_button_contact_label',
|
||||
'mainwp_branding_extra_settings',
|
||||
|
@ -1086,40 +1087,44 @@ class MainWP_Child {
|
|||
return;
|
||||
}
|
||||
|
||||
if ( 'hidden' === ( get_option( 'mainwp_child_pluginDir' ) ) && ( $hard || 'yes' !== ( get_option( 'mainwp_child_htaccess_set' ) ) ) ) {
|
||||
include_once( ABSPATH . '/wp-admin/includes/misc.php' );
|
||||
// if ( 'hidden' === ( get_option( 'mainwp_child_pluginDir' ) ) && ( $hard || 'yes' !== ( get_option( 'mainwp_child_htaccess_set' ) ) ) ) {
|
||||
|
||||
$snPluginDir = basename( $this->plugin_dir );
|
||||
// include_once( ABSPATH . '/wp-admin/includes/misc.php' );
|
||||
//
|
||||
// $snPluginDir = basename( $this->plugin_dir );
|
||||
//
|
||||
// $rules = null;
|
||||
// if ( ( '1' !== get_option( 'heatMapsIndividualOverrideSetting' ) && '0' !== get_option( 'heatMapEnabled' ) ) ||
|
||||
// ( '1' === get_option( 'heatMapsIndividualOverrideSetting' ) && '1' !== get_option( 'heatMapsIndividualDisable' ) ) ||
|
||||
// get_option( 'mainwp_kwl_enable_statistic' )
|
||||
// ) {
|
||||
// //Heatmap enabled
|
||||
// //Make the plugin invisible, except heatmap
|
||||
// $rules = $this->mod_rewrite_rules( array( 'wp-content/plugins/' . $snPluginDir . '/([^js\/]*)$' => 'wp-content/plugins/THIS_PLUGIN_DOES_NOT_EXIST' ) );
|
||||
// } else {
|
||||
// //Make the plugin invisible
|
||||
// $rules = $this->mod_rewrite_rules( array( 'wp-content/plugins/' . $snPluginDir . '/(.*)$' => 'wp-content/plugins/THIS_PLUGIN_DOES_NOT_EXIST' ) );
|
||||
// }
|
||||
//
|
||||
// $home_path = ABSPATH;
|
||||
// $htaccess_file = $home_path . '.htaccess';
|
||||
// if ( function_exists( 'save_mod_rewrite_rules' ) ) {
|
||||
// $rules = explode( "\n", $rules );
|
||||
//
|
||||
// // $ch = @fopen($htaccess_file,'w');
|
||||
// // if (@flock($ch, LOCK_EX))
|
||||
// // {
|
||||
// insert_with_markers( $htaccess_file, 'MainWP', $rules );
|
||||
// // }
|
||||
// // @flock($ch, LOCK_UN);
|
||||
// // @fclose($ch);
|
||||
//
|
||||
// }
|
||||
// MainWP_Helper::update_option( 'mainwp_child_htaccess_set', 'yes', 'yes' );
|
||||
//
|
||||
// } else
|
||||
|
||||
$rules = null;
|
||||
if ( ( '1' !== get_option( 'heatMapsIndividualOverrideSetting' ) && '0' !== get_option( 'heatMapEnabled' ) ) ||
|
||||
( '1' === get_option( 'heatMapsIndividualOverrideSetting' ) && '1' !== get_option( 'heatMapsIndividualDisable' ) ) ||
|
||||
get_option( 'mainwp_kwl_enable_statistic' )
|
||||
) {
|
||||
//Heatmap enabled
|
||||
//Make the plugin invisible, except heatmap
|
||||
$rules = $this->mod_rewrite_rules( array( 'wp-content/plugins/' . $snPluginDir . '/([^js\/]*)$' => 'wp-content/plugins/THIS_PLUGIN_DOES_NOT_EXIST' ) );
|
||||
} else {
|
||||
//Make the plugin invisible
|
||||
$rules = $this->mod_rewrite_rules( array( 'wp-content/plugins/' . $snPluginDir . '/(.*)$' => 'wp-content/plugins/THIS_PLUGIN_DOES_NOT_EXIST' ) );
|
||||
}
|
||||
|
||||
$home_path = ABSPATH;
|
||||
$htaccess_file = $home_path . '.htaccess';
|
||||
if ( function_exists( 'save_mod_rewrite_rules' ) ) {
|
||||
$rules = explode( "\n", $rules );
|
||||
|
||||
// $ch = @fopen($htaccess_file,'w');
|
||||
// if (@flock($ch, LOCK_EX))
|
||||
// {
|
||||
insert_with_markers( $htaccess_file, 'MainWP', $rules );
|
||||
// }
|
||||
// @flock($ch, LOCK_UN);
|
||||
// @fclose($ch);
|
||||
|
||||
}
|
||||
MainWP_Helper::update_option( 'mainwp_child_htaccess_set', 'yes', 'yes' );
|
||||
} else if ( $hard ) {
|
||||
if ( $hard ) {
|
||||
include_once( ABSPATH . '/wp-admin/includes/misc.php' );
|
||||
|
||||
$home_path = ABSPATH;
|
||||
|
@ -1566,7 +1571,7 @@ class MainWP_Child {
|
|||
MainWP_Client_Report::Instance()->creport_init();
|
||||
MainWP_Child_Pagespeed::Instance()->init();
|
||||
MainWP_Child_Links_Checker::Instance()->init();
|
||||
|
||||
MainWP_Child_WPvivid_BackupRestore::Instance()->init();
|
||||
global $_wp_submenu_nopriv;
|
||||
if ($_wp_submenu_nopriv === null)
|
||||
$_wp_submenu_nopriv = array(); // fix warning
|
||||
|
@ -1589,11 +1594,11 @@ class MainWP_Child {
|
|||
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' ) );
|
||||
}
|
||||
|
||||
// going to retire soon
|
||||
|
||||
if ( 1 === (int) get_option( 'mainwpKeywordLinks' ) ) {
|
||||
new MainWP_Keyword_Links();
|
||||
if ( ! is_admin() ) {
|
||||
//add_filter( 'the_content', array( MainWP_Keyword_Links::Instance(), 'filter_content' ), 100 );
|
||||
add_filter( 'the_content', array( MainWP_Keyword_Links::Instance(), 'filter_content' ), 100 );
|
||||
}
|
||||
MainWP_Keyword_Links::Instance()->update_htaccess(); // if needed
|
||||
MainWP_Keyword_Links::Instance()->redirect_cloak();
|
||||
|
@ -1987,7 +1992,8 @@ class MainWP_Child {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
MainWP_Helper::error( __( 'Invalid request!', 'mainwp-child' ) );
|
||||
//MainWP_Helper::error( __( 'Invalid request!', 'mainwp-child' ) );
|
||||
$information['upgrades'] = array(); // to fix error message when translations updated
|
||||
}
|
||||
|
||||
$information['sync'] = $this->getSiteStats( array(), false );
|
||||
|
@ -3692,6 +3698,7 @@ class MainWP_Child {
|
|||
|
||||
$information['site_info'] = array(
|
||||
'wpversion' => $wp_version,
|
||||
'debug_mode' => (defined('WP_DEBUG') && true === WP_DEBUG) ? true : false,
|
||||
'phpversion' => phpversion(),
|
||||
'child_version' => self::$version,
|
||||
'memory_limit' => MainWP_Child_Server_Information::getPHPMemoryLimit(),
|
||||
|
@ -3920,14 +3927,30 @@ class MainWP_Child {
|
|||
}
|
||||
|
||||
$information['recent_comments'] = $this->get_recent_comments( array( 'approve', 'hold' ), 5 );
|
||||
$information['recent_posts'] = $this->get_recent_posts( array( 'publish', 'draft', 'pending', 'trash', 'future' ), 5 );
|
||||
|
||||
$recent_number = 5;
|
||||
|
||||
if (isset($_POST) && isset( $_POST['recent_number'] )) {
|
||||
$recent_number = $_POST['recent_number'];
|
||||
if ($recent_number != get_option('mainwp_child_recent_number', 5)) {
|
||||
update_option( 'mainwp_child_recent_number', $recent_number );
|
||||
}
|
||||
} else {
|
||||
$recent_number = get_option('mainwp_child_recent_number', 5);
|
||||
}
|
||||
|
||||
if ($recent_number <= 0 || $recent_number > 30) {
|
||||
$recent_number = 5;
|
||||
}
|
||||
|
||||
$information['recent_posts'] = $this->get_recent_posts( array( 'publish', 'draft', 'pending', 'trash', 'future' ), $recent_number );
|
||||
$information['recent_pages'] = $this->get_recent_posts( array(
|
||||
'publish',
|
||||
'draft',
|
||||
'pending',
|
||||
'trash',
|
||||
'future'
|
||||
), 5, 'page' );
|
||||
), $recent_number, 'page' );
|
||||
|
||||
$securityIssuess = 0;
|
||||
if ( ! MainWP_Security::prevent_listing_ok() ) {
|
||||
|
@ -5708,6 +5731,11 @@ class MainWP_Child {
|
|||
MainWP_Child_Updraft_Plus_Backups::Instance()->action();
|
||||
}
|
||||
|
||||
function wpvivid_backuprestore()
|
||||
{
|
||||
MainWP_Child_WPvivid_BackupRestore::Instance()->action();
|
||||
}
|
||||
|
||||
function backup_wp() {
|
||||
if ( ! version_compare( phpversion(), '5.3', '>=' ) ) {
|
||||
$error = sprintf( __( 'PHP Version %s is unsupported.', 'mainwp-child' ), phpversion() );
|
||||
|
|
|
@ -186,7 +186,7 @@ class MainWP_Client_Report {
|
|||
$exclude_connector_posts = true;
|
||||
if ( isset( $sections['body'] ) && isset( $sections['body']['section_token'] ) && is_array($sections['body']['section_token']) ) {
|
||||
foreach ($sections['body']['section_token'] as $sec) {
|
||||
if (strpos($sec, "[section.posts") !== false) {
|
||||
if (strpos($sec, "[section.posts") !== false || strpos($sec, "[section.pages") !== false) {
|
||||
$exclude_connector_posts = false;
|
||||
break;
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ class MainWP_Client_Report {
|
|||
if ($exclude_connector_posts) {
|
||||
if ( isset( $sections['header'] ) && isset( $sections['header']['section_token'] ) && is_array($sections['header']['section_token']) ) {
|
||||
foreach ($sections['header']['section_token'] as $sec) {
|
||||
if (strpos($sec, "[section.posts") !== false) {
|
||||
if (strpos($sec, "[section.posts") !== false || strpos($sec, "[section.pages") !== false) {
|
||||
$exclude_connector_posts = false;
|
||||
break;
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ class MainWP_Client_Report {
|
|||
if ($exclude_connector_posts) {
|
||||
if ( isset( $sections['footer'] ) && isset( $sections['footer']['section_token'] ) && is_array($sections['footer']['section_token']) ) {
|
||||
foreach ($sections['footer']['section_token'] as $sec) {
|
||||
if (strpos($sec, "[section.posts") !== false) {
|
||||
if (strpos($sec, "[section.posts") !== false || strpos($sec, "[section.pages") !== false) {
|
||||
$exclude_connector_posts = false;
|
||||
break;
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ class MainWP_Client_Report {
|
|||
if ($exclude_connector_posts) {
|
||||
if ( isset( $other_tokens['body'] ) && is_array( $other_tokens['body'] ) ) {
|
||||
foreach ( $other_tokens['body'] as $sec ) {
|
||||
if ( strpos( $sec, "[post." ) !== false ) {
|
||||
if ( strpos( $sec, "[post." ) !== false || strpos($sec, "[page.") !== false) {
|
||||
$exclude_connector_posts = false;
|
||||
break;
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ class MainWP_Client_Report {
|
|||
if ($exclude_connector_posts) {
|
||||
if ( isset( $other_tokens['header'] ) && is_array($other_tokens['header']) ) {
|
||||
foreach ($other_tokens['header'] as $sec) {
|
||||
if (strpos($sec, "[post.") !== false) {
|
||||
if (strpos($sec, "[post.") !== false || strpos($sec, "[page.") !== false) {
|
||||
$exclude_connector_posts = false;
|
||||
break;
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ class MainWP_Client_Report {
|
|||
if ($exclude_connector_posts) {
|
||||
if ( isset( $other_tokens['footer'] ) && is_array($other_tokens['footer']) ) {
|
||||
foreach ($other_tokens['footer'] as $sec) {
|
||||
if (strpos($sec, "[post.") !== false) {
|
||||
if (strpos($sec, "[post.") !== false || strpos($sec, "[page.") !== false) {
|
||||
$exclude_connector_posts = false;
|
||||
break;
|
||||
}
|
||||
|
@ -354,6 +354,7 @@ class MainWP_Client_Report {
|
|||
$tokens = array();
|
||||
}
|
||||
|
||||
$backups_created_time_to_fix = array();
|
||||
foreach ( $tokens as $token ) {
|
||||
$str_tmp = str_replace( array( '[', ']' ), '', $token );
|
||||
$array_tmp = explode( '.', $str_tmp );
|
||||
|
@ -386,6 +387,17 @@ class MainWP_Client_Report {
|
|||
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') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$created = strtotime( $record->created );
|
||||
if ( in_array( $created, $backups_created_time_to_fix ) ) {
|
||||
if ( !in_array($record->ID, $skip_records) ) {
|
||||
$skip_records[] = $record->ID;
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
$backups_created_time_to_fix[] = $created;
|
||||
}
|
||||
|
||||
} else if ( 'mainwp_sucuri' === $context ) {
|
||||
if ( $record->context !== 'mainwp_sucuri' ) {
|
||||
continue;
|
||||
|
@ -454,7 +466,6 @@ class MainWP_Client_Report {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$count ++;
|
||||
|
|
|
@ -297,7 +297,7 @@ class MainWP_Helper {
|
|||
);
|
||||
|
||||
$wprocket_activated = false;
|
||||
if ( MainWP_Child_WP_Rocket::isActivated() ) {
|
||||
if ( MainWP_Child_WP_Rocket::Instance()->isActivated() ) {
|
||||
if ( function_exists( 'get_rocket_option' ) ) {
|
||||
$wprocket_activated = true;
|
||||
foreach ( $wprocket_fields as $field ) {
|
||||
|
@ -576,6 +576,9 @@ class MainWP_Helper {
|
|||
'_categories',
|
||||
'_edit_last',
|
||||
'_sticky',
|
||||
'_mainwp_post_dripper',
|
||||
'_bulkpost_do_not_del',
|
||||
'_mainwp_spin_me'
|
||||
);
|
||||
$not_allowed[] = '_mainwp_boilerplate_sites_posts';
|
||||
$not_allowed[] = '_ezine_post_keyword';
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
Author: MainWP
|
||||
Author URI: https://mainwp.com
|
||||
Text Domain: mainwp-child
|
||||
Version: 3.5.7
|
||||
Version: 4.0
|
||||
*/
|
||||
//if ( ( isset( $_REQUEST['heatmap'] ) && '1' === $_REQUEST['heatmap'] ) || ( isset( $_REQUEST['mainwpsignature'] ) && ( ! empty( $_REQUEST['mainwpsignature'] ) ) ) ) {
|
||||
// header( 'X-Frame-Options: ALLOWALL' );
|
||||
|
|
19
readme.txt
19
readme.txt
|
@ -1,13 +1,13 @@
|
|||
=== MainWP Child ===
|
||||
Contributors: mainwp
|
||||
Donate link:
|
||||
Tags: WordPress management, management, manager, manage, WordPress controller, network, MainWP, updates, admin, administration, multiple, multisite, plugin updates, theme updates, login, remote, backups
|
||||
Author: mainwp
|
||||
Author URI: https://mainwp.com
|
||||
Plugin URI: https://mainwp.com
|
||||
Requires at least: 3.6
|
||||
Tested up to: 5.2
|
||||
Stable tag: 3.5.7
|
||||
Tested up to: 5.2.2
|
||||
Requires PHP: 5.6
|
||||
Stable tag: 4.0
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
|
@ -71,6 +71,14 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
|
|||
|
||||
== Changelog ==
|
||||
|
||||
= 4.0 - 8-26-19 =
|
||||
* Fixed: various functionality problems
|
||||
* Added: support for ucoming 3rd party extensions
|
||||
* Added: .htaccess file with custom redirect to rule the MainWP Child plugin directory to hide the plugin from serach engines
|
||||
* Updated: support for the MainWP Dashboard 4.0
|
||||
* Updated: notifications texts
|
||||
* Removed: unused code
|
||||
|
||||
= 3.5.7 - 5-6-19 =
|
||||
* Fixed: multiple PHP Warnings
|
||||
* Fixed: multiple conflicts with 3rd party products
|
||||
|
@ -828,3 +836,8 @@ Fixed cloning issue with custom prefix
|
|||
|
||||
= 0.1 =
|
||||
* Initial version
|
||||
|
||||
== Upgrade Notice ==
|
||||
|
||||
= 4.0 =
|
||||
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/)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue