From acdfa23a812085b7f691d5de9af26505c3d78a1c Mon Sep 17 00:00:00 2001 From: thanghv Date: Thu, 7 May 2020 23:22:05 +0700 Subject: [PATCH] Refactoring --- class/class-mainwp-child-back-up-buddy.php | 13 +- .../class-mainwp-child-back-up-wordpress.php | 2 +- class/class-mainwp-child-back-wp-up.php | 25 ++- class/class-mainwp-child-branding.php | 17 +- class/class-mainwp-child-ithemes-security.php | 4 +- class/class-mainwp-child-links-checker.php | 4 +- class/class-mainwp-child-pagespeed.php | 4 +- class/class-mainwp-child-skeleton-key.php | 2 +- class/class-mainwp-child-timecapsule.php | 2 +- ...lass-mainwp-child-updraft-plus-backups.php | 8 +- .../class-mainwp-child-woocommerce-status.php | 4 +- class/class-mainwp-child-wordfence.php | 10 +- class/class-mainwp-child-wp-rocket.php | 2 +- ...ass-mainwp-child-wpvivid-backuprestore.php | 2 +- class/class-mainwp-child.php | 180 ++++-------------- class/class-mainwp-client-report.php | 8 +- class/class-mainwp-clone-install.php | 58 +----- class/class-mainwp-custom-post-type.php | 5 +- class/class-mainwp-debug.php | 6 +- class/class-mainwp-helper.php | 25 +-- class/class-mainwp-keyword-links.php | 9 +- class/class-mainwp-security.php | 2 +- class/class-mainwp-wordpress-seo.php | 4 +- class/class-tar-archiver.php | 6 +- includes/functions.php | 4 +- 25 files changed, 121 insertions(+), 285 deletions(-) diff --git a/class/class-mainwp-child-back-up-buddy.php b/class/class-mainwp-child-back-up-buddy.php index bb0b6f0..3ef4363 100644 --- a/class/class-mainwp-child-back-up-buddy.php +++ b/class/class-mainwp-child-back-up-buddy.php @@ -12,6 +12,9 @@ * Extension URL: https://mainwp.com/extension/mainwpbuddy/ */ +// phpcs:disable PSR1.Classes.ClassDeclaration -- use external code. + + class MainWP_Child_Back_Up_Buddy { public static $instance = null; @@ -1177,7 +1180,7 @@ class MainWP_Child_Back_Up_Buddy { if ( is_array( $files ) && ! empty( $files ) ) { // For robustness. Without open_basedir the glob() function returns an empty array for no match. With open_basedir in effect the glob() function returns a boolean false for no match. - $backup_prefix = backupbuddy_core::backup_prefix(); // Backup prefix for this site. Used for MS checking that this user can see this backup. + $backup_prefix = backupbuddy_core::backup_prefix(); // Backup prefix. To checking that this user can see this backup. foreach ( $files as $file_id => $file ) { if ( ( true === $subsite_mode ) && is_multisite() ) { // If a Network and NOT the superadmin must make sure they can only see the specific subsite backups for security purposes. @@ -1733,7 +1736,7 @@ class MainWP_Child_Back_Up_Buddy { echo 'Display Advanced Debugging'; echo '

