diff --git a/class/class-mainwp-child-callable.php b/class/class-mainwp-child-callable.php index 85e367a..55f5120 100644 --- a/class/class-mainwp-child-callable.php +++ b/class/class-mainwp-child-callable.php @@ -5,7 +5,7 @@ namespace MainWP\Child; class MainWP_Child_Callable { protected static $instance = null; - + private $callableFunctions = array( 'stats' => 'get_site_stats', 'upgrade' => 'upgrade_wp', @@ -71,12 +71,12 @@ class MainWP_Child_Callable { 'wpvivid_backuprestore' => 'wpvivid_backuprestore', ); - + private $callableFunctionsNoAuth = array( 'stats' => 'get_site_stats_no_auth', ); - - + + /** * Method get_class_name() * @@ -87,42 +87,43 @@ class MainWP_Child_Callable { public static function get_class_name() { return __CLASS__; } - + public function __construct() { - } - + public static function get_instance() { if ( null === self::$instance ) { self::$instance = new self(); } return self::$instance; } - + public function is_callable_function( $func ) { - if ( isset( $this->callableFunctions[ $func ] ) ) + if ( isset( $this->callableFunctions[ $func ] ) ) { return true; + } return false; } - + public function is_callable_function_no_auth( $func ) { - if ( isset( $this->callableFunctionsNoAuth[ $func ] ) ) + if ( isset( $this->callableFunctionsNoAuth[ $func ] ) ) { return true; + } return false; } - + public function call_function( $func ) { - if ( $this->is_callable_function( $func )) { + if ( $this->is_callable_function( $func ) ) { call_user_func( array( $this, $this->callableFunctions[ $func ] ) ); - } + } } - + public function call_function_no_auth( $func ) { - if ( $this->is_callable_function_no_auth( $func )) { + if ( $this->is_callable_function_no_auth( $func ) ) { call_user_func( array( $this, $this->callableFunctionsNoAuth[ $func ] ) ); - } + } } - + public function get_site_stats() { MainWP_Child_Stats::get_instance()->get_site_stats(); } @@ -149,8 +150,8 @@ class MainWP_Child_Callable { public function upgrade_plugin_theme() { MainWP_Child_Updates::get_instance()->upgrade_plugin_theme(); } - - + + public function insert_comment() { $postId = $_POST['id']; $comments = maybe_unserialize( base64_decode( $_POST['comments'] ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for begin reasons. @@ -215,18 +216,18 @@ class MainWP_Child_Callable { mainwp_child_helper()->write( $information ); } - public function theme_action() { + public function theme_action() { MainWP_Child_Install::get_instance()->theme_action(); } - + public function plugin_action() { MainWP_Child_Install::get_instance()->plugin_action(); } - + public function get_all_plugins() { MainWP_Child_Install::get_instance()->get_all_plugins(); } - + public function get_all_themes() { MainWP_Child_Install::get_instance()->get_all_themes(); } @@ -234,35 +235,35 @@ class MainWP_Child_Callable { public function get_all_users() { MainWP_Child_Users::get_instance()->get_all_users(); } - + public function user_action() { MainWP_Child_Users::get_instance()->user_action(); } - + public function search_users() { MainWP_Child_Users::get_instance()->search_users(); } - + public function get_all_posts() { MainWP_Child_Posts::get_instance()->get_all_posts(); } - + public function get_all_pages() { MainWP_Child_Posts::get_instance()->get_all_pages(); } - + public function comment_action() { - MainWP_Child_Posts::get_instance()->comment_action(); - } - - public function get_all_comments() { - MainWP_Child_Posts::get_instance()->get_all_comments(); + MainWP_Child_Posts::get_instance()->comment_action(); } - + + public function get_all_comments() { + MainWP_Child_Posts::get_instance()->get_all_comments(); + } + public function comment_bulk_action() { - MainWP_Child_Posts::get_instance()->comment_bulk_action(); - } - + MainWP_Child_Posts::get_instance()->comment_bulk_action(); + } + public function server_information() { ob_start(); MainWP_Child_Server_Information::render(); @@ -427,24 +428,24 @@ class MainWP_Child_Callable { } } } - - + + public function new_post() { MainWP_Child_Posts::get_instance()->new_post(); } - + public function post_action() { MainWP_Child_Posts::get_instance()->post_action(); } - + public function new_admin_password() { MainWP_Child_Users::get_instance()->new_admin_password(); } - + public function new_user() { MainWP_Child_Users::get_instance()->new_user(); - } - + } + public function cloneinfo() { global $table_prefix; $information['dbCharset'] = DB_CHARSET; @@ -735,7 +736,7 @@ class MainWP_Child_Callable { 'filesize' => filesize( $result['filepath'] ), ); } - + public function get_site_icon() { $information = array(); $url = $this->get_favicon( true ); @@ -813,7 +814,7 @@ class MainWP_Child_Callable { return $favi_url; } } - + public function get_security_stats() { $information = array(); @@ -831,7 +832,7 @@ class MainWP_Child_Callable { mainwp_child_helper()->write( $information ); } - + public function do_security_fix() { $sync = false; if ( 'all' === $_POST['feature'] ) { @@ -963,7 +964,7 @@ class MainWP_Child_Callable { mainwp_child_helper()->write( $information ); } - + public function settings_tools() { if ( isset( $_POST['action'] ) ) { switch ( $_POST['action'] ) { @@ -1021,7 +1022,7 @@ class MainWP_Child_Callable { $information = apply_filters( 'mainwp_child_extra_execution', $information, $post ); mainwp_child_helper()->write( $information ); } - + public function uploader_action() { $file_url = base64_decode( $_POST['url'] ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for begin reasons. @@ -1136,15 +1137,15 @@ class MainWP_Child_Callable { mainwp_child_helper()->write( array( 'result' => 'ok' ) ); } - + public function update_child_values() { $uniId = isset( $_POST['uniqueId'] ) ? $_POST['uniqueId'] : ''; MainWP_Helper::update_option( 'mainwp_child_uniqueId', $uniId ); mainwp_child_helper()->write( array( 'result' => 'ok' ) ); } - - - + + + public function keyword_links_action() { MainWP_Keyword_Links::instance()->action(); } @@ -1235,14 +1236,14 @@ class MainWP_Child_Callable { } return false; } - + public function disconnect() { global $mainWPChild; $mainWPChild->deactivation( false ); mainwp_child_helper()->write( array( 'result' => 'success' ) ); } - - + + // Deactivating child plugin. public function deactivate() { global $mainWPChild; @@ -1255,5 +1256,5 @@ class MainWP_Child_Callable { $information['deactivated'] = true; mainwp_child_helper()->write( $information ); } - + } diff --git a/class/class-mainwp-child-install.php b/class/class-mainwp-child-install.php index 3656439..ef716ea 100644 --- a/class/class-mainwp-child-install.php +++ b/class/class-mainwp-child-install.php @@ -28,11 +28,11 @@ class MainWP_Child_Install { return self::$instance; } - + public function plugin_action() { - + global $mainWPChild; - + $action = $_POST['action']; $plugins = explode( '||', $_POST['plugin'] ); @@ -111,7 +111,7 @@ class MainWP_Child_Install { } public function theme_action() { - + $action = $_POST['action']; $theme = $_POST['theme']; @@ -171,7 +171,7 @@ class MainWP_Child_Install { if ( ! isset( $information['status'] ) ) { $information['status'] = 'SUCCESS'; } - + $information['sync'] = MainWP_Child_Stats::get_instance()->get_site_stats( array(), false ); mainwp_child_helper()->write( $information ); } @@ -303,6 +303,6 @@ class MainWP_Child_Install { $information['installation'] = 'SUCCESS'; $information['destination_name'] = $result['destination_name']; mainwp_child_helper()->write( $information ); - } + } } diff --git a/class/class-mainwp-child-posts.php b/class/class-mainwp-child-posts.php index 344ce24..816d5ed 100644 --- a/class/class-mainwp-child-posts.php +++ b/class/class-mainwp-child-posts.php @@ -5,11 +5,11 @@ namespace MainWP\Child; class MainWP_Child_Posts { protected static $instance = null; - + private $comments_and_clauses; private $posts_where_suffix; - - + + /** * Method get_class_name() * @@ -20,12 +20,12 @@ class MainWP_Child_Posts { public static function get_class_name() { return __CLASS__; } - + public function __construct() { $this->comments_and_clauses = ''; - $this->posts_where_suffix = ''; + $this->posts_where_suffix = ''; } - + public static function get_instance() { if ( null === self::$instance ) { self::$instance = new self(); @@ -33,8 +33,8 @@ class MainWP_Child_Posts { return self::$instance; } - - + + public function get_recent_posts( $pAllowedStatuses, $pCount, $type = 'post', $extra = null ) { $allPosts = array(); @@ -172,17 +172,17 @@ class MainWP_Child_Posts { } } } - - + + public function get_all_posts() { $post_type = ( isset( $_POST['post_type'] ) ? $_POST['post_type'] : 'post' ); $this->get_all_posts_by_type( $post_type ); } - + public function get_all_pages() { $this->get_all_posts_by_type( 'page' ); } - + public function posts_where( $where ) { if ( $this->posts_where_suffix ) { $where .= ' ' . $this->posts_where_suffix; @@ -190,7 +190,7 @@ class MainWP_Child_Posts { return $where; } - + public function get_all_posts_by_type( $type ) { global $wpdb; @@ -255,7 +255,7 @@ class MainWP_Child_Posts { mainwp_child_helper()->write( $rslt ); } - + public function new_post() { $new_post = maybe_unserialize( base64_decode( $_POST['new_post'] ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for begin reasons. $post_custom = maybe_unserialize( base64_decode( $_POST['post_custom'] ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for begin reasons. @@ -575,8 +575,8 @@ class MainWP_Child_Posts { } mainwp_child_helper()->write( $information ); } - - + + public function comments_clauses( $clauses ) { if ( $this->comments_and_clauses ) { $clauses['where'] .= ' ' . $this->comments_and_clauses; @@ -658,5 +658,5 @@ class MainWP_Child_Posts { return $allComments; } - + } diff --git a/class/class-mainwp-child-stats.php b/class/class-mainwp-child-stats.php index 21340f0..cac8894 100644 --- a/class/class-mainwp-child-stats.php +++ b/class/class-mainwp-child-stats.php @@ -37,7 +37,7 @@ class MainWP_Child_Stats { return self::$instance; } - + // Show stats without login - only allowed while no account is added yet. public function get_site_stats_no_auth( $information = array() ) { if ( get_option( 'mainwp_child_pubkey' ) ) { @@ -51,8 +51,8 @@ class MainWP_Child_Stats { $information['wpe'] = MainWP_Helper::is_wp_engine() ? 1 : 0; mainwp_child_helper()->write( $information ); } - - + + public function default_option_active_plugins( $default ) { if ( ! is_array( $default ) ) { $default = array(); @@ -63,7 +63,7 @@ class MainWP_Child_Stats { return $default; } - + // Show stats. public function get_site_stats( $information = array(), $exit = true ) { global $wp_version; @@ -76,7 +76,7 @@ class MainWP_Child_Stats { if ( isset( $_POST['server'] ) ) { MainWP_Helper::update_option( 'mainwp_child_server', $_POST['server'] ); } - + MainWP_Child_Plugins_Check::may_outdate_number_change(); $information['version'] = MainWP_Child::$version; @@ -107,7 +107,7 @@ class MainWP_Child_Stats { $information['nossl'] = ( 1 == $nossl ? 1 : 0 ); include_once ABSPATH . '/wp-admin/includes/update.php'; - + $timeout = 3 * 60 * 60; set_time_limit( $timeout ); ini_set( 'max_execution_time', $timeout ); //phpcs:ignore -- to custom @@ -253,7 +253,7 @@ class MainWP_Child_Stats { } } } - + if ( null !== $this->filterFunction ) { add_filter( 'pre_site_transient_update_themes', $this->filterFunction, 99 ); } @@ -340,7 +340,7 @@ class MainWP_Child_Stats { if ( $recent_number <= 0 || $recent_number > 30 ) { $recent_number = 5; } - + $information['recent_posts'] = MainWP_Child_Posts::get_instance()->get_recent_posts( array( 'publish', 'draft', 'pending', 'trash', 'future' ), $recent_number ); $information['recent_pages'] = MainWP_Child_Posts::get_instance()->get_recent_posts( array( 'publish', 'draft', 'pending', 'trash', 'future' ), $recent_number, 'page' ); $information['securityIssues'] = MainWP_Security::get_stats_security(); @@ -360,7 +360,6 @@ class MainWP_Child_Stats { } $information['categories'] = $categories; - $get_file_size = apply_filters_deprecated( 'mainwp-child-get-total-size', array( true ), '4.0.7.1', 'mainwp_child_get_total_size' ); $get_file_size = apply_filters( 'mainwp_child_get_total_size', $get_file_size ); @@ -371,11 +370,10 @@ class MainWP_Child_Stats { } } $information['dbsize'] = MainWP_Child_DB::get_size(); - + global $mainWPChild; $max_his = $mainWPChild->get_max_history(); - - + $auths = get_option( 'mainwp_child_auth' ); $information['extauth'] = ( $auths && isset( $auths[ $max_his ] ) ? $auths[ $max_his ] : null ); @@ -387,7 +385,7 @@ class MainWP_Child_Stats { if ( isset( $_POST['optimize'] ) && ( '1' === $_POST['optimize'] ) ) { $information['users'] = MainWP_Child_Users::get_instance()->get_all_users_int( 500 ); } - + if ( isset( $_POST['primaryBackup'] ) && ! empty( $_POST['primaryBackup'] ) ) { $primary_bk = $_POST['primaryBackup']; $information['primaryLasttimeBackup'] = MainWP_Helper::get_lasttime_backup( $primary_bk ); @@ -412,11 +410,11 @@ class MainWP_Child_Stats { $information['admin_useremail'] = $user->data->user_email; } } - + try { do_action( 'mainwp_child_site_stats' ); } catch ( \Exception $e ) { - MainWP_Helper::log_debug( $e->getMessage() ); + MainWP_Helper::log_debug( $e->getMessage() ); } if ( isset( $_POST['othersData'] ) ) { @@ -437,17 +435,17 @@ class MainWP_Child_Stats { $information = apply_filters( 'mainwp_site_sync_others_data', $information, $othersData ); } catch ( \Exception $e ) { - MainWP_Helper::log_debug( $e->getMessage() ); + MainWP_Helper::log_debug( $e->getMessage() ); } } - + if ( $exit ) { mainwp_child_helper()->write( $information ); } return $information; } - + public function update_external_settings() { $update_htaccess = false; @@ -479,7 +477,7 @@ class MainWP_Child_Stats { $mainWPChild->update_htaccess( true ); } } - + public function get_total_file_size( $directory = WP_CONTENT_DIR ) { try { if ( MainWP_Helper::function_exists( 'popen' ) ) { @@ -536,7 +534,7 @@ class MainWP_Child_Stats { return 0; } } - + public function scan_dir( $pDir, $pLvl ) { $output = array(); if ( file_exists( $pDir ) && is_dir( $pDir ) ) { @@ -590,7 +588,7 @@ class MainWP_Child_Stats { return false; } - + public function get_all_themes() { $keyword = $_POST['keyword']; $status = $_POST['status']; @@ -630,8 +628,8 @@ class MainWP_Child_Stats { return $rslt; } - - + + public function get_all_plugins() { $keyword = $_POST['keyword']; $status = $_POST['status']; @@ -697,5 +695,5 @@ class MainWP_Child_Stats { return $rslt; } - + } diff --git a/class/class-mainwp-child-updates.php b/class/class-mainwp-child-updates.php index 5e3b734..97db9df 100644 --- a/class/class-mainwp-child-updates.php +++ b/class/class-mainwp-child-updates.php @@ -350,7 +350,7 @@ class MainWP_Child_Updates { $information['upgrades'][ $slug ] = false; } } - } + } $information['sync'] = MainWP_Child_Stats::get_instance()->get_site_stats( array(), false ); mainwp_child_helper()->write( $information ); } @@ -370,7 +370,7 @@ class MainWP_Child_Updates { return $newThemeUpdates; } - + public function hook_fix_optimize_press_theme_update( $transient ) { if ( ! defined( 'OP_FUNC' ) ) { return $transient; @@ -479,15 +479,15 @@ class MainWP_Child_Updates { if ( 'plugin' == $type || 'theme' == $type ) { $list = isset( $_GET['list'] ) ? $_GET['list'] : ''; - - if ( ! empty( $list ) ) { + + if ( ! empty( $list ) ) { $_POST['type'] = $type; $_POST['list'] = $list; - + $function = 'upgradeplugintheme'; // to call function upgrade_plugin_theme(). - if ( MainWP_Child_Callable::get_instance()->is_callable_function( $function ) ) { - MainWP_Child_Callable::get_instance()->call_function( $function ); - } + if ( MainWP_Child_Callable::get_instance()->is_callable_function( $function ) ) { + MainWP_Child_Callable::get_instance()->call_function( $function ); + } } } } @@ -757,9 +757,9 @@ class MainWP_Child_Updates { } } else { $information['upgrades'] = array(); // to fix error message when translations updated. - } + } $information['sync'] = MainWP_Child_Stats::get_instance()->get_site_stats( array(), false ); mainwp_child_helper()->write( $information ); - } - + } + } diff --git a/class/class-mainwp-child-users.php b/class/class-mainwp-child-users.php index 9c59596..4a93f04 100644 --- a/class/class-mainwp-child-users.php +++ b/class/class-mainwp-child-users.php @@ -17,7 +17,6 @@ class MainWP_Child_Users { } public function __construct() { - } public static function get_instance() { @@ -27,7 +26,7 @@ class MainWP_Child_Users { return self::$instance; } - + public function user_action() { $action = $_POST['action']; $extra = $_POST['extra']; @@ -89,8 +88,8 @@ class MainWP_Child_Users { } mainwp_child_helper()->write( $information ); } - - + + public function get_all_users_int( $number = false ) { $allusers = array(); @@ -122,7 +121,7 @@ class MainWP_Child_Users { return $allusers; } - + public function get_all_users( $return = false ) { $roles = explode( ',', $_POST['role'] ); $allusers = array(); @@ -150,8 +149,8 @@ class MainWP_Child_Users { } mainwp_child_helper()->write( $allusers ); } - - + + public function search_users() { $search_user_role = array(); @@ -404,7 +403,7 @@ class MainWP_Child_Users { return $edit_data; } - + public function new_admin_password() { $new_password = maybe_unserialize( base64_decode( $_POST['new_password'] ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for begin reasons. $user = get_user_by( 'login', $_POST['user'] ); @@ -466,5 +465,5 @@ class MainWP_Child_Users { mainwp_child_helper()->write( $information ); } - + } diff --git a/class/class-mainwp-child.php b/class/class-mainwp-child.php index 8286657..565ac90 100644 --- a/class/class-mainwp-child.php +++ b/class/class-mainwp-child.php @@ -25,7 +25,7 @@ class MainWP_Child { private $update_version = '1.5'; public $plugin_slug; - private $plugin_dir; + private $plugin_dir; private $maxHistory = 5; public static $brandingTitle = null; @@ -36,10 +36,10 @@ class MainWP_Child { public function __construct( $plugin_file ) { $this->update(); $this->load_all_options(); - - $this->plugin_dir = dirname( $plugin_file ); - $this->plugin_slug = plugin_basename( $plugin_file ); - + + $this->plugin_dir = dirname( $plugin_file ); + $this->plugin_slug = plugin_basename( $plugin_file ); + add_action( 'template_redirect', array( $this, 'template_redirect' ) ); add_action( 'init', array( &$this, 'check_login' ), 1 ); add_action( 'init', array( &$this, 'parse_init' ), 9999 ); @@ -815,10 +815,10 @@ class MainWP_Child { maxHistory; } - + public function mod_rewrite_rules( $pRules ) { $home_root = wp_parse_url( home_url() ); @@ -884,7 +884,7 @@ class MainWP_Child { if ( ! $auth ) { MainWP_Helper::error( __( 'Authentication failed! Please deactivate and re-activate the MainWP Child plugin on this site.', 'mainwp-child' ) ); } - + $auth_user = false; if ( $auth ) { // disable duo auth for mainwp. @@ -1209,14 +1209,14 @@ class MainWP_Child { MainWP_Helper::error( __( 'Authentication failed! Please deactivate & re-activate the MainWP Child plugin on this site and try again.', 'mainwp-child' ) ); } - if ( ! $auth && isset( $_POST['function'] ) ) { - $func = $_POST['function']; - $callable = MainWP_Child_Callable::get_instance()->is_callable_function( $func ); - $callable_no_auth = MainWP_Child_Callable::get_instance()->is_callable_function_no_auth( $func ); - - if ( $callable && ! $callable_no_auth ) { + if ( ! $auth && isset( $_POST['function'] ) ) { + $func = $_POST['function']; + $callable = MainWP_Child_Callable::get_instance()->is_callable_function( $func ); + $callable_no_auth = MainWP_Child_Callable::get_instance()->is_callable_function_no_auth( $func ); + + if ( $callable && ! $callable_no_auth ) { MainWP_Helper::error( __( 'Authentication failed! Please deactivate & re-activate the MainWP Child plugin on this site and try again.', 'mainwp-child' ) ); - } + } } $auth_user = false; @@ -1292,40 +1292,39 @@ class MainWP_Child { $_wp_submenu_nopriv = array(); // phpcs:ignore -- to fix warning. } - $callable = false; + $callable = false; $func_auth = false; - + $callable_no_auth = false; - $func_no_auth = false; - - if ( isset( $_POST['function'] ) ) { - + $func_no_auth = false; + + if ( isset( $_POST['function'] ) ) { + $func = $_POST['function']; - + $callable = MainWP_Child_Callable::get_instance()->is_callable_function( $func ); if ( $callable ) { $func_auth = $func; } - + if ( ! $callable ) { - $callable_no_auth = MainWP_Child_Callable::get_instance()->is_callable_function_no_auth( $func ); + $callable_no_auth = MainWP_Child_Callable::get_instance()->is_callable_function_no_auth( $func ); if ( $callable_no_auth ) { $func_no_auth = $func; } } - } - - + } + // Call the function required. if ( $auth && isset( $_POST['function'] ) && $callable ) { define( 'DOING_CRON', true ); MainWP_Helper::handle_fatal_error(); - self::fix_for_custom_themes(); - MainWP_Child_Callable::get_instance()->call_function( $func_auth ); + self::fix_for_custom_themes(); + MainWP_Child_Callable::get_instance()->call_function( $func_auth ); } elseif ( isset( $_POST['function'] ) && $callable_no_auth ) { define( 'DOING_CRON', true ); self::fix_for_custom_themes(); - MainWP_Child_Callable::get_instance()->call_function_no_auth( $func_no_auth ); + MainWP_Child_Callable::get_instance()->call_function_no_auth( $func_no_auth ); } elseif ( isset( $_POST['function'] ) && isset( $_POST['mainwpsignature'] ) && ! $callable && ! $callable_no_auth ) { MainWP_Helper::error( __( 'Required version has not been detected. Please, make sure that you are using the latest version of the MainWP Child plugin on your site.', 'mainwp-child' ) ); } @@ -1455,7 +1454,7 @@ class MainWP_Child { // Login. if ( isset( $_POST['user'] ) ) { - if ( ! $this->login( $_POST['user'] ) ) { + if ( ! $this->login( $_POST['user'] ) ) { $hint_miss_user = __( 'That administrator username was not found on this child site. Please verify that it is an existing administrator.', 'mainwp-child' ) . '
' . __( 'Hint: Check if the administrator user exists on the child site, if not, you need to use an existing administrator.', 'mainwp-child' ); MainWP_Helper::error( $hint_miss_user ); } @@ -1483,7 +1482,7 @@ class MainWP_Child { $information['register'] = 'OK'; $information['uniqueId'] = get_option( 'mainwp_child_uniqueId', '' ); $information['user'] = $_POST['user']; - + MainWP_Child_Stats::get_instance()->get_site_stats( $information ); } @@ -1612,7 +1611,7 @@ class MainWP_Child { return fclose( $handle ); } - + public function run_saved_snippets() { $action = null; if ( isset( $_POST['action'] ) ) { @@ -1633,7 +1632,7 @@ class MainWP_Child { } } - + /* * hook to deactivation child plugin action */ @@ -1666,7 +1665,7 @@ class MainWP_Child { do_action( 'mainwp_child_deactivation' ); } } - + /* * hook to activation child plugin action */ @@ -1696,7 +1695,7 @@ class MainWP_Child { delete_option( $delete ); } } - + public static function fix_for_custom_themes() { if ( file_exists( ABSPATH . '/wp-admin/includes/screen.php' ) ) { include_once ABSPATH . '/wp-admin/includes/screen.php'; diff --git a/class/class-mainwp-helper.php b/class/class-mainwp-helper.php index 4c6aa7e..7f0409d 100644 --- a/class/class-mainwp-helper.php +++ b/class/class-mainwp-helper.php @@ -519,7 +519,7 @@ class MainWP_Helper { $new_post['post_content'] = str_replace( $lnkToReplace, $linkToReplaceWith, $new_post['post_content'] ); } } catch ( \Exception $e ) { - MainWP_Helper::log_debug( $e->getMessage() ); + self::log_debug( $e->getMessage() ); } } } @@ -1004,11 +1004,11 @@ class MainWP_Helper { public static function check_wp_filesystem() { - + $FTP_ERROR = 'Failed! Please, add FTP details for automatic updates.'; - + self::get_wp_filesystem(); - + global $wp_filesystem; if ( empty( $wp_filesystem ) ) { @@ -1791,6 +1791,6 @@ class MainWP_Helper { public static function log_debug( $msg ) { if ( defined( 'MAINWP_DEBUG' ) && MAINWP_DEBUG ) { error_log( $msg ); // phpcs:ignore -- debug mode only. - } + } } }