From 171da7f164f956cd0088040dc5ad7a9decf33484 Mon Sep 17 00:00:00 2001 From: codefactor-io Date: Thu, 26 Mar 2020 19:51:58 +0000 Subject: [PATCH] [CodeFactor] Apply fixes --- class/class-mainwp-child-back-up-buddy.php | 286 +++---- .../class-mainwp-child-back-up-wordpress.php | 60 +- class/class-mainwp-child-back-wp-up.php | 6 +- class/class-mainwp-child-branding.php | 74 +- class/class-mainwp-child-ithemes-security.php | 144 ++-- class/class-mainwp-child-links-checker.php | 4 +- class/class-mainwp-child-pagespeed.php | 22 +- .../class-mainwp-child-server-information.php | 110 +-- class/class-mainwp-child-skeleton-key.php | 6 +- class/class-mainwp-child-staging.php | 368 ++++----- class/class-mainwp-child-themes-check.php | 2 +- class/class-mainwp-child-timecapsule.php | 390 ++++----- ...lass-mainwp-child-updraft-plus-backups.php | 186 ++--- ...ass-mainwp-child-vulnerability-checker.php | 116 +-- .../class-mainwp-child-woocommerce-status.php | 24 +- class/class-mainwp-child-wordfence.php | 472 +++++------ class/class-mainwp-child-wp-rocket.php | 14 +- ...ass-mainwp-child-wpvivid-backuprestore.php | 34 +- class/class-mainwp-child.php | 738 +++++++++--------- class/class-mainwp-clone.php | 34 +- class/class-mainwp-custom-post-type.php | 4 +- class/class-mainwp-helper.php | 320 ++++---- class/class-mainwp-security.php | 2 +- class/class-mainwp-wordpress-seo.php | 32 +- 24 files changed, 1724 insertions(+), 1724 deletions(-) diff --git a/class/class-mainwp-child-back-up-buddy.php b/class/class-mainwp-child-back-up-buddy.php index c5bdb32..afa2d78 100644 --- a/class/class-mainwp-child-back-up-buddy.php +++ b/class/class-mainwp-child-back-up-buddy.php @@ -139,75 +139,75 @@ class MainWP_Child_Back_Up_Buddy { $recentBackups_list = glob( backupbuddy_core::getLogDirectory() . 'fileoptions/*.txt' ); - foreach ( $recentBackups_list as $backup_fileoptions ) { + foreach ( $recentBackups_list as $backup_fileoptions ) { - $backup = new pb_backupbuddy_fileoptions( $backup_fileoptions, $read_only = true ); - if ( method_exists($backup, 'is_ok') && true !== ( $result = $backup->is_ok() ) ) { - continue; - } + $backup = new pb_backupbuddy_fileoptions( $backup_fileoptions, $read_only = true ); + if ( method_exists($backup, 'is_ok') && true !== ( $result = $backup->is_ok() ) ) { + continue; + } - $backup = &$backup->options; + $backup = &$backup->options; - if ( ! isset( $backup['serial'] ) || ( $backup['serial'] == '' ) ) { - continue; - } + if ( ! isset( $backup['serial'] ) || ( $backup['serial'] == '' ) ) { + continue; + } - if ( ( $backup['finish_time'] >= $backup['start_time'] ) && ( 0 != $backup['start_time'] ) ) { - // it is ok - } else { - continue; - } + if ( ( $backup['finish_time'] >= $backup['start_time'] ) && ( 0 != $backup['start_time'] ) ) { + // it is ok + } else { + continue; + } - $backupType = ''; - if ( isset( $backup['profile'] ) && isset( $backup['profile']['type'] ) ) { - if (true === MainWP_Helper::check_properties('pb_backupbuddy', 'format', true)) { - if (true === MainWP_Helper::check_methods(pb_backupbuddy::$format, array( 'prettify' ), true)) { - $backupType = pb_backupbuddy::$format->prettify( $backup['profile']['type'], $pretty_type ); - } - } - } else { - if (true === MainWP_Helper::check_methods('backupbuddy_core', array( 'pretty_backup_type', 'getBackupTypeFromFile' ), true)) { - $backupType = backupbuddy_core::pretty_backup_type( backupbuddy_core::getBackupTypeFromFile( $backup['archive_file'] ) ); - } - } + $backupType = ''; + if ( isset( $backup['profile'] ) && isset( $backup['profile']['type'] ) ) { + if (true === MainWP_Helper::check_properties('pb_backupbuddy', 'format', true)) { + if (true === MainWP_Helper::check_methods(pb_backupbuddy::$format, array( 'prettify' ), true)) { + $backupType = pb_backupbuddy::$format->prettify( $backup['profile']['type'], $pretty_type ); + } + } + } else { + if (true === MainWP_Helper::check_methods('backupbuddy_core', array( 'pretty_backup_type', 'getBackupTypeFromFile' ), true)) { + $backupType = backupbuddy_core::pretty_backup_type( backupbuddy_core::getBackupTypeFromFile( $backup['archive_file'] ) ); + } + } - if ( '' == $backupType ) { - $backupType = 'Unknown'; - } + if ( '' == $backupType ) { + $backupType = 'Unknown'; + } - $finish_time = $backup['finish_time']; - $message = 'BackupBuddy ' . $backupType . ' finished'; - if ( ! empty($finish_time)) { - do_action( 'mainwp_reports_backupbuddy_backup', $message, $backupType, $finish_time); - } - } + $finish_time = $backup['finish_time']; + $message = 'BackupBuddy ' . $backupType . ' finished'; + if ( ! empty($finish_time)) { + do_action( 'mainwp_reports_backupbuddy_backup', $message, $backupType, $finish_time); + } + } - if ( file_exists(pb_backupbuddy::plugin_path() . '/destinations/live/live_periodic.php') ) { - require_once pb_backupbuddy::plugin_path() . '/destinations/live/live_periodic.php'; + if ( file_exists(pb_backupbuddy::plugin_path() . '/destinations/live/live_periodic.php') ) { + require_once pb_backupbuddy::plugin_path() . '/destinations/live/live_periodic.php'; - MainWP_Helper::check_classes_exists(array( 'backupbuddy_live_periodic' )); - MainWP_Helper::check_methods('backupbuddy_live_periodic', 'get_stats'); + MainWP_Helper::check_classes_exists(array( 'backupbuddy_live_periodic' )); + MainWP_Helper::check_methods('backupbuddy_live_periodic', 'get_stats'); - $state = backupbuddy_live_periodic::get_stats(); - if (is_array($state) && isset($state['stats'])) { + $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); - } + 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); + } - } - } - } + } + } + } - } - } + } + } } catch ( Exception $e ) { } @@ -802,7 +802,7 @@ class MainWP_Child_Back_Up_Buddy { return $data; } catch (Exception $e) { - // not exit here + // not exit here } return false; @@ -1537,24 +1537,24 @@ class MainWP_Child_Back_Up_Buddy {

Log file:
@@ -2344,43 +2344,43 @@ class MainWP_Child_Back_Up_Buddy {
', __('none', 'it-l10n-backupbuddy' ),'
'; } -?> + if ( ! empty( $scan['SCAN']['SITE'] ) ) { + echo lined_array( $scan['SCAN']['SITE'] ); + } else { + echo '', __('none', 'it-l10n-backupbuddy' ),'
'; } + ?>
',__('none', 'it-l10n-backupbuddy' ),'
'; } -?> + if ( ! empty( $scan['SCAN']['DOMAIN'] ) ) { + echo lined_array( $scan['SCAN']['DOMAIN'] ); + } else { + echo '',__('none', 'it-l10n-backupbuddy' ),'
'; } + ?>
',__('none', 'it-l10n-backupbuddy' ),'
'; } -?> + if ( ! empty( $scan['SCAN']['IP'] ) ) { + echo lined_array( $scan['SCAN']['IP'] ); + } else { + echo '',__('none', 'it-l10n-backupbuddy' ),'
'; } + ?>
', __('none', 'it-l10n-backupbuddy' ), '
'; } -?> + if ( ! empty( $scan['SYSTEM']['NOTICE'] ) ) { + echo lined_array( $scan['SYSTEM']['NOTICE'] ); + } else { + echo '', __('none', 'it-l10n-backupbuddy' ), '
'; } + ?>
', __('none', 'it-l10n-backupbuddy' ), '
'; } -?> + if ( ! empty( $scan['SYSTEM']['INFO'] ) ) { + echo lined_array( $scan['SYSTEM']['INFO'] ); + } else { + echo '', __('none', 'it-l10n-backupbuddy' ), '
'; } + ?>
@@ -2391,43 +2391,43 @@ echo '', __('none', 'it-l10n-backupbuddy' ), '
'; }
', __('none', 'it-l10n-backupbuddy' ),'
'; } -?> + if ( ! empty( $scan['WEBAPP']['INFO'] ) ) { + echo lined_array( $scan['WEBAPP']['INFO'] ); + } else { + echo '', __('none', 'it-l10n-backupbuddy' ),'
'; } + ?>
',__('none', 'it-l10n-backupbuddy' ),'
'; } -?> + if ( ! empty( $scan['WEBAPP']['VERSION'] ) ) { + echo lined_array( $scan['WEBAPP']['VERSION'] ); + } else { + echo '',__('none', 'it-l10n-backupbuddy' ),'
'; } + ?>
', __('none', 'it-l10n-backupbuddy' ), '
'; } -?> + if ( ! empty( $scan['WEBAPP']['NOTICE'] ) ) { + echo lined_array( $scan['WEBAPP']['NOTICE'] ); + } else { + echo '', __('none', 'it-l10n-backupbuddy' ), '
'; } + ?>
',__('none', 'it-l10n-backupbuddy' ),'
'; } -?> + if ( ! empty( $scan['WEBAPP']['ERROR'] ) ) { + echo lined_array( $scan['WEBAPP']['ERROR'] ); + } else { + echo '',__('none', 'it-l10n-backupbuddy' ),'
'; } + ?>
', __('none', 'it-l10n-backupbuddy' ), '
'; } -?> + if ( ! empty( $scan['WEBAPP']['WARN'] ) ) { + echo lined_array( $scan['WEBAPP']['WARN'] ); + } else { + echo '', __('none', 'it-l10n-backupbuddy' ), '
'; } + ?>
@@ -2438,10 +2438,10 @@ echo '', __('none', 'it-l10n-backupbuddy' ), '
'; }
', __('none', 'it-l10n-backupbuddy' ), '
'; } -?> + echo lined_array( $scan['LINKS']['URL'] ); + } else { + echo '', __('none', 'it-l10n-backupbuddy' ), '
'; } + ?>
@@ -2451,10 +2451,10 @@ echo '', __('none', 'it-l10n-backupbuddy' ), '
'; }
', __('none', 'it-l10n-backupbuddy' ),'
'; } -?> + echo lined_array( $scan['LINKS']['JSLOCAL'] ); + } else { + echo '', __('none', 'it-l10n-backupbuddy' ),'
'; } + ?>
@@ -2464,10 +2464,10 @@ echo '', __('none', 'it-l10n-backupbuddy' ),'
'; }
', __('none', 'it-l10n-backupbuddy' ), '
'; } -?> + echo lined_array( $scan['LINKS']['JSEXTERNAL'] ); + } else { + echo '', __('none', 'it-l10n-backupbuddy' ), '
'; } + ?>
@@ -2477,10 +2477,10 @@ echo '', __('none', 'it-l10n-backupbuddy' ), '
'; }
', __('none', 'it-l10n-backupbuddy' ), '
'; } -?> + echo lined_array( $scan['LINKS']['IFRAME'] ); + } else { + echo '', __('none', 'it-l10n-backupbuddy' ), '
'; } + ?>
@@ -2490,10 +2490,10 @@ echo '', __('none', 'it-l10n-backupbuddy' ), '
'; }
', __('none', 'it-l10n-backupbuddy' ), '
'; } -?> + echo lined_array( $scan['BLACKLIST']['INFO'] ); + } else { + echo '', __('none', 'it-l10n-backupbuddy' ), '
'; } + ?>
diff --git a/class/class-mainwp-child-back-up-wordpress.php b/class/class-mainwp-child-back-up-wordpress.php index a20add2..19e24ea 100644 --- a/class/class-mainwp-child-back-up-wordpress.php +++ b/class/class-mainwp-child-back-up-wordpress.php @@ -44,7 +44,7 @@ class MainWP_Child_Back_Up_Wordpress { } if ( ! $this->is_plugin_installed) { -return; + return; } add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) ); @@ -204,10 +204,10 @@ return; // ok public function do_reports_log( $ext = '') { if ( $ext !== 'backupwordpress' ) { -return; + return; } if ( ! $this->is_plugin_installed) { -return; + return; } try { @@ -477,7 +477,7 @@ return; } } else { - ?> + ?> | - ', get_id() ); ?>, this);" class="download-action"> | - @@ -560,7 +560,7 @@ return; - + ?> @@ -695,7 +695,7 @@ return; } if ( $files ) { - ?> + ?> @@ -729,7 +729,7 @@ return; $parents = array_filter( explode( '/', str_replace( trailingslashit( $root_dir ), '', trailingslashit( dirname( $directory ) ) ) ) ); foreach ( $parents as $directory_basename ) { - ?> + ?> @@ -857,7 +857,7 @@ return; + ?> getBasename() ); ?> @@ -873,11 +873,11 @@ return; onclick="event.preventDefault(); mainwp_backupwp_directory_browse('getPathname()) ); ?>', this)">getBasename() ); ?> - + ?> getBasename() ); ?> @@ -887,7 +887,7 @@ return; getBasename() ); ?> - isDir() ) { //echo add_query_arg( 'hmbkp_directory_browse', urlencode( $file->getPathname() ) ); ?> @@ -895,7 +895,7 @@ return; href="#" onclick="event.preventDefault(); mainwp_backupwp_directory_browse('getPathname() ); ?>', this)">getBasename() ); ?> - @@ -944,7 +944,7 @@ return; -- - @@ -962,7 +962,7 @@ return; - isDir() ) : esc_html_e( 'Folder', 'backupwordpress' ); @@ -1136,16 +1136,16 @@ return; $exclude_rule_to_remove = trim($exclude_rule_to_remove); $exclude_rule_to_remove = trim($exclude_rule_to_remove, '/'); - if (empty($exclude_rule_to_remove)) { - continue; - } + if (empty($exclude_rule_to_remove)) { + continue; + } $excludes = $schedule->get_excludes(); - if (method_exists($excludes, 'get_user_excludes')) { - $schedule->set_excludes( array_diff( $excludes->get_user_excludes(), (array) $exclude_rule_to_remove ) ); - } else { - $schedule->set_excludes( array_diff( $excludes, $exclude_rule_to_remove ) ); - } + if (method_exists($excludes, 'get_user_excludes')) { + $schedule->set_excludes( array_diff( $excludes->get_user_excludes(), (array) $exclude_rule_to_remove ) ); + } else { + $schedule->set_excludes( array_diff( $excludes, $exclude_rule_to_remove ) ); + } $schedule->save(); } } @@ -1163,11 +1163,11 @@ return; return array( 'error' => 'Error: Schedule data' ); } -// $current_value = get_option( 'hmbkp_schedule_' . $sch_id ); -// if ( is_array( $current_value ) && isset( $current_value['excludes'] ) ) { -// // do not update 'excludes' value -// $options['excludes'] = $current_value['excludes']; -// } + // $current_value = get_option( 'hmbkp_schedule_' . $sch_id ); + // if ( is_array( $current_value ) && isset( $current_value['excludes'] ) ) { + // // do not update 'excludes' value + // $options['excludes'] = $current_value['excludes']; + // } $filter_opts = array( 'type', diff --git a/class/class-mainwp-child-back-wp-up.php b/class/class-mainwp-child-back-wp-up.php index 2fc9e00..09bfe88 100644 --- a/class/class-mainwp-child-back-wp-up.php +++ b/class/class-mainwp-child-back-wp-up.php @@ -240,7 +240,7 @@ class MainWP_Child_Back_WP_Up { // ok public function do_reports_log( $ext = '') { if ( $ext !== 'backwpup' ) { -return; + return; } if ( ! $this->is_backwpup_installed) { return; @@ -846,10 +846,10 @@ return; $dest_class->file_download( (int) $_GET['jobid'], $_GET['file'] ); } else { die( '-5' ); - } + } die(); - } + } protected function create_nonce_without_session( $action = - 1 ) { $user = wp_get_current_user(); diff --git a/class/class-mainwp-child-branding.php b/class/class-mainwp-child-branding.php index 90a1809..8252f53 100644 --- a/class/class-mainwp-child-branding.php +++ b/class/class-mainwp-child-branding.php @@ -187,22 +187,22 @@ class MainWP_Child_Branding { MainWP_Helper::update_option( 'mainwp_branding_preserve_branding', $settings['child_preserve_branding'], 'yes' ); // to compatible with old version of child report plugin MainWP_Helper::update_option( 'mainwp_branding_plugin_header', $header, 'yes' ); // to compatible -// MainWP_Helper::update_option( 'mainwp_branding_support_email', $settings['child_support_email'] ); -// MainWP_Helper::update_option( 'mainwp_branding_support_message', $settings['child_support_message'] ); -// MainWP_Helper::update_option( 'mainwp_branding_remove_restore', $settings['child_remove_restore'] ); -// MainWP_Helper::update_option( 'mainwp_branding_remove_setting', $settings['child_remove_setting'], 'yes' ); -// MainWP_Helper::update_option( 'mainwp_branding_remove_server_info', $settings['child_remove_server_info'] ); -// MainWP_Helper::update_option( 'mainwp_branding_remove_connection_detail', (isset($settings['child_remove_connection_detail']) ? $settings['child_remove_connection_detail'] : 0) ); -// MainWP_Helper::update_option( 'mainwp_branding_remove_wp_tools', $settings['child_remove_wp_tools'], 'yes' ); -// MainWP_Helper::update_option( 'mainwp_branding_remove_wp_setting', $settings['child_remove_wp_setting'], 'yes' ); -// MainWP_Helper::update_option( 'mainwp_branding_remove_permalink', $settings['child_remove_permalink'], 'yes' ); -// MainWP_Helper::update_option( 'mainwp_branding_button_contact_label', $settings['child_button_contact_label'], 'yes' ); -// MainWP_Helper::update_option( 'mainwp_branding_send_email_message', $settings['child_send_email_message'] ); -// MainWP_Helper::update_option( 'mainwp_branding_message_return_sender', $settings['child_message_return_sender'] ); -// MainWP_Helper::update_option( 'mainwp_branding_submit_button_title', $settings['child_submit_button_title'] ); -// if ( isset( $settings['child_disable_wp_branding'] ) && ( 'Y' === $settings['child_disable_wp_branding'] || 'N' === $settings['child_disable_wp_branding'] ) ) { -// MainWP_Helper::update_option( 'mainwp_branding_disable_wp_branding', $settings['child_disable_wp_branding'] ); -// } + // MainWP_Helper::update_option( 'mainwp_branding_support_email', $settings['child_support_email'] ); + // MainWP_Helper::update_option( 'mainwp_branding_support_message', $settings['child_support_message'] ); + // MainWP_Helper::update_option( 'mainwp_branding_remove_restore', $settings['child_remove_restore'] ); + // MainWP_Helper::update_option( 'mainwp_branding_remove_setting', $settings['child_remove_setting'], 'yes' ); + // MainWP_Helper::update_option( 'mainwp_branding_remove_server_info', $settings['child_remove_server_info'] ); + // MainWP_Helper::update_option( 'mainwp_branding_remove_connection_detail', (isset($settings['child_remove_connection_detail']) ? $settings['child_remove_connection_detail'] : 0) ); + // MainWP_Helper::update_option( 'mainwp_branding_remove_wp_tools', $settings['child_remove_wp_tools'], 'yes' ); + // MainWP_Helper::update_option( 'mainwp_branding_remove_wp_setting', $settings['child_remove_wp_setting'], 'yes' ); + // MainWP_Helper::update_option( 'mainwp_branding_remove_permalink', $settings['child_remove_permalink'], 'yes' ); + // MainWP_Helper::update_option( 'mainwp_branding_button_contact_label', $settings['child_button_contact_label'], 'yes' ); + // MainWP_Helper::update_option( 'mainwp_branding_send_email_message', $settings['child_send_email_message'] ); + // MainWP_Helper::update_option( 'mainwp_branding_message_return_sender', $settings['child_message_return_sender'] ); + // MainWP_Helper::update_option( 'mainwp_branding_submit_button_title', $settings['child_submit_button_title'] ); + // if ( isset( $settings['child_disable_wp_branding'] ) && ( 'Y' === $settings['child_disable_wp_branding'] || 'N' === $settings['child_disable_wp_branding'] ) ) { + // MainWP_Helper::update_option( 'mainwp_branding_disable_wp_branding', $settings['child_disable_wp_branding'] ); + // } $current_settings['preserve_branding'] = $settings['child_preserve_branding']; $current_settings['branding_header'] = $header; @@ -322,24 +322,24 @@ class MainWP_Child_Branding { } else { MainWP_Helper::update_option( 'mainwp_branding_child_hide', '' ); } -// -// if ( $settings['child_show_support_button'] && ! empty( $settings['child_support_email'] ) ) { -// MainWP_Helper::update_option( 'mainwp_branding_show_support', 'T' ); -// } else { -// MainWP_Helper::update_option( 'mainwp_branding_show_support', '' ); -// } + // + // if ( $settings['child_show_support_button'] && ! empty( $settings['child_support_email'] ) ) { + // MainWP_Helper::update_option( 'mainwp_branding_show_support', 'T' ); + // } else { + // MainWP_Helper::update_option( 'mainwp_branding_show_support', '' ); + // } -// if ( $settings['child_disable_change'] ) { -// MainWP_Helper::update_option( 'mainwp_branding_disable_change', 'T' ); -// } else { -// MainWP_Helper::update_option( 'mainwp_branding_disable_change', '' ); -// } + // if ( $settings['child_disable_change'] ) { + // MainWP_Helper::update_option( 'mainwp_branding_disable_change', 'T' ); + // } else { + // MainWP_Helper::update_option( 'mainwp_branding_disable_change', '' ); + // } -// if ( $settings['child_disable_switching_theme'] ) { -// MainWP_Helper::update_option( 'mainwp_branding_disable_switching_theme', 'T' ); -// } else { -// MainWP_Helper::update_option( 'mainwp_branding_disable_switching_theme', '' ); -// } + // if ( $settings['child_disable_switching_theme'] ) { + // MainWP_Helper::update_option( 'mainwp_branding_disable_switching_theme', 'T' ); + // } else { + // MainWP_Helper::update_option( 'mainwp_branding_disable_switching_theme', '' ); + // } $current_settings['hide'] = $settings['child_plugin_hide'] ? 'T' : ''; $current_settings['show_support'] = ( $settings['child_show_support_button'] && ! empty($settings['child_support_email']) ) ? 'T' : ''; @@ -426,15 +426,15 @@ class MainWP_Child_Branding { // 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; -} )); + 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); + 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'); } @@ -926,7 +926,7 @@ class MainWP_Child_Branding { value=""/> - ' . __( 'Your site is now using Network Brute Force Protection.', 'better-wp-security' ) . '

' ); + // ITSEC_Response::set_response( '

' . __( 'Your site is now using Network Brute Force Protection.', 'better-wp-security' ) . '

' ); } } if ($nbf_settings !== null) { @@ -409,15 +409,15 @@ class MainWP_Child_iThemes_Security { $key = ITSEC_Network_Brute_Force_Utilities::get_api_key( $settings['email'], $settings['updates_optin'] ); if ( is_wp_error( $key ) ) { return false; -// $this->set_can_save( false ); -// $this->add_error( $key ); + // $this->set_can_save( false ); + // $this->add_error( $key ); } else { $secret = ITSEC_Network_Brute_Force_Utilities::activate_api_key( $key ); if ( is_wp_error( $secret ) ) { return false; -// $this->set_can_save( false ); -// $this->add_error( $secret ); + // $this->set_can_save( false ); + // $this->add_error( $secret ); } else { $settings['api_key'] = $key; $settings['api_secret'] = $secret; @@ -634,8 +634,8 @@ class MainWP_Child_iThemes_Security { } $class = 'entry-row'; - ob_start(); - ?> + ob_start(); + ?>

@@ -668,7 +668,7 @@ class MainWP_Child_iThemes_Security {

- $html ); } @@ -723,13 +723,13 @@ class MainWP_Child_iThemes_Security { $msg .= __( 'Admin user ID already changes.', 'mainwp-child' ); } -// if ( $change_id ) { -// $user = get_user_by( 'login', $new_username ); -// if ( $user && 1 === (int) $user->ID ) { -// $return['result'] = 'CHILD_ADMIN'; -// return $return; -// } -// } + // if ( $change_id ) { + // $user = get_user_by( 'login', $new_username ); + // if ( $user && 1 === (int) $user->ID ) { + // $return['result'] = 'CHILD_ADMIN'; + // return $return; + // } + // } $admin_success = true; $return = array(); @@ -763,79 +763,79 @@ class MainWP_Child_iThemes_Security { //Get the full user object $user_object = get_user_by( 'id', '1' ); - if ( null !== $username && validate_username( $new_user ) && false === username_exists( $new_user ) ) { //there is a valid username to change + if ( null !== $username && validate_username( $new_user ) && false === username_exists( $new_user ) ) { //there is a valid username to change - if ( true === $id ) { //we're changing the id too so we'll set the username + if ( true === $id ) { //we're changing the id too so we'll set the username - $user_login = $new_user; + $user_login = $new_user; - } else { // we're only changing the username + } else { // we're only changing the username - //query main user table - $wpdb->query( 'UPDATE `' . $wpdb->users . "` SET user_login = '" . esc_sql( $new_user ) . "' WHERE user_login='admin';" ); + //query main user table + $wpdb->query( 'UPDATE `' . $wpdb->users . "` SET user_login = '" . esc_sql( $new_user ) . "' WHERE user_login='admin';" ); - if ( is_multisite() ) { //process sitemeta if we're in a multi-site situation - - $oldAdmins = $wpdb->get_var( 'SELECT meta_value FROM `' . $wpdb->sitemeta . "` WHERE meta_key = 'site_admins'" ); - $newAdmins = str_replace( '5:"admin"', strlen( $new_user ) . ':"' . esc_sql( $new_user ) . '"', $oldAdmins ); - $wpdb->query( $wpdb->prepare( 'UPDATE `' . $wpdb->sitemeta . "` SET meta_value = %s WHERE meta_key = 'site_admins'", $newAdmins ) ); - } - - wp_clear_auth_cookie(); - $itsec_files->release_file_lock( 'admin_user' ); - - return true; - - } - } elseif ( null !== $username ) { //username didn't validate - - $itsec_files->release_file_lock( 'admin_user' ); - - return false; - - } else { //only changing the id - - $user_login = $user_object->user_login; - - } - - if ( true === $id ) { //change the user id - - $wpdb->query( 'DELETE FROM `' . $wpdb->users . '` WHERE ID = 1;' ); - - $wpdb->insert( $wpdb->users, array( - 'user_login' => $user_login, - 'user_pass' => $user_object->user_pass, - 'user_nicename' => $user_object->user_nicename, - 'user_email' => $user_object->user_email, - 'user_url' => $user_object->user_url, - 'user_registered' => $user_object->user_registered, - 'user_activation_key' => $user_object->user_activation_key, - 'user_status' => $user_object->user_status, - 'display_name' => $user_object->display_name, - ) ); - - if ( is_multisite() && null !== $username && validate_username( $new_user ) ) { //process sitemeta if we're in a multi-site situation + if ( is_multisite() ) { //process sitemeta if we're in a multi-site situation $oldAdmins = $wpdb->get_var( 'SELECT meta_value FROM `' . $wpdb->sitemeta . "` WHERE meta_key = 'site_admins'" ); $newAdmins = str_replace( '5:"admin"', strlen( $new_user ) . ':"' . esc_sql( $new_user ) . '"', $oldAdmins ); - $wpdb->query( 'UPDATE `' . $wpdb->sitemeta . "` SET meta_value = '" . esc_sql( $newAdmins ) . "' WHERE meta_key = 'site_admins'" ); - + $wpdb->query( $wpdb->prepare( 'UPDATE `' . $wpdb->sitemeta . "` SET meta_value = %s WHERE meta_key = 'site_admins'", $newAdmins ) ); } - $new_user = $wpdb->insert_id; - - $wpdb->query( $wpdb->prepare( 'UPDATE `' . $wpdb->posts . '` SET post_author = %s WHERE post_author = 1;', $new_user ) ); - $wpdb->query( $wpdb->prepare( 'UPDATE `' . $wpdb->usermeta . '` SET user_id = %s WHERE user_id = 1;', $new_user ) ); - $wpdb->query( $wpdb->prepare( 'UPDATE `' . $wpdb->comments . '` SET user_id = %s WHERE user_id = 1;', $new_user ) ); - $wpdb->query( $wpdb->prepare( 'UPDATE `' . $wpdb->links . '` SET link_owner = %s WHERE link_owner = 1;', $new_user ) ); - wp_clear_auth_cookie(); $itsec_files->release_file_lock( 'admin_user' ); return true; } + } elseif ( null !== $username ) { //username didn't validate + + $itsec_files->release_file_lock( 'admin_user' ); + + return false; + + } else { //only changing the id + + $user_login = $user_object->user_login; + + } + + if ( true === $id ) { //change the user id + + $wpdb->query( 'DELETE FROM `' . $wpdb->users . '` WHERE ID = 1;' ); + + $wpdb->insert( $wpdb->users, array( + 'user_login' => $user_login, + 'user_pass' => $user_object->user_pass, + 'user_nicename' => $user_object->user_nicename, + 'user_email' => $user_object->user_email, + 'user_url' => $user_object->user_url, + 'user_registered' => $user_object->user_registered, + 'user_activation_key' => $user_object->user_activation_key, + 'user_status' => $user_object->user_status, + 'display_name' => $user_object->display_name, + ) ); + + if ( is_multisite() && null !== $username && validate_username( $new_user ) ) { //process sitemeta if we're in a multi-site situation + + $oldAdmins = $wpdb->get_var( 'SELECT meta_value FROM `' . $wpdb->sitemeta . "` WHERE meta_key = 'site_admins'" ); + $newAdmins = str_replace( '5:"admin"', strlen( $new_user ) . ':"' . esc_sql( $new_user ) . '"', $oldAdmins ); + $wpdb->query( 'UPDATE `' . $wpdb->sitemeta . "` SET meta_value = '" . esc_sql( $newAdmins ) . "' WHERE meta_key = 'site_admins'" ); + + } + + $new_user = $wpdb->insert_id; + + $wpdb->query( $wpdb->prepare( 'UPDATE `' . $wpdb->posts . '` SET post_author = %s WHERE post_author = 1;', $new_user ) ); + $wpdb->query( $wpdb->prepare( 'UPDATE `' . $wpdb->usermeta . '` SET user_id = %s WHERE user_id = 1;', $new_user ) ); + $wpdb->query( $wpdb->prepare( 'UPDATE `' . $wpdb->comments . '` SET user_id = %s WHERE user_id = 1;', $new_user ) ); + $wpdb->query( $wpdb->prepare( 'UPDATE `' . $wpdb->links . '` SET link_owner = %s WHERE link_owner = 1;', $new_user ) ); + + wp_clear_auth_cookie(); + $itsec_files->release_file_lock( 'admin_user' ); + + return true; + + } //} return false; diff --git a/class/class-mainwp-child-links-checker.php b/class/class-mainwp-child-links-checker.php index 86c253f..bc20009 100644 --- a/class/class-mainwp-child-links-checker.php +++ b/class/class-mainwp-child-links-checker.php @@ -232,7 +232,7 @@ class MainWP_Child_Links_Checker { function get_links_data() { if ( ! defined('BLC_DIRECTORY')) { -return; + return; } $file_path1 = BLC_DIRECTORY . '/includes/link-query.php'; @@ -293,7 +293,7 @@ return; function get_count_links() { if ( ! defined('BLC_DIRECTORY')) { -return; + return; } $file_path1 = BLC_DIRECTORY . '/includes/link-query.php'; diff --git a/class/class-mainwp-child-pagespeed.php b/class/class-mainwp-child-pagespeed.php index 39c8a45..31c3d2c 100644 --- a/class/class-mainwp-child-pagespeed.php +++ b/class/class-mainwp-child-pagespeed.php @@ -240,17 +240,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; } diff --git a/class/class-mainwp-child-server-information.php b/class/class-mainwp-child-server-information.php index 8157ee4..760fc51 100644 --- a/class/class-mainwp-child-server-information.php +++ b/class/class-mainwp-child-server-information.php @@ -19,11 +19,11 @@ class MainWP_Child_Server_Information { } if ( $_POST['what'] == 'warning' ) { - if (isset($_POST['warnings'])) { - $warnings = intval($_POST['warnings']); - } else { - $warnings = self::getWarnings(); - } + if (isset($_POST['warnings'])) { + $warnings = intval($_POST['warnings']); + } else { + $warnings = self::getWarnings(); + } $dismissWarnings['warnings'] = $warnings; } MainWP_Helper::update_option( 'mainwp_child_dismiss_warnings', $dismissWarnings ); @@ -476,8 +476,8 @@ class MainWP_Child_Server_Information {

+ self::render(); + ?>

get_branding_title(); - if ($branding_title == '') { - $branding_title = 'MainWP'; - } + public static function renderConnectionDetails() { + $branding_title = MainWP_Child_Branding::Instance()->get_branding_title(); + if ($branding_title == '') { + $branding_title = 'MainWP'; + } - global $current_user; - $uniqueId = get_option('mainwp_child_uniqueId'); - $details = array( - 'siteurl' => array( - 'title' => __('Site URL', 'mainwp-child'), - 'value' => get_bloginfo( 'url' ), - 'desc' => get_bloginfo( 'url' ), - ), - 'adminuser' => array( - 'title' => __('Administrator name', 'mainwp-child'), - 'value' => $current_user->user_login, - 'desc' => __('This is your Administrator username, however, you can use any existing Administrator username.', 'mainwp-child'), - ), - 'friendly_name' => array( - 'title' => __('Friendly site name', 'mainwp-child'), - 'value' => get_bloginfo( 'name' ), - 'desc' => __('For the friendly site name, you can use any name, this is just a suggestion.', 'mainwp-child'), - ), - 'uniqueid' => array( - 'title' => __('Child unique security id', 'mainwp-child'), - 'value' => ! empty($uniqueId) ? $uniqueId : __('Leave the field blank', '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'), - 'value' => __('Yes', 'mainwp-child'), - 'desc' => __('If there is an issue with SSL certificate on this site, try to set this option to No.', 'mainwp-child'), - ), - 'ssl_version' => array( - 'title' => __('SSL version', 'mainwp-child'), - 'value' => __('Auto Detect', 'mainwp-child'), - 'desc' => __('Auto Detect', 'mainwp-child'), - ), + global $current_user; + $uniqueId = get_option('mainwp_child_uniqueId'); + $details = array( + 'siteurl' => array( + 'title' => __('Site URL', 'mainwp-child'), + 'value' => get_bloginfo( 'url' ), + 'desc' => get_bloginfo( 'url' ), + ), + 'adminuser' => array( + 'title' => __('Administrator name', 'mainwp-child'), + 'value' => $current_user->user_login, + 'desc' => __('This is your Administrator username, however, you can use any existing Administrator username.', 'mainwp-child'), + ), + 'friendly_name' => array( + 'title' => __('Friendly site name', 'mainwp-child'), + 'value' => get_bloginfo( 'name' ), + 'desc' => __('For the friendly site name, you can use any name, this is just a suggestion.', 'mainwp-child'), + ), + 'uniqueid' => array( + 'title' => __('Child unique security id', 'mainwp-child'), + 'value' => ! empty($uniqueId) ? $uniqueId : __('Leave the field blank', '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'), + 'value' => __('Yes', 'mainwp-child'), + 'desc' => __('If there is an issue with SSL certificate on this site, try to set this option to No.', 'mainwp-child'), + ), + 'ssl_version' => array( + 'title' => __('SSL version', 'mainwp-child'), + 'value' => __('Auto Detect', 'mainwp-child'), + 'desc' => __('Auto Detect', 'mainwp-child'), + ), - ); + ); ?>

- +
- + - +
diff --git a/class/class-mainwp-child-skeleton-key.php b/class/class-mainwp-child-skeleton-key.php index fc40816..2d4a632 100644 --- a/class/class-mainwp-child-skeleton-key.php +++ b/class/class-mainwp-child-skeleton-key.php @@ -23,9 +23,9 @@ class MainWP_Child_Skeleton_Key { MainWP_Helper::write( array( 'error' => 'MainWP_Child fatal error : ' . $error['message'] . ' Line: ' . $error['line'] . ' File: ' . $error['file'] ) ); } // to fix issue double header in response -// else { -// MainWP_Helper::write( MainWP_Child_Skeleton_Key::$information ); -// } + // else { + // MainWP_Helper::write( MainWP_Child_Skeleton_Key::$information ); + // } } register_shutdown_function( 'mainwp_skeleton_key_handle_fatal_error' ); diff --git a/class/class-mainwp-child-staging.php b/class/class-mainwp-child-staging.php index 9783fff..2b11591 100644 --- a/class/class-mainwp-child-staging.php +++ b/class/class-mainwp-child-staging.php @@ -77,75 +77,75 @@ class MainWP_Child_Staging { } public function action() { - if ( ! $this->is_plugin_installed) { - MainWP_Helper::write( array( 'error' => 'Please install WP Staging plugin on child website' ) ); - } + if ( ! $this->is_plugin_installed) { + MainWP_Helper::write( array( 'error' => 'Please install WP Staging plugin on child website' ) ); + } - if ( ! class_exists( 'WPStaging\WPStaging' )) { - require_once WPSTG_PLUGIN_DIR . 'apps/Core/WPStaging.php'; - } + if ( ! class_exists( 'WPStaging\WPStaging' )) { + require_once WPSTG_PLUGIN_DIR . 'apps/Core/WPStaging.php'; + } \WPStaging\WPStaging::getInstance(); $information = array(); - if (get_option( 'mainwp_wp_staging_ext_enabled' ) !== 'Y') { - MainWP_Helper::update_option( 'mainwp_wp_staging_ext_enabled', 'Y', 'yes' ); - } + if (get_option( 'mainwp_wp_staging_ext_enabled' ) !== 'Y') { + MainWP_Helper::update_option( 'mainwp_wp_staging_ext_enabled', 'Y', 'yes' ); + } - if ( isset( $_POST['mwp_action'] ) ) { - switch ( $_POST['mwp_action'] ) { - case 'set_showhide': - $information = $this->set_showhide(); - break; - case 'save_settings': - $information = $this->save_settings(); - break; - case 'get_overview': - $information = $this->get_overview(); - break; - case 'get_scan': - $information = $this->get_scan(); - break; - case 'check_disk_space': - $information = $this->ajaxCheckFreeSpace(); - break; - case 'check_clone': - $information = $this->ajaxCheckCloneName(); - break; - case 'start_clone': - $information = $this->ajaxStartClone(); - break; - case 'clone_database': - $information = $this->ajaxCloneDatabase(); - break; - case 'prepare_directories': - $information = $this->ajaxPrepareDirectories(); - break; - case 'copy_files': - $information = $this->ajaxCopyFiles(); - break; - case 'replace_data': - $information = $this->ajaxReplaceData(); - break; - case 'clone_finish': - $information = $this->ajaxFinish(); - break; - case 'delete_confirmation': - $information = $this->ajaxDeleteConfirmation(); - break; - case 'delete_clone': - $information = $this->ajaxDeleteClone(); - break; - case 'cancel_clone': - $information = $this->ajaxCancelClone(); - break; - case 'staging_update': - $information = $this->ajaxUpdateProcess(); - break; - case 'cancel_update': - $information = $this->ajaxCancelUpdate(); - break; - } - } + if ( isset( $_POST['mwp_action'] ) ) { + switch ( $_POST['mwp_action'] ) { + case 'set_showhide': + $information = $this->set_showhide(); + break; + case 'save_settings': + $information = $this->save_settings(); + break; + case 'get_overview': + $information = $this->get_overview(); + break; + case 'get_scan': + $information = $this->get_scan(); + break; + case 'check_disk_space': + $information = $this->ajaxCheckFreeSpace(); + break; + case 'check_clone': + $information = $this->ajaxCheckCloneName(); + break; + case 'start_clone': + $information = $this->ajaxStartClone(); + break; + case 'clone_database': + $information = $this->ajaxCloneDatabase(); + break; + case 'prepare_directories': + $information = $this->ajaxPrepareDirectories(); + break; + case 'copy_files': + $information = $this->ajaxCopyFiles(); + break; + case 'replace_data': + $information = $this->ajaxReplaceData(); + break; + case 'clone_finish': + $information = $this->ajaxFinish(); + break; + case 'delete_confirmation': + $information = $this->ajaxDeleteConfirmation(); + break; + case 'delete_clone': + $information = $this->ajaxDeleteClone(); + break; + 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 ); } @@ -206,176 +206,176 @@ class MainWP_Child_Staging { 'prefix' => WPStaging\WPStaging::getTablePrefix(), ); return $return; - } + } public function ajaxCheckCloneName() { - $cloneName = sanitize_key( $_POST['cloneID'] ); - $cloneNameLength = strlen( $cloneName ); - $clones = get_option( 'wpstg_existing_clones_beta', array() ); + $cloneName = sanitize_key( $_POST['cloneID'] ); + $cloneNameLength = strlen( $cloneName ); + $clones = get_option( 'wpstg_existing_clones_beta', array() ); - // Check clone name length - if ( $cloneNameLength < 1 || $cloneNameLength > 16 ) { - echo array( - 'status' => 'failed', - 'message' => 'Clone name must be between 1 - 16 characters', - ); - } elseif ( array_key_exists( $cloneName, $clones ) ) { - return array( - 'status' => 'failed', - 'message' => 'Clone name is already in use, please choose an another clone name', - ); - } + // Check clone name length + if ( $cloneNameLength < 1 || $cloneNameLength > 16 ) { + echo array( + 'status' => 'failed', + 'message' => 'Clone name must be between 1 - 16 characters', + ); + } elseif ( array_key_exists( $cloneName, $clones ) ) { + return array( + 'status' => 'failed', + 'message' => 'Clone name is already in use, please choose an another clone name', + ); + } - return array( 'status' => 'success' ); - } + return array( 'status' => 'success' ); + } - public function ajaxStartClone() { + public function ajaxStartClone() { - $this->url = ''; // to fix warning - $cloning = new WPStaging\Backend\Modules\Jobs\Cloning(); + $this->url = ''; // to fix warning + $cloning = new WPStaging\Backend\Modules\Jobs\Cloning(); - if ( ! $cloning->save() ) { - return; - } + if ( ! $cloning->save() ) { + return; + } - ob_start(); - require_once WPSTG_PLUGIN_DIR . 'apps/Backend/views/clone/ajax/start.php'; - $result = ob_get_clean(); - return $result; - } + ob_start(); + require_once WPSTG_PLUGIN_DIR . 'apps/Backend/views/clone/ajax/start.php'; + $result = ob_get_clean(); + return $result; + } public function ajaxCloneDatabase() { - $cloning = new WPStaging\Backend\Modules\Jobs\Cloning(); + $cloning = new WPStaging\Backend\Modules\Jobs\Cloning(); - return $cloning->start(); - } + return $cloning->start(); + } - /** - * Ajax Prepare Directories (get listing of files) - */ - public function ajaxPrepareDirectories() { + /** + * Ajax Prepare Directories (get listing of files) + */ + public function ajaxPrepareDirectories() { - $cloning = new WPStaging\Backend\Modules\Jobs\Cloning(); + $cloning = new WPStaging\Backend\Modules\Jobs\Cloning(); - return $cloning->start(); - } + return $cloning->start(); + } - /** - * Ajax Clone Files - */ - public function ajaxCopyFiles() { + /** + * Ajax Clone Files + */ + public function ajaxCopyFiles() { - $cloning = new WPStaging\Backend\Modules\Jobs\Cloning(); + $cloning = new WPStaging\Backend\Modules\Jobs\Cloning(); - return $cloning->start(); - } + return $cloning->start(); + } - /** - * Ajax Replace Data - */ - public function ajaxReplaceData() { - $cloning = new WPStaging\Backend\Modules\Jobs\Cloning(); - return $cloning->start(); - } + /** + * Ajax Replace Data + */ + public function ajaxReplaceData() { + $cloning = new WPStaging\Backend\Modules\Jobs\Cloning(); + return $cloning->start(); + } - /** - * Ajax Finish - */ - public function ajaxFinish() { + /** + * Ajax Finish + */ + public function ajaxFinish() { - $cloning = new WPStaging\Backend\Modules\Jobs\Cloning(); - $this->url = ''; // to fix warning - $return = $cloning->start(); - $return->blogInfoName = get_bloginfo('name'); + $cloning = new WPStaging\Backend\Modules\Jobs\Cloning(); + $this->url = ''; // to fix warning + $return = $cloning->start(); + $return->blogInfoName = get_bloginfo('name'); - return $return; - } + return $return; + } - /** - * Ajax Delete Confirmation - */ - public function ajaxDeleteConfirmation() { + /** + * Ajax Delete Confirmation + */ + public function ajaxDeleteConfirmation() { - $delete = new WPStaging\Backend\Modules\Jobs\Delete(); - $delete->setData(); - $clone = $delete->getClone(); - $result = array( - 'clone' => $clone, - 'deleteTables' => $delete->getTables(), - ); - return $result; - } + $delete = new WPStaging\Backend\Modules\Jobs\Delete(); + $delete->setData(); + $clone = $delete->getClone(); + $result = array( + 'clone' => $clone, + 'deleteTables' => $delete->getTables(), + ); + return $result; + } - /** - * Delete clone - */ - public function ajaxDeleteClone() { + /** + * Delete clone + */ + public function ajaxDeleteClone() { - $delete = new WPStaging\Backend\Modules\Jobs\Delete(); - return $delete->start(); - } + $delete = new WPStaging\Backend\Modules\Jobs\Delete(); + return $delete->start(); + } - /** - * Delete clone - */ - public function ajaxCancelClone() { - $cancel = new WPStaging\Backend\Modules\Jobs\Cancel(); - return $cancel->start(); - } + /** + * Delete clone + */ + public function ajaxCancelClone() { + $cancel = new WPStaging\Backend\Modules\Jobs\Cancel(); + return $cancel->start(); + } public function ajaxCancelUpdate() { - $cancel = new WPStaging\Backend\Modules\Jobs\CancelUpdate(); - return $cancel->start(); - } + $cancel = new WPStaging\Backend\Modules\Jobs\CancelUpdate(); + return $cancel->start(); + } - public function ajaxUpdateProcess() { + public function ajaxUpdateProcess() { $cloning = new WPStaging\Backend\Modules\Jobs\Updating(); if ( ! $cloning->save() ) { - return; + 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(); + return $this->hasFreeDiskSpace(); } // from wp-staging plugin public function hasFreeDiskSpace() { - if ( ! function_exists( 'disk_free_space' ) ) { - return null; - } - $freeSpace = @disk_free_space( ABSPATH ); - if ( false === $freeSpace ) { - $data = array( - 'freespace' => false, - 'usedspace' => $this->formatSize($this->getDirectorySizeInclSubdirs(ABSPATH)), - ); - return $data; - } - $data = array( - 'freespace' => $this->formatSize($freeSpace), - 'usedspace' => $this->formatSize($this->getDirectorySizeInclSubdirs(ABSPATH)), - ); - return $data; - } + if ( ! function_exists( 'disk_free_space' ) ) { + return null; + } + $freeSpace = @disk_free_space( ABSPATH ); + if ( false === $freeSpace ) { + $data = array( + 'freespace' => false, + 'usedspace' => $this->formatSize($this->getDirectorySizeInclSubdirs(ABSPATH)), + ); + return $data; + } + $data = array( + 'freespace' => $this->formatSize($freeSpace), + 'usedspace' => $this->formatSize($this->getDirectorySizeInclSubdirs(ABSPATH)), + ); + return $data; + } // from wp-staging plugin function getDirectorySizeInclSubdirs( $dir ) { - $size = 0; - foreach ( glob( rtrim( $dir, '/' ) . '/*', GLOB_NOSORT ) as $each ) { - $size += is_file( $each ) ? filesize( $each ) : $this->getDirectorySizeInclSubdirs( $each ); - } - return $size; - } + $size = 0; + foreach ( glob( rtrim( $dir, '/' ) . '/*', GLOB_NOSORT ) as $each ) { + $size += is_file( $each ) ? filesize( $each ) : $this->getDirectorySizeInclSubdirs( $each ); + } + return $size; + } // from wp-staging plugin public function formatSize( $bytes, $precision = 2) { diff --git a/class/class-mainwp-child-themes-check.php b/class/class-mainwp-child-themes-check.php index a7cfc9f..547b22f 100644 --- a/class/class-mainwp-child-themes-check.php +++ b/class/class-mainwp-child-themes-check.php @@ -178,7 +178,7 @@ class MainWP_Child_Themes_Check { foreach ( $themes_to_scan as $slug => $v ) { if ( in_array( $slug, $avoid_themes ) ) { -continue; + continue; } $body = $this->try_get_response_body( $slug, false ); diff --git a/class/class-mainwp-child-timecapsule.php b/class/class-mainwp-child-timecapsule.php index a0fb9fa..4e95a07 100644 --- a/class/class-mainwp-child-timecapsule.php +++ b/class/class-mainwp-child-timecapsule.php @@ -40,9 +40,9 @@ class MainWP_Child_Timecapsule { public function init() { - if ( ! $this->is_plugin_installed) { + if ( ! $this->is_plugin_installed) { return; - } + } if ( get_option( 'mainwp_time_capsule_ext_enabled' ) !== 'Y' ) { return; @@ -60,16 +60,16 @@ class MainWP_Child_Timecapsule { public function action() { - if ( ! $this->is_plugin_installed) { - MainWP_Helper::write( array( 'error' => 'Please install WP Time Capsule plugin on child website' ) ); - } + if ( ! $this->is_plugin_installed) { + MainWP_Helper::write( array( 'error' => 'Please install WP Time Capsule plugin on child website' ) ); + } - try { - $this->require_files(); - } catch ( Exception $e) { - $error = $e->getMessage(); - MainWP_Helper::write( array( 'error' => $error ) ); - } + try { + $this->require_files(); + } catch ( Exception $e) { + $error = $e->getMessage(); + MainWP_Helper::write( array( 'error' => $error ) ); + } $information = array(); @@ -78,158 +78,158 @@ class MainWP_Child_Timecapsule { $is_user_logged_in = $options->get_option('is_user_logged_in'); $privileges_wptc = $options_helper->get_unserialized_privileges(); - if ( isset( $_POST['mwp_action'] ) ) { + if ( isset( $_POST['mwp_action'] ) ) { - if (( - $_POST['mwp_action'] == 'save_settings' || - $_POST['mwp_action'] == 'get_staging_details_wptc' || - $_POST['mwp_action'] == 'progress_wptc' - ) && ( ! $is_user_logged_in || ! $privileges_wptc ) - ) { - MainWP_Helper::write( array( 'error' => 'You are not login to your WP Time Capsule account.' ) ); - } + if (( + $_POST['mwp_action'] == 'save_settings' || + $_POST['mwp_action'] == 'get_staging_details_wptc' || + $_POST['mwp_action'] == 'progress_wptc' + ) && ( ! $is_user_logged_in || ! $privileges_wptc ) + ) { + MainWP_Helper::write( array( 'error' => 'You are not login to your WP Time Capsule account.' ) ); + } - switch ( $_POST['mwp_action'] ) { - case 'set_showhide': - $information = $this->set_showhide(); - break; - case 'get_root_files': - $information = $this->get_root_files(); - break; - case 'get_tables': - $information = $this->get_tables(); - break; - case 'exclude_file_list': - $information = $this->exclude_file_list(); - break; - case 'exclude_table_list': - $information = $this->exclude_table_list(); - break; - case 'include_table_list': - $information = $this->include_table_list(); - break; - case 'include_table_structure_only': - $information = $this->include_table_structure_only(); - break; - case 'include_file_list': - $information = $this->include_file_list(); - break; - case 'get_files_by_key': - $information = $this->get_files_by_key(); - break; - case 'wptc_login': - $information = $this->process_wptc_login(); - break; - case 'get_installed_plugins': - $information = $this->get_installed_plugins(); - break; - case 'get_installed_themes': - $information = $this->get_installed_themes(); - break; - case 'is_staging_need_request': - $information = $this->is_staging_need_request(); - break; - case 'get_staging_details_wptc': - $information = $this->get_staging_details_wptc(); - break; - case 'start_fresh_staging_wptc': - $information = $this->start_fresh_staging_wptc(); - break; - case 'get_staging_url_wptc': - $information = $this->get_staging_url_wptc(); - break; - case 'stop_staging_wptc': - $information = $this->stop_staging_wptc(); - break; - case 'continue_staging_wptc': - $information = $this->continue_staging_wptc(); - break; - case 'delete_staging_wptc': - $information = $this->delete_staging_wptc(); - break; - case 'copy_staging_wptc': - $information = $this->copy_staging_wptc(); - break; - case 'get_staging_current_status_key': - $information = $this->get_staging_current_status_key(); - break; - case 'wptc_sync_purchase': - $information = $this->wptc_sync_purchase(); - break; - case 'init_restore': - $information = $this->init_restore(); - break; - case 'save_settings': - $information = $this->save_settings_wptc(); - break; - case 'analyze_inc_exc': - $information = $this->analyze_inc_exc(); - break; - case 'get_enabled_plugins': - $information = $this->get_enabled_plugins(); - break; - case 'get_enabled_themes': - $information = $this->get_enabled_themes(); - break; - case 'get_system_info': - $information = $this->get_system_info(); - break; - case 'update_vulns_settings': - $information = $this->update_vulns_settings(); - break; - case 'start_fresh_backup': - $information = $this->start_fresh_backup_tc_callback_wptc(); - break; - case 'save_manual_backup_name': - $information = $this->save_manual_backup_name_wptc(); - break; - case 'progress_wptc': - $information = $this->progress_wptc(); - break; - case 'stop_fresh_backup': - $information = $this->stop_fresh_backup_tc_callback_wptc(); - break; - case 'wptc_cron_status': - $information = $this->wptc_cron_status(); - break; - case 'get_this_backups_html': - $information = $this->get_this_backups_html(); - break; - case 'start_restore_tc_wptc': - $information = $this->start_restore_tc_callback_wptc(); - break; - case 'get_sibling_files': - $information = $this->get_sibling_files_callback_wptc(); - break; - case 'get_logs_rows': - $information = $this->get_logs_rows(); - break; - case 'clear_logs': - $information = $this->clear_wptc_logs(); - break; - case 'send_issue_report': - $information = $this->send_issue_report(); - break; - case 'lazy_load_activity_log': - $information = $this->lazy_load_activity_log_wptc(); - break; - } - } + switch ( $_POST['mwp_action'] ) { + case 'set_showhide': + $information = $this->set_showhide(); + break; + case 'get_root_files': + $information = $this->get_root_files(); + break; + case 'get_tables': + $information = $this->get_tables(); + break; + case 'exclude_file_list': + $information = $this->exclude_file_list(); + break; + case 'exclude_table_list': + $information = $this->exclude_table_list(); + break; + case 'include_table_list': + $information = $this->include_table_list(); + break; + case 'include_table_structure_only': + $information = $this->include_table_structure_only(); + break; + case 'include_file_list': + $information = $this->include_file_list(); + break; + case 'get_files_by_key': + $information = $this->get_files_by_key(); + break; + case 'wptc_login': + $information = $this->process_wptc_login(); + break; + case 'get_installed_plugins': + $information = $this->get_installed_plugins(); + break; + case 'get_installed_themes': + $information = $this->get_installed_themes(); + break; + case 'is_staging_need_request': + $information = $this->is_staging_need_request(); + break; + case 'get_staging_details_wptc': + $information = $this->get_staging_details_wptc(); + break; + case 'start_fresh_staging_wptc': + $information = $this->start_fresh_staging_wptc(); + break; + case 'get_staging_url_wptc': + $information = $this->get_staging_url_wptc(); + break; + case 'stop_staging_wptc': + $information = $this->stop_staging_wptc(); + break; + case 'continue_staging_wptc': + $information = $this->continue_staging_wptc(); + break; + case 'delete_staging_wptc': + $information = $this->delete_staging_wptc(); + break; + case 'copy_staging_wptc': + $information = $this->copy_staging_wptc(); + break; + case 'get_staging_current_status_key': + $information = $this->get_staging_current_status_key(); + break; + case 'wptc_sync_purchase': + $information = $this->wptc_sync_purchase(); + break; + case 'init_restore': + $information = $this->init_restore(); + break; + case 'save_settings': + $information = $this->save_settings_wptc(); + break; + case 'analyze_inc_exc': + $information = $this->analyze_inc_exc(); + break; + case 'get_enabled_plugins': + $information = $this->get_enabled_plugins(); + break; + case 'get_enabled_themes': + $information = $this->get_enabled_themes(); + break; + case 'get_system_info': + $information = $this->get_system_info(); + break; + case 'update_vulns_settings': + $information = $this->update_vulns_settings(); + break; + case 'start_fresh_backup': + $information = $this->start_fresh_backup_tc_callback_wptc(); + break; + case 'save_manual_backup_name': + $information = $this->save_manual_backup_name_wptc(); + break; + case 'progress_wptc': + $information = $this->progress_wptc(); + break; + case 'stop_fresh_backup': + $information = $this->stop_fresh_backup_tc_callback_wptc(); + break; + case 'wptc_cron_status': + $information = $this->wptc_cron_status(); + break; + case 'get_this_backups_html': + $information = $this->get_this_backups_html(); + break; + case 'start_restore_tc_wptc': + $information = $this->start_restore_tc_callback_wptc(); + break; + case 'get_sibling_files': + $information = $this->get_sibling_files_callback_wptc(); + break; + case 'get_logs_rows': + $information = $this->get_logs_rows(); + break; + case 'clear_logs': + $information = $this->clear_wptc_logs(); + break; + case 'send_issue_report': + $information = $this->send_issue_report(); + break; + case 'lazy_load_activity_log': + $information = $this->lazy_load_activity_log_wptc(); + break; + } + } MainWP_Helper::write( $information ); } public function require_files() { - if ( ! class_exists('WPTC_Base_Factory') && defined('WPTC_PLUGIN_DIR') ) { - if ( MainWP_Helper::check_files_exists(WPTC_PLUGIN_DIR . 'Base/Factory.php') ) { - include_once WPTC_PLUGIN_DIR . 'Base/Factory.php'; - } - } - if ( ! class_exists('Wptc_Options_Helper') && defined('WPTC_PLUGIN_DIR') ) { - if ( MainWP_Helper::check_files_exists(WPTC_PLUGIN_DIR . 'Views/wptc-options-helper.php') ) { - include_once WPTC_PLUGIN_DIR . 'Views/wptc-options-helper.php'; - } - } + if ( ! class_exists('WPTC_Base_Factory') && defined('WPTC_PLUGIN_DIR') ) { + if ( MainWP_Helper::check_files_exists(WPTC_PLUGIN_DIR . 'Base/Factory.php') ) { + include_once WPTC_PLUGIN_DIR . 'Base/Factory.php'; + } + } + if ( ! class_exists('Wptc_Options_Helper') && defined('WPTC_PLUGIN_DIR') ) { + if ( MainWP_Helper::check_files_exists(WPTC_PLUGIN_DIR . 'Views/wptc-options-helper.php') ) { + include_once WPTC_PLUGIN_DIR . 'Views/wptc-options-helper.php'; + } + } } function set_showhide() { @@ -272,7 +272,7 @@ class MainWP_Child_Timecapsule { $backups_count = 0; if (is_array($all_backups)) { $formatted_backups = array(); - foreach ($all_backups as $key => $value) { + foreach ($all_backups as $key => $value) { $value_array = (array) $value; $formatted_backups[ $value_array['backupID'] ][] = $value_array; } @@ -414,31 +414,31 @@ class MainWP_Child_Timecapsule { } -function start_restore_tc_callback_wptc() { + function start_restore_tc_callback_wptc() { - if (apply_filters('is_restore_to_staging_wptc', '')) { - $request = apply_filters('get_restore_to_staging_request_wptc', ''); - } else { - $request = $_POST['data']; + if (apply_filters('is_restore_to_staging_wptc', '')) { + $request = apply_filters('get_restore_to_staging_request_wptc', ''); + } else { + $request = $_POST['data']; + } + + include_once WPTC_CLASSES_DIR . 'class-prepare-restore-bridge.php'; + + new WPTC_Prepare_Restore_Bridge($request); } - include_once WPTC_CLASSES_DIR . 'class-prepare-restore-bridge.php'; + function get_sibling_files_callback_wptc() { + //note that we are getting the ajax function data via $_POST. + $file_name = $_POST['data']['file_name']; + $file_name = wp_normalize_path($file_name); + $backup_id = $_POST['data']['backup_id']; + $recursive_count = $_POST['data']['recursive_count']; + // //getting the backups - new WPTC_Prepare_Restore_Bridge($request); -} - -function get_sibling_files_callback_wptc() { - //note that we are getting the ajax function data via $_POST. - $file_name = $_POST['data']['file_name']; - $file_name = wp_normalize_path($file_name); - $backup_id = $_POST['data']['backup_id']; - $recursive_count = $_POST['data']['recursive_count']; - // //getting the backups - - $processed_files = WPTC_Factory::get('processed-files'); - echo $processed_files->get_this_backups_html($backup_id, $file_name, $type = 'sibling', (int) $recursive_count); - die(); -} + $processed_files = WPTC_Factory::get('processed-files'); + echo $processed_files->get_this_backups_html($backup_id, $file_name, $type = 'sibling', (int) $recursive_count); + die(); + } function send_issue_report() { WPTC_Base_Factory::get('Wptc_App_Functions')->send_report(); @@ -458,26 +458,26 @@ function get_sibling_files_callback_wptc() { if (isset($_POST['type'])) { $type = $_POST['type']; switch ($type) { - case 'backups': - $query = 'SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE type LIKE '%backup%' AND show_user = 1 GROUP BY action_id"; + case 'backups': + $query = 'SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE type LIKE '%backup%' AND show_user = 1 GROUP BY action_id"; break; - case 'restores': - $query = 'SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE type LIKE 'restore%' GROUP BY action_id"; + case 'restores': + $query = 'SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE type LIKE 'restore%' GROUP BY action_id"; break; - case 'staging': - $query = 'SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE type LIKE 'staging%' GROUP BY action_id"; + case 'staging': + $query = 'SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE type LIKE 'staging%' GROUP BY action_id"; break; - case 'backup_and_update': - $query = 'SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE type LIKE 'backup_and_update%' GROUP BY action_id"; + case 'backup_and_update': + $query = 'SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE type LIKE 'backup_and_update%' GROUP BY action_id"; break; - case 'auto_update': - $query = 'SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE type LIKE 'auto_update%' GROUP BY action_id"; + case 'auto_update': + $query = 'SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE type LIKE 'auto_update%' GROUP BY action_id"; break; - case 'others': - $query = 'SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE type NOT LIKE 'restore%' AND type NOT LIKE 'backup%' AND show_user = 1"; + case 'others': + $query = 'SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE type NOT LIKE 'restore%' AND type NOT LIKE 'backup%' AND show_user = 1"; break; - default: - $query = 'SELECT * FROM ' . $wpdb->base_prefix . 'wptc_activity_log GROUP BY action_id UNION SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE action_id='' AND show_user = 1"; + default: + $query = 'SELECT * FROM ' . $wpdb->base_prefix . 'wptc_activity_log GROUP BY action_id UNION SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE action_id='' AND show_user = 1"; break; } } else { @@ -491,7 +491,7 @@ function get_sibling_files_callback_wptc() { $orderby = ! empty($_POST['orderby']) ? mysql_real_escape_string($_POST['orderby']) : 'id'; $order = ! empty($_POST['order']) ? mysql_real_escape_string($_POST['order']) : 'DESC'; if ( ! empty($orderby) & ! empty($order)) { -$query .= ' ORDER BY ' . $orderby . ' ' . $order;} + $query .= ' ORDER BY ' . $orderby . ' ' . $order;} /* -- Pagination parameters -- */ @@ -502,7 +502,7 @@ $query .= ' ORDER BY ' . $orderby . ' ' . $order;} //Which page is this? $paged = ! empty($_POST['paged']) ? $_POST['paged'] : ''; if (empty($paged) || ! is_numeric($paged) || $paged <= 0) { -$paged = 1;} //Page Number + $paged = 1;} //Page Number //How many pages do we have in total? $totalpages = ceil($totalitems / $perpage); //Total number of pages //adjust the query to take pagination into account @@ -712,7 +712,7 @@ $paged = 1;} //Page Number public function do_reports_log( $ext = '') { if ( $ext !== 'wptimecapsule' ) { -return; + return; } if ( ! $this->is_plugin_installed) { diff --git a/class/class-mainwp-child-updraft-plus-backups.php b/class/class-mainwp-child-updraft-plus-backups.php index 4c8a5fa..324ccf0 100644 --- a/class/class-mainwp-child-updraft-plus-backups.php +++ b/class/class-mainwp-child-updraft-plus-backups.php @@ -47,9 +47,9 @@ class MainWP_Child_Updraft_Plus_Backups { if (isset($last_backup['backup_time'])) { $backup_time = $last_backup['backup_time']; - if ($last_backup['success']) { + if ($last_backup['success']) { MainWP_Helper::update_lasttime_backup('updraftplus', $backup_time); - } + } } return $last_backup; } @@ -61,9 +61,9 @@ class MainWP_Child_Updraft_Plus_Backups { $with_hist = true; if ( version_compare( $info, '1.7', '>=' ) ) { $with_hist = false; - } + } $information['syncUpdraftData'] = $this->get_sync_data( $with_hist ); - } + } } if ( isset( $data['sync_Updraftvault_quota_text'] ) && $data['sync_Updraftvault_quota_text'] ) { if ( $this->is_plugin_installed ) { @@ -319,7 +319,7 @@ class MainWP_Child_Updraft_Plus_Backups { ); if ( is_wp_error( $result ) || ( false === $result ) ) { -return $result; + return $result; } $response = json_decode( $result['body'], true ); @@ -338,14 +338,14 @@ return $result; // Store it $vault_settings = UpdraftPlus_Options::get_updraft_option( 'updraft_updraftvault' ); if ( ! is_array( $vault_settings ) ) { -$vault_settings = array(); + $vault_settings = array(); } $vault_settings['email'] = $email; $vault_settings['token'] = (string) $response['token']; $vault_settings['quota'] = -1; unset( $vault_settings['last_config'] ); if ( isset($response['quota'] ) ) { -$vault_settings['quota'] = $response['quota']; + $vault_settings['quota'] = $response['quota']; } UpdraftPlus_Options::update_updraft_option( 'updraft_updraftvault', $vault_settings ); } elseif ( isset( $response['quota'] ) && ! $response['quota'] ) { @@ -400,7 +400,7 @@ $vault_settings['quota'] = $response['quota']; ); if ( ! empty( $vault_settings['token'] ) ) { -$post_body['token'] = (string) $vault_settings['token']; + $post_body['token'] = (string) $vault_settings['token']; } // Use SSL to prevent snooping @@ -444,75 +444,75 @@ $post_body['token'] = (string) $vault_settings['token']; if (isset($settings['is_general']) && ! empty($settings['is_general'])) { $opts['settings'][ $settings_key ]['folder'] = $this->replace_tokens($settings[ $key ]['folder']); } else { -// $opts['settings'][$settings_key]['appkey'] = $settings[ $key ]['appkey']; -// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret']; + // $opts['settings'][$settings_key]['appkey'] = $settings[ $key ]['appkey']; + // $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret']; $opts['settings'][ $settings_key ]['folder'] = $this->replace_tokens($settings[ $key ]['folder']); } } else { if (isset($settings['is_general']) && ! empty($settings['is_general'])) { $opts['folder'] = $this->replace_tokens($settings[ $key ]['folder']); } else { -// $opts['appkey'] = $settings[ $key ]['appkey']; -// $opts['secret'] = $settings[ $key ]['secret']; + // $opts['appkey'] = $settings[ $key ]['appkey']; + // $opts['secret'] = $settings[ $key ]['secret']; $opts['folder'] = $this->replace_tokens($settings[ $key ]['folder']); } } UpdraftPlus_Options::update_updraft_option( $key, $opts ); } elseif ( 'updraft_googledrive' === $key ) { // do not saving from dashboard -// $opts = UpdraftPlus_Options::get_updraft_option( 'updraft_googledrive' ); -// if (!is_array($opts)) -// $opts = array(); -// if(is_array($opts) && isset($opts['settings'])) { -// $settings_key = key($opts['settings']); -//// $opts['settings'][$settings_key]['clientid'] = $settings[ $key ]['clientid']; -//// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret']; -// $opts['settings'][$settings_key]['folder'] = $this->replace_tokens($settings[ $key ]['folder']); -// } else { -//// $opts['clientid'] = $settings[ $key ]['clientid']; -//// $opts['secret'] = $settings[ $key ]['secret']; -// $opts['folder'] = $this->replace_tokens($settings[ $key ]['folder']); -// } -// UpdraftPlus_Options::update_updraft_option( $key, $opts ); + // $opts = UpdraftPlus_Options::get_updraft_option( 'updraft_googledrive' ); + // if (!is_array($opts)) + // $opts = array(); + // if(is_array($opts) && isset($opts['settings'])) { + // $settings_key = key($opts['settings']); + //// $opts['settings'][$settings_key]['clientid'] = $settings[ $key ]['clientid']; + //// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret']; + // $opts['settings'][$settings_key]['folder'] = $this->replace_tokens($settings[ $key ]['folder']); + // } else { + //// $opts['clientid'] = $settings[ $key ]['clientid']; + //// $opts['secret'] = $settings[ $key ]['secret']; + // $opts['folder'] = $this->replace_tokens($settings[ $key ]['folder']); + // } + // UpdraftPlus_Options::update_updraft_option( $key, $opts ); } elseif ( 'updraft_googlecloud' === $key ) { // do not saving from dashboard -// $opts = UpdraftPlus_Options::get_updraft_option( $key ); -// if (!is_array($opts)) -// $opts = array(); -// if(is_array($opts) && isset($opts['settings'])) { -// $settings_key = key($opts['settings']); -//// $opts['settings'][$settings_key]['clientid'] = $settings[ $key ]['clientid']; -//// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret']; -//// $opts['settings'][$settings_key]['project_id'] = $settings[ $key ]['project_id']; -//// $opts['settings'][$settings_key]['bucket_path'] = $settings[ $key ]['bucket_path']; -// $opts['settings'][$settings_key]['storage_class'] = $settings[ $key ]['storage_class']; -// $opts['settings'][$settings_key]['bucket_location'] = $settings[ $key ]['bucket_location']; -// } else { -//// $opts['clientid'] = $settings[ $key ]['clientid']; -//// $opts['secret'] = $settings[ $key ]['secret']; -//// $opts['project_id'] = $settings[ $key ]['project_id']; -//// $opts['bucket_path'] = $settings[ $key ]['bucket_path']; -// $opts['storage_class'] = $settings[ $key ]['storage_class']; -// $opts['bucket_location'] = $settings[ $key ]['bucket_location']; -// } -// UpdraftPlus_Options::update_updraft_option( $key, $opts ); + // $opts = UpdraftPlus_Options::get_updraft_option( $key ); + // if (!is_array($opts)) + // $opts = array(); + // if(is_array($opts) && isset($opts['settings'])) { + // $settings_key = key($opts['settings']); + //// $opts['settings'][$settings_key]['clientid'] = $settings[ $key ]['clientid']; + //// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret']; + //// $opts['settings'][$settings_key]['project_id'] = $settings[ $key ]['project_id']; + //// $opts['settings'][$settings_key]['bucket_path'] = $settings[ $key ]['bucket_path']; + // $opts['settings'][$settings_key]['storage_class'] = $settings[ $key ]['storage_class']; + // $opts['settings'][$settings_key]['bucket_location'] = $settings[ $key ]['bucket_location']; + // } else { + //// $opts['clientid'] = $settings[ $key ]['clientid']; + //// $opts['secret'] = $settings[ $key ]['secret']; + //// $opts['project_id'] = $settings[ $key ]['project_id']; + //// $opts['bucket_path'] = $settings[ $key ]['bucket_path']; + // $opts['storage_class'] = $settings[ $key ]['storage_class']; + // $opts['bucket_location'] = $settings[ $key ]['bucket_location']; + // } + // UpdraftPlus_Options::update_updraft_option( $key, $opts ); } elseif ( 'updraft_onedrive' === $key ) { // do not saving from dashboard -// $opts = UpdraftPlus_Options::get_updraft_option( 'updraft_onedrive' ); -// if (!is_array($opts)) -// $opts = array(); -// if(is_array($opts) && isset($opts['settings'])) { -// $settings_key = key($opts['settings']); -//// $opts['settings'][$settings_key]['clientid'] = $settings[ $key ]['clientid']; -//// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret']; -// $opts['settings'][$settings_key]['folder'] = $this->replace_tokens($settings[ $key ]['folder']); -// } else { -//// $opts['clientid'] = $settings[ $key ]['clientid']; -//// $opts['secret'] = $settings[ $key ]['secret']; -// $opts['folder'] = $this->replace_tokens($settings[ $key ]['folder']); -// } -// -// UpdraftPlus_Options::update_updraft_option( $key, $opts ); + // $opts = UpdraftPlus_Options::get_updraft_option( 'updraft_onedrive' ); + // if (!is_array($opts)) + // $opts = array(); + // if(is_array($opts) && isset($opts['settings'])) { + // $settings_key = key($opts['settings']); + //// $opts['settings'][$settings_key]['clientid'] = $settings[ $key ]['clientid']; + //// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret']; + // $opts['settings'][$settings_key]['folder'] = $this->replace_tokens($settings[ $key ]['folder']); + // } else { + //// $opts['clientid'] = $settings[ $key ]['clientid']; + //// $opts['secret'] = $settings[ $key ]['secret']; + // $opts['folder'] = $this->replace_tokens($settings[ $key ]['folder']); + // } + // + // UpdraftPlus_Options::update_updraft_option( $key, $opts ); } elseif ( 'updraft_email' === $key ) { $value = $settings[ $key ]; // free version @@ -729,7 +729,7 @@ $post_body['token'] = (string) $vault_settings['token']; function addons_connect() { if ( ! defined( 'UDADDONS2_SLUG' ) ) { if (is_file(UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php')) { -require_once UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php'; + require_once UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php'; } if ( ! defined( 'UDADDONS2_SLUG' ) ) { return array( 'error' => 'NO_PREMIUM' ); @@ -990,9 +990,9 @@ require_once UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php'; // //echo htmlspecialchars(__('OK. You should soon see activity in the "Last log message" field below.','updraftplus'))."
".__('Nothing happening? Follow this link for help.','updraftplus')."
"; // $updraftplus->log("A backup run has been scheduled"); // } -// $out = array( 'result' => 'OK' ); -// -// return $out; + // $out = array( 'result' => 'OK' ); + // + // return $out; } function activejobs_list() { @@ -1169,7 +1169,7 @@ require_once UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php'; // to fix performance issue if ( $with_hist ) { - $out['updraft_historystatus'] = $bh['h']; + $out['updraft_historystatus'] = $bh['h']; } $out['updraft_count_backups'] = $bh['c']; @@ -1194,7 +1194,7 @@ require_once UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php'; $next_scheduled_backup_gmt = gmdate('Y-m-d H:i:s', $next_scheduled_backup); // Convert to blog time zone $next_scheduled_backup = get_date_from_gmt($next_scheduled_backup_gmt, 'D, F j, Y H:i'); -// $next_scheduled_backup = date_i18n('D, F j, Y H:i', $next_scheduled_backup); + // $next_scheduled_backup = date_i18n('D, F j, Y H:i', $next_scheduled_backup); } else { $next_scheduled_backup = __('Nothing currently scheduled', 'updraftplus'); $files_not_scheduled = true; @@ -1215,7 +1215,7 @@ require_once UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php'; $next_scheduled_backup_database_gmt = gmdate('Y-m-d H:i:s', $next_scheduled_backup_database); // Convert to blog time zone $next_scheduled_backup_database = get_date_from_gmt($next_scheduled_backup_database_gmt, 'D, F j, Y H:i'); -// $next_scheduled_backup_database = date_i18n('D, F j, Y H:i', $next_scheduled_backup_database); + // $next_scheduled_backup_database = date_i18n('D, F j, Y H:i', $next_scheduled_backup_database); } else { $next_scheduled_backup_database = __('Nothing currently scheduled', 'updraftplus'); $database_not_scheduled = true; @@ -1242,8 +1242,8 @@ require_once UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php'; '; - 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; @@ -1863,7 +1863,7 @@ require_once UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php'; @set_time_limit( 900 ); global $wp_filesystem, $updraftplus; -// $backup_history = UpdraftPlus_Options::get_updraft_option( 'updraft_backup_history' ); + // $backup_history = UpdraftPlus_Options::get_updraft_option( 'updraft_backup_history' ); $backup_history = UpdraftPlus_Backup_History::get_history(); if ( ! is_array( $backup_history[ $timestamp ] ) ) { echo wp_kses_post( '

' . esc_html__( 'This backup does not exist in the backup history - restoration aborted. Timestamp:', 'updraftplus' ) . " $timestamp


" ); @@ -2615,14 +2615,14 @@ require_once UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php'; $backup = UpdraftPlus_Backup_History::get_history($timestamp); if ( ! isset($backup['nonce']) || ! isset($backup['db'])) { -return array( $mess, $warn, $err, $info ); + return array( $mess, $warn, $err, $info ); } $db_file = ( is_string($backup['db']) ) ? $updraft_dir . '/' . $backup['db'] : $updraft_dir . '/' . $backup['db'][0]; } if ( ! is_readable($db_file)) { -return array( $mess, $warn, $err, $info ); + return array( $mess, $warn, $err, $info ); } // Encrypted - decrypt it @@ -2768,7 +2768,7 @@ return array( $mess, $warn, $err, $info ); $migration_warning = true; $powarn = apply_filters('updraftplus_dbscan_urlchange', '' . __('This backup set is from a different site - this is not a restoration, but a migration. You need the Migrator add-on in order to make this work.', 'updraftplus') . '', $old_home, $res); if ( ! empty($powarn)) { -$warn[] = $powarn; + $warn[] = $powarn; } } } elseif ( ! isset($info['created_by_version']) && preg_match('/^\# Created by UpdraftPlus version ([\d\.]+)/', $buffer, $matches)) { @@ -2776,7 +2776,7 @@ $warn[] = $powarn; } elseif ('' == $old_wp_version && preg_match('/^\# WordPress Version: ([0-9]+(\.[0-9]+)+)(-[-a-z0-9]+,)?(.*)$/', $buffer, $matches)) { $old_wp_version = $matches[1]; if ( ! empty($matches[3])) { -$old_wp_version .= substr($matches[3], 0, strlen($matches[3]) - 1); + $old_wp_version .= substr($matches[3], 0, strlen($matches[3]) - 1); } if (version_compare($old_wp_version, $wp_version, '>')) { // $mess[] = sprintf(__('%s version: %s', 'updraftplus'), 'WordPress', $old_wp_version); @@ -2792,7 +2792,7 @@ $old_wp_version .= substr($matches[3], 0, strlen($matches[3]) - 1); } } elseif ('' == $old_table_prefix && ( preg_match('/^\# Table prefix: (\S+)$/', $buffer, $matches) || preg_match('/^-- Table prefix: (\S+)$/i', $buffer, $matches) )) { $old_table_prefix = $matches[1]; -// echo ''.__('Old table prefix:', 'updraftplus').' '.htmlspecialchars($old_table_prefix).'
'; + // echo ''.__('Old table prefix:', 'updraftplus').' '.htmlspecialchars($old_table_prefix).'
'; } elseif (empty($info['label']) && preg_match('/^\# Label: (.*)$/', $buffer, $matches)) { $info['label'] = $matches[1]; $mess[] = __('Backup label:', 'updraftplus') . ' ' . htmlspecialchars($info['label']); @@ -2822,7 +2822,7 @@ $old_wp_version .= substr($matches[3], 0, strlen($matches[3]) - 1); if ('multisite' == $key) { $info['multisite'] = $val ? true : false; if ($val) { -$mess[] = '' . __('Site information:', 'updraftplus') . ' ' . 'backup is of a WordPress Network'; + $mess[] = '' . __('Site information:', 'updraftplus') . ' ' . 'backup is of a WordPress Network'; } } $old_siteinfo[ $key ] = $val; @@ -2921,7 +2921,7 @@ $mess[] = '' . __('Site information:', 'updraftplus') . ' ' . ' } $charset_select_html .= ''; if (empty($info['addui'])) { -$info['addui'] = ''; + $info['addui'] = ''; } $info['addui'] .= $charset_select_html; } @@ -3008,7 +3008,7 @@ $info['addui'] = ''; CREATE TABLE $wpdb->signups ( */ if ( ! isset($skipped_tables)) { -$skipped_tables = array(); + $skipped_tables = array(); } $missing_tables = array(); if ($old_table_prefix) { @@ -3179,17 +3179,17 @@ $skipped_tables = array(); $non = $backup['nonce']; -// $rawbackup = "

$esc_pretty_date ($key)

" . esc_attr( print_r( $backup, true ) ); -// if ( ! empty( $non ) ) { -// $jd = $updraftplus->jobdata_getarray( $non ); -// if ( ! empty( $jd ) && is_array( $jd ) ) { -// $rawbackup .= '

' . esc_attr( print_r( $jd, true ) ); -// } -// } -// $rawbackup .= '

'; + // $rawbackup = "

$esc_pretty_date ($key)

" . esc_attr( print_r( $backup, true ) ); + // if ( ! empty( $non ) ) { + // $jd = $updraftplus->jobdata_getarray( $non ); + // if ( ! empty( $jd ) && is_array( $jd ) ) { + // $rawbackup .= '

' . esc_attr( print_r( $jd, true ) ); + // } + // } + // $rawbackup .= '

'; - // 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 ); @@ -3199,16 +3199,16 @@ $skipped_tables = array(); $service_title = ''; if ( ! isset($backup['service'])) { -$backup['service'] = array(); + $backup['service'] = array(); } if ( ! is_array($backup['service'])) { -$backup['service'] = 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'; + // $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 ]; @@ -3235,7 +3235,7 @@ ENDHERE; if ( class_exists( 'UpdraftPlus_Encryption')) { if ( method_exists('UpdraftPlus_Encryption', 'is_file_encrypted')) { if (UpdraftPlus_Encryption::is_file_encrypted($db)) { -$entities .= '/dbcrypted=1/'; + $entities .= '/dbcrypted=1/'; } } } elseif ( method_exists($updraftplus, 'is_db_encrypted') && $updraftplus->is_db_encrypted( $db ) ) { diff --git a/class/class-mainwp-child-vulnerability-checker.php b/class/class-mainwp-child-vulnerability-checker.php index ec9b170..8830422 100644 --- a/class/class-mainwp-child-vulnerability-checker.php +++ b/class/class-mainwp-child-vulnerability-checker.php @@ -23,9 +23,9 @@ class MainWP_Child_Vulnerability_Checker { private $wpvulndb_token = false; static function Instance() { - if ( null === self::$instance ) { - self::$instance = new MainWP_Child_Vulnerability_Checker(); - } + if ( null === self::$instance ) { + self::$instance = new MainWP_Child_Vulnerability_Checker(); + } return self::$instance; } @@ -36,15 +36,15 @@ class MainWP_Child_Vulnerability_Checker { public function action() { $information = array(); - if ( ! empty( $this->wpvulndb_token ) ) { - if ( isset( $_POST['mwp_action'] ) ) { - switch ( $_POST['mwp_action'] ) { - case 'vulner_recheck': - $information = $this->vulner_recheck(); - break; - } + if ( ! empty( $this->wpvulndb_token ) ) { + if ( isset( $_POST['mwp_action'] ) ) { + switch ( $_POST['mwp_action'] ) { + case 'vulner_recheck': + $information = $this->vulner_recheck(); + break; } } + } MainWP_Helper::write( $information ); } @@ -66,67 +66,67 @@ class MainWP_Child_Vulnerability_Checker { $result = array(); $active_plugins = get_option('active_plugins'); - if ( ! empty($active_plugins) ) { - foreach ($active_plugins as $plug) { + if ( ! empty($active_plugins) ) { + foreach ($active_plugins as $plug) { - $plugin_file = WP_CONTENT_DIR . '/plugins/' . $plug; - $plugin_info = get_plugin_data($plugin_file); - $plugin_version = isset($plugin_info['Version']) ? $plugin_info['Version'] : ''; - $string = explode('/', $plug); - $plug_vuln = get_transient('mainwp_vulnche_trans_plug_' . $string[0]); - if (false === $plug_vuln || $force) { - $plug_vuln = $this->vulnche_get_content( $this->wpvulndb_api . 'plugins/' . $string[0]); - set_transient('mainwp_vulnche_trans_plug_' . $string[0], $plug_vuln, 1 * DAY_IN_SECONDS); - } - if ($plug_vuln) { - $plug_vuln = json_decode($plug_vuln, true); - $plug_vuln_filter = $plug_vuln; + $plugin_file = WP_CONTENT_DIR . '/plugins/' . $plug; + $plugin_info = get_plugin_data($plugin_file); + $plugin_version = isset($plugin_info['Version']) ? $plugin_info['Version'] : ''; + $string = explode('/', $plug); + $plug_vuln = get_transient('mainwp_vulnche_trans_plug_' . $string[0]); + if (false === $plug_vuln || $force) { + $plug_vuln = $this->vulnche_get_content( $this->wpvulndb_api . 'plugins/' . $string[0]); + set_transient('mainwp_vulnche_trans_plug_' . $string[0], $plug_vuln, 1 * DAY_IN_SECONDS); + } + if ($plug_vuln) { + $plug_vuln = json_decode($plug_vuln, true); + $plug_vuln_filter = $plug_vuln; - foreach ($plug_vuln as $slug => $pl_data) { - if (isset($pl_data['vulnerabilities']) && count($pl_data['vulnerabilities']) > 0) { - $plug_vulner_data = array(); - foreach ($pl_data['vulnerabilities'] as $vuln_data) { - if ( isset($vuln_data['fixed_in']) && version_compare( $plugin_version, $vuln_data['fixed_in'] ) >= 0 ) { - continue; - } - $plug_vulner_data[] = $vuln_data; - } + foreach ($plug_vuln as $slug => $pl_data) { + if (isset($pl_data['vulnerabilities']) && count($pl_data['vulnerabilities']) > 0) { + $plug_vulner_data = array(); + foreach ($pl_data['vulnerabilities'] as $vuln_data) { + if ( isset($vuln_data['fixed_in']) && version_compare( $plugin_version, $vuln_data['fixed_in'] ) >= 0 ) { + continue; + } + $plug_vulner_data[] = $vuln_data; + } - if (count($plug_vulner_data) == 0) { - unset($plug_vuln_filter[ $slug ]); - } else { - $plug_vuln_filter[ $slug ]['vulnerabilities'] = $plug_vulner_data; - $plug_vuln_filter[ $slug ]['detected_version'] = $plugin_version; - $plug_vuln_filter[ $slug ]['plugin_slug'] = $plug; - } + if (count($plug_vulner_data) == 0) { + unset($plug_vuln_filter[ $slug ]); + } else { + $plug_vuln_filter[ $slug ]['vulnerabilities'] = $plug_vulner_data; + $plug_vuln_filter[ $slug ]['detected_version'] = $plugin_version; + $plug_vuln_filter[ $slug ]['plugin_slug'] = $plug; + } - } else { - unset($plug_vuln_filter[ $slug ]); - } + } else { + unset($plug_vuln_filter[ $slug ]); + } - } + } - if (count($plug_vuln_filter) == 0) { - continue; - } - $plug_vuln = json_encode($plug_vuln_filter); + if (count($plug_vuln_filter) == 0) { + continue; + } + $plug_vuln = json_encode($plug_vuln_filter); - } else { - continue; - } - $result[ $plug ] = $plug_vuln; - } - } + } else { + continue; + } + $result[ $plug ] = $plug_vuln; + } + } return $result; } function check_wp( $force = false) { $wp_vuln = get_transient('mainwp_vulnche_trans_wp_json'); $wp_version = str_replace('.', '', get_bloginfo('version')); - if (false === $wp_vuln || $force) { - $wp_vuln = $this->vulnche_get_content( $this->wpvulndb_api . 'wordpresses/' . $wp_version); - set_transient('mainwp_vulnche_trans_wp_json', $wp_vuln, 1 * DAY_IN_SECONDS); - } + if (false === $wp_vuln || $force) { + $wp_vuln = $this->vulnche_get_content( $this->wpvulndb_api . 'wordpresses/' . $wp_version); + set_transient('mainwp_vulnche_trans_wp_json', $wp_vuln, 1 * DAY_IN_SECONDS); + } return $wp_vuln; } diff --git a/class/class-mainwp-child-woocommerce-status.php b/class/class-mainwp-child-woocommerce-status.php index 4724946..9dbd5aa 100644 --- a/class/class-mainwp-child-woocommerce-status.php +++ b/class/class-mainwp-child-woocommerce-status.php @@ -81,9 +81,9 @@ class MainWP_Child_WooCommerce_Status { AND posts.post_status = 'publish' AND tax.taxonomy = 'shop_order_status' AND term.slug IN ( '" . implode( "','", apply_filters( 'woocommerce_reports_order_statuses', array( - 'completed', - 'processing', - 'on-hold', + 'completed', + 'processing', + 'on-hold', ) ) ) . "' ) AND postmeta.meta_key = '_order_total' AND posts.post_date >= %s @@ -103,9 +103,9 @@ class MainWP_Child_WooCommerce_Status { AND posts.post_status = 'publish' AND tax.taxonomy = 'shop_order_status' AND term.slug IN ( '" . implode( "','", apply_filters( 'woocommerce_reports_order_statuses', array( - 'completed', - 'processing', - 'on-hold', + 'completed', + 'processing', + 'on-hold', ) ) ) . "' ) AND order_item_meta.meta_key = '_qty' AND order_item_meta_2.meta_key = '_product_id' @@ -202,9 +202,9 @@ class MainWP_Child_WooCommerce_Status { AND posts.post_status = 'publish' AND tax.taxonomy = 'shop_order_status' AND term.slug IN ( '" . implode( "','", apply_filters( 'woocommerce_reports_order_statuses', array( - 'completed', - 'processing', - 'on-hold', + 'completed', + 'processing', + 'on-hold', ) ) ) . "' ) AND postmeta.meta_key = '_order_total' AND posts.post_date >= STR_TO_DATE(" . $wpdb->prepare('%s', $start_date) . ", '%Y-%m-%d %H:%i:%s') @@ -224,9 +224,9 @@ class MainWP_Child_WooCommerce_Status { AND posts.post_status = 'publish' AND tax.taxonomy = 'shop_order_status' AND term.slug IN ( '" . implode( "','", apply_filters( 'woocommerce_reports_order_statuses', array( - 'completed', - 'processing', - 'on-hold', + 'completed', + 'processing', + 'on-hold', ) ) ) . "' ) AND order_item_meta.meta_key = '_qty' AND order_item_meta_2.meta_key = '_product_id' diff --git a/class/class-mainwp-child-wordfence.php b/class/class-mainwp-child-wordfence.php index 18744f5..c8c44ec 100644 --- a/class/class-mainwp-child-wordfence.php +++ b/class/class-mainwp-child-wordfence.php @@ -394,7 +394,7 @@ class MainWP_Child_Wordfence { case 'misconfigured_howget_ips_choice': $information = $this->misconfiguredHowGetIPsChoice(); break; - case 'delete_admin_user': + case 'delete_admin_user': $information = $this->deleteAdminUser(); break; case 'revoke_admin_user': @@ -428,13 +428,13 @@ class MainWP_Child_Wordfence { $information = $this->whitelistBulkEnable(); break; case 'whitelist_bulk_disable': - $information = $this->whitelistBulkDisable(); + $information = $this->whitelistBulkDisable(); break; - case 'update_config': - $information = $this->updateConfig(); + case 'update_config': + $information = $this->updateConfig(); break; - case 'save_country_blocking': - $information = $this->saveCountryBlocking(); + case 'save_country_blocking': + $information = $this->saveCountryBlocking(); break; } } @@ -655,7 +655,7 @@ class MainWP_Child_Wordfence { public function wordfence_init() { if ( ! $this->is_wordfence_installed ) { -return; + return; } add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) ); @@ -673,10 +673,10 @@ return; // ok public function do_reports_log( $ext = '') { if ( $ext !== 'wordfence' ) { -return; + return; } if ( ! $this->is_wordfence_installed ) { -return; + return; } global $wpdb; @@ -860,7 +860,7 @@ FROM {$table_wfBlockedIPLog} WHERE unixday >= {$interval} SQL ); - } + } function get_lastscan() { @@ -1183,35 +1183,35 @@ SQL } } -// $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', -// ); -// + // $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 @@ -1296,116 +1296,116 @@ SQL $existingAPIKey = wfConfig::get('apiKey', ''); $ping = false; - if ( empty( $apiKey ) && empty($existingAPIKey) ) { // then try to get one. + if ( empty( $apiKey ) && empty($existingAPIKey) ) { // then try to get one. - $api = new wfAPI( '', wfUtils::getWPVersion() ); - try { - $keyData = $api->call( 'get_anon_api_key' ); - if ( $keyData['ok'] && $keyData['apiKey'] ) { - wfConfig::set( 'apiKey', $keyData['apiKey'] ); - wfConfig::set( 'isPaid', 0 ); - wfConfig::set('keyType', wfAPI::KEY_TYPE_FREE); - wordfence::licenseStatusChanged(); - $result['apiKey'] = $apiKey = $keyData['apiKey']; - $result['isPaid'] = 0; - $reload = 'reload'; - } else { - throw new Exception("The Wordfence server's response did not contain the expected elements."); - } - } catch ( Exception $e ) { - $result['error'] = 'Your options have been saved, but you left your license key blank, so we tried to get you a free license key from the Wordfence servers. There was a problem fetching the free key: ' . wp_kses( $e->getMessage(), array() ); - return $result; - } - - } elseif ( ! empty( $apiKey ) && $existingAPIKey != $apiKey ) { - $api = new wfAPI( $apiKey, wfUtils::getWPVersion() ); - try { - $res = $api->call('check_api_key', array(), array( 'previousLicense' => $existingAPIKey )); - if ( $res['ok'] && isset( $res['isPaid'] ) ) { - -// wfConfig::set( 'apiKey', $apiKey ); -// wfConfig::set( 'isPaid', $res['isPaid'] ); //res['isPaid'] is boolean coming back as JSON and turned back into PHP struct. Assuming JSON to PHP handles bools. -// $result['apiKey'] = $apiKey; -// $result['isPaid'] = $res['isPaid']; -// if ( $res['isPaid'] ) { -// $result['paidKeyMsg'] = true; -// } - - $isPaid = wfUtils::truthyToBoolean($res['isPaid']); - wfConfig::set('apiKey', $apiKey); - wfConfig::set('isPaid', $isPaid); //res['isPaid'] is boolean coming back as JSON and turned back into PHP struct. Assuming JSON to PHP handles bools. - wordfence::licenseStatusChanged(); - if ( ! $isPaid) { - wfConfig::set('keyType', wfAPI::KEY_TYPE_FREE); - } - - $result['apiKey'] = $apiKey; - $result['isPaid'] = $isPaid; - if ( $isPaid ) { - $result['paidKeyMsg'] = true; - } - - $ping = true; - $reload = 'reload'; - } else { - throw new Exception( 'We could not understand the Wordfence API server reply when updating your API key.' ); - } - } catch ( Exception $e ) { - $result['error'] = 'Your options have been saved. However we noticed you changed your API key and we tried to verify it with the Wordfence servers and received an error: ' . htmlentities( $e->getMessage() ); - return $result; - } - } else { - $ping = true; - $apiKey = $existingAPIKey; + $api = new wfAPI( '', wfUtils::getWPVersion() ); + try { + $keyData = $api->call( 'get_anon_api_key' ); + if ( $keyData['ok'] && $keyData['apiKey'] ) { + wfConfig::set( 'apiKey', $keyData['apiKey'] ); + wfConfig::set( 'isPaid', 0 ); + wfConfig::set('keyType', wfAPI::KEY_TYPE_FREE); + wordfence::licenseStatusChanged(); + $result['apiKey'] = $apiKey = $keyData['apiKey']; + $result['isPaid'] = 0; + $reload = 'reload'; + } else { + throw new Exception("The Wordfence server's response did not contain the expected elements."); + } + } catch ( Exception $e ) { + $result['error'] = 'Your options have been saved, but you left your license key blank, so we tried to get you a free license key from the Wordfence servers. There was a problem fetching the free key: ' . wp_kses( $e->getMessage(), array() ); + return $result; } - if ( $ping ) { + } elseif ( ! empty( $apiKey ) && $existingAPIKey != $apiKey ) { + $api = new wfAPI( $apiKey, wfUtils::getWPVersion() ); + try { + $res = $api->call('check_api_key', array(), array( 'previousLicense' => $existingAPIKey )); + if ( $res['ok'] && isset( $res['isPaid'] ) ) { - $api = new wfAPI($apiKey, wfUtils::getWPVersion()); - try { - $keyType = wfAPI::KEY_TYPE_FREE; - $keyData = $api->call('ping_api_key', array(), array( - 'supportHash' => wfConfig::get('supportHash', ''), - 'whitelistHash' => wfConfig::get('whitelistHash', ''), - )); - if (isset($keyData['_isPaidKey'])) { - $keyType = wfConfig::get('keyType'); - } - if (isset($keyData['dashboard'])) { - wfConfig::set('lastDashboardCheck', time()); - wfDashboard::processDashboardResponse($keyData['dashboard']); - } - if (isset($keyData['support']) && isset($keyData['supportHash'])) { - wfConfig::set('supportContent', $keyData['support']); - wfConfig::set('supportHash', $keyData['supportHash']); - } - if (isset($keyData['_whitelist']) && isset($keyData['_whitelistHash'])) { - wfConfig::setJSON('whitelistPresets', $keyData['_whitelist']); - wfConfig::set('whitelistHash', $keyData['_whitelistHash']); - } - if (isset($keyData['scanSchedule']) && is_array($keyData['scanSchedule'])) { - wfConfig::set_ser('noc1ScanSchedule', $keyData['scanSchedule']); - if (wfScanner::shared()->schedulingMode() == wfScanner::SCAN_SCHEDULING_MODE_AUTOMATIC) { - wfScanner::shared()->scheduleScans(); - } + // wfConfig::set( 'apiKey', $apiKey ); + // wfConfig::set( 'isPaid', $res['isPaid'] ); //res['isPaid'] is boolean coming back as JSON and turned back into PHP struct. Assuming JSON to PHP handles bools. + // $result['apiKey'] = $apiKey; + // $result['isPaid'] = $res['isPaid']; + // if ( $res['isPaid'] ) { + // $result['paidKeyMsg'] = true; + // } + + $isPaid = wfUtils::truthyToBoolean($res['isPaid']); + wfConfig::set('apiKey', $apiKey); + wfConfig::set('isPaid', $isPaid); //res['isPaid'] is boolean coming back as JSON and turned back into PHP struct. Assuming JSON to PHP handles bools. + wordfence::licenseStatusChanged(); + if ( ! $isPaid) { + wfConfig::set('keyType', wfAPI::KEY_TYPE_FREE); } - wfConfig::set('keyType', $keyType); - - if ( ! isset($result['apiKey'])) { - $isPaid = ( $keyType == wfAPI::KEY_TYPE_FREE ) ? false : true; - $result['apiKey'] = $apiKey; - $result['isPaid'] = $isPaid; - if ( $isPaid ) { - $result['paidKeyMsg'] = true; - } + $result['apiKey'] = $apiKey; + $result['isPaid'] = $isPaid; + if ( $isPaid ) { + $result['paidKeyMsg'] = true; } - } catch ( Exception $e ) { - $result['error'] = 'Your options have been saved. However we tried to verify your license key with the Wordfence servers and received an error: ' . wp_kses($e->getMessage(), array()); - return $result; - } - } + $ping = true; + $reload = 'reload'; + } else { + throw new Exception( 'We could not understand the Wordfence API server reply when updating your API key.' ); + } + } catch ( Exception $e ) { + $result['error'] = 'Your options have been saved. However we noticed you changed your API key and we tried to verify it with the Wordfence servers and received an error: ' . htmlentities( $e->getMessage() ); + return $result; + } + } else { + $ping = true; + $apiKey = $existingAPIKey; + } + + if ( $ping ) { + + $api = new wfAPI($apiKey, wfUtils::getWPVersion()); + try { + $keyType = wfAPI::KEY_TYPE_FREE; + $keyData = $api->call('ping_api_key', array(), array( + 'supportHash' => wfConfig::get('supportHash', ''), + 'whitelistHash' => wfConfig::get('whitelistHash', ''), + )); + if (isset($keyData['_isPaidKey'])) { + $keyType = wfConfig::get('keyType'); + } + if (isset($keyData['dashboard'])) { + wfConfig::set('lastDashboardCheck', time()); + wfDashboard::processDashboardResponse($keyData['dashboard']); + } + if (isset($keyData['support']) && isset($keyData['supportHash'])) { + wfConfig::set('supportContent', $keyData['support']); + wfConfig::set('supportHash', $keyData['supportHash']); + } + if (isset($keyData['_whitelist']) && isset($keyData['_whitelistHash'])) { + wfConfig::setJSON('whitelistPresets', $keyData['_whitelist']); + wfConfig::set('whitelistHash', $keyData['_whitelistHash']); + } + if (isset($keyData['scanSchedule']) && is_array($keyData['scanSchedule'])) { + wfConfig::set_ser('noc1ScanSchedule', $keyData['scanSchedule']); + if (wfScanner::shared()->schedulingMode() == wfScanner::SCAN_SCHEDULING_MODE_AUTOMATIC) { + wfScanner::shared()->scheduleScans(); + } + } + + wfConfig::set('keyType', $keyType); + + if ( ! isset($result['apiKey'])) { + $isPaid = ( $keyType == wfAPI::KEY_TYPE_FREE ) ? false : true; + $result['apiKey'] = $apiKey; + $result['isPaid'] = $isPaid; + if ( $isPaid ) { + $result['paidKeyMsg'] = true; + } + } + + } catch ( Exception $e ) { + $result['error'] = 'Your options have been saved. However we tried to verify your license key with the Wordfence servers and received an error: ' . wp_kses($e->getMessage(), array()); + return $result; + } + } } $result['ok'] = 1; @@ -1785,57 +1785,57 @@ SQL return $return; } - public static function permanentlyBlockAllIPs() { - $return = wordfence::ajax_permanentlyBlockAllIPs_callback(); - return $return; - } + public static function permanentlyBlockAllIPs() { + $return = wordfence::ajax_permanentlyBlockAllIPs_callback(); + return $return; + } - public static function unlockOutIP() { - $return = wordfence::ajax_unlockOutIP_callback(); - return $return; - } + public static function unlockOutIP() { + $return = wordfence::ajax_unlockOutIP_callback(); + return $return; + } - public static function unblockRange() { - $return = wordfence::ajax_unblockRange_callback(); - return $return; - } + public static function unblockRange() { + $return = wordfence::ajax_unblockRange_callback(); + return $return; + } - public static function blockIPUARange() { - $return = wordfence::ajax_blockIPUARange_callback(); - return $return; - } + public static function blockIPUARange() { + $return = wordfence::ajax_blockIPUARange_callback(); + return $return; + } - public static function loadBlockRanges() { - $return = wordfence::ajax_loadBlockRanges_callback(); - return $return; - } + public static function loadBlockRanges() { + $return = wordfence::ajax_loadBlockRanges_callback(); + return $return; + } - public static function saveWAFConfig() { - $return = wordfence::ajax_saveWAFConfig_callback(); - if (is_array($return) && isset($return['data'])) { - $return['learningModeGracePeriod'] = wfWAF::getInstance()->getStorageEngine()->getConfig('learningModeGracePeriod'); - } - return $return; - } + public static function saveWAFConfig() { + $return = wordfence::ajax_saveWAFConfig_callback(); + if (is_array($return) && isset($return['data'])) { + $return['learningModeGracePeriod'] = wfWAF::getInstance()->getStorageEngine()->getConfig('learningModeGracePeriod'); + } + return $return; + } - public static function whitelistBulkDelete() { - $return = wordfence::ajax_whitelistBulkDelete_callback(); - return $return; - } + public static function whitelistBulkDelete() { + $return = wordfence::ajax_whitelistBulkDelete_callback(); + return $return; + } - public static function whitelistBulkEnable() { - $return = wordfence::ajax_whitelistBulkEnable_callback(); - return $return; - } + public static function whitelistBulkEnable() { + $return = wordfence::ajax_whitelistBulkEnable_callback(); + return $return; + } - public static function whitelistBulkDisable() { - $return = wordfence::ajax_whitelistBulkDisable_callback(); - return $return; - } - public static function updateConfig() { - $return = wordfence::ajax_updateConfig_callback(); - return $return; - } + public static function whitelistBulkDisable() { + $return = wordfence::ajax_whitelistBulkDisable_callback(); + return $return; + } + public static function updateConfig() { + $return = wordfence::ajax_updateConfig_callback(); + return $return; + } // credit of Wordfence private static function _getWAFData( $updated = null) { @@ -2416,7 +2416,7 @@ SQL $inEmail = false; ob_start(); -?> + ?>
@@ -2432,7 +2432,7 @@ SQL } if ($inEmail) : - ?> + ?> @@ -2445,13 +2445,13 @@ SQL @@ -3053,19 +3053,19 @@ SQL + ?> - $readable) : - ?> + ?> - @@ -3148,9 +3148,9 @@ SQL public static function save_debugging_config() { $settings = $_POST['settings']; foreach (self::$diagnosticParams as $param) { - if (isset($settings[ $param ])) { - wfConfig::set( $param, $settings[ $param ] ); - } + if (isset($settings[ $param ])) { + wfConfig::set( $param, $settings[ $param ] ); + } } return array( 'ok' => 1 ); } diff --git a/class/class-mainwp-child-wp-rocket.php b/class/class-mainwp-child-wp-rocket.php index b67646c..b5c8afe 100644 --- a/class/class-mainwp-child-wp-rocket.php +++ b/class/class-mainwp-child-wp-rocket.php @@ -34,9 +34,9 @@ class MainWP_Child_WP_Rocket { } 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; @@ -207,9 +207,9 @@ class MainWP_Child_WP_Rocket { if ( ! $this->is_plugin_installed ) { return false; } -// if ( ! defined( 'WP_ROCKET_VERSION' ) || ! defined( 'WP_ROCKET_SLUG' ) ) { -// return false; -// } + // if ( ! defined( 'WP_ROCKET_VERSION' ) || ! defined( 'WP_ROCKET_SLUG' ) ) { + // return false; + // } return true; } @@ -252,7 +252,7 @@ class MainWP_Child_WP_Rocket { $information = array(); if ( isset( $_POST['mwp_action'] ) ) { -// MainWP_Helper::update_option( 'mainwp_wprocket_ext_enabled', 'Y' ); + // MainWP_Helper::update_option( 'mainwp_wprocket_ext_enabled', 'Y' ); try { switch ( $_POST['mwp_action'] ) { case 'set_showhide': diff --git a/class/class-mainwp-child-wpvivid-backuprestore.php b/class/class-mainwp-child-wpvivid-backuprestore.php index 6689092..0a3dc8d 100644 --- a/class/class-mainwp-child-wpvivid-backuprestore.php +++ b/class/class-mainwp-child-wpvivid-backuprestore.php @@ -143,7 +143,7 @@ class MainWP_Child_WPvivid_BackupRestore { $wpvivid_plugin->ajax_check_security(); $ret = $this->public_intetface->prepare_backup($_POST['backup']); return $ret; - } + } public function backup_now() { global $wpvivid_plugin; @@ -164,112 +164,112 @@ class MainWP_Child_WPvivid_BackupRestore { $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; diff --git a/class/class-mainwp-child.php b/class/class-mainwp-child.php index 2cdf739..359afec 100644 --- a/class/class-mainwp-child.php +++ b/class/class-mainwp-child.php @@ -7,7 +7,7 @@ if ( defined( 'MAINWP_DEBUG' ) && MAINWP_DEBUG === true ) { if (isset($_REQUEST['mainwpsignature'])) { @ini_set( 'display_errors', false ); @error_reporting( 0 ); -} + } } define( 'MAINWP_CHILD_NR_OF_COMMENTS', 50 ); @@ -213,7 +213,7 @@ class MainWP_Child { $this->load_all_options(); $this->filterFunction = function( $a) { if ($a == null) { -return false; } + return false; } if (is_object($a) && property_exists($a, 'last_checked') && ! property_exists($a, 'checked')) { return false; } @@ -330,7 +330,7 @@ return false; } $alloptions_db = $wpdb->get_results( $query ); $wpdb->suppress_errors($suppress); if ( ! is_array( $alloptions ) ) { -$alloptions = array(); + $alloptions = array(); } if ( is_array( $alloptions_db ) ) { foreach ( (array) $alloptions_db as $o ) { @@ -401,24 +401,24 @@ $alloptions = array(); 'mainwp_kwl_statistic_data_', 'mainwp_kwl_enable_statistic', 'mainwpKeywordLinks', -// 'mainwp_branding_ext_enabled', -// 'mainwp_branding_plugin_header', -// 'mainwp_branding_support_email', -// 'mainwp_branding_support_message', -// 'mainwp_branding_remove_restore', -// 'mainwp_branding_remove_setting', -// 'mainwp_branding_remove_wp_tools', -// 'mainwp_branding_remove_wp_setting', -// 'mainwp_branding_remove_permalink', -// 'mainwp_branding_button_contact_label', -// 'mainwp_branding_send_email_message', -// 'mainwp_branding_message_return_sender', -// 'mainwp_branding_submit_button_title', -// 'mainwp_branding_disable_wp_branding', -// 'mainwp_branding_extra_settings', -// 'mainwp_branding_child_hide', -// 'mainwp_branding_show_support', -// 'mainwp_branding_disable_change', + // 'mainwp_branding_ext_enabled', + // 'mainwp_branding_plugin_header', + // 'mainwp_branding_support_email', + // 'mainwp_branding_support_message', + // 'mainwp_branding_remove_restore', + // 'mainwp_branding_remove_setting', + // 'mainwp_branding_remove_wp_tools', + // 'mainwp_branding_remove_wp_setting', + // 'mainwp_branding_remove_permalink', + // 'mainwp_branding_button_contact_label', + // 'mainwp_branding_send_email_message', + // 'mainwp_branding_message_return_sender', + // 'mainwp_branding_submit_button_title', + // 'mainwp_branding_disable_wp_branding', + // 'mainwp_branding_extra_settings', + // 'mainwp_branding_child_hide', + // 'mainwp_branding_show_support', + // 'mainwp_branding_disable_change', ); foreach ( $options as $option ) { MainWP_Helper::fix_option( $option ); @@ -929,32 +929,32 @@ $alloptions = array(); + echo 'nav-tab-active'; } + ?> " tab-slug="" href="options-general.php?page="> + if ( '' != get_option( 'mainwp_child_uniqueId' ) ) { + echo 'checked'; } + ?> /> @@ -1563,9 +1563,9 @@ echo 'checked'; } //Call the function required if ( $auth && isset( $_POST['function'] ) && isset( $this->callableFunctions[ $_POST['function'] ] ) ) { define( 'DOING_CRON', true ); -// ob_start(); -// require_once( ABSPATH . 'wp-admin/admin.php' ); -// ob_end_clean(); + // ob_start(); + // require_once( ABSPATH . 'wp-admin/admin.php' ); + // ob_end_clean(); MainWP_Helper::handle_fatal_error(); self::fix_for_custom_themes(); @@ -2019,7 +2019,7 @@ echo 'checked'; } if ( isset( $_POST['type'] ) && 'plugin' === $_POST['type'] ) { include_once ABSPATH . '/wp-admin/includes/update.php'; if ( null !== $this->filterFunction ) { -// ET_Automatic_Updates + // ET_Automatic_Updates add_filter( 'pre_site_transient_update_plugins', $this->filterFunction, 99 ); } @@ -2105,17 +2105,17 @@ echo 'checked'; } } else { $information['upgrades'][ $plugin ] = true; // to fix logging update -// if (isset($information['plugin_updates']) && isset($information['plugin_updates'][$plugin])) { -// $plugin_info = $information['plugin_updates'][$plugin]; -// $args = array(); -// $args['type'] = 'plugin'; -// $args['slug'] = $plugin; -// $args['name'] = $plugin_info->Name; -// $args['version'] = $plugin_info->update->new_version; -// $args['old_version'] = $plugin_info->Version; -// $args['action'] = 'update'; -// //do_action( 'mainwp_child_upgradePluginTheme', $args ); -// } + // if (isset($information['plugin_updates']) && isset($information['plugin_updates'][$plugin])) { + // $plugin_info = $information['plugin_updates'][$plugin]; + // $args = array(); + // $args['type'] = 'plugin'; + // $args['slug'] = $plugin; + // $args['name'] = $plugin_info->Name; + // $args['version'] = $plugin_info->update->new_version; + // $args['old_version'] = $plugin_info->Version; + // $args['action'] = 'update'; + // //do_action( 'mainwp_child_upgradePluginTheme', $args ); + // } } } $failed = false; @@ -2162,8 +2162,8 @@ echo 'checked'; } add_filter( 'pre_site_transient_update_themes', $this->filterFunction, 99 ); } -// $last_update = get_site_transient( 'update_themes' ); -// $originalLastChecked = !empty( $last_update ) && property_exists( $last_update, 'last_checked' ) ? $last_update->last_checked : 0; + // $last_update = get_site_transient( 'update_themes' ); + // $originalLastChecked = !empty( $last_update ) && property_exists( $last_update, 'last_checked' ) ? $last_update->last_checked : 0; @wp_update_themes(); include_once ABSPATH . '/wp-admin/includes/theme.php'; @@ -2202,12 +2202,12 @@ echo 'checked'; } $last_update2 = get_site_transient( 'update_themes' ); set_site_transient( 'update_themes', $last_update ); -// if ( !empty( $last_update ) && property_exists( $last_update, 'last_checked' ) ) { -// $last_update->last_checked = $originalLastChecked; -// set_site_transient( 'update_themes', $last_update ); -// } + // if ( !empty( $last_update ) && property_exists( $last_update, 'last_checked' ) ) { + // $last_update->last_checked = $originalLastChecked; + // set_site_transient( 'update_themes', $last_update ); + // } -// @wp_update_themes(); + // @wp_update_themes(); $failed = true; $upgrader = new Theme_Upgrader( new Bulk_Theme_Upgrader_Skin( compact( 'nonce', 'url' ) ) ); $result = $upgrader->bulk_upgrade( $themes ); @@ -2218,17 +2218,17 @@ echo 'checked'; } } else { $information['upgrades'][ $theme ] = true; // to fix logging update -// if (isset($information['theme_updates']) && isset($information['theme_updates'][$theme])) { -// $theme_info = $information['theme_updates'][$theme]; -// $args = array(); -// $args['type'] = 'theme'; -// $args['slug'] = $theme; -// $args['name'] = $theme_info['Name']; -// $args['version'] = $theme_info['update']['new_version']; -// $args['old_version'] = $theme_info['Version']; -// $args['action'] = 'update'; -// //do_action( 'mainwp_child_upgradePluginTheme', $args ); -// } + // if (isset($information['theme_updates']) && isset($information['theme_updates'][$theme])) { + // $theme_info = $information['theme_updates'][$theme]; + // $args = array(); + // $args['type'] = 'theme'; + // $args['slug'] = $theme; + // $args['name'] = $theme_info['Name']; + // $args['version'] = $theme_info['update']['new_version']; + // $args['old_version'] = $theme_info['Version']; + // $args['action'] = 'update'; + // //do_action( 'mainwp_child_upgradePluginTheme', $args ); + // } } } @@ -2257,13 +2257,13 @@ echo 'checked'; } remove_filter( 'pre_site_transient_update_themes', array( $this, 'set_cached_update_themes' ), 10 ); delete_site_transient( 'mainwp_update_themes_cached' ); // to fix cached update info -// $last_update = get_site_transient( 'update_themes' ); -// if ( !empty( $last_update ) && property_exists( $last_update, 'last_checked' ) ) { -// $last_update->last_checked = $originalLastChecked; -// set_site_transient( 'update_themes', $last_update ); -// } + // $last_update = get_site_transient( 'update_themes' ); + // if ( !empty( $last_update ) && property_exists( $last_update, 'last_checked' ) ) { + // $last_update->last_checked = $originalLastChecked; + // set_site_transient( 'update_themes', $last_update ); + // } -// @wp_update_themes(); + // @wp_update_themes(); if ( count( $premiumThemes ) > 0 ) { $mwp_premium_updates = apply_filters( 'mwp_premium_perform_update', array() ); @@ -2724,19 +2724,19 @@ echo 'checked'; } if ( is_array($galleries) && isset($galleries['ids']) ) { $attached_images = explode( ',', $galleries['ids'] ); - foreach ( $attached_images as $attachment_id ) { - $attachment = get_post( $attachment_id ); - if ( $attachment ) { - $post_gallery_images[] = array( - 'id' => $attachment_id, - 'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ), - 'caption' => $attachment->post_excerpt, - 'description' => $attachment->post_content, - 'src' => $attachment->guid, - 'title' => $attachment->post_title, - ); - } - } + foreach ( $attached_images as $attachment_id ) { + $attachment = get_post( $attachment_id ); + if ( $attachment ) { + $post_gallery_images[] = array( + 'id' => $attachment_id, + 'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ), + 'caption' => $attachment->post_excerpt, + 'description' => $attachment->post_content, + 'src' => $attachment->guid, + 'title' => $attachment->post_title, + ); + } + } } require_once ABSPATH . 'wp-admin/includes/post.php'; @@ -2781,233 +2781,233 @@ echo 'checked'; } wp_update_user( $my_user ); } elseif ( 'edit' === $action ) { $user_data = $this->get_user_to_edit($userId); - if ( ! empty($user_data)) { - $information['user_data'] = $user_data; - } else { - $failed = true; - } + if ( ! empty($user_data)) { + $information['user_data'] = $user_data; + } else { + $failed = true; + } } elseif ( 'update_user' === $action ) { $my_user = $_POST['extra']; - if (is_array($my_user)) { - foreach ($my_user as $idx => $val) { - if ($val === 'donotupdate' || ( empty($val) && $idx !== 'role' )) { - unset($my_user[ $idx ]); - } - } - $result = $this->edit_user( $userId, $my_user ); - if (is_array($result) && isset($result['error'])) { - $information['error'] = $result['error']; - } - } else { - $failed = true; - } + if (is_array($my_user)) { + foreach ($my_user as $idx => $val) { + if ($val === 'donotupdate' || ( empty($val) && $idx !== 'role' )) { + unset($my_user[ $idx ]); + } + } + $result = $this->edit_user( $userId, $my_user ); + if (is_array($result) && isset($result['error'])) { + $information['error'] = $result['error']; + } + } else { + $failed = true; + } } else { $failed = true; } - if ($failed) { - $information['status'] = 'FAIL'; - } + if ($failed) { + $information['status'] = 'FAIL'; + } if ( ! isset( $information['status'] ) && ! isset($information['error']) ) { $information['status'] = 'SUCCESS'; - if ('update_user' === $action && isset($_POST['optimize']) && ! empty($_POST['optimize'])) { - $information['users'] = $this->get_all_users_int(500); // to fix - } + if ('update_user' === $action && isset($_POST['optimize']) && ! empty($_POST['optimize'])) { + $information['users'] = $this->get_all_users_int(500); // to fix + } } MainWP_Helper::write( $information ); } - function edit_user( $user_id, $data) { - $wp_roles = wp_roles(); - $user = new stdClass(); + function edit_user( $user_id, $data) { + $wp_roles = wp_roles(); + $user = new stdClass(); - $update = true; + $update = true; - if ( $user_id ) { - $user->ID = (int) $user_id; - $userdata = get_userdata( $user_id ); - $user->user_login = wp_slash( $userdata->user_login ); - } else { - return array( 'error' => 'ERROR: Empty user id.' ); - } + if ( $user_id ) { + $user->ID = (int) $user_id; + $userdata = get_userdata( $user_id ); + $user->user_login = wp_slash( $userdata->user_login ); + } else { + return array( 'error' => 'ERROR: Empty user id.' ); + } - $pass1 = $pass2 = ''; - if ( isset( $data['pass1'] ) ) { - $pass1 = $data['pass1']; - } - if ( isset( $data['pass2'] ) ) { - $pass2 = $data['pass2']; - } + $pass1 = $pass2 = ''; + if ( isset( $data['pass1'] ) ) { + $pass1 = $data['pass1']; + } + if ( isset( $data['pass2'] ) ) { + $pass2 = $data['pass2']; + } - if ( isset( $data['role'] ) && current_user_can( 'edit_users' ) ) { - $new_role = sanitize_text_field( $data['role'] ); - $potential_role = isset($wp_roles->role_objects[ $new_role ]) ? $wp_roles->role_objects[ $new_role ] : false; - // Don't let anyone with 'edit_users' (admins) edit their own role to something without it. - // Multisite super admins can freely edit their blog roles -- they possess all caps. - if ( ( is_multisite() && current_user_can( 'manage_sites' ) ) || $user_id != get_current_user_id() || ( $potential_role && $potential_role->has_cap( 'edit_users' ) ) ) { - $user->role = $new_role; - } + if ( isset( $data['role'] ) && current_user_can( 'edit_users' ) ) { + $new_role = sanitize_text_field( $data['role'] ); + $potential_role = isset($wp_roles->role_objects[ $new_role ]) ? $wp_roles->role_objects[ $new_role ] : false; + // Don't let anyone with 'edit_users' (admins) edit their own role to something without it. + // Multisite super admins can freely edit their blog roles -- they possess all caps. + if ( ( is_multisite() && current_user_can( 'manage_sites' ) ) || $user_id != get_current_user_id() || ( $potential_role && $potential_role->has_cap( 'edit_users' ) ) ) { + $user->role = $new_role; + } - // If the new role isn't editable by the logged-in user die with error - $editable_roles = get_editable_roles(); - if ( ! empty( $new_role ) && empty( $editable_roles[ $new_role ] ) ) { - return array( 'error' => 'You can’t give users that role.' ); - } - } + // If the new role isn't editable by the logged-in user die with error + $editable_roles = get_editable_roles(); + if ( ! empty( $new_role ) && empty( $editable_roles[ $new_role ] ) ) { + return array( 'error' => 'You can’t give users that role.' ); + } + } - $email = ''; - if ( isset( $data['email'] ) ) { - $email = trim( $data['email'] ); - } + $email = ''; + if ( isset( $data['email'] ) ) { + $email = trim( $data['email'] ); + } - if ( ! empty( $email ) ) { - $user->user_email = sanitize_text_field( wp_unslash( $email ) ); - } else { - $user->user_email = $userdata->user_email; - } + if ( ! empty( $email ) ) { + $user->user_email = sanitize_text_field( wp_unslash( $email ) ); + } else { + $user->user_email = $userdata->user_email; + } - if ( isset( $data['url'] ) ) { - if ( empty ( $data['url'] ) || $data['url'] == 'http://' ) { - $user->user_url = ''; - } else { - $user->user_url = esc_url_raw( $data['url'] ); - $protocols = implode( '|', array_map( 'preg_quote', wp_allowed_protocols() ) ); - $user->user_url = preg_match('/^(' . $protocols . '):/is', $user->user_url) ? $user->user_url : 'http://' . $user->user_url; - } - } + if ( isset( $data['url'] ) ) { + if ( empty ( $data['url'] ) || $data['url'] == 'http://' ) { + $user->user_url = ''; + } else { + $user->user_url = esc_url_raw( $data['url'] ); + $protocols = implode( '|', array_map( 'preg_quote', wp_allowed_protocols() ) ); + $user->user_url = preg_match('/^(' . $protocols . '):/is', $user->user_url) ? $user->user_url : 'http://' . $user->user_url; + } + } - if ( isset( $data['first_name'] ) ) { - $user->first_name = sanitize_text_field( $data['first_name'] ); - } - if ( isset( $data['last_name'] ) ) { - $user->last_name = sanitize_text_field( $data['last_name'] ); - } - if ( isset( $data['nickname'] ) && ! empty($data['nickname'])) { - $user->nickname = sanitize_text_field( $data['nickname'] ); - } - if ( isset( $data['display_name'] ) ) { - $user->display_name = sanitize_text_field( $data['display_name'] ); - } - if ( isset( $data['description'] ) ) { - $user->description = trim( $data['description'] ); - } + if ( isset( $data['first_name'] ) ) { + $user->first_name = sanitize_text_field( $data['first_name'] ); + } + if ( isset( $data['last_name'] ) ) { + $user->last_name = sanitize_text_field( $data['last_name'] ); + } + if ( isset( $data['nickname'] ) && ! empty($data['nickname'])) { + $user->nickname = sanitize_text_field( $data['nickname'] ); + } + if ( isset( $data['display_name'] ) ) { + $user->display_name = sanitize_text_field( $data['display_name'] ); + } + if ( isset( $data['description'] ) ) { + $user->description = trim( $data['description'] ); + } - $errors = new WP_Error(); + $errors = new WP_Error(); - /* checking that username has been typed */ - if ( $user->user_login == '' ) { - $errors->add( 'user_login', __( 'ERROR: Please enter a username.' ) ); - } + /* checking that username has been typed */ + if ( $user->user_login == '' ) { + $errors->add( 'user_login', __( 'ERROR: Please enter a username.' ) ); + } - do_action_ref_array( 'check_passwords', array( $user->user_login, &$pass1, &$pass2 ) ); + do_action_ref_array( 'check_passwords', array( $user->user_login, &$pass1, &$pass2 ) ); - if ( ! empty($pass1) || ! empty($pass2)) { - // Check for blank password when adding a user. - if ( ! $update && empty( $pass1 ) ) { - $errors->add( 'pass', __( 'ERROR: Please enter a password.' ), array( 'form-field' => 'pass1' ) ); - } + if ( ! empty($pass1) || ! empty($pass2)) { + // Check for blank password when adding a user. + if ( ! $update && empty( $pass1 ) ) { + $errors->add( 'pass', __( 'ERROR: Please enter a password.' ), array( 'form-field' => 'pass1' ) ); + } - // Check for "\" in password. - if ( false !== strpos( wp_unslash( $pass1 ), '\\' ) ) { - $errors->add( 'pass', __( 'ERROR: Passwords may not contain the character "\\".' ), array( 'form-field' => 'pass1' ) ); - } + // Check for "\" in password. + if ( false !== strpos( wp_unslash( $pass1 ), '\\' ) ) { + $errors->add( 'pass', __( 'ERROR: Passwords may not contain the character "\\".' ), array( 'form-field' => 'pass1' ) ); + } - // Checking the password has been typed twice the same. - if ( ( $update || ! empty( $pass1 ) ) && $pass1 != $pass2 ) { - $errors->add( 'pass', __( 'ERROR: Please enter the same password in both password fields.' ), array( 'form-field' => 'pass1' ) ); - } + // Checking the password has been typed twice the same. + if ( ( $update || ! empty( $pass1 ) ) && $pass1 != $pass2 ) { + $errors->add( 'pass', __( 'ERROR: Please enter the same password in both password fields.' ), array( 'form-field' => 'pass1' ) ); + } - if ( ! empty( $pass1 ) ) { - $user->user_pass = $pass1; - } - } else { - $user->user_pass = $userdata->user_pass; - } + if ( ! empty( $pass1 ) ) { + $user->user_pass = $pass1; + } + } else { + $user->user_pass = $userdata->user_pass; + } - /** This filter is documented in wp-includes/user.php */ - $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); + /** This filter is documented in wp-includes/user.php */ + $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); - if ( in_array( strtolower( $user->user_login ), array_map( 'strtolower', $illegal_logins ) ) ) { - $errors->add( 'invalid_username', __( 'ERROR: Sorry, that username is not allowed.' ) ); - } + if ( in_array( strtolower( $user->user_login ), array_map( 'strtolower', $illegal_logins ) ) ) { + $errors->add( 'invalid_username', __( 'ERROR: Sorry, that username is not allowed.' ) ); + } - /* checking email address */ - if ( empty( $user->user_email ) ) { - $errors->add( 'empty_email', __( 'ERROR: Please enter an email address.' ), array( 'form-field' => 'email' ) ); - } elseif ( ! is_email( $user->user_email ) ) { - $errors->add( 'invalid_email', __( 'ERROR: The email address isn’t correct.' ), array( 'form-field' => 'email' ) ); - } elseif ( ( $owner_id = email_exists($user->user_email) ) && ( ! $update || ( $owner_id != $user->ID ) ) ) { - $errors->add( 'email_exists', __('ERROR: This email is already registered, please choose another one.'), array( 'form-field' => 'email' ) ); - } + /* checking email address */ + if ( empty( $user->user_email ) ) { + $errors->add( 'empty_email', __( 'ERROR: Please enter an email address.' ), array( 'form-field' => 'email' ) ); + } elseif ( ! is_email( $user->user_email ) ) { + $errors->add( 'invalid_email', __( 'ERROR: The email address isn’t correct.' ), array( 'form-field' => 'email' ) ); + } elseif ( ( $owner_id = email_exists($user->user_email) ) && ( ! $update || ( $owner_id != $user->ID ) ) ) { + $errors->add( 'email_exists', __('ERROR: This email is already registered, please choose another one.'), array( 'form-field' => 'email' ) ); + } - do_action_ref_array( 'user_profile_update_errors', array( &$errors, $update, &$user ) ); + do_action_ref_array( 'user_profile_update_errors', array( &$errors, $update, &$user ) ); - if ( $errors->get_error_codes() ) { - $error_str = ''; - foreach ( $errors->get_error_messages() as $message ) { - if ( is_string( $message ) ) { - $error_str .= ' ' . esc_html( strip_tags( $message ) ); - } + if ( $errors->get_error_codes() ) { + $error_str = ''; + foreach ( $errors->get_error_messages() as $message ) { + if ( is_string( $message ) ) { + $error_str .= ' ' . esc_html( strip_tags( $message ) ); + } - } - return array( 'error' => $error_str ); - } + } + return array( 'error' => $error_str ); + } - $user_id = wp_update_user( $user ); + $user_id = wp_update_user( $user ); - return $user_id; - } + return $user_id; + } - function get_user_to_edit( $user_id ) { - require_once ABSPATH . 'wp-admin/includes/user.php'; - $profileuser = get_user_to_edit($user_id); + function get_user_to_edit( $user_id ) { + require_once ABSPATH . 'wp-admin/includes/user.php'; + $profileuser = get_user_to_edit($user_id); - $edit_data = array(); - if (is_object($profileuser)) { - $user_roles = array_intersect( array_values( $profileuser->roles ), array_keys( get_editable_roles() ) ); - $user_role = reset( $user_roles ); - $edit_data['role'] = $user_role; - $edit_data['first_name'] = $profileuser->first_name; - $edit_data['last_name'] = $profileuser->last_name; - $edit_data['nickname'] = $profileuser->nickname; + $edit_data = array(); + if (is_object($profileuser)) { + $user_roles = array_intersect( array_values( $profileuser->roles ), array_keys( get_editable_roles() ) ); + $user_role = reset( $user_roles ); + $edit_data['role'] = $user_role; + $edit_data['first_name'] = $profileuser->first_name; + $edit_data['last_name'] = $profileuser->last_name; + $edit_data['nickname'] = $profileuser->nickname; - $public_display = array(); - $public_display['display_nickname'] = $profileuser->nickname; - $public_display['display_username'] = $profileuser->user_login; + $public_display = array(); + $public_display['display_nickname'] = $profileuser->nickname; + $public_display['display_username'] = $profileuser->user_login; - if ( ! empty($profileuser->first_name) ) { - $public_display['display_firstname'] = $profileuser->first_name; - } + if ( ! empty($profileuser->first_name) ) { + $public_display['display_firstname'] = $profileuser->first_name; + } - if ( ! empty($profileuser->last_name) ) { - $public_display['display_lastname'] = $profileuser->last_name; - } + if ( ! empty($profileuser->last_name) ) { + $public_display['display_lastname'] = $profileuser->last_name; + } - if ( ! empty($profileuser->first_name) && ! empty($profileuser->last_name) ) { - $public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name; - $public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name; - } + if ( ! empty($profileuser->first_name) && ! empty($profileuser->last_name) ) { + $public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name; + $public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name; + } - if ( ! in_array( $profileuser->display_name, $public_display ) ) { // Only add this if it isn't duplicated elsewhere - $public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display; - } + if ( ! in_array( $profileuser->display_name, $public_display ) ) { // Only add this if it isn't duplicated elsewhere + $public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display; + } - $public_display = array_map( 'trim', $public_display ); - $public_display = array_unique( $public_display ); + $public_display = array_map( 'trim', $public_display ); + $public_display = array_unique( $public_display ); - $edit_data['public_display'] = $public_display; - $edit_data['display_name'] = $profileuser->display_name; - $edit_data['user_email'] = $profileuser->user_email; - $edit_data['user_url'] = $profileuser->user_url; - foreach ( wp_get_user_contact_methods( $profileuser ) as $name => $desc ) { - $edit_data['contact_methods'][ $name ] = $profileuser->$name; - } - $edit_data['description'] = $profileuser->description; - } - return $edit_data; - } + $edit_data['public_display'] = $public_display; + $edit_data['display_name'] = $profileuser->display_name; + $edit_data['user_email'] = $profileuser->user_email; + $edit_data['user_url'] = $profileuser->user_url; + foreach ( wp_get_user_contact_methods( $profileuser ) as $name => $desc ) { + $edit_data['contact_methods'][ $name ] = $profileuser->$name; + } + $edit_data['description'] = $profileuser->description; + } + return $edit_data; + } //todo: backwards compatible: wp_set_comment_status ? function comment_action() { @@ -3858,8 +3858,8 @@ echo 'checked'; } // to fix for some premiums update info if ( property_exists( $plugin_update, 'update' ) ) { if ( ! property_exists( $plugin_update->update, 'new_version' ) || empty( $plugin_update->update->new_version ) ) { - continue; - } + continue; + } } else { continue; } @@ -4112,9 +4112,9 @@ echo 'checked'; } $favi = ''; // to compatible $site_url = get_option( 'siteurl' ); - if ( substr( $site_url, - 1 ) != '/' ) { - $site_url .= '/'; - } + if ( substr( $site_url, - 1 ) != '/' ) { + $site_url .= '/'; + } if ( function_exists( 'get_site_icon_url' ) && has_site_icon() ) { $favi = $favi_url = get_site_icon_url(); @@ -4138,28 +4138,28 @@ echo 'checked'; } $request = wp_remote_get( $site_url, array( 'timeout' => 50 ) ); $favi = ''; if ( is_array( $request ) && isset( $request['body'] ) ) { - // to fix bug - $preg_str1 = '/(]*)(?:rel="shortcut\s+icon"\s*)(?:[^>]*)?href="([^"]+)"(?:[^>]*)?>)/is'; - $preg_str2 = '/(]*)(?:rel="(?:shortcut\s+)?icon"\s*)(?:[^>]*)?href="([^"]+)"(?:[^>]*)?>)/is'; + // to fix bug + $preg_str1 = '/(]*)(?:rel="shortcut\s+icon"\s*)(?:[^>]*)?href="([^"]+)"(?:[^>]*)?>)/is'; + $preg_str2 = '/(]*)(?:rel="(?:shortcut\s+)?icon"\s*)(?:[^>]*)?href="([^"]+)"(?:[^>]*)?>)/is'; - if ( preg_match( $preg_str1, $request['body'], $matches ) ) { - $favi = $matches[2]; - } elseif ( preg_match( $preg_str2, $request['body'], $matches ) ) { - $favi = $matches[2]; - } + if ( preg_match( $preg_str1, $request['body'], $matches ) ) { + $favi = $matches[2]; + } elseif ( preg_match( $preg_str2, $request['body'], $matches ) ) { + $favi = $matches[2]; + } } if ( ! empty( $favi ) ) { if ( false === strpos( $favi, 'http' )) { - if (0 === strpos( $favi, '//' )) { - if (0 === strpos( $site_url, 'https' )) { - $favi_url = 'https:' . $favi; - } else { - $favi_url = 'http:' . $favi; - } - } else { + if (0 === strpos( $favi, '//' )) { + if (0 === strpos( $site_url, 'https' )) { + $favi_url = 'https:' . $favi; + } else { + $favi_url = 'http:' . $favi; + } + } else { $favi_url = $site_url . $favi; - } + } } else { $favi_url = $favi; } @@ -4294,13 +4294,13 @@ echo 'checked'; } * The code is used for the MainWP WordPress SEO Extension * Extension URL: https://mainwp.com/extension/wordpress-seo/ * - */ + */ $wp_seo_enabled = false; if ( isset( $_POST['WPSEOEnabled'] ) && $_POST['WPSEOEnabled']) { - if (is_plugin_active('wordpress-seo/wp-seo.php') && class_exists('WPSEO_Link_Column_Count') && class_exists('WPSEO_Meta')) { + if (is_plugin_active('wordpress-seo/wp-seo.php') && class_exists('WPSEO_Link_Column_Count') && class_exists('WPSEO_Meta')) { $wp_seo_enabled = true; - } + } } $posts = get_posts( $args ); @@ -4987,9 +4987,9 @@ echo 'checked'; } } } } - if ($return) { - return $allusers; - } + if ($return) { + return $allusers; + } MainWP_Helper::write( $allusers ); } @@ -5056,11 +5056,11 @@ echo 'checked'; } ) ); if ( ! empty( $user_query->results ) ) { foreach ( $user_query->results as $new_user ) { - if ($check_users_role) { - if ( ! in_array($new_user->ID, $search_user_role )) { - continue; - } - } + if ($check_users_role) { + if ( ! in_array($new_user->ID, $search_user_role )) { + continue; + } + } $exclude[] = $new_user->ID; $usr = array(); $usr['id'] = $new_user->ID; @@ -5201,34 +5201,34 @@ echo 'checked'; } function getTotalFileSize( $directory = WP_CONTENT_DIR ) { try { -// function continueFileSize( $dir, $limit ) { -// $dirs = array( $dir ); -// $cnt = 0; -// while ( isset( $dirs[0] ) ) { -// $path = array_shift( $dirs ); -// if ( stristr( $path, WP_CONTENT_DIR . '/uploads/mainwp' ) ) { -// continue; -// } -// $uploadDir = MainWP_Helper::getMainWPDir(); -// $uploadDir = $uploadDir[0]; -// if ( stristr( $path, $uploadDir ) ) { -// continue; -// } -// $res = @glob( $path . '/*' ); -// if ( is_array( $res ) ) { -// foreach ( $res as $next ) { -// if ( is_dir( $next ) ) { -// $dirs[] = $next; -// } else { -// if ($cnt++ > $limit) return false;; -// } -// } -// } -// } -// return true; -// } -// -// if ( !continueFilesize( $directory, 20000 ) ) return 0; + // function continueFileSize( $dir, $limit ) { + // $dirs = array( $dir ); + // $cnt = 0; + // while ( isset( $dirs[0] ) ) { + // $path = array_shift( $dirs ); + // if ( stristr( $path, WP_CONTENT_DIR . '/uploads/mainwp' ) ) { + // continue; + // } + // $uploadDir = MainWP_Helper::getMainWPDir(); + // $uploadDir = $uploadDir[0]; + // if ( stristr( $path, $uploadDir ) ) { + // continue; + // } + // $res = @glob( $path . '/*' ); + // if ( is_array( $res ) ) { + // foreach ( $res as $next ) { + // if ( is_dir( $next ) ) { + // $dirs[] = $next; + // } else { + // if ($cnt++ > $limit) return false;; + // } + // } + // } + // } + // return true; + // } + // + // if ( !continueFilesize( $directory, 20000 ) ) return 0; if ( MainWP_Helper::function_exists( 'popen' ) ) { $uploadDir = MainWP_Helper::getMainWPDir(); @@ -5280,36 +5280,36 @@ echo 'checked'; } } } -// function dirsize( $dir ) { -// $dirs = array( $dir ); -// $size = 0; -// while ( isset( $dirs[0] ) ) { -// $path = array_shift( $dirs ); -// if ( stristr( $path, WP_CONTENT_DIR . '/uploads/mainwp' ) ) { -// continue; -// } -// $uploadDir = MainWP_Helper::getMainWPDir(); -// $uploadDir = $uploadDir[0]; -// if ( stristr( $path, $uploadDir ) ) { -// continue; -// } -// $res = @glob( $path . '/*' ); -// if ( is_array( $res ) ) { -// foreach ( $res as $next ) { -// if ( is_dir( $next ) ) { -// $dirs[] = $next; -// } else { -// $fs = filesize( $next ); -// $size += $fs; -// } -// } -// } -// } -// -// return $size / 1024 / 1024; -// } -// -// return dirsize( $directory ); + // function dirsize( $dir ) { + // $dirs = array( $dir ); + // $size = 0; + // while ( isset( $dirs[0] ) ) { + // $path = array_shift( $dirs ); + // if ( stristr( $path, WP_CONTENT_DIR . '/uploads/mainwp' ) ) { + // continue; + // } + // $uploadDir = MainWP_Helper::getMainWPDir(); + // $uploadDir = $uploadDir[0]; + // if ( stristr( $path, $uploadDir ) ) { + // continue; + // } + // $res = @glob( $path . '/*' ); + // if ( is_array( $res ) ) { + // foreach ( $res as $next ) { + // if ( is_dir( $next ) ) { + // $dirs[] = $next; + // } else { + // $fs = filesize( $next ); + // $size += $fs; + // } + // } + // } + // } + // + // return $size / 1024 / 1024; + // } + // + // return dirsize( $directory ); return 0; } catch ( Exception $e ) { return 0; @@ -5379,17 +5379,17 @@ echo 'checked'; } $maint_options = array(); } -// $this->options = array( -// 'revisions' => __( 'Delete all post revisions', 'mainwp-maintenance-extension' ), -// 'autodraft' => __( 'Delete all auto draft posts', 'mainwp-maintenance-extension' ), -// 'trashpost' => __( 'Delete trash posts', 'mainwp-maintenance-extension' ), -// 'spam' => __( 'Delete spam comments', 'mainwp-maintenance-extension' ), -// 'pending' => __( 'Delete pending comments', 'mainwp-maintenance-extension' ), -// 'trashcomment' => __( 'Delete trash comments', 'mainwp-maintenance-extension' ), -// 'tags' => __( 'Delete tags with 0 posts associated', 'mainwp-maintenance-extension' ), -// 'categories' => __( 'Delete categories with 0 posts associated', 'mainwp-maintenance-extension' ), -// 'optimize' => __( 'Optimize database tables', 'mainwp-maintenance-extension' ) -// ); + // $this->options = array( + // 'revisions' => __( 'Delete all post revisions', 'mainwp-maintenance-extension' ), + // 'autodraft' => __( 'Delete all auto draft posts', 'mainwp-maintenance-extension' ), + // 'trashpost' => __( 'Delete trash posts', 'mainwp-maintenance-extension' ), + // 'spam' => __( 'Delete spam comments', 'mainwp-maintenance-extension' ), + // 'pending' => __( 'Delete pending comments', 'mainwp-maintenance-extension' ), + // 'trashcomment' => __( 'Delete trash comments', 'mainwp-maintenance-extension' ), + // 'tags' => __( 'Delete tags with 0 posts associated', 'mainwp-maintenance-extension' ), + // 'categories' => __( 'Delete categories with 0 posts associated', 'mainwp-maintenance-extension' ), + // 'optimize' => __( 'Optimize database tables', 'mainwp-maintenance-extension' ) + // ); $performed_what = array(); if ( empty( $max_revisions ) ) { diff --git a/class/class-mainwp-clone.php b/class/class-mainwp-clone.php index 309513d..e44ffaf 100644 --- a/class/class-mainwp-clone.php +++ b/class/class-mainwp-clone.php @@ -281,10 +281,10 @@ class MainWP_Clone { is_writable( WP_CONTENT_DIR ) ) || ( empty( $wp_filesystem ) && ! is_writable( WP_CONTENT_DIR ) ) ) { - echo '
' . esc_html__( 'Your content directory is not writable. Please set 0755 permission to ', 'mainwp-child' ) . esc_html( basename( WP_CONTENT_DIR ) ) . '. (' . esc_html( WP_CONTENT_DIR ) . ')
'; - $error = true; - } + if ( ( ! empty( $wp_filesystem ) && ! $wp_filesystem->is_writable( WP_CONTENT_DIR ) ) || ( empty( $wp_filesystem ) && ! is_writable( WP_CONTENT_DIR ) ) ) { + echo '
' . esc_html__( 'Your content directory is not writable. Please set 0755 permission to ', 'mainwp-child' ) . esc_html( basename( WP_CONTENT_DIR ) ) . '. (' . esc_html( WP_CONTENT_DIR ) . ')
'; + $error = true; + } ?> getSecurityNonces(); - foreach ($security_nonces as $k => $v) { - echo 'child_security_nonces[' . "'" . $k . "'" . '] = ' . "'" . $v . "';\n"; - } + foreach ($security_nonces as $k => $v) { + echo 'child_security_nonces[' . "'" . $k . "'" . '] = ' . "'" . $v . "';\n"; + } ?> mainwpchild_secure_data = function(data, includeDts) @@ -1575,10 +1575,10 @@ class MainWP_Clone { + } + ?> . diff --git a/class/class-mainwp-custom-post-type.php b/class/class-mainwp-custom-post-type.php index 0849858..3a4ee40 100755 --- a/class/class-mainwp-custom-post-type.php +++ b/class/class-mainwp-custom-post-type.php @@ -20,10 +20,10 @@ class MainWP_Custom_Post_Type { $error = error_get_last(); if ( isset( $error['type'] ) && E_ERROR === $error['type'] && isset( $error['message'] ) ) { $data = array( 'error' => 'MainWPChild fatal error : ' . $error['message'] . ' Line: ' . $error['line'] . ' File: ' . $error['file'] ); -// die( '' . base64_encode( serialize( ) ) . '' ); + // die( '' . base64_encode( serialize( ) ) . '' ); } else { $data = self::$information; -// die( '' . base64_encode( serialize( MainWP_Custom_Post_Type::$information ) ) . '' ); + // die( '' . base64_encode( serialize( MainWP_Custom_Post_Type::$information ) ) . '' ); } if ( isset( $_REQUEST['json_result'] ) && $_REQUEST['json_result'] ) { diff --git a/class/class-mainwp-helper.php b/class/class-mainwp-helper.php index 76ccd56..37cf97b 100644 --- a/class/class-mainwp-helper.php +++ b/class/class-mainwp-helper.php @@ -108,7 +108,7 @@ class MainWP_Helper { if ( ! empty($selector)) { if ( ! isset($new[ $selector ])) { -$new[ $selector ] = array(); + $new[ $selector ] = array(); } $rules = explode(';', $val[ ++$i ]); foreach ($rules as $rule) { @@ -119,9 +119,9 @@ $new[ $selector ] = array(); $value = implode(':', array_reverse($rule)); if ( ! isset($new[ $selector ][ $property ]) || ! preg_match('/!important/', $new[ $selector ][ $property ])) { -$new[ $selector ][ $property ] = $value; + $new[ $selector ][ $property ] = $value; } elseif (preg_match('/!important/', $new[ $selector ][ $property ]) && preg_match('/!important/', $value)) { -$new[ $selector ][ $property ] = $value; + $new[ $selector ][ $property ] = $value; } } } @@ -137,7 +137,7 @@ $new[ $selector ][ $property ] = $value; $output .= $media . " {\n"; $prefix = "\t"; } else { -$prefix = ''; + $prefix = ''; } foreach ($content as $selector => $rules) { @@ -413,9 +413,9 @@ $prefix = ''; $new_post['post_date'] = date( 'Y-m-d H:i:s', $post_date_timestamp ); //$new_post['post_status'] = ( $post_date_timestamp <= current_time( 'timestamp' ) ) ? 'publish' : 'future'; } -// else { -// $new_post['post_status'] = 'publish'; -// } + // else { + // $new_post['post_status'] = 'publish'; + // } } $wpr_options = isset( $_POST['wpr_options'] ) ? $_POST['wpr_options'] : array(); @@ -476,12 +476,12 @@ $prefix = ''; $new_post['post_content'] = str_replace( $serverHref, $replaceServerHref, $new_post['post_content'] ); } // To fix bug -// else if ( strpos( $hrefLink, 'http' ) !== false ) { -// $lnkToReplace = dirname( $hrefLink ); -// if ( 'http:' !== $lnkToReplace && 'https:' !== $lnkToReplace ) { -// $new_post['post_content'] = str_replace( $lnkToReplace, $linkToReplaceWith, $new_post['post_content'] ); -// } -// } + // else if ( strpos( $hrefLink, 'http' ) !== false ) { + // $lnkToReplace = dirname( $hrefLink ); + // if ( 'http:' !== $lnkToReplace && 'https:' !== $lnkToReplace ) { + // $new_post['post_content'] = str_replace( $lnkToReplace, $linkToReplaceWith, $new_post['post_content'] ); + // } + // } } $lnkToReplace = dirname( $imgUrl ); if ( 'http:' !== $lnkToReplace && 'https:' !== $lnkToReplace ) { @@ -563,8 +563,8 @@ $prefix = ''; } $random_timestamp = rand( $random_date_from, $random_date_to ); -// $post_status = ( $random_timestamp <= current_time( 'timestamp' ) ) ? 'publish' : 'future'; -// $new_post['post_status'] = $post_status; + // $post_status = ( $random_timestamp <= current_time( 'timestamp' ) ) ? 'publish' : 'future'; + // $new_post['post_status'] = $post_status; $new_post['post_date'] = date( 'Y-m-d H:i:s', $random_timestamp ); } } @@ -599,10 +599,10 @@ $prefix = ''; } if ( ! $edit_post_id ) { - wp_update_post( array( - 'ID' => $new_post_id, - 'post_status' => $post_status, - ) ); + wp_update_post( array( + 'ID' => $new_post_id, + 'post_status' => $post_status, + ) ); } if ( ! empty( $terms ) ) { @@ -658,33 +658,33 @@ $prefix = ''; 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) { - continue; // not save - } + if ( ! in_array( $meta_key, $not_allowed ) ) { + foreach ( $meta_values as $meta_value ) { + if (strpos($meta_key, '_mainwp_spinner_') === 0) { + continue; // not save + } - if ( ! $seo_ext_activated ) { - // if WordPress SEO plugin is not activated do not save yoast post meta - if ( strpos( $meta_key, '_yoast_wpseo_' ) === false ) { + if ( ! $seo_ext_activated ) { + // if WordPress SEO plugin is not activated do not save yoast post meta + if ( strpos( $meta_key, '_yoast_wpseo_' ) === false ) { + update_post_meta( $new_post_id, $meta_key, $meta_value ); + } + } else { update_post_meta( $new_post_id, $meta_key, $meta_value ); } - } else { - update_post_meta( $new_post_id, $meta_key, $meta_value ); } - } - } elseif ( '_sticky' === $meta_key ) { - foreach ( $meta_values as $meta_value ) { - if ( 'sticky' === base64_decode( $meta_value ) ) { - stick_post( $new_post_id ); + } elseif ( '_sticky' === $meta_key ) { + foreach ( $meta_values as $meta_value ) { + if ( 'sticky' === base64_decode( $meta_value ) ) { + stick_post( $new_post_id ); + } + } + } elseif ( '_post_to_only_existing_categories' === $meta_key ) { + if ( isset( $meta_values[0] ) && $meta_values[0] ) { + $post_to_only_existing_categories = true; } - } - } elseif ( '_post_to_only_existing_categories' === $meta_key ) { - if ( isset( $meta_values[0] ) && $meta_values[0] ) { - $post_to_only_existing_categories = true; } } - } } // yoast seo extension @@ -949,9 +949,9 @@ $prefix = ''; if ( empty( $wp_filesystem ) ) { ob_start(); -// if ( file_exists( ABSPATH . '/wp-admin/includes/deprecated.php' ) ) { -// include_once( ABSPATH . '/wp-admin/includes/deprecated.php' ); -// } + // if ( file_exists( ABSPATH . '/wp-admin/includes/deprecated.php' ) ) { + // include_once( ABSPATH . '/wp-admin/includes/deprecated.php' ); + // } if ( file_exists( ABSPATH . '/wp-admin/includes/screen.php' ) ) { include_once ABSPATH . '/wp-admin/includes/screen.php'; } @@ -1451,34 +1451,34 @@ $prefix = ''; * Credit to the : wp-filters-extras */ -static function remove_filters_with_method_name( $hook_name = '', $method_name = '', $priority = 0 ) { + static function remove_filters_with_method_name( $hook_name = '', $method_name = '', $priority = 0 ) { - global $wp_filter; - // Take only filters on right hook name and priority - if ( ! isset( $wp_filter[ $hook_name ][ $priority ] ) || ! is_array( $wp_filter[ $hook_name ][ $priority ] ) ) { - return false; - } - // Loop on filters registered - foreach ( (array) $wp_filter[ $hook_name ][ $priority ] as $unique_id => $filter_array ) { - // Test if filter is an array ! (always for class/method) - if ( isset( $filter_array['function'] ) && is_array( $filter_array['function'] ) ) { - // Test if object is a class and method is equal to param ! - if ( is_object( $filter_array['function'][0] ) && get_class( $filter_array['function'][0] ) && $filter_array['function'][1] == $method_name ) { - // Test for WordPress >= 4.7 WP_Hook class - if ( is_a( $wp_filter[ $hook_name ], 'WP_Hook' ) ) { - unset( $wp_filter[ $hook_name ]->callbacks[ $priority ][ $unique_id ] ); - } else { - unset( $wp_filter[ $hook_name ][ $priority ][ $unique_id ] ); + global $wp_filter; + // Take only filters on right hook name and priority + if ( ! isset( $wp_filter[ $hook_name ][ $priority ] ) || ! is_array( $wp_filter[ $hook_name ][ $priority ] ) ) { + return false; + } + // Loop on filters registered + foreach ( (array) $wp_filter[ $hook_name ][ $priority ] as $unique_id => $filter_array ) { + // Test if filter is an array ! (always for class/method) + if ( isset( $filter_array['function'] ) && is_array( $filter_array['function'] ) ) { + // Test if object is a class and method is equal to param ! + if ( is_object( $filter_array['function'][0] ) && get_class( $filter_array['function'][0] ) && $filter_array['function'][1] == $method_name ) { + // Test for WordPress >= 4.7 WP_Hook class + if ( is_a( $wp_filter[ $hook_name ], 'WP_Hook' ) ) { + unset( $wp_filter[ $hook_name ]->callbacks[ $priority ][ $unique_id ] ); + } else { + unset( $wp_filter[ $hook_name ][ $priority ][ $unique_id ] ); + } } } } + return false; } - return false; -} public static function sanitize_filename( $filename ) { if ( ! function_exists('mb_ereg_replace')) { -return sanitize_file_name($filename); + return sanitize_file_name($filename); } // Remove anything which isn't a word, whitespace, number @@ -1551,7 +1551,7 @@ return sanitize_file_name($filename); public static function isSSLEnabled() { if ( defined( 'MAINWP_NOSSL' ) ) { -return ! MAINWP_NOSSL; + return ! MAINWP_NOSSL; } return function_exists( 'openssl_verify' ); } @@ -1579,132 +1579,132 @@ return ! MAINWP_NOSSL; public static function check_files_exists( $files = array(), $return = false ) { $missing = array(); - if (is_array($files)) { - foreach ($files as $name) { - if ( ! file_exists( $name )) { - $missing[] = $name; - } - } - } else { - if ( ! file_exists( $files )) { - $missing[] = $files; - } - } + if (is_array($files)) { + foreach ($files as $name) { + if ( ! file_exists( $name )) { + $missing[] = $name; + } + } + } else { + if ( ! file_exists( $files )) { + $missing[] = $files; + } + } - if ( ! empty($missing)) { - $message = 'Missing file(s): ' . implode(',', $missing); - if ($return) { - return $message; - } else { - throw new Exception( $message ); - } - } + if ( ! empty($missing)) { + $message = 'Missing file(s): ' . implode(',', $missing); + if ($return) { + return $message; + } else { + throw new Exception( $message ); + } + } return true; } public static function check_classes_exists( $classes = array(), $return = false) { $missing = array(); - if (is_array($classes)) { - foreach ($classes as $name) { - if ( ! class_exists( $name )) { - $missing[] = $name; - } - } - } else { - if ( ! class_exists($classes) ) { - $missing[] = $classes; - } - } + if (is_array($classes)) { + foreach ($classes as $name) { + if ( ! class_exists( $name )) { + $missing[] = $name; + } + } + } else { + if ( ! class_exists($classes) ) { + $missing[] = $classes; + } + } - if ( ! empty($missing) ) { - $message = 'Missing classes: ' . implode(',', $missing); - if ($return) { - return $message; - } else { - throw new Exception( $message ); - } - } + if ( ! empty($missing) ) { + $message = 'Missing classes: ' . implode(',', $missing); + if ($return) { + return $message; + } else { + throw new Exception( $message ); + } + } return true; } public static function check_methods( $object, $methods = array(), $return = false) { $missing = array(); - if (is_array($methods)) { - $missing = array(); - foreach ($methods as $name) { - if ( ! method_exists($object, $name) ) { - $missing[] = $name; - } - } - } elseif ( ! empty($methods)) { - if ( ! method_exists($object, $methods) ) { - $missing[] = $methods; - } + if (is_array($methods)) { + $missing = array(); + foreach ($methods as $name) { + if ( ! method_exists($object, $name) ) { + $missing[] = $name; + } + } + } elseif ( ! empty($methods)) { + if ( ! method_exists($object, $methods) ) { + $missing[] = $methods; + } - } + } - if ( ! empty($missing) ) { - $message = 'Missing method: ' . implode(',', $missing); - if ($return) { - return $message; - } else { - throw new Exception( $message ); - } - } + if ( ! empty($missing) ) { + $message = 'Missing method: ' . implode(',', $missing); + if ($return) { + return $message; + } else { + throw new Exception( $message ); + } + } return true; } public static function check_properties( $object, $properties = array(), $return = false) { $missing = array(); - if (is_array($properties)) { - foreach ($properties as $name) { - if ( ! property_exists($object, $name) ) { - $missing[] = $name; - } - } - } elseif ( ! empty($properties)) { - if ( ! property_exists($object, $properties) ) { - $missing[] = $properties; - } + if (is_array($properties)) { + foreach ($properties as $name) { + if ( ! property_exists($object, $name) ) { + $missing[] = $name; + } + } + } elseif ( ! empty($properties)) { + if ( ! property_exists($object, $properties) ) { + $missing[] = $properties; + } - } + } - if ( ! empty($missing) ) { - $message = 'Missing properties: ' . implode(',', $missing); - if ($return) { - return $message; - } else { - throw new Exception( $message ); - } - } + if ( ! empty($missing) ) { + $message = 'Missing properties: ' . implode(',', $missing); + if ($return) { + return $message; + } else { + throw new Exception( $message ); + } + } return true; } public static function check_functions( $funcs = array(), $return = false) { $missing = array(); - if (is_array($funcs)) { - foreach ($funcs as $name) { - if ( ! function_exists( $name) ) { - $missing[] = $name; - } - } - } elseif ( ! empty($funcs)) { - if ( ! function_exists($funcs) ) { - $missing[] = $funcs; - } + if (is_array($funcs)) { + foreach ($funcs as $name) { + if ( ! function_exists( $name) ) { + $missing[] = $name; + } + } + } elseif ( ! empty($funcs)) { + if ( ! function_exists($funcs) ) { + $missing[] = $funcs; + } - } + } - if ( ! empty($missing) ) { - $message = 'Missing functions: ' . implode(',', $missing); - if ($return) { - return $message; - } else { - throw new Exception( $message ); - } - } + if ( ! empty($missing) ) { + $message = 'Missing functions: ' . implode(',', $missing); + if ($return) { + return $message; + } else { + throw new Exception( $message ); + } + } return true; } @@ -1724,7 +1724,7 @@ return ! MAINWP_NOSSL; if ( isset( $error['type'] ) && isset( $error['message'] ) && ( E_ERROR === $error['type'] || E_COMPILE_ERROR === $error['type'] ) ) { - self::write( array( 'error' => 'MainWP_Child fatal error : ' . $error['message'] . ' Line: ' . $error['line'] . ' File: ' . $error['file'] ) ); + self::write( array( 'error' => 'MainWP_Child fatal error : ' . $error['message'] . ' Line: ' . $error['line'] . ' File: ' . $error['file'] ) ); } } diff --git a/class/class-mainwp-security.php b/class/class-mainwp-security.php index cb07009..d716092 100644 --- a/class/class-mainwp-security.php +++ b/class/class-mainwp-security.php @@ -353,7 +353,7 @@ class MainWP_Security { public static function admin_user_ok() { $user = get_user_by( 'login', 'admin' ); if ( ! $user ) { -return true; + return true; } if ( 10 !== $user->wp_user_level && ( ! isset( $user->user_level ) || 10 !== $user->user_level ) && ! user_can( $user, 'level_10' ) ) { diff --git a/class/class-mainwp-wordpress-seo.php b/class/class-mainwp-wordpress-seo.php index 4f6beba..771a0b4 100644 --- a/class/class-mainwp-wordpress-seo.php +++ b/class/class-mainwp-wordpress-seo.php @@ -86,24 +86,24 @@ class MainWP_Wordpress_SEO { if ( is_array( $options ) && array() !== $options ) { $old_wpseo_version = null; - if ( isset( $options['wpseo']['version'] ) && '' !== $options['wpseo']['version'] ) { - $old_wpseo_version = $options['wpseo']['version']; - } - foreach ( $options as $name => $optgroup ) { - if ( 'wpseo_taxonomy_meta' === $name ) { - $optgroup = json_decode( urldecode( $optgroup['wpseo_taxonomy_meta'] ), true ); - } - // Make sure that the imported options are cleaned/converted on import - $option_instance = WPSEO_Options::get_option_instance( $name ); - if ( is_object( $option_instance ) && method_exists( $option_instance, 'import' ) ) { - $optgroup = $option_instance->import( $optgroup, $old_wpseo_version, $options ); - } - } + if ( isset( $options['wpseo']['version'] ) && '' !== $options['wpseo']['version'] ) { + $old_wpseo_version = $options['wpseo']['version']; + } + foreach ( $options as $name => $optgroup ) { + if ( 'wpseo_taxonomy_meta' === $name ) { + $optgroup = json_decode( urldecode( $optgroup['wpseo_taxonomy_meta'] ), true ); + } + // Make sure that the imported options are cleaned/converted on import + $option_instance = WPSEO_Options::get_option_instance( $name ); + if ( is_object( $option_instance ) && method_exists( $option_instance, 'import' ) ) { + $optgroup = $option_instance->import( $optgroup, $old_wpseo_version, $options ); + } + } $information['success'] = true; - } else { - throw new Exception( __( 'Settings could not be imported:', 'wordpress-seo' ) ); - } + } else { + throw new Exception( __( 'Settings could not be imported:', 'wordpress-seo' ) ); + } } catch ( Exception $e ) { $information['error'] = $e->getMessage(); }
array(), - 'strong' => array(), - 'em' => array(), - 'a' => array( 'href' => true ), - )) - ?> + echo wp_kses($result['label'], array( + 'code' => array(), + 'strong' => array(), + 'em' => array(), + 'a' => array( 'href' => true ), + )) + ?> @@ -2469,7 +2469,7 @@ SQL isActive($key) ? ' wf-active' : '' ) . ( $hasFailingTest ? ' wf-diagnostic-fail' : '' ) - ?> + ?> " data-persistence-key="">
@@ -2489,13 +2489,13 @@ SQL
array(), - 'strong' => array(), - 'em' => array(), - 'a' => array( 'href' => true ), - )) - ?> + echo wp_kses($result['label'], array( + 'code' => array(), + 'strong' => array(), + 'em' => array(), + 'a' => array( 'href' => true ), + )) + ?>
@@ -2558,44 +2558,44 @@ SQL 'HTTP_X_REAL_IP' => 'X-Real-IP', 'HTTP_X_FORWARDED_FOR' => 'X-Forwarded-For', ) as $variable => $label) : - ?> + ?>
$i) { - foreach ($trustedProxies as $proxy) { - if ( ! empty($proxy)) { - if (wfUtils::subnetContainsIP($proxy, $i) && $index < count($items) - 1) { - $output = esc_html($i) . ', ' . $output; - continue 2; - } + if ( ! array_key_exists($variable, $_SERVER)) { + echo '(not set)'; + } else { + if (strpos($_SERVER[ $variable ], ',') !== false) { + $trustedProxies = explode("\n", wfConfig::get('howGetIPs_trusted_proxies', '')); + $items = preg_replace('/[\s,]/', '', explode(',', $_SERVER[ $variable ])); + $items = array_reverse($items); + $output = ''; + $markedSelectedAddress = false; + foreach ($items as $index => $i) { + foreach ($trustedProxies as $proxy) { + if ( ! empty($proxy)) { + if (wfUtils::subnetContainsIP($proxy, $i) && $index < count($items) - 1) { + $output = esc_html($i) . ', ' . $output; + continue 2; } } - - if ( ! $markedSelectedAddress) { - $output = '' . esc_html($i) . ', ' . $output; - $markedSelectedAddress = true; - } else { - $output = esc_html($i) . ', ' . $output; - } } - echo substr($output, 0, -2); - } else { - echo esc_html($_SERVER[ $variable ]); + if ( ! $markedSelectedAddress) { + $output = '' . esc_html($i) . ', ' . $output; + $markedSelectedAddress = true; + } else { + $output = esc_html($i) . ', ' . $output; + } } + + echo substr($output, 0, -2); + } else { + echo esc_html($_SERVER[ $variable ]); } - ?> + } + ?> In use
No log files found.
Download' : 'Requires downloading from the server directly' ); ?>