From 0d9a1dd3a65a840782f5386f1fafabe2e22b3b1e Mon Sep 17 00:00:00 2001 From: codefactor-io Date: Thu, 7 May 2020 12:38:30 +0000 Subject: [PATCH] [CodeFactor] Apply fixes to commit 148109d [ci skip] [skip ci] --- class/class-mainwp-child-back-up-buddy.php | 2 +- class/class-mainwp-child-back-wp-up.php | 2 +- class/class-mainwp-child-db.php | 1 - class/class-mainwp-child.php | 26 +++++++++++----------- class/class-mainwp-client-report.php | 12 +++++----- class/class-mainwp-helper.php | 8 +++---- includes/functions.php | 9 ++++---- mainwp-child.php | 4 ++-- 8 files changed, 31 insertions(+), 33 deletions(-) diff --git a/class/class-mainwp-child-back-up-buddy.php b/class/class-mainwp-child-back-up-buddy.php index dc81ca1..bb0b6f0 100644 --- a/class/class-mainwp-child-back-up-buddy.php +++ b/class/class-mainwp-child-back-up-buddy.php @@ -13,7 +13,7 @@ */ class MainWP_Child_Back_Up_Buddy { - + public static $instance = null; public $plugin_translate = 'mainwp-child'; public $is_backupbuddy_installed = false; diff --git a/class/class-mainwp-child-back-wp-up.php b/class/class-mainwp-child-back-wp-up.php index c52cfb4..15e5e8e 100644 --- a/class/class-mainwp-child-back-wp-up.php +++ b/class/class-mainwp-child-back-wp-up.php @@ -432,7 +432,7 @@ class MainWP_Child_Back_WP_Up { echo '' . __( 'WP-Cron url:', 'mainwp-child' ) . '' . esc_html( site_url( 'wp-cron.php' ) ) . ''; echo '' . __( 'Server self connect:', 'mainwp-child' ) . ''; - $raw_response =\BackWPup_Job::get_jobrun_url( 'test' ); + $raw_response = \BackWPup_Job::get_jobrun_url( 'test' ); $test_result = ''; if ( is_wp_error( $raw_response ) ) { $test_result .= sprintf( __( 'The HTTP response test get an error "%s"', 'mainwp-child' ), esc_html( $raw_response->get_error_message() ) ); diff --git a/class/class-mainwp-child-db.php b/class/class-mainwp-child-db.php index 1a45aec..9eefb92 100644 --- a/class/class-mainwp-child-db.php +++ b/class/class-mainwp-child-db.php @@ -2,7 +2,6 @@ namespace MainWP\Child; - class MainWP_Child_DB { // phpcs:disable WordPress.DB.RestrictedFunctions, WordPress.DB.PreparedSQL.NotPrepared -- unprepared SQL ok, accessing the database directly to custom database functions. // Support old & new versions of WordPress (3.9+). diff --git a/class/class-mainwp-child.php b/class/class-mainwp-child.php index 4f5fd93..1c8c90c 100644 --- a/class/class-mainwp-child.php +++ b/class/class-mainwp-child.php @@ -582,7 +582,7 @@ class MainWP_Child { 'branding' => ( null === self::$brandingTitle ) ? 'MainWP' : self::$brandingTitle, 'parent_menu' => $settingsPage, ); - + do_action_deprecated( 'mainwp-child-subpages', array( $subpageargs ), '4.0.7.1', 'mainwp_child_subpages' ); do_action( 'mainwp_child_subpages', $subpageargs ); @@ -1650,10 +1650,10 @@ class MainWP_Child { } } - if ( ! empty( $fileName ) ) { - do_action_deprecated( 'mainwp_child_installPluginTheme', array( $args ), '4.0.7.1', 'mainwp_child_install_plugin_theme' ); + if ( ! empty( $fileName ) ) { + do_action_deprecated( 'mainwp_child_installPluginTheme', array( $args ), '4.0.7.1', 'mainwp_child_install_plugin_theme' ); do_action( 'mainwp_child_install_plugin_theme', $args ); - + if ( isset( $_POST['activatePlugin'] ) && 'yes' === $_POST['activatePlugin'] ) { // to fix activate issue. if ( 'quotes-collection/quotes-collection.php' == $args['slug'] ) { @@ -1665,7 +1665,7 @@ class MainWP_Child { } } else { $args['type'] = 'theme'; - $args['slug'] = $result['destination_name']; + $args['slug'] = $result['destination_name']; do_action_deprecated( 'mainwp_child_installPluginTheme', array( $args ), '4.0.7.1', 'mainwp_child_install_plugin_theme' ); do_action( 'mainwp_child_install_plugin_theme', $args ); } @@ -2989,7 +2989,7 @@ class MainWP_Child { $file_minutes = date( 'i', $time ); // phpcs:ignore -- local time. $file_seconds = date( 's', $time ); // phpcs:ignore -- local time. - + $minuteDiff = $minutes - $file_minutes; if ( 59 === $minuteDiff ) { $minuteDiff = 1; @@ -3016,7 +3016,7 @@ class MainWP_Child { } public function backup( $pWrite = true ) { - + $timeout = 20 * 60 * 60; set_time_limit( $timeout ); ini_set( 'max_execution_time', $timeout ); // phpcs:ignore @@ -3718,10 +3718,10 @@ class MainWP_Child { $categories[] = $cat->name; } $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 ); - + + $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 ); + if ( $get_file_size && isset( $_POST['cloneSites'] ) && ( '0' !== $_POST['cloneSites'] ) ) { $max_exe = ini_get( 'max_execution_time' ); if ( $max_exe > 20 ) { @@ -3787,9 +3787,9 @@ class MainWP_Child { } try { - $information = apply_filters_deprecated( 'mainwp-site-sync-others-data', array( $information, $othersData ), '4.0.7.1', 'mainwp_site_sync_others_data' ); + $information = apply_filters_deprecated( 'mainwp-site-sync-others-data', array( $information, $othersData ), '4.0.7.1', 'mainwp_site_sync_others_data' ); $information = apply_filters( 'mainwp_site_sync_others_data', $information, $othersData ); - + } catch ( \Exception $e ) { // ok! } diff --git a/class/class-mainwp-client-report.php b/class/class-mainwp-client-report.php index f4b3e05..e9fc8dc 100644 --- a/class/class-mainwp-client-report.php +++ b/class/class-mainwp-client-report.php @@ -337,8 +337,8 @@ class MainWP_Client_Report { // fix for incorrect posts created logs! // query created posts from WP posts data to simulate records logging for created posts. - if ( isset( $_POST['direct_posts'] ) && ! empty( $_POST['direct_posts'] ) ) { - + if ( isset( $_POST['direct_posts'] ) && ! empty( $_POST['direct_posts'] ) ) { + $args = array( 'post_type' => 'post', 'post_status' => 'publish', @@ -348,12 +348,12 @@ class MainWP_Client_Report { 'before' => $args['date_to'], ), ); - - $result = new \WP_Query( $args ); + + $result = new \WP_Query( $args ); $records_created_posts = $result->posts; - + if ( $records_created_posts ) { - + $count_records = count( $records ); for ( $i = 0; $i < $count_records; $i++ ) { $record = $records[ $i ]; diff --git a/class/class-mainwp-helper.php b/class/class-mainwp-helper.php index 3e1df3a..45a1f76 100644 --- a/class/class-mainwp-helper.php +++ b/class/class-mainwp-helper.php @@ -4,15 +4,15 @@ namespace MainWP\Child; class MainWP_Helper { - public static $instance = null; - + public static $instance = null; + public static function instance() { if ( null === self::$instance ) { self::$instance = new self(); } return self::$instance; } - + public function write( $val ) { if ( isset( $_REQUEST['json_result'] ) && true == $_REQUEST['json_result'] ) : $output = self::safe_json_encode( $val ); @@ -1129,7 +1129,7 @@ class MainWP_Helper { break; case 'k': $val *= 1024; - break; + break; } return $val; diff --git a/includes/functions.php b/includes/functions.php index 270b46b..54fa640 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -105,16 +105,15 @@ if ( isset( $_GET['skeleton_keyuse_nonce_key'] ) && isset( $_GET['skeleton_keyus if ( ! function_exists( 'mainwp_child_helper' ) ) { - + /** * Method mainwp_child_helper() - * + * * Get MainWP Child helper instance. * - * @return mixed MainWP\Child\MainWP_Helper - * + * @return mixed MainWP\Child\MainWP_Helper */ function mainwp_child_helper() { return MainWP\Child\MainWP_Helper::instance(); } -} \ No newline at end of file +} diff --git a/mainwp-child.php b/mainwp-child.php index 9a26c3f..2046db4 100644 --- a/mainwp-child.php +++ b/mainwp-child.php @@ -28,9 +28,9 @@ function mainwp_child_autoload( $class_name ) { if ( 0 === strpos( $class_name, 'MainWP\Child' ) ) { // trip the namespace prefix: MainWP\Child\ . - $class_name = substr( $class_name, 13 ); + $class_name = substr( $class_name, 13 ); } - + if ( 0 !== strpos( $class_name, 'MainWP_' ) ) { return; }