diff --git a/class/class-mainwp-backup.php b/class/class-mainwp-backup.php
index df8c2bf..0f49c5f 100644
--- a/class/class-mainwp-backup.php
+++ b/class/class-mainwp-backup.php
@@ -795,7 +795,11 @@ class MainWP_Backup {
// @codingStandardsIgnoreEnd
$query = $table_insert;
foreach ( $row as $value ) {
- $query .= '"' . MainWP_Child_DB::real_escape_string( $value ) . '", ';
+ if ( $value === null ) {
+ $query .= 'NULL, ';
+ } else {
+ $query .= '"' . MainWP_Child_DB::real_escape_string( $value ) . '", ';
+ }
}
$query = trim( $query, ', ' ) . ');';
diff --git a/class/class-mainwp-child-back-up-buddy.php b/class/class-mainwp-child-back-up-buddy.php
index 811b290..ca8d86c 100644
--- a/class/class-mainwp-child-back-up-buddy.php
+++ b/class/class-mainwp-child-back-up-buddy.php
@@ -72,7 +72,7 @@ class MainWP_Child_Back_Up_Buddy {
}
- function do_site_stats() {
+ function do_site_stats() {
if (has_action('mainwp_child_reports_log')) {
do_action( 'mainwp_child_reports_log', 'backupbuddy');
} else {
@@ -91,7 +91,7 @@ class MainWP_Child_Back_Up_Buddy {
if ( ! class_exists( 'backupbuddy_core' ) ) {
require_once( pb_backupbuddy::plugin_path() . '/classes/core.php' );
}
-
+
// Backup type.
$pretty_type = array(
'full' => 'Full',
@@ -139,6 +139,31 @@ class MainWP_Child_Back_Up_Buddy {
MainWP_Helper::update_lasttime_backup('backupbuddy', $finish_time); // to support backup before update feature
}
}
+
+ if ( file_exists(pb_backupbuddy::plugin_path() . '/destinations/live/live_periodic.php') ) {
+ require_once( pb_backupbuddy::plugin_path() . '/destinations/live/live_periodic.php' );
+
+ $state = backupbuddy_live_periodic::get_stats();
+ if (is_array($state) && isset($state['stats'])) {
+
+ if ( is_array($state['stats'] ) && isset( $state['stats']['last_remote_snapshot'] )) {
+ if (isset( $state['stats']['last_remote_snapshot_response'] )) {
+ $resp = $state['stats']['last_remote_snapshot_response'];
+ if ( isset( $resp['success'] ) && $resp['success']) {
+ $finish_time = $state['stats']['last_remote_snapshot'];
+ $backupType = 'Live Backup to cloud';
+ $message = 'BackupBuddy ' . $backupType . ' finished';
+ if (!empty($finish_time)) {
+ do_action( 'mainwp_reports_backupbuddy_backup', $message, $backupType, $finish_time);
+ MainWP_Helper::update_lasttime_backup('backupbuddy', $finish_time); // to support backup before update feature
+ }
+
+ }
+ }
+ }
+
+ }
+ }
}
public function action() {
diff --git a/class/class-mainwp-child-back-wp-up.php b/class/class-mainwp-child-back-wp-up.php
index 030217e..82b7916 100644
--- a/class/class-mainwp-child-back-wp-up.php
+++ b/class/class-mainwp-child-back-wp-up.php
@@ -66,6 +66,7 @@ class MainWP_Child_Back_WP_Up {
if ( $this->is_backwpup_installed ) {
add_action( 'wp_ajax_mainwp_backwpup_download_backup', array( $this, 'download_backup' ) );
+ add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
}
}
@@ -236,7 +237,17 @@ class MainWP_Child_Back_WP_Up {
}
}
}
-
+
+ function syncOthersData( $information, $data = array() ) {
+ if ( isset( $data['syncBackwpupData'] ) ) {
+ $lastbackup = MainWP_Helper::get_lasttime_backup('backwpup');
+ $information['syncBackwpupData'] = array(
+ 'lastbackup' => $lastbackup
+ );
+ }
+ return $information;
+ }
+
function get_destinations_list() {
$jobdest = array();
@@ -577,11 +588,12 @@ class MainWP_Child_Back_WP_Up {
if ( is_null($dest_class) ) {
continue;
}
- $items = $dest_class->file_get_list( $jobid . '_' . $dest );
+ $items = $dest_class->file_get_list( $jobid . '_' . $dest );
if ( ! empty( $items ) ) {
foreach ( $items as $item ) {
$temp_single_item = $item;
$temp_single_item['dest'] = $jobid . '_' . $dest;
+ $temp_single_item['timeloc'] = sprintf( __( '%1$s at %2$s', 'backwpup' ), date_i18n( get_option( 'date_format' ), $temp_single_item[ 'time' ], TRUE ), date_i18n( get_option( 'time_format' ), $temp_single_item[ 'time' ], TRUE ) );
$output->items[] = $temp_single_item;
}
}
diff --git a/class/class-mainwp-child-branding.php b/class/class-mainwp-child-branding.php
index 1eca1b8..842758d 100644
--- a/class/class-mainwp-child-branding.php
+++ b/class/class-mainwp-child-branding.php
@@ -51,9 +51,6 @@ class MainWP_Child_Branding {
return $plugin_meta;
}
- public static function admin_init() {
- }
-
public function child_deactivation() {
$dell_all = array(
'mainwp_branding_disable_change',
@@ -105,7 +102,7 @@ class MainWP_Child_Branding {
'description' => $settings['child_plugin_desc'],
'author' => $settings['child_plugin_author'],
'authoruri' => $settings['child_plugin_author_uri'],
- 'pluginuri' => $settings['child_plugin_uri'],
+ 'pluginuri' => isset($settings['child_plugin_uri']) ? $settings['child_plugin_uri'] : '',
);
MainWP_Helper::update_option( 'mainwp_branding_preserve_branding', $settings['child_preserve_branding'], 'yes' );
MainWP_Helper::update_option( 'mainwp_branding_plugin_header', $header, 'yes' );
@@ -287,6 +284,28 @@ class MainWP_Child_Branding {
}
add_filter( 'map_meta_cap', array( $this, 'branding_map_meta_cap' ), 10, 5 );
+
+ if ( 'T' === get_option( 'mainwp_branding_disable_change' ) ) {
+
+ // Disable the wordpress plugin update notifications
+ remove_action('load-update-core.php', 'wp_update_plugins');
+ add_filter('pre_site_transient_update_plugins', '__return_null');
+
+ // Disable the wordpress theme update notifications
+ remove_action('load-update-core.php', 'wp_update_themes');
+ add_filter('pre_site_transient_update_themes', ( $func = function($a){ return null;} ));
+
+ // Disable the wordpress core update notifications
+ add_action('after_setup_theme', 'remove_core_updates');
+ function remove_core_updates() {
+ add_action('init', ( $func = function($a){ remove_action( 'wp_version_check', 'wp_version_check' );} ), 2);
+ add_filter('pre_option_update_core', '__return_null');
+ add_filter('pre_site_transient_update_core', '__return_null');
+ }
+
+ add_action( 'admin_head', array( &$this, 'admin_head_hide_elements' ), 15 );
+ add_action( 'admin_menu', array($this, 'branding_redirect' ), 9);
+ }
// to fix
add_action( 'admin_menu', array( &$this, 'admin_menu' ) );
@@ -322,12 +341,13 @@ class MainWP_Child_Branding {
add_action( 'login_head', array( &$this, 'custom_login_logo' ) );
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' );
- add_filter( 'update_footer', array( &$this, 'update_admin_footer' ), 14 );
+ //remove_filter( 'update_footer', 'core_update_footer' );
+ add_filter( 'update_footer', array( &$this, 'core_update_footer' ), 14 );
+ add_filter( 'admin_footer_text', array( &$this, 'admin_footer_text' ), 14 );
}
- if ( isset( $extra_setting['hide_nag'] ) && ! empty( $extra_setting['hide_nag'] ) ) {
- add_action( 'admin_init', create_function( '', 'remove_action( \'admin_notices\', \'update_nag\', 3 );' ) );
+ if ( isset( $extra_setting['hide_nag'] ) && ! empty( $extra_setting['hide_nag'] ) ) {
+ add_action( 'admin_init', array($this, 'admin_init'));
}
add_action( 'admin_menu', array( &$this, 'remove_default_post_metaboxes' ) );
@@ -335,6 +355,11 @@ class MainWP_Child_Branding {
}
}
+
+ public function admin_init() {
+ remove_action( 'admin_notices', 'update_nag', 3 );
+ }
+
// to fix conflict with other plugin
function admin_menu() {
if ( !current_user_can( 'administrator' ) ) {
@@ -487,8 +512,34 @@ class MainWP_Child_Branding {
return $defaults;
}
-
- function update_admin_footer() {
+ public function branding_redirect() {
+ $pos1 = stripos( $_SERVER['REQUEST_URI'], 'update-core.php' );
+ $pos2 = stripos( $_SERVER['REQUEST_URI'], 'plugins.php' );
+ if ( false !== $pos1 || false !== $pos2 ) {
+ wp_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
+ exit();
+ }
+ }
+
+ function admin_head_hide_elements() {
+ ?>settings['extra_settings'];
if ( isset( $extra_setting['dashboard_footer'] ) && ! empty( $extra_setting['dashboard_footer'] ) ) {
echo wp_kses_post( nl2br( stripslashes( $extra_setting['dashboard_footer'] ) ) );
@@ -800,12 +851,14 @@ class MainWP_Child_Branding {
}
public function branding_map_meta_cap( $caps, $cap, $user_id, $args ) {
- if ( 'T' === get_option( 'mainwp_branding_disable_change' ) ) {
- // disable: edit, update, install, active themes and plugins
- if ( false !== strpos( $cap, 'plugins' ) || false !== strpos( $cap, 'themes' ) || 'edit_theme_options' === $cap ) {
- $caps[0] = 'do_not_allow';
- }
- }
+
+ // this is causing of some plugin's menu not added
+// if ( 'T' === get_option( 'mainwp_branding_disable_change' ) ) {
+// // disable: edit, update, install, active themes and plugins
+// if ( false !== strpos( $cap, 'plugins' ) || false !== strpos( $cap, 'themes' ) || 'edit_theme_options' === $cap ) {
+// $caps[0] = 'do_not_allow';
+// }
+// }
if ( 'T' === get_option( 'mainwp_branding_disable_switching_theme' ) ) {
// disable: theme switching
if ( 'switch_themes' === $cap ) {
diff --git a/class/class-mainwp-child-links-checker.php b/class/class-mainwp-child-links-checker.php
index 8a89ad6..70153ae 100644
--- a/class/class-mainwp-child-links-checker.php
+++ b/class/class-mainwp-child-links-checker.php
@@ -212,9 +212,15 @@ class MainWP_Child_Links_Checker {
} else {
$params['offset'] = $offset;
}
-
+
$link_data = $this->do_sync_links_data($params);
+ $total_sync = 0;
+ if ($offset){
+ $total_sync = $offset;
+ }
+ $total_sync += (is_array($link_data) ? count($link_data) : 0);
+
$information = array('links_data' => $link_data);
if ($first_sync) {
@@ -225,6 +231,8 @@ class MainWP_Child_Links_Checker {
$information['sync_offset'] = $offset + $max_results;
} else {
$information['last_sync'] = 1;
+ $information['total_sync'] = $total_sync;
+ $information['data'] = $this->get_count_links();
}
$information['result'] = 'success';
@@ -275,7 +283,7 @@ class MainWP_Child_Links_Checker {
'status_code',
'log'
);
- $return = '';
+ $return = array();
$blc_option = get_option( 'wsblc_options' );
@@ -366,7 +374,7 @@ class MainWP_Child_Links_Checker {
$return[] = $new_link;
}
} else {
- return '';
+ return array();
}
return $return;
diff --git a/class/class-mainwp-child-server-information.php b/class/class-mainwp-child-server-information.php
index 5a17347..ff1b45f 100644
--- a/class/class-mainwp-child-server-information.php
+++ b/class/class-mainwp-child-server-information.php
@@ -1490,7 +1490,7 @@ class MainWP_Child_Server_Information {
$lines[ $key ] = compact( 'time', 'error' );
}
- if ( count( $error_log ) > 1 ) {
+ if ( is_array( $error_log ) && count( $error_log ) > 1 ) {
uasort( $lines, array( __CLASS__, 'time_compare' ) );
$lines = array_slice( $lines, 0, $count );
@@ -1620,6 +1620,11 @@ class MainWP_Child_Server_Information {
}
public static function renderConnectionDetails() {
+ $branding_title = 'MainWP';
+ if ( MainWP_Child_Branding::is_branding() ) {
+ $branding_title = MainWP_Child_Branding::get_branding();
+ }
+
global $current_user;
$uniqueId = get_option('mainwp_child_uniqueId');
$details = array(
@@ -1641,7 +1646,7 @@ class MainWP_Child_Server_Information {
'uniqueid' => array(
'title' => __('Child unique security id', 'mainwp-child'),
'value' => !empty($uniqueId) ? $uniqueId : __('Leave the field blank', 'mainwp-child'),
- 'desc' => __('Child unique security id is not required, however, since you have enabled it, you need to add it to your MainWP dashboad.', 'mainwp-child')
+ 'desc' => sprintf(__('Child unique security id is not required, however, since you have enabled it, you need to add it to your %s dashboard.', 'mainwp-child') , stripslashes( $branding_title ) )
),
'verify_ssl' => array(
'title' => __('Verify certificate', 'mainwp-child'),
@@ -1661,7 +1666,7 @@ class MainWP_Child_Server_Information {
diff --git a/class/class-mainwp-child-staging.php b/class/class-mainwp-child-staging.php
index ba85913..1aa5040 100644
--- a/class/class-mainwp-child-staging.php
+++ b/class/class-mainwp-child-staging.php
@@ -106,6 +106,12 @@ class MainWP_Child_Staging {
case 'cancel_clone':
$information = $this->ajaxCancelClone();
break;
+ case 'staging_update':
+ $information = $this->ajaxUpdateProcess();
+ break;
+ case 'cancel_update':
+ $information = $this->ajaxCancelUpdate();
+ break;
}
}
MainWP_Helper::write( $information );
@@ -129,7 +135,9 @@ class MainWP_Child_Staging {
'wpSubDirectory',
'debugMode',
'unInstallOnDelete',
- 'checkDirectorySize'
+ 'checkDirectorySize',
+ 'optimizer',
+ 'loginSlug'
);
$save_fields = array();
@@ -188,9 +196,11 @@ class MainWP_Child_Staging {
}
public function ajaxStartClone() {
-
- $cloning = new WPStaging\Backend\Modules\Jobs\Cloning();
+ $this->url = ''; // to fix warning
+ $cloning = new WPStaging\Backend\Modules\Jobs\Cloning();
+
+
if( !$cloning->save() ) {
return;
}
@@ -280,7 +290,25 @@ class MainWP_Child_Staging {
$cancel = new WPStaging\Backend\Modules\Jobs\Cancel();
return $cancel->start();
}
+
+ public function ajaxCancelUpdate() {
+ $cancel = new WPStaging\Backend\Modules\Jobs\CancelUpdate();
+ return $cancel->start();
+ }
+ public function ajaxUpdateProcess() {
+
+ $cloning = new WPStaging\Backend\Modules\Jobs\Updating();
+
+ if( !$cloning->save() ) {
+ return;
+ }
+
+ ob_start();
+ require_once WPSTG_PLUGIN_DIR . "apps/Backend/views/clone/ajax/update.php";
+ $result = ob_get_clean();
+ return $result;
+ }
public function ajaxCheckFreeSpace() {
return $this->hasFreeDiskSpace();
diff --git a/class/class-mainwp-child-updraft-plus-backups.php b/class/class-mainwp-child-updraft-plus-backups.php
index aeaa77e..08056cd 100644
--- a/class/class-mainwp-child-updraft-plus-backups.php
+++ b/class/class-mainwp-child-updraft-plus-backups.php
@@ -217,7 +217,8 @@ class MainWP_Child_Updraft_Plus_Backups {
//'updraft_azure', // disabled
'updraft_googlecloud',
//'updraft_updraftvault',
- 'updraft_retain_extrarules'
+ 'updraft_retain_extrarules',
+ 'updraft_backblaze',
);
}
@@ -558,6 +559,16 @@ class MainWP_Child_Updraft_Plus_Backups {
}
}
UpdraftPlus_Options::update_updraft_option( 'updraft_sftp', $opts );
+ } else if ( 'updraft_backblaze' === $key ) {
+ $opts = UpdraftPlus_Options::get_updraft_option( 'updraft_backblaze' );
+ if (is_array($opts) && isset($opts['settings'])) {
+ $settings_key = key($opts['settings']);
+ $opts['settings'][$settings_key]['account_id'] = $settings[ $key ]['account_id'];
+ $opts['settings'][$settings_key]['key'] = $settings[ $key ]['key'];
+ $opts['settings'][$settings_key]['bucket_name'] = $this->replace_tokens( $settings[ $key ]['bucket_name'] );
+ $opts['settings'][$settings_key]['backup_path'] = $this->replace_tokens( $settings[ $key ]['backup_path'] );
+ UpdraftPlus_Options::update_updraft_option( $key, $opts );
+ }
} else {
UpdraftPlus_Options::update_updraft_option( $key, $settings[ $key ] );
}
diff --git a/class/class-mainwp-child-wordfence.php b/class/class-mainwp-child-wordfence.php
index be0b098..b88db89 100644
--- a/class/class-mainwp-child-wordfence.php
+++ b/class/class-mainwp-child-wordfence.php
@@ -141,6 +141,7 @@ class MainWP_Child_Wordfence {
'displayTopLevelBlocking',
'betaThreatDefenseFeed',
'scanType',
+ 'schedMode', // paid, if free then auto
'wafStatus',
'learningModeGracePeriodEnabled',
'learningModeGracePeriod'
@@ -233,7 +234,7 @@ class MainWP_Child_Wordfence {
case 'get_summary':
$information = $this->get_summary();
break;
- case 'load_issues':
+ case 'load_issues': // not used in from version 2.0 of WF ext
$information = $this->load_issues();
break;
case 'loadIssues':
@@ -437,7 +438,7 @@ class MainWP_Child_Wordfence {
'disableCodeExecutionUploads',
'disableCookies',
'actUpdateInterval',
- 'disableCookies',
+ 'other_bypassLitespeedNoabort',
'deleteTablesOnDeact',
'notification_updatesNeeded',
'notification_securityAlerts', // paid
@@ -552,7 +553,8 @@ class MainWP_Child_Wordfence {
'maxExecutionTime',
'scan_exclude',
'scan_include_extra',
- 'scanType'
+ 'scanType',
+ 'schedMode'
);
$diagnostics_opts = array(
'debugOn',
@@ -786,11 +788,18 @@ class MainWP_Child_Wordfence {
$i = new wfIssues();
$iss = $i->getIssues($offset, $limit);
$counts = $i->getIssueCounts();
- return array(
+ $return = array(
'issuesLists' => $iss,
'issueCounts' => $counts,
- 'lastScanCompleted' => wfConfig::get('lastScanCompleted')
- );
+ 'lastScanCompleted' => wfConfig::get('lastScanCompleted'),
+ 'apiKey' => wfConfig::get( 'apiKey' ),
+ 'isPaid' => wfConfig::get('isPaid'),
+ 'lastscan_timestamp' => MainWP_Child_Wordfence::Instance()->get_lastscan(),
+ 'todayAttBlocked' => MainWP_Child_Wordfence::Instance()->count_attacks_blocked(1),
+ 'weekAttBlocked' => MainWP_Child_Wordfence::Instance()->count_attacks_blocked(7),
+ 'monthAttBlocked' => MainWP_Child_Wordfence::Instance()->count_attacks_blocked(30),
+ );
+ return $return;
}
public function load_wafData() {
@@ -1096,7 +1105,7 @@ SQL
$opts = $settings;
// if saving then validate data
- if (isset($saving_opts['liveTraf_ignoreUsers'])) {
+ if (in_array('liveTraf_ignoreUsers', $saving_opts)) {
$validUsers = array();
$invalidUsers = array();
foreach ( explode( ',', $opts['liveTraf_ignoreUsers'] ) as $val ) {
@@ -1122,8 +1131,8 @@ SQL
}
}
- // if saving then validate data
- if (isset($saving_opts['other_WFNet'])) {
+ // if saving then validate data
+ if (in_array('other_WFNet', $saving_opts)) {
if ( ! $opts['other_WFNet'] ) {
$wfdb = new wfDB();
global $wpdb;
@@ -1133,35 +1142,63 @@ SQL
}
$regenerateHtaccess = false;
- // if saving then validate data
- if (isset($saving_opts['bannedURLs'])) {
+ // if saving then validate data
+ if (in_array('bannedURLs', $saving_opts)) {
if ( wfConfig::get( 'bannedURLs', false ) !== $opts['bannedURLs'] ) {
$regenerateHtaccess = true;
}
- }
-
+ }
+ //error_log(print_r($opts, true));
+// $to_fix_boolean_values = array(
+// 'scansEnabled_checkGSB',
+// 'spamvertizeCheck',
+// 'checkSpamIP',
+// 'scansEnabled_checkHowGetIPs',
+// 'scansEnabled_checkReadableConfig',
+// 'scansEnabled_suspectedFiles',
+// 'scansEnabled_core',
+// 'scansEnabled_themes',
+// 'scansEnabled_plugins',
+// 'scansEnabled_coreUnknown',
+// 'scansEnabled_malware',
+// 'scansEnabled_fileContents',
+// 'scansEnabled_fileContentsGSB',
+// 'scansEnabled_posts',
+// 'scansEnabled_comments',
+// 'scansEnabled_suspiciousOptions',
+// 'scansEnabled_oldVersions',
+// 'scansEnabled_suspiciousAdminUsers',
+// 'scansEnabled_passwds',
+// 'scansEnabled_diskSpace',
+// 'scansEnabled_dns',
+// 'other_scanOutside',
+// 'scansEnabled_scanImages',
+// 'scansEnabled_highSense',
+// 'scheduledScansEnabled',
+// 'lowResourceScansEnabled',
+// );
+//
// save the settings
foreach ( $opts as $key => $val ) {
// check saving section fields
if ( in_array( $key, $saving_opts ) ) {
if ( 'apiKey' == $key ) { //Don't save API key yet
continue;
- }
-
+ }
if (in_array( $key, self::$firewall_options_filter ) ) {
wfWAF::getInstance()->getStorageEngine()->setConfig($key, $val);
- } else {
- wfConfig::set( $key, $val ); // save it
+ } else {
+ wfConfig::set( $key, $val ); // save it
}
}
}
-
+
if ( $regenerateHtaccess && ( wfConfig::get('cacheType') == 'falcon' ) ) {
wfCache::addHtaccessCode('add');
}
- // if saving then validate data
- if (isset($saving_opts['autoUpdate'])) {
+ // if saving then validate data
+ if (in_array('autoUpdate', $saving_opts)) {
if ( '1' === $opts['autoUpdate'] ) {
wfConfig::enableAutoUpdate();
} else if ( '0' === $opts['autoUpdate'] ) {
@@ -1169,8 +1206,8 @@ SQL
}
}
- // if saving then validate data
- if (isset($saving_opts['disableCodeExecutionUploads'])) {
+ // if saving then validate data
+ if (in_array('disableCodeExecutionUploads', $saving_opts)) {
if (isset($opts['disableCodeExecutionUploads'])) {
try {
if ( $opts['disableCodeExecutionUploads'] ) {
@@ -1184,8 +1221,8 @@ SQL
}
}
- // if saving then validate data
- if (isset($saving_opts['email_summary_enabled'])) {
+ // if saving then validate data
+ if (in_array('email_summary_enabled', $saving_opts)) {
if (isset($opts['email_summary_enabled'])) {
if ( ! empty( $opts['email_summary_enabled'] ) ) {
wfConfig::set( 'email_summary_enabled', 1 );
@@ -1199,8 +1236,8 @@ SQL
}
}
- // if saving then validate data
- if (isset($saving_opts['scheduleScan'])) {
+ // if saving then validate data
+ if (in_array('scheduleScan', $saving_opts)) {
$sch = isset( $opts['scheduleScan'] ) ? $opts['scheduleScan'] : '';
if ( get_option( 'mainwp_child_wordfence_cron_time' ) !== $sch ) {
update_option( 'mainwp_child_wordfence_cron_time', $sch );
@@ -1219,7 +1256,7 @@ SQL
$result['paidKeyMsg'] = false;
// if saving then validate data
- if (isset($saving_opts['apiKey'])) {
+ if (in_array('apiKey', $saving_opts)) {
$apiKey = trim( $_POST['apiKey'] );
if ( ! $apiKey ) { //Empty API key (after trim above), then try to get one.
$api = new wfAPI( '', wfUtils::getWPVersion() );
@@ -1815,7 +1852,7 @@ SQL
if ( isset( $_POST['IP'] ) ) {
$IP = $_POST['IP'];
wfBlock::unblockIP( $IP );
- return array( 'ok' => 1 );
+ return array( 'success' => 1 );
}
}
diff --git a/class/class-mainwp-child.php b/class/class-mainwp-child.php
index 6feb262..169f66f 100644
--- a/class/class-mainwp-child.php
+++ b/class/class-mainwp-child.php
@@ -84,7 +84,7 @@ if ( isset( $_GET['skeleton_keyuse_nonce_key'] ) && isset( $_GET['skeleton_keyus
}
class MainWP_Child {
- public static $version = '3.4.6';
+ public static $version = '3.4.7';
private $update_version = '1.3';
private $callableFunctions = array(
@@ -176,7 +176,12 @@ class MainWP_Child {
public function __construct( $plugin_file ) {
$this->update();
$this->load_all_options();
- $this->filterFunction = create_function( '$a', 'if ($a == null) { return false; } if (is_object($a) && property_exists($a, "last_checked") && !property_exists($a, "checked")) return false; return $a;' );
+ $this->filterFunction = function($a) {
+ if ($a == null) { return false; }
+ if (is_object($a) && property_exists($a, "last_checked") && !property_exists($a, "checked"))
+ return false;
+ return $a;
+ };
$this->plugin_dir = dirname( $plugin_file );
$this->plugin_slug = plugin_basename( $plugin_file );
list ( $t1, $t2 ) = explode( '/', $this->plugin_slug );
@@ -186,7 +191,7 @@ class MainWP_Child {
$this->comments_and_clauses = '';
add_action( 'template_redirect', array( $this, 'template_redirect' ) );
add_action( 'init', array( &$this, 'check_login' ), 1 );
- add_action( 'init', array( &$this, 'parse_init' ), 33 );
+ add_action( 'init', array( &$this, 'parse_init' ), 9999 );
add_action( 'admin_menu', array( &$this, 'admin_menu' ) );
add_action( 'admin_init', array( &$this, 'admin_init' ) );
add_action( 'admin_head', array( &$this, 'admin_head' ) );
@@ -866,8 +871,7 @@ class MainWP_Child {
init_ajax();
}
@@ -3646,6 +3650,25 @@ class MainWP_Child {
$information['users'] = $this->get_all_users_int(500); // to fix
}
+ if (isset($_POST['primaryBackup']) && !empty($_POST['primaryBackup'])) {
+ $primary_bk = $_POST['primaryBackup'];
+ $information['primaryLasttimeBackup'] = MainWP_Helper::get_lasttime_backup($primary_bk);
+ }
+
+ $last_post = wp_get_recent_posts( array( 'numberposts' => absint( '1' ) ) );
+ if ( isset( $last_post[0] ) ) {
+ $last_post = $last_post[0];
+ }
+ if ( isset( $last_post ) && isset( $last_post['post_modified_gmt'] ) ) {
+ $information['last_post_gmt'] = strtotime( $last_post['post_modified_gmt'] );
+ }
+ $information['mainwpdir'] = ( MainWP_Helper::validateMainWPDir() ? 1 : - 1 );
+ $information['uniqueId'] = get_option( 'mainwp_child_uniqueId', '' );
+ $information['plugins_outdate_info'] = MainWP_Child_Plugins_Check::Instance()->get_plugins_outdate_info();
+ $information['themes_outdate_info'] = MainWP_Child_Themes_Check::Instance()->get_themes_outdate_info();
+
+ do_action('mainwp_child_site_stats');
+
if ( isset( $_POST['othersData'] ) ) {
$othersData = json_decode( stripslashes( $_POST['othersData'] ), true );
if ( ! is_array( $othersData ) ) {
@@ -3705,29 +3728,11 @@ class MainWP_Child {
if ( !empty( $creport_sync_data ) ) {
$information['syncClientReportData'] = $creport_sync_data;
}
- }
+ }
}
- if (isset($_POST['primaryBackup']) && !empty($_POST['primaryBackup'])) {
- $primary_bk = $_POST['primaryBackup'];
- $information['primaryLasttimeBackup'] = MainWP_Helper::get_lasttime_backup($primary_bk);
- }
-
- $last_post = wp_get_recent_posts( array( 'numberposts' => absint( '1' ) ) );
- if ( isset( $last_post[0] ) ) {
- $last_post = $last_post[0];
- }
- if ( isset( $last_post ) && isset( $last_post['post_modified_gmt'] ) ) {
- $information['last_post_gmt'] = strtotime( $last_post['post_modified_gmt'] );
- }
- $information['mainwpdir'] = ( MainWP_Helper::validateMainWPDir() ? 1 : - 1 );
- $information['uniqueId'] = get_option( 'mainwp_child_uniqueId', '' );
- $information['plugins_outdate_info'] = MainWP_Child_Plugins_Check::Instance()->get_plugins_outdate_info();
- $information['themes_outdate_info'] = MainWP_Child_Themes_Check::Instance()->get_themes_outdate_info();
-
- do_action('mainwp_child_site_stats');
-
+
if ( $exit ) {
MainWP_Helper::write( $information );
}
diff --git a/class/class-mainwp-helper.php b/class/class-mainwp-helper.php
index 61a53c2..1325569 100644
--- a/class/class-mainwp-helper.php
+++ b/class/class-mainwp-helper.php
@@ -509,7 +509,9 @@ class MainWP_Helper {
$not_allowed[] = '_edit_post_status';
$post_to_only_existing_categories = false;
- foreach ( $post_custom as $meta_key => $meta_values ) {
+
+ if (is_array($post_custom)) {
+ foreach ( $post_custom as $meta_key => $meta_values ) {
if ( ! in_array( $meta_key, $not_allowed ) ) {
foreach ( $meta_values as $meta_value ) {
if (strpos($meta_key, "_mainwp_spinner_") === 0)
@@ -536,7 +538,8 @@ class MainWP_Helper {
}
}
}
-
+ }
+
// yoast seo extension
if ( $seo_ext_activated ) {
$_seo_opengraph_image = isset( $post_custom[ WPSEO_Meta::$meta_prefix . 'opengraph-image' ] ) ? $post_custom[ WPSEO_Meta::$meta_prefix . 'opengraph-image' ] : array();
@@ -931,9 +934,11 @@ class MainWP_Helper {
return $str;
}
- public static function return_bytes( $val ) {
+ public static function return_bytes( $val ) {
$val = trim( $val );
- $last = strtolower( $val[ strlen( $val ) - 1 ] );
+ $last = $val[ strlen( $val ) - 1 ];
+ $val = rtrim($val, $last);
+ $last = strtolower( $last );
switch ( $last ) {
// The 'G' modifier is available since PHP 5.1.0
case 'g':
diff --git a/mainwp-child.php b/mainwp-child.php
index dc1d0ce..06f52f9 100644
--- a/mainwp-child.php
+++ b/mainwp-child.php
@@ -6,7 +6,7 @@
Author: MainWP
Author URI: https://mainwp.com
Text Domain: mainwp-child
- Version: 3.4.6
+ Version: 3.4.7
*/
if ( ( isset( $_REQUEST['heatmap'] ) && '1' === $_REQUEST['heatmap'] ) || ( isset( $_REQUEST['mainwpsignature'] ) && ( ! empty( $_REQUEST['mainwpsignature'] ) ) ) ) {
header( 'X-Frame-Options: ALLOWALL' );