Merge pull request #135 from mainwp/bogdan01-cf-autofix

Apply fixes from CodeFactor
This commit is contained in:
Thang Hoang Van 2020-05-08 16:48:15 +07:00 committed by GitHub
commit d1ee11a4fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 10 deletions

View file

@ -306,7 +306,7 @@ class MainWP_Backup {
}
closedir( $fh );
// phpcs:enable
if ( defined( 'MAINWP_DEBUG' ) && MAINWP_DEBUG ) {
$string = wp_json_encode(
array(
@ -317,7 +317,7 @@ class MainWP_Backup {
'lang' => defined( 'WPLANG' ) ? WPLANG : '',
'plugins' => $plugins,
'themes' => $themes,
)
)
);
} else {
$string = base64_encode( // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- safe.
@ -446,7 +446,7 @@ class MainWP_Backup {
$this->zip->create( $backupFolder, PCLZIP_OPT_REMOVE_PATH, $backupFolder );
if ( $addConfig ) {
global $wpdb;
if ( defined( 'MAINWP_DEBUG' ) && MAINWP_DEBUG ) {
$string = wp_json_encode(
array(
@ -455,7 +455,7 @@ class MainWP_Backup {
'abspath' => ABSPATH,
'prefix' => $wpdb->prefix,
'lang' => WPLANG,
)
)
);
} else {
$string = base64_encode( // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- safe.
@ -470,7 +470,7 @@ class MainWP_Backup {
)
);
}
$this->add_file_from_string_to_pcl_zip( 'clone/config.txt', $string, $filepath );
}
// Remove backup folder.

View file

@ -523,7 +523,7 @@ class MainWP_Child_Timecapsule {
$current_limit = WPTC_Factory::get( 'config' )->get_option( 'activity_log_lazy_load_limit' );
$to_limit = $from_limit + $current_limit;
$sub_records = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE action_id = %s AND show_user = 1 ORDER BY id DESC LIMIT %d, %d", $action_id, $from_limit, $current_limit ) );
$sub_records = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM ' . $wpdb->base_prefix . 'wptc_activity_log WHERE action_id = %s AND show_user = 1 ORDER BY id DESC LIMIT %d, %d', $action_id, $from_limit, $current_limit ) );
$row_count = count( $sub_records );
@ -560,7 +560,7 @@ class MainWP_Child_Timecapsule {
$more_logs = false;
$load_more = false;
if ( '' != $rec->action_id ) {
$sub_records = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE action_id= %s AND show_user = 1 ORDER BY id DESC LIMIT 0, %d", $rec->action_id, $limit ) );
$sub_records = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM ' . $wpdb->base_prefix . 'wptc_activity_log WHERE action_id= %s AND show_user = 1 ORDER BY id DESC LIMIT 0, %d', $rec->action_id, $limit ) );
$row_count = count( $sub_records );
if ( $row_count == $limit ) {
$load_more = true;

View file

@ -72,7 +72,7 @@ class MainWP_Child_WooCommerce_Status {
// Get sales.
$sales = $wpdb->get_var(
$wpdb->prepare(
$wpdb->prepare(
"SELECT SUM( postmeta.meta_value ) FROM {$wpdb->posts} as posts
LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID=rel.object_ID
LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id )

View file

@ -247,7 +247,7 @@ class Tar_Archiver {
'lang' => get_bloginfo( 'language' ),
'plugins' => $plugins,
'themes' => $themes,
)
)
);
} else {
$string = base64_encode( // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for begin reasons.
@ -264,7 +264,6 @@ class Tar_Archiver {
)
);
}
$this->add_empty_directory( 'clone', 0, 0, 0, time() );
$this->add_file_from_string( 'clone/config.txt', $string );