'; @@ -2473,7 +2476,7 @@ class MainWP_Child_Back_Up_Buddy { $response = pb_backupbuddy_destination_stash2::stashAPI( $settings, 'connect' ); if ( ! is_array( $response ) ) { // Error message. - $errors[] = print_r( $response, true ); + $errors[] = print_r( $response, true ); // phpcs:ignore -- debug feature. } else { if ( isset( $response['error'] ) ) { $errors[] = $response['error']['message']; @@ -2481,7 +2484,7 @@ class MainWP_Child_Back_Up_Buddy { if ( isset( $response['token'] ) ) { $itxapi_token = $response['token']; } else { - $errors[] = 'Error #2308832: Unexpected server response. Token missing. Check your BackupBuddy Stash Live login and try again. Detailed response: `' . print_r( $response, true ) . '`.'; + $errors[] = 'Error #2308832: Unexpected server response. Token missing. Check your BackupBuddy Stash Live login and try again. Detailed response: `' . print_r( $response, true ) . '`.'; // phpcs:ignore -- debug feature. } } } @@ -2688,7 +2691,7 @@ class MainWP_Child_Back_Up_Buddy { public function download_troubleshooting() { require pb_backupbuddy::plugin_path() . '/destinations/live/_troubleshooting.php'; backupbuddy_live_troubleshooting::run(); - $output = "**File best viewed with wordwrap OFF**\n\n" . print_r( backupbuddy_live_troubleshooting::get_raw_results(), true ); + $output = "**File best viewed with wordwrap OFF**\n\n" . print_r( backupbuddy_live_troubleshooting::get_raw_results(), true ); // phpcs:ignore -- debug feature. $backup_prefix = backupbuddy_core::backup_prefix(); return array( 'output' => $output, diff --git a/class/class-mainwp-child-back-up-wordpress.php b/class/class-mainwp-child-back-up-wordpress.php index 31a8773..d9f1c46 100644 --- a/class/class-mainwp-child-back-up-wordpress.php +++ b/class/class-mainwp-child-back-up-wordpress.php @@ -13,7 +13,7 @@ * Extension URL: https://mainwp.com/extension/backupwordpress/ */ -namespace MainWP\Child; +// phpcs:disable PSR1.Classes.ClassDeclaration -- use external code. class MainWP_Child_Back_Up_WordPress { public static $instance = null; diff --git a/class/class-mainwp-child-back-wp-up.php b/class/class-mainwp-child-back-wp-up.php index 15e5e8e..cbb7990 100644 --- a/class/class-mainwp-child-back-wp-up.php +++ b/class/class-mainwp-child-back-wp-up.php @@ -13,6 +13,8 @@ * Extension URL: https://mainwp.com/extension/backwpup/ */ +// phpcs:disable PSR1.Classes.ClassDeclaration -- use external code. + if ( ! defined( 'MAINWP_BACKWPUP_DEVELOPMENT' ) ) { define( 'MAINWP_BACKWPUP_DEVELOPMENT', false ); } @@ -106,8 +108,6 @@ class MainWP_Child_Back_WP_Up { return; } - - error_reporting( 0 ); function mainwp_backwpup_handle_fatal_error() { $error = error_get_last(); $info = self::$information; @@ -777,10 +777,7 @@ class MainWP_Child_Back_WP_Up { if ( preg_match( '/.*&jobid=([^&]+)&.*/is', $temp_array['downloadurl'], $matches ) ) { if ( ! empty( $matches[1] ) && is_numeric( $matches[1] ) ) { $temp_array['downloadurl_id'] .= '&download_click_id=' . $matches[1]; - } - error_log( 'did match' . print_r( $matches, true ) ); - } else { - error_log( 'not match' ); + } } $temp_array['website_id'] = $website_id; @@ -1321,12 +1318,16 @@ class MainWP_Child_Back_WP_Up { // Parse and save files to exclude. $exclude_input = $post_data['fileexclude']; $to_exclude_list = $exclude_input ? str_replace( array( "\r\n", "\r" ), ',', $exclude_input ) : array(); - $to_exclude_list && $to_exclude_list = sanitize_text_field( stripslashes( $to_exclude_list ) ); + if ( $to_exclude_list ) { + $to_exclude_list = sanitize_text_field( stripslashes( $to_exclude_list ) ); + } $to_exclude = $to_exclude_list ? explode( ',', $to_exclude_list ) : array(); $to_exclude_parsed = array(); foreach ( $to_exclude as $key => $value ) { $normalized = wp_normalize_path( trim( $value ) ); - $normalized && $to_exclude_parsed[ $key ] = $normalized; + if ( $normalized ) { + $to_exclude_parsed[ $key ] = $normalized; + } } sort( $to_exclude_parsed ); \BackWPup_Option::update( $id, 'fileexclude', implode( ',', $to_exclude_parsed ) ); @@ -1339,9 +1340,13 @@ class MainWP_Child_Back_WP_Up { $to_include_parsed = array(); foreach ( $to_include as $key => $value ) { $normalized = trailingslashit( wp_normalize_path( trim( $value ) ) ); - $normalized && $normalized = filter_var( $normalized, FILTER_SANITIZE_URL ); + if ( $normalized ) { + $normalized = filter_var( $normalized, FILTER_SANITIZE_URL ); + } $realpath = $normalized && '/' !== $normalized ? realpath( $normalized ) : false; - $realpath && $to_include_parsed[ $key ] = $realpath; + if ( $realpath ) { + $to_include_parsed[ $key ] = $realpath; + } } sort( $to_include_parsed ); \BackWPup_Option::update( $id, 'dirinclude', implode( ',', $to_include_parsed ) ); diff --git a/class/class-mainwp-child-branding.php b/class/class-mainwp-child-branding.php index 8b36540..f6df7bc 100644 --- a/class/class-mainwp-child-branding.php +++ b/class/class-mainwp-child-branding.php @@ -344,6 +344,7 @@ class MainWP_Child_Branding { public function branding_init() { + $extra_setting = $this->get_extra_options(); if ( is_admin() ) { @@ -374,7 +375,7 @@ class MainWP_Child_Branding { add_filter( 'map_meta_cap', array( $this, 'branding_map_meta_cap' ), 10, 5 ); if ( 'T' === $opts['disable_change'] ) { - + // Disable the WordPress plugin update notifications. remove_action( 'load-update-core.php', 'wp_update_plugins' ); add_filter( 'pre_site_transient_update_plugins', '__return_null' ); @@ -383,11 +384,9 @@ class MainWP_Child_Branding { remove_action( 'load-update-core.php', 'wp_update_themes' ); add_filter( 'pre_site_transient_update_themes', - ( - $func = function( $a ) { - return null; - } - ) + function( $a ) { + return null; + } ); // Disable the WordPress core update notifications. @@ -395,11 +394,9 @@ class MainWP_Child_Branding { function remove_core_updates() { add_action( 'init', - ( - $func = function( $a ) { + function( $a ) { remove_action( 'wp_version_check', 'wp_version_check' ); - } - ), + }, 2 ); add_filter( 'pre_option_update_core', '__return_null' ); diff --git a/class/class-mainwp-child-ithemes-security.php b/class/class-mainwp-child-ithemes-security.php index 8a46dbd..b5c9140 100644 --- a/class/class-mainwp-child-ithemes-security.php +++ b/class/class-mainwp-child-ithemes-security.php @@ -13,7 +13,7 @@ * Extension URL: https://mainwp.com/extension/ithemes-security/ */ -namespace MainWP\Child; +// phpcs:disable PSR1.Classes.ClassDeclaration -- use external code. class MainWP_Child_IThemes_Security { public static $instance = null; @@ -46,7 +46,7 @@ class MainWP_Child_IThemes_Security { 'users_and_roles' => $this->get_available_admin_users_and_roles(), ); } catch ( \Exception $e ) { - error_log( $e->getMessage() ); + error_log( $e->getMessage() ); // phpcs:ignore -- debug mode only. } } return $information; diff --git a/class/class-mainwp-child-links-checker.php b/class/class-mainwp-child-links-checker.php index 9b133f0..9856de3 100644 --- a/class/class-mainwp-child-links-checker.php +++ b/class/class-mainwp-child-links-checker.php @@ -9,7 +9,7 @@ * The code is used for the MainWP Broken Links Checker Extension (Retired Extension) */ -namespace MainWP\Child; +// phpcs:disable PSR1.Classes.ClassDeclaration -- use external code. class MainWP_Child_Links_Checker { @@ -18,7 +18,7 @@ class MainWP_Child_Links_Checker { public static function instance() { if ( null === self::$instance ) { - self::$instance = new MainWP_Child_Links_Checker(); + self::$instance = new self(); } return self::$instance; diff --git a/class/class-mainwp-child-pagespeed.php b/class/class-mainwp-child-pagespeed.php index fafd0e2..88fbf3c 100644 --- a/class/class-mainwp-child-pagespeed.php +++ b/class/class-mainwp-child-pagespeed.php @@ -12,7 +12,7 @@ * Extension URL: https://mainwp.com/extension/page-speed/ */ -namespace MainWP\Child; +// phpcs:disable PSR1.Classes.ClassDeclaration -- use external code. class MainWP_Child_Pagespeed { @@ -88,7 +88,7 @@ class MainWP_Child_Pagespeed { } public function init_cron() { - add_action( 'mainwp_child_pagespeed_cron_check', array( 'MainWP_Child_Pagespeed', 'pagespeed_cron_check' ) ); + add_action( 'mainwp_child_pagespeed_cron_check', array( '\MainWP_Child_Pagespeed', 'pagespeed_cron_check' ) ); $sched = wp_next_scheduled( 'mainwp_child_pagespeed_cron_check' ); if ( false === $sched ) { wp_schedule_event( time(), 'daily', 'mainwp_child_pagespeed_cron_check' ); diff --git a/class/class-mainwp-child-skeleton-key.php b/class/class-mainwp-child-skeleton-key.php index 3fd5632..b619bd0 100644 --- a/class/class-mainwp-child-skeleton-key.php +++ b/class/class-mainwp-child-skeleton-key.php @@ -15,7 +15,7 @@ class MainWP_Child_Skeleton_Key { } public function action() { - error_reporting( 0 ); + function mainwp_skeleton_key_handle_fatal_error() { $error = error_get_last(); if ( isset( $error['type'] ) && in_array( $error['type'], array( 1, 4, 16, 64, 256 ) ) && isset( $error['message'] ) ) { diff --git a/class/class-mainwp-child-timecapsule.php b/class/class-mainwp-child-timecapsule.php index 550f8fb..20b8d1b 100644 --- a/class/class-mainwp-child-timecapsule.php +++ b/class/class-mainwp-child-timecapsule.php @@ -11,7 +11,7 @@ * Extension URL: https://mainwp.com/extension/time-capsule/ */ -namespace MainWP\Child; +// phpcs:disable PSR1.Classes.ClassDeclaration -- use external code. class MainWP_Child_Timecapsule { public static $instance = null; diff --git a/class/class-mainwp-child-updraft-plus-backups.php b/class/class-mainwp-child-updraft-plus-backups.php index 37caa18..12fab95 100644 --- a/class/class-mainwp-child-updraft-plus-backups.php +++ b/class/class-mainwp-child-updraft-plus-backups.php @@ -12,7 +12,7 @@ * Extension URL: https://mainwp.com/extension/updraftplus/ */ -namespace MainWP\Child; +// phpcs:disable PSR1.Classes.ClassDeclaration -- use external code. class MainWP_Child_Updraft_Plus_Backups { public static $instance = null; @@ -1212,7 +1212,7 @@ class MainWP_Child_Updraft_Plus_Backups { if ( UpdraftPlus_Options::get_updraft_option( 'updraft_debug_mode' ) ) { $updraftplus->logfile_open( $updraftplus->nonce ); - set_error_handler( array( $updraftplus, 'php_error' ), E_ALL & ~E_STRICT ); + set_error_handler( array( $updraftplus, 'php_error' ), E_ALL & ~E_STRICT ); // phpcs:ignore -- third party credits. } $updraft_dir = $updraftplus->backups_dir_location(); @@ -1446,7 +1446,7 @@ class MainWP_Child_Updraft_Plus_Backups { $updraftplus->logfile_open( $updraftplus->nonce ); } - set_error_handler( array( $updraftplus, 'php_error' ), E_ALL & ~E_STRICT ); + set_error_handler( array( $updraftplus, 'php_error' ), E_ALL & ~E_STRICT ); // phpcs:ignore -- third party credits. $updraftplus->log( "Requested to obtain file: timestamp=$timestamp, type=$type, index=$findex" ); @@ -1590,7 +1590,7 @@ class MainWP_Child_Updraft_Plus_Backups { $mess = array(); parse_str( $_POST['restoreopts'], $res ); if ( isset( $res['updraft_restore'] ) ) { - set_error_handler( array( $this, 'get_php_errors' ), E_ALL & ~E_STRICT ); + set_error_handler( array( $this, 'get_php_errors' ), E_ALL & ~E_STRICT ); // phpcs:ignore -- third party credits. $elements = array_flip( $res['updraft_restore'] ); diff --git a/class/class-mainwp-child-woocommerce-status.php b/class/class-mainwp-child-woocommerce-status.php index 3360306..7c9e7db 100644 --- a/class/class-mainwp-child-woocommerce-status.php +++ b/class/class-mainwp-child-woocommerce-status.php @@ -11,14 +11,14 @@ * Extension URL: https://mainwp.com/extension/woocommerce-status/ */ -namespace MainWP\Child; +// phpcs:disable PSR1.Classes.ClassDeclaration -- use external code. class MainWP_Child_WooCommerce_Status { public static $instance = null; public static function instance() { if ( null === self::$instance ) { - self::$instance = new MainWP_Child_WooCommerce_Status(); + self::$instance = new self(); } return self::$instance; diff --git a/class/class-mainwp-child-wordfence.php b/class/class-mainwp-child-wordfence.php index 6626900..81334b9 100644 --- a/class/class-mainwp-child-wordfence.php +++ b/class/class-mainwp-child-wordfence.php @@ -11,7 +11,7 @@ * Extension URL: https://mainwp.com/extension/wordfence/ */ -namespace MainWP\Child; +// phpcs:disable PSR1.Classes.ClassDeclaration -- use external code. class MainWP_Child_Wordfence { public static $instance = null; @@ -835,10 +835,12 @@ class MainWP_Child_Wordfence { global $wpdb; $table_wfBlockedIPLog = wfDB::networkTable( 'wfBlockedIPLog' ); $interval = 'FLOOR(UNIX_TIMESTAMP(DATE_SUB(NOW(), interval ' . $maxAgeDays . ' day)) / 86400)'; - return $wpdb->get_var( + // phpcs:disable -- third party code, safe. + return $wpdb->get_var( <<= {$interval} SQL + // phpcs:enable ); } @@ -1548,7 +1550,7 @@ SQL } elseif ( $res['err'] ) { return array( 'errorExport' => __( 'An error occurred: ', 'wordfence' ) . $res['err'] ); } else { - throw new \Exception( __( 'Invalid response: ', 'wordfence' ) . var_export( $res, true ) ); + throw new \Exception( __( 'Invalid response: ', 'wordfence' ) ); } } catch ( \Exception $e ) { return array( 'errorExport' => __( 'An error occurred: ', 'wordfence' ) . $e->getMessage() ); @@ -1611,7 +1613,7 @@ SQL } elseif ( $res['err'] ) { return array( 'errorImport' => 'An error occurred: ' . $res['err'] ); } else { - throw new \Exception( 'Invalid response: ' . var_export( $res, true ) ); + throw new \Exception( 'Invalid response: ' ); } } catch ( \Exception $e ) { return array( 'errorImport' => 'An error occurred: ' . $e->getMessage() ); diff --git a/class/class-mainwp-child-wp-rocket.php b/class/class-mainwp-child-wp-rocket.php index fe34cac..e3d965c 100644 --- a/class/class-mainwp-child-wp-rocket.php +++ b/class/class-mainwp-child-wp-rocket.php @@ -12,7 +12,7 @@ * Extension URL: https://mainwp.com/extension/rocket/ */ -namespace MainWP\Child; +// phpcs:disable PSR1.Classes.ClassDeclaration -- use external code. class MainWP_Child_WP_Rocket { public static $instance = null; diff --git a/class/class-mainwp-child-wpvivid-backuprestore.php b/class/class-mainwp-child-wpvivid-backuprestore.php index c835829..2bc88ca 100644 --- a/class/class-mainwp-child-wpvivid-backuprestore.php +++ b/class/class-mainwp-child-wpvivid-backuprestore.php @@ -1,6 +1,6 @@ 'get_all_users', 'user_action' => 'user_action', 'search_users' => 'search_users', - 'get_terms' => 'get_terms', - 'set_terms' => 'set_terms', - 'insert_comment' => 'insert_comment', - 'get_post_meta' => 'get_post_meta', - 'get_total_ezine_post' => 'get_total_ezine_post', - 'get_next_time_to_post' => 'get_next_time_to_post', + 'insert_comment' => 'insert_comment', 'cancel_scheduled_post' => 'cancel_scheduled_post', 'serverInformation' => 'server_information', 'maintenance_site' => 'maintenance_site', @@ -1395,20 +1390,20 @@ class MainWP_Child { // Init extensions. // Handle fatal errors for those init if needed. - MainWP_Child_IThemes_Security::instance()->ithemes_init(); - MainWP_Child_Updraft_Plus_Backups::instance()->updraftplus_init(); - MainWP_Child_Back_Up_WordPress::instance()->init(); - MainWP_Child_WP_Rocket::instance()->init(); + \MainWP_Child_IThemes_Security::instance()->ithemes_init(); + \MainWP_Child_Updraft_Plus_Backups::instance()->updraftplus_init(); + \MainWP_Child_Back_Up_WordPress::instance()->init(); + \MainWP_Child_WP_Rocket::instance()->init(); \MainWP_Child_Back_WP_Up::instance()->init(); \MainWP_Child_Back_Up_Buddy::instance(); - MainWP_Child_Wordfence::instance()->wordfence_init(); - MainWP_Child_Timecapsule::instance()->init(); + \MainWP_Child_Wordfence::instance()->wordfence_init(); + \MainWP_Child_Timecapsule::instance()->init(); MainWP_Child_Staging::instance()->init(); MainWP_Child_Branding::instance()->branding_init(); MainWP_Client_Report::instance()->creport_init(); - MainWP_Child_Pagespeed::instance()->init(); - MainWP_Child_Links_Checker::instance()->init(); - MainWP_Child_WPvivid_BackupRestore::instance()->init(); + \MainWP_Child_Pagespeed::instance()->init(); + \MainWP_Child_Links_Checker::instance()->init(); + \MainWP_Child_WPvivid_BackupRestore::instance()->init(); global $_wp_submenu_nopriv; if ( null === $_wp_submenu_nopriv ) { @@ -2351,10 +2346,10 @@ class MainWP_Child { $my_post['post_status'] = 'draft'; wp_update_post( $my_post ); } elseif ( 'trash' === $action ) { - add_action( 'trash_post', array( 'MainWP_Child_Links_Checker', 'hook_post_deleted' ) ); + add_action( 'trash_post', array( '\MainWP_Child_Links_Checker', 'hook_post_deleted' ) ); wp_trash_post( $postId ); } elseif ( 'delete' === $action ) { - add_action( 'delete_post', array( 'MainWP_Child_Links_Checker', 'hook_post_deleted' ) ); + add_action( 'delete_post', array( '\MainWP_Child_Links_Checker', 'hook_post_deleted' ) ); wp_delete_post( $postId, true ); } elseif ( 'restore' === $action ) { wp_untrash_post( $postId ); @@ -2803,7 +2798,7 @@ class MainWP_Child { } elseif ( 'unspam' === $action ) { wp_unspam_comment( $commentId ); } elseif ( 'trash' === $action ) { - add_action( 'trashed_comment', array( 'MainWP_Child_Links_Checker', 'hook_trashed_comment' ), 10, 1 ); + add_action( 'trashed_comment', array( '\MainWP_Child_Links_Checker', 'hook_trashed_comment' ), 10, 1 ); wp_trash_comment( $commentId ); } elseif ( 'restore' === $action ) { wp_untrash_comment( $commentId ); @@ -4077,8 +4072,8 @@ class MainWP_Child { $outPost['seo_data'] = array( 'count_seo_links' => $link_count->get( $post_id, 'internal_link_count' ), 'count_seo_linked' => $link_count->get( $post_id, 'incoming_link_count' ), - 'seo_score' => MainWP_Wordpress_SEO::instance()->parse_column_score( $post_id ), - 'readability_score' => MainWP_Wordpress_SEO::instance()->parse_column_score_readability( $post_id ), + 'seo_score' => \MainWP_WordPress_SEO::instance()->parse_column_score( $post_id ), + 'readability_score' => \MainWP_WordPress_SEO::instance()->parse_column_score_readability( $post_id ), ); } @@ -4100,25 +4095,6 @@ class MainWP_Child { $this->get_all_posts_by_type( $post_type ); } - public function get_terms() { - $taxonomy = base64_decode( $_POST['taxonomy'] ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for benign reasons. - $rslt = get_terms( taxonomy_exists( $taxonomy ) ? $taxonomy : 'category', 'hide_empty=0' ); - mainwp_child_helper()->write( $rslt ); - } - - public function set_terms() { - $id = base64_decode( $_POST['id'] ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for benign reasons. - $terms = base64_decode( $_POST['terms'] ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for benign reasons. - $taxonomy = base64_decode( $_POST['taxonomy'] ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for benign reasons. - - if ( '' !== trim( $terms ) ) { - $terms = explode( ',', $terms ); - if ( count( $terms ) > 0 ) { - wp_set_object_terms( $id, array_map( 'intval', $terms ), taxonomy_exists( $taxonomy ) ? $taxonomy : 'category' ); - } - } - } - 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 benign reasons. @@ -4136,46 +4112,6 @@ class MainWP_Child { mainwp_child_helper()->write( $ids ); } - public function get_post_meta() { - /** @var $wpdb wpdb */ - global $wpdb; - $postId = $_POST['id']; - $keys = base64_decode( unserialize( $_POST['keys'] ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for benign reasons. - $meta_value = $_POST['value']; - - $where = ''; - if ( ! empty( $postId ) ) { - $where .= " AND `post_id` = $postId "; - } - if ( ! empty( $keys ) ) { - $str_keys = '\'' . implode( '\',\'', $keys ) . '\''; - $where .= " AND `meta_key` IN = $str_keys "; - } - if ( ! empty( $meta_value ) ) { - $where .= " AND `meta_value` = $meta_value "; - } - - $results = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM %s WHERE 1 = 1 $where ", $wpdb->postmeta ) ); - mainwp_child_helper()->write( $results ); - } - - public function get_total_ezine_post() { - /** @var $wpdb wpdb */ - global $wpdb; - $start_date = base64_decode( $_POST['start_date'] ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for benign reasons. - $end_date = base64_decode( $_POST['end_date'] ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for benign reasons. - $keyword_meta = base64_decode( $_POST['keyword_meta'] ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for benign reasons. - $where = ' WHERE '; - if ( ! empty( $start_date ) && ! empty( $end_date ) ) { - $where .= " p.post_date>='$start_date' AND p.post_date<='$end_date' AND "; - } elseif ( ! empty( $start_date ) && empty( $end_date ) ) { - $where .= " p.post_date='$start_date' AND "; - } - $where .= " ( p.post_status='publish' OR p.post_status='future' OR p.post_status='draft' ) AND (pm.meta_key='_ezine_keyword' AND pm.meta_value='$keyword_meta')"; - $total = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts p JOIN $wpdb->postmeta pm ON p.ID=pm.post_id $where " ); - mainwp_child_helper()->write( $total ); - } - public function cancel_scheduled_post() { global $wpdb; $postId = $_POST['post_id']; @@ -4200,9 +4136,8 @@ class MainWP_Child { $information['status'] = 'SUCCESS'; } } elseif ( $cancel_all ) { - $post_type = $_POST['post_type']; - $where = " WHERE p.post_status='future' AND p.post_type = %s AND pm.meta_key = '_is_auto_generate_content' AND pm.meta_value = 'yes' "; - $posts = $wpdb->get_results( $wpdb->prepare( "SELECT p.ID FROM $wpdb->posts p JOIN $wpdb->postmeta pm ON p.ID=pm.post_id $where ", $post_type ) ); + $post_type = $_POST['post_type']; + $posts = $wpdb->get_results( $wpdb->prepare( "SELECT p.ID FROM $wpdb->posts p JOIN $wpdb->postmeta pm ON p.ID=pm.post_id WHERE p.post_status='future' AND p.post_type = %s AND pm.meta_key = '_is_auto_generate_content' AND pm.meta_value = 'yes' ", $post_type ) ); $count = 0; if ( is_array( $posts ) ) { foreach ( $posts as $post ) { @@ -4224,49 +4159,6 @@ class MainWP_Child { mainwp_child_helper()->write( $information ); } - public function get_next_time_to_post() { - $post_type = $_POST['post_type']; - if ( 'post' !== $post_type && 'page' !== $post_type ) { - mainwp_child_helper()->write( array( 'error' => 'Data error.' ) ); - - return; - } - $information = array(); - try { - global $wpdb; - $ct = current_time( 'mysql' ); - $next_post = $wpdb->get_row( - $wpdb->prepare( - 'SELECT * - FROM ' . $wpdb->posts . ' p JOIN ' . $wpdb->postmeta . " pm ON p.ID=pm.post_id - WHERE - pm.meta_key='_is_auto_generate_content' AND - pm.meta_value='yes' AND - p.post_status='future' AND - p.post_type= %s AND - p.post_date > NOW() - ORDER BY p.post_date - LIMIT 1", - $post_type - ) - ); - - if ( ! $next_post ) { - $information['error'] = __( 'No scheduled posts.', 'mainwp-child' ); - } else { - $timestamp = strtotime( $next_post->post_date ); - $timestamp_gmt = $timestamp - get_option( 'gmt_offset' ) * 60 * 60; - $information['next_post_date_timestamp_gmt'] = $timestamp_gmt; - $information['next_post_id'] = $next_post->ID; - } - - mainwp_child_helper()->write( $information ); - } catch ( \Exception $e ) { - $information['error'] = $e->getMessage(); - mainwp_child_helper()->write( $information ); - } - } - public function get_all_pages() { $this->get_all_posts_by_type( 'page' ); } @@ -4914,7 +4806,7 @@ class MainWP_Child { if ( MainWP_Helper::function_exists( 'popen' ) ) { $uploadDir = MainWP_Helper::get_mainwp_dir(); $uploadDir = $uploadDir[0]; - $popenHandle = popen( 'du -s ' . $directory . ' --exclude "' . str_replace( ABSPATH, '', $uploadDir ) . '"', 'r' ); + $popenHandle = popen( 'du -s ' . $directory . ' --exclude "' . str_replace( ABSPATH, '', $uploadDir ) . '"', 'r' ); // phpcs:ignore -- run if enabled. if ( 'resource' === gettype( $popenHandle ) ) { $size = fread( $popenHandle, 1024 ); pclose( $popenHandle ); @@ -4928,7 +4820,7 @@ class MainWP_Child { if ( MainWP_Helper::function_exists( 'shell_exec' ) ) { $uploadDir = MainWP_Helper::get_mainwp_dir(); $uploadDir = $uploadDir[0]; - $size = shell_exec( 'du -s ' . $directory . ' --exclude "' . str_replace( ABSPATH, '', $uploadDir ) . '"' ); + $size = shell_exec( 'du -s ' . $directory . ' --exclude "' . str_replace( ABSPATH, '', $uploadDir ) . '"' ); // phpcs:ignore -- run if enabled. if ( null !== $size ) { $size = substr( $size, 0, strpos( $size, "\t" ) ); if ( $size && MainWP_Helper::ctype_digit( $size ) ) { @@ -5032,7 +4924,7 @@ class MainWP_Child { $performed_what = array(); if ( empty( $max_revisions ) ) { $sql_clean = "DELETE FROM $wpdb->posts WHERE post_type = 'revision'"; - $wpdb->query( $sql_clean ); + $wpdb->query( $sql_clean ); // phpcs:ignore -- safe sql. // to fix issue of meta_value short length. $performed_what[] = 'revisions'; // 'Posts revisions deleted'. } else { @@ -5043,31 +4935,31 @@ class MainWP_Child { if ( in_array( 'autodraft', $maint_options ) ) { $sql_clean = "DELETE FROM $wpdb->posts WHERE post_status = 'auto-draft'"; - $wpdb->query( $sql_clean ); + $wpdb->query( $sql_clean ); // phpcs:ignore -- safe sql. $performed_what[] = 'autodraft'; // 'Auto draft posts deleted'. } if ( in_array( 'trashpost', $maint_options ) ) { $sql_clean = "DELETE FROM $wpdb->posts WHERE post_status = 'trash'"; - $wpdb->query( $sql_clean ); + $wpdb->query( $sql_clean ); // phpcs:ignore -- safe sql. $performed_what[] = 'trashpost'; // 'Trash posts deleted'. } if ( in_array( 'spam', $maint_options ) ) { $sql_clean = "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam'"; - $wpdb->query( $sql_clean ); + $wpdb->query( $sql_clean ); // phpcs:ignore -- safe sql. $performed_what[] = 'spam'; // 'Spam comments deleted'. } if ( in_array( 'pending', $maint_options ) ) { $sql_clean = "DELETE FROM $wpdb->comments WHERE comment_approved = '0'"; - $wpdb->query( $sql_clean ); + $wpdb->query( $sql_clean ); // phpcs:ignore -- safe sql. $performed_what[] = 'pending'; // 'Pending comments deleted'. } if ( in_array( 'trashcomment', $maint_options ) ) { $sql_clean = "DELETE FROM $wpdb->comments WHERE comment_approved = 'trash'"; - $wpdb->query( $sql_clean ); + $wpdb->query( $sql_clean ); // phpcs:ignore -- safe sql. $performed_what[] = 'trashcomment'; // 'Trash comments deleted'. } @@ -5370,7 +5262,7 @@ class MainWP_Child { } public function wordpress_seo() { - MainWP_Wordpress_SEO::instance()->action(); + \MainWP_WordPress_SEO::instance()->action(); } public function client_report() { @@ -5378,32 +5270,32 @@ class MainWP_Child { } public function page_speed() { - MainWP_Child_Pagespeed::instance()->action(); + \MainWP_Child_Pagespeed::instance()->action(); } public function woo_com_status() { - MainWP_Child_WooCommerce_Status::instance()->action(); + \MainWP_Child_WooCommerce_Status::instance()->action(); } public function links_checker() { - MainWP_Child_Links_Checker::instance()->action(); + \MainWP_Child_Links_Checker::instance()->action(); } public function wordfence() { - MainWP_Child_Wordfence::instance()->action(); + \MainWP_Child_Wordfence::instance()->action(); } public function ithemes() { - MainWP_Child_IThemes_Security::instance()->action(); + \MainWP_Child_IThemes_Security::instance()->action(); } public function updraftplus() { - MainWP_Child_Updraft_Plus_Backups::instance()->action(); + \MainWP_Child_Updraft_Plus_Backups::instance()->action(); } public function wpvivid_backuprestore() { - MainWP_Child_WPvivid_BackupRestore::instance()->action(); + \MainWP_Child_WPvivid_BackupRestore::instance()->action(); } public function backup_wp() { @@ -5411,11 +5303,11 @@ class MainWP_Child { $error = sprintf( __( 'PHP Version %s is unsupported.', 'mainwp-child' ), phpversion() ); mainwp_child_helper()->write( array( 'error' => $error ) ); } - MainWP_Child_Back_Up_WordPress::instance()->action(); + \MainWP_Child_Back_Up_WordPress::instance()->action(); } public function wp_rocket() { - MainWP_Child_WP_Rocket::instance()->action(); + \MainWP_Child_WP_Rocket::instance()->action(); } public function backwpup() { @@ -5529,7 +5421,7 @@ class MainWP_Child { } public function time_capsule() { - MainWP_Child_Timecapsule::instance()->action(); + \MainWP_Child_Timecapsule::instance()->action(); } public function wp_staging() { diff --git a/class/class-mainwp-client-report.php b/class/class-mainwp-client-report.php index e9fc8dc..d0cd43c 100644 --- a/class/class-mainwp-client-report.php +++ b/class/class-mainwp-client-report.php @@ -50,16 +50,16 @@ class MainWP_Client_Report { \MainWP_Child_Back_Up_Buddy::instance()->do_reports_log( $ext ); break; case 'backupwordpress': - MainWP_Child_Back_Up_WordPress::instance()->do_reports_log( $ext ); + \MainWP_Child_Back_Up_WordPress::instance()->do_reports_log( $ext ); break; case 'backwpup': \MainWP_Child_Back_WP_Up::instance()->do_reports_log( $ext ); break; case 'wordfence': - MainWP_Child_Wordfence::instance()->do_reports_log( $ext ); + \MainWP_Child_Wordfence::instance()->do_reports_log( $ext ); break; case 'wptimecapsule': - MainWP_Child_Timecapsule::instance()->do_reports_log( $ext ); + \MainWP_Child_Timecapsule::instance()->do_reports_log( $ext ); break; } } @@ -848,7 +848,7 @@ class MainWP_Client_Report { if ( empty( $tok_value ) ) { if ( defined( 'MAINWP_CHILD_DEBUG' ) && MAINWP_CHILD_DEBUG === true ) { - error_log( 'MainWP Child Report:: skip empty value :: token :: ' . $token . ' :: record :: ' . print_r( $record, true ) ); + error_log( 'MainWP Child Report:: skip empty value :: token :: ' . $token . ' :: record :: ' . print_r( $record, true ) ); // phpcs:ignore -- debug mode only. } } } diff --git a/class/class-mainwp-clone-install.php b/class/class-mainwp-clone-install.php index 436ed83..fe5b698 100644 --- a/class/class-mainwp-clone-install.php +++ b/class/class-mainwp-clone-install.php @@ -267,56 +267,6 @@ class MainWP_Clone_Install { return true; } - /** - * Check value to find if it was serialized. - * - * If $data is not an string, then returned value will always be false. - * Serialized data is always a string. - * - * @since 2.0.5 - * - * @param mixed $data Value to check to see if was serialized. - * - * @return bool False if not serialized and true if it was. - */ - public function is_serialized( $data ) { - // if it isn't a string, it isn't serialized. - if ( ! is_string( $data ) ) { - return false; - } - $data = trim( $data ); - if ( 'N;' === $data ) { - return true; - } - $length = strlen( $data ); - if ( $length < 4 ) { - return false; - } - if ( ':' !== $data[1] ) { - return false; - } - $lastc = $data[ $length - 1 ]; - if ( ';' !== $lastc && '}' !== $lastc ) { - return false; - } - $token = $data[0]; - switch ( $token ) { - case 's': - if ( '"' !== $data[ $length - 2 ] ) { - return false; - } - case 'a': - case 'O': - return (bool) preg_match( "/^{$token}:[0-9]+:/s", $data ); - case 'b': - case 'i': - case 'd': - return (bool) preg_match( "/^{$token}:[0-9.E-]+;\$/", $data ); - } - - return false; - } - public function get_config_contents() { if ( 'extracted' === $this->file ) { return file_get_contents( '../clone/config.txt' ); @@ -608,7 +558,7 @@ class MainWP_Clone_Install { // some unseriliased data cannot be re-serialised eg. SimpleXMLElements. try { - $unserialized = unserialize( $data ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions. + $unserialized = unserialize( $data ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions if ( is_string( $data ) && is_serialized( $data ) && ! is_serialized_string( $data ) && false !== $unserialized ) { $data = $this->recursive_unserialize_replace( $from, $to, $unserialized, true ); } elseif ( is_array( $data ) ) { @@ -628,10 +578,10 @@ class MainWP_Clone_Install { $data = $_tmp; unset( $_tmp ); } elseif ( is_serialized_string( $data ) && is_serialized( $data ) ) { - $data = unserialize( $data ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions. + $data = unserialize( $data ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions if ( false !== $data ) { $data = str_replace( $from, $to, $data ); - $data = serialize( $data ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions. + $data = serialize( $data ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions } } else { if ( is_string( $data ) ) { @@ -640,7 +590,7 @@ class MainWP_Clone_Install { } if ( $serialised ) { - return serialize( $data ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions. + return serialize( $data ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions } } catch ( \Exception $error ) { // ok! diff --git a/class/class-mainwp-custom-post-type.php b/class/class-mainwp-custom-post-type.php index 22e6b47..8c57053 100755 --- a/class/class-mainwp-custom-post-type.php +++ b/class/class-mainwp-custom-post-type.php @@ -15,8 +15,7 @@ class MainWP_Custom_Post_Type { return self::$instance; } - public function action() { - error_reporting( 0 ); + public function action() { function mainwp_custom_post_type_handle_fatal_error() { $error = error_get_last(); if ( isset( $error['type'] ) && E_ERROR === $error['type'] && isset( $error['message'] ) ) { @@ -28,7 +27,7 @@ class MainWP_Custom_Post_Type { if ( isset( $_REQUEST['json_result'] ) && $_REQUEST['json_result'] ) { $data = json_encode( $data ); } else { - $data = serialize( $data ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions. + $data = serialize( $data ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions } die( '' . base64_encode( $data ) . '' ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for benign reasons. } diff --git a/class/class-mainwp-debug.php b/class/class-mainwp-debug.php index e85701f..895fd45 100644 --- a/class/class-mainwp-debug.php +++ b/class/class-mainwp-debug.php @@ -21,11 +21,11 @@ class MainWP_Debug { $_POST['excludezip'] = '1'; $_POST['excludenonwp'] = '1'; $_POST['ext'] = 'tar.gz'; - print_r( $mainwpChild->backup( false ) ); + print_r( $mainwpChild->backup( false ) ); // phpcs:ignore -- debug feature. } elseif ( 'test' == $_GET['mainwpdebug'] ) { - print_r( get_included_files() ); + print_r( get_included_files() ); // phpcs:ignore -- debug feature. } else { - print_r( $mainwpChild->get_site_stats( array(), false ) ); + print_r( $mainwpChild->get_site_stats( array(), false ) ); // phpcs:ignore -- debug feature. } $stop = microtime( true ); diff --git a/class/class-mainwp-helper.php b/class/class-mainwp-helper.php index 45a1f76..d8f66f2 100644 --- a/class/class-mainwp-helper.php +++ b/class/class-mainwp-helper.php @@ -17,7 +17,7 @@ class MainWP_Helper { if ( isset( $_REQUEST['json_result'] ) && true == $_REQUEST['json_result'] ) : $output = self::safe_json_encode( $val ); else : - $output = serialize( $val ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions. + $output = serialize( $val ); // phpcs:ignore -- to compatible. endif; die( '' . base64_encode( $output ) . '' ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for benign reasons. @@ -91,7 +91,7 @@ class MainWP_Helper { if ( isset( $_REQUEST['json_result'] ) && true == $_REQUEST['json_result'] ) : $output = self::safe_json_encode( $val ); else : - $output = serialize( $val ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions. + $output = serialize( $val ); // phpcs:ignore -- to compatible. endif; $output = '' . base64_encode( $output ) . ''; // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for benign reasons. @@ -397,7 +397,7 @@ class MainWP_Helper { ); $wprocket_activated = false; - if ( MainWP_Child_WP_Rocket::instance()->is_activated() ) { + if ( \MainWP_Child_WP_Rocket::instance()->is_activated() ) { if ( function_exists( 'get_rocket_option' ) ) { $wprocket_activated = true; foreach ( $wprocket_fields as $field ) { @@ -513,7 +513,7 @@ class MainWP_Helper { $new_post['post_content'] = str_replace( $lnkToReplace, $linkToReplaceWith, $new_post['post_content'] ); } } catch ( \Exception $e ) { - error_log( $e->getMessage() ); + error_log( $e->getMessage() ); // phpcs:ignore -- debug mode only. } } } @@ -1343,9 +1343,7 @@ class MainWP_Helper { public static function get_revisions( $max_revisions ) { global $wpdb; - $sql = " SELECT `post_parent`, COUNT(*) cnt FROM $wpdb->posts WHERE `post_type` = 'revision' GROUP BY `post_parent` HAVING COUNT(*) > " . $max_revisions; - - return $wpdb->get_results( $sql ); + return $wpdb->get_results( $wpdb->prepare( " SELECT `post_parent`, COUNT(*) cnt FROM $wpdb->posts WHERE `post_type` = 'revision' GROUP BY `post_parent` HAVING COUNT(*) > %d " , $max_revisions ) ); } public static function delete_revisions( $results, $max_revisions ) { @@ -1358,10 +1356,8 @@ class MainWP_Helper { $results_length = count( $results ); for ( $i = 0; $i < $results_length; $i ++ ) { $number_to_delete = $results[ $i ]->cnt - $max_revisions; - $count_deleted += $number_to_delete; - $sql_get = "SELECT `ID`, `post_modified` FROM $wpdb->posts WHERE `post_parent`=" . $results[ $i ]->post_parent . " AND `post_type`='revision' ORDER BY `post_modified` ASC"; - $results_posts = $wpdb->get_results( $sql_get ); - + $count_deleted += $number_to_delete; + $results_posts = $wpdb->get_results( $wpdb->prepare( "SELECT `ID`, `post_modified` FROM $wpdb->posts WHERE `post_parent`= %d AND `post_type`='revision' ORDER BY `post_modified` ASC", $results[ $i ]->post_parent ) ); $delete_ids = array(); if ( is_array( $results_posts ) && count( $results_posts ) > 0 ) { for ( $j = 0; $j < $number_to_delete; $j ++ ) { @@ -1369,10 +1365,9 @@ class MainWP_Helper { } } - if ( count( $delete_ids ) > 0 ) { - // phpcs:ignore - $sql_delete = " DELETE FROM $wpdb->posts WHERE `ID` IN (" . implode( ',', $delete_ids ) . ")"; - $wpdb->get_results( $sql_delete ); + if ( count( $delete_ids ) > 0 ) { + $sql_delete = " DELETE FROM $wpdb->posts WHERE `ID` IN (" . implode( ',', $delete_ids ) . ")"; // phpcs:ignore -- safe + $wpdb->get_results( $sql_delete ); // phpcs:ignore -- safe } } diff --git a/class/class-mainwp-keyword-links.php b/class/class-mainwp-keyword-links.php index 9bffc18..deef3ad 100644 --- a/class/class-mainwp-keyword-links.php +++ b/class/class-mainwp-keyword-links.php @@ -33,7 +33,7 @@ class MainWP_Keyword_Links { if ( empty( $this->keyword_links ) ) { $this->keyword_links = array(); } - // print_r($this->keyword_links); + $this->siteurl = get_option( 'home' ); add_action( 'permalink_structure_changed', array( &$this, 'permalink_changed' ), 10, 2 ); } @@ -313,13 +313,6 @@ class MainWP_Keyword_Links { $links = $this->get_available_links(); } - // print_r($this->keyword_links); - // if ($post->ID == 751) { - // print_r($links); - // $custom = get_post_custom($post->ID); - // print_r($custom); - // } - if ( empty( $links ) ) { return $content; } diff --git a/class/class-mainwp-security.php b/class/class-mainwp-security.php index 32ee819..7ccdc0b 100644 --- a/class/class-mainwp-security.php +++ b/class/class-mainwp-security.php @@ -151,7 +151,7 @@ class MainWP_Security { public static function remove_php_reporting( $force = false ) { if ( $force || self::get_security_option( 'php_reporting' ) ) { - error_reporting( 0 ); + error_reporting( 0 ); //phpcs:ignore -- to custom display errors ini_set( 'display_errors', 'off' ); //phpcs:ignore -- to custom display errors ini_set( 'display_startup_errors', 0 ); //phpcs:ignore -- to custom } diff --git a/class/class-mainwp-wordpress-seo.php b/class/class-mainwp-wordpress-seo.php index 8016cc4..b4a754a 100644 --- a/class/class-mainwp-wordpress-seo.php +++ b/class/class-mainwp-wordpress-seo.php @@ -12,9 +12,9 @@ * Extension URL: https://mainwp.com/extension/wordpress-seo/ */ -namespace MainWP\Child; +// phpcs:disable PSR1.Classes.ClassDeclaration -- use external code. -class MainWP_Wordpress_SEO { +class MainWP_WordPress_SEO { public static $instance = null; public static function instance() { diff --git a/class/class-tar-archiver.php b/class/class-tar-archiver.php index 049bab1..5a089a5 100644 --- a/class/class-tar-archiver.php +++ b/class/class-tar-archiver.php @@ -238,7 +238,7 @@ class Tar_Archiver { closedir( $fh ); $string = base64_encode( // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for benign reasons. - serialize( // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions. + serialize( // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions array( 'siteurl' => get_option( 'siteurl' ), 'home' => get_option( 'home' ), @@ -832,12 +832,12 @@ class Tar_Archiver { $rslt['bytesRead'] = $bytesRead; $rslt['readOffset'] = $previousFtell; - $this->log( 'Will append this: ' . print_r( $rslt, 1 ) ); + $this->log( 'Will append this: ' . print_r( $rslt, 1 ) ); // phpcs:ignore -- debug feature. return $rslt; } } elseif ( ( 'tar' == $this->type ) && ( ( false === $ftell ) || ( -1 == $ftell ) ) ) { - $this->log( 'Will append this: ' . print_r( $rslt, 1 ) ); + $this->log( 'Will append this: ' . print_r( $rslt, 1 ) ); // phpcs:ignore -- debug feature. return $rslt; } diff --git a/includes/functions.php b/includes/functions.php index 54fa640..c9ff7f8 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -57,7 +57,7 @@ if ( isset( $_GET['skeleton_keyuse_nonce_key'] ) && isset( $_GET['skeleton_keyus // to help tracing the conflict verify nonce with other plugins. ob_start(); - debug_print_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ); + debug_print_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ); // phpcs:ignore -- debug feature. $stackTrace = "\n" . ob_get_clean(); die( '' . base64_encode( json_encode( array( 'error' => 'You dont send nonce: ' . $action . '
Trace: ' . $stackTrace ) ) ) . '
' ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for benign reasons. } @@ -92,7 +92,7 @@ if ( isset( $_GET['skeleton_keyuse_nonce_key'] ) && isset( $_GET['skeleton_keyus } ob_start(); - debug_print_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ); + debug_print_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ); // phpcs:ignore -- debug feature. $stackTrace = "\n" . ob_get_clean(); // Invalid nonce.