[CodeFactor] Apply fixes

This commit is contained in:
codefactor-io 2020-03-26 17:03:00 +00:00
parent 055f7232cd
commit 44cdebaf44
28 changed files with 891 additions and 829 deletions

View file

@ -2344,32 +2344,42 @@ class MainWP_Child_Back_Up_Buddy {
<div class="inside">
<label><?php _e('Site', 'it-l10n-backupbuddy' ); ?></label>
<?php
if ( !empty( $scan['SCAN']['SITE'] ) ) { echo lined_array( $scan['SCAN']['SITE'] );
} else { echo '<i>', __('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
if ( ! empty( $scan['SCAN']['SITE'] ) ) {
echo lined_array( $scan['SCAN']['SITE'] );
} else {
echo '<i>', __('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
?>
<br />
<label><?php _e('Hostname', 'it-l10n-backupbuddy' ); ?></label>
<?php
if ( !empty( $scan['SCAN']['DOMAIN'] ) ) { echo lined_array( $scan['SCAN']['DOMAIN'] );
} else { echo '<i>',__('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
if ( ! empty( $scan['SCAN']['DOMAIN'] ) ) {
echo lined_array( $scan['SCAN']['DOMAIN'] );
} else {
echo '<i>',__('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
?>
<br />
<label><?php _e('IP Address', 'it-l10n-backupbuddy' ); ?></label>
<?php
if ( !empty( $scan['SCAN']['IP'] ) ) { echo lined_array( $scan['SCAN']['IP'] );
} else { echo '<i>',__('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
if ( ! empty( $scan['SCAN']['IP'] ) ) {
echo lined_array( $scan['SCAN']['IP'] );
} else {
echo '<i>',__('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
?>
<br />
<label><?php _e('System details', 'it-l10n-backupbuddy' ); ?></label>
<?php
if ( !empty( $scan['SYSTEM']['NOTICE'] ) ) { echo lined_array( $scan['SYSTEM']['NOTICE'] );
} else { echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
if ( ! empty( $scan['SYSTEM']['NOTICE'] ) ) {
echo lined_array( $scan['SYSTEM']['NOTICE'] );
} else {
echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
?>
<br />
<label><?php _e('Information', 'it-l10n-backupbuddy' ); ?></label>
<?php
if ( !empty( $scan['SYSTEM']['INFO'] ) ) { echo lined_array( $scan['SYSTEM']['INFO'] );
} else { echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
if ( ! empty( $scan['SYSTEM']['INFO'] ) ) {
echo lined_array( $scan['SYSTEM']['INFO'] );
} else {
echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
?>
<br />
</div>
@ -2381,32 +2391,42 @@ class MainWP_Child_Back_Up_Buddy {
<div class="inside">
<label><?php _e('Details', 'it-l10n-backupbuddy' ); ?></label>
<?php
if ( !empty( $scan['WEBAPP']['INFO'] ) ) { echo lined_array( $scan['WEBAPP']['INFO'] );
} else { echo '<i>', __('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
if ( ! empty( $scan['WEBAPP']['INFO'] ) ) {
echo lined_array( $scan['WEBAPP']['INFO'] );
} else {
echo '<i>', __('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
?>
<br />
<label><?php _e('Versions', 'it-l10n-backupbuddy' ); ?></label>
<?php
if ( !empty( $scan['WEBAPP']['VERSION'] ) ) { echo lined_array( $scan['WEBAPP']['VERSION'] );
} else { echo '<i>',__('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
if ( ! empty( $scan['WEBAPP']['VERSION'] ) ) {
echo lined_array( $scan['WEBAPP']['VERSION'] );
} else {
echo '<i>',__('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
?>
<br />
<label><?php _e('Notices', 'it-l10n-backupbuddy' ); ?></label>
<?php
if ( !empty( $scan['WEBAPP']['NOTICE'] ) ) { echo lined_array( $scan['WEBAPP']['NOTICE'] );
} else { echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
if ( ! empty( $scan['WEBAPP']['NOTICE'] ) ) {
echo lined_array( $scan['WEBAPP']['NOTICE'] );
} else {
echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
?>
<br />
<label><?php _e('Errors', 'it-l10n-backupbuddy' ); ?></label>
<?php
if ( !empty( $scan['WEBAPP']['ERROR'] ) ) { echo lined_array( $scan['WEBAPP']['ERROR'] );
} else { echo '<i>',__('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
if ( ! empty( $scan['WEBAPP']['ERROR'] ) ) {
echo lined_array( $scan['WEBAPP']['ERROR'] );
} else {
echo '<i>',__('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
?>
<br />
<label><?php _e('Warnings', 'it-l10n-backupbuddy' ); ?></label>
<?php
if ( !empty( $scan['WEBAPP']['WARN'] ) ) { echo lined_array( $scan['WEBAPP']['WARN'] );
} else { echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
if ( ! empty( $scan['WEBAPP']['WARN'] ) ) {
echo lined_array( $scan['WEBAPP']['WARN'] );
} else {
echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
?>
<br />
</div>
@ -2417,8 +2437,10 @@ class MainWP_Child_Back_Up_Buddy {
<h3 class="hndle"><span><?php _e('Links', 'it-l10n-backupbuddy' ); ?></span></h3>
<div class="inside">
<?php
if ( !empty( $scan['LINKS']['URL'] ) ) { echo lined_array( $scan['LINKS']['URL'] );
} else { echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
if ( ! empty( $scan['LINKS']['URL'] ) ) {
echo lined_array( $scan['LINKS']['URL'] );
} else {
echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
?>
</div>
</div>
@ -2428,8 +2450,10 @@ class MainWP_Child_Back_Up_Buddy {
<h3 class="hndle"><span><?php _e('Local Javascript', 'it-l10n-backupbuddy' ); ?></span></h3>
<div class="inside">
<?php
if ( !empty( $scan['LINKS']['JSLOCAL'] ) ) { echo lined_array( $scan['LINKS']['JSLOCAL'] );
} else { echo '<i>', __('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
if ( ! empty( $scan['LINKS']['JSLOCAL'] ) ) {
echo lined_array( $scan['LINKS']['JSLOCAL'] );
} else {
echo '<i>', __('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
?>
</div>
</div>
@ -2439,8 +2463,10 @@ class MainWP_Child_Back_Up_Buddy {
<h3 class="hndle"><span><?php _e('External Javascript', 'it-l10n-backupbuddy' ); ?></span></h3>
<div class="inside">
<?php
if ( !empty( $scan['LINKS']['JSEXTERNAL'] ) ) { echo lined_array( $scan['LINKS']['JSEXTERNAL'] );
} else { echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
if ( ! empty( $scan['LINKS']['JSEXTERNAL'] ) ) {
echo lined_array( $scan['LINKS']['JSEXTERNAL'] );
} else {
echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
?>
</div>
</div>
@ -2450,8 +2476,10 @@ class MainWP_Child_Back_Up_Buddy {
<h3 class="hndle"><span><?php _e('Iframes Included', 'it-l10n-backupbuddy' ); ?></span></h3>
<div class="inside">
<?php
if ( !empty( $scan['LINKS']['IFRAME'] ) ) { echo lined_array( $scan['LINKS']['IFRAME'] );
} else { echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
if ( ! empty( $scan['LINKS']['IFRAME'] ) ) {
echo lined_array( $scan['LINKS']['IFRAME'] );
} else {
echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
?>
</div>
</div>
@ -2461,8 +2489,10 @@ class MainWP_Child_Back_Up_Buddy {
<h3 class="hndle"><span><?php _e('Blacklisting Status', 'it-l10n-backupbuddy' ); ?></span></h3>
<div class="inside">
<?php
if ( !empty( $scan['BLACKLIST']['INFO'] ) ) { echo lined_array( $scan['BLACKLIST']['INFO'] );
} else { echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
if ( ! empty( $scan['BLACKLIST']['INFO'] ) ) {
echo lined_array( $scan['BLACKLIST']['INFO'] );
} else {
echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
?>
</div>
</div>

View file

@ -43,7 +43,8 @@ class MainWP_Child_Back_Up_Wordpress {
return;
}
if (!$this->is_plugin_installed) { return;
if ( ! $this->is_plugin_installed) {
return;
}
add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
@ -202,9 +203,11 @@ class MainWP_Child_Back_Up_Wordpress {
// ok
public function do_reports_log( $ext = '') {
if ( $ext !== 'backupwordpress' ) { return;
if ( $ext !== 'backupwordpress' ) {
return;
}
if (!$this->is_plugin_installed) { return;
if ( ! $this->is_plugin_installed) {
return;
}
try {
@ -1118,8 +1121,7 @@ class MainWP_Child_Back_Up_Wordpress {
$exclude_rule = ABSPATH . $excl_rule;
$path = realpath($exclude_rule);
// If it exist
if($path !== false)
{
if ($path !== false) {
$schedule->set_excludes( $exclude_rule, true );
$schedule->save();
}

View file

@ -239,7 +239,8 @@ class MainWP_Child_Back_WP_Up {
}
// ok
public function do_reports_log( $ext = '') {
if ( $ext !== 'backwpup' ) { return;
if ( $ext !== 'backwpup' ) {
return;
}
if ( ! $this->is_backwpup_installed) {
return;

View file

@ -231,7 +231,8 @@ class MainWP_Child_Links_Checker {
function get_links_data() {
if (!defined('BLC_DIRECTORY')) { return;
if ( ! defined('BLC_DIRECTORY')) {
return;
}
$file_path1 = BLC_DIRECTORY . '/includes/link-query.php';
@ -291,7 +292,8 @@ class MainWP_Child_Links_Checker {
}
function get_count_links() {
if (!defined('BLC_DIRECTORY')) { return;
if ( ! defined('BLC_DIRECTORY')) {
return;
}
$file_path1 = BLC_DIRECTORY . '/includes/link-query.php';

View file

@ -478,8 +478,7 @@ class MainWP_Child_Pagespeed {
$custom_post_types = get_post_types($args, 'names', 'and');
if ($restrict_type != 'gpi_custom_posts' && $restrict_type != 'all' && $restrict_type != 'ignored') {
$restrict_type = str_replace('gpi_custom_posts-', '', $restrict_type);
foreach($custom_post_types as $post_type)
{
foreach ($custom_post_types as $post_type) {
if ($cpt_whitelist_arr && in_array($post_type, $cpt_whitelist_arr)) {
if ($post_type == $restrict_type) {
$typestocheck[] = 'type = %s';
@ -488,8 +487,7 @@ class MainWP_Child_Pagespeed {
}
}
} else {
foreach($custom_post_types as $post_type)
{
foreach ($custom_post_types as $post_type) {
if ($cpt_whitelist_arr && in_array($post_type, $cpt_whitelist_arr)) {
$typestocheck[] = 'type = %s';
$types[1][] = $custom_post_types[ $post_type ];
@ -520,13 +518,11 @@ class MainWP_Child_Pagespeed {
if ( ! empty($typestocheck)) {
$types[0] = '';
foreach($typestocheck as $type)
{
foreach ($typestocheck as $type) {
if ( ! is_array($type)) {
$types[0] .= $type . ' OR ';
} else {
foreach($type as $custom_post_type)
{
foreach ($type as $custom_post_type) {
$types[0] .= 'type = %s OR ';
$types[1][] = $custom_post_type;
}

View file

@ -151,14 +151,12 @@ class MainWP_Child_Plugins_Check {
$plugin_info = get_transient( $this->tran_name_plugin_timestamps );
//Sanity check the response
if( false === $plugin_info || ! is_array( $plugin_info ) && 0 === count( $plugin_info ) )
{
if ( false === $plugin_info || ! is_array( $plugin_info ) && 0 === count( $plugin_info ) ) {
return $plugin_meta;
}
//See if this specific plugin is in the known list
if( array_key_exists( $plugin_file, $plugin_info ) )
{
if ( array_key_exists( $plugin_file, $plugin_info ) ) {
//Get now
$now = new \DateTime();
$last_updated = $plugin_info[ $plugin_file ]['last_updated'];
@ -173,12 +171,9 @@ class MainWP_Child_Plugins_Check {
$tolerance_in_days = get_option( 'mainwp_child_plugintheme_days_outdate', 365 );
//If we're outside the window for tolerance show a message
if( $diff_in_days > $tolerance_in_days )
{
if ( $diff_in_days > $tolerance_in_days ) {
$plugin_meta[] = sprintf( '<strong style="color: #f00;">This plugin has not been updated by the author in %1$d days!</strong>', $diff_in_days );
}
else
{
} else {
$plugin_meta[] = sprintf( '<span style="color: #090;">This plugin was last updated by the author in %1$d days ago.</span>', $diff_in_days );
}
}

View file

@ -379,8 +379,7 @@ class MainWP_Child_Staging {
// from wp-staging plugin
public function formatSize( $bytes, $precision = 2) {
if ( (float) $bytes < 1)
{
if ( (float) $bytes < 1) {
return '';
}

View file

@ -177,7 +177,8 @@ class MainWP_Child_Themes_Check {
$tolerance_in_days = get_option( 'mainwp_child_plugintheme_days_outdate', 365 );
foreach ( $themes_to_scan as $slug => $v ) {
if ( in_array( $slug, $avoid_themes ) ) { continue;
if ( in_array( $slug, $avoid_themes ) ) {
continue;
}
$body = $this->try_get_response_body( $slug, false );

View file

@ -490,7 +490,8 @@ function get_sibling_files_callback_wptc() {
//Parameters that are going to be used to order the result
$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;}
if ( ! empty($orderby) & ! empty($order)) {
$query .= ' ORDER BY ' . $orderby . ' ' . $order;}
/*
-- Pagination parameters -- */
@ -500,7 +501,8 @@ function get_sibling_files_callback_wptc() {
$perpage = 20;
//Which page is this?
$paged = ! empty($_POST['paged']) ? $_POST['paged'] : '';
if (empty($paged) || !is_numeric($paged) || $paged <= 0) {$paged = 1;} //Page Number
if (empty($paged) || ! is_numeric($paged) || $paged <= 0) {
$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
@ -709,7 +711,8 @@ function get_sibling_files_callback_wptc() {
// ok
public function do_reports_log( $ext = '') {
if ( $ext !== 'wptimecapsule' ) { return;
if ( $ext !== 'wptimecapsule' ) {
return;
}
if ( ! $this->is_plugin_installed) {
@ -1169,8 +1172,7 @@ function get_sibling_files_callback_wptc() {
$curlversion = curl_version();
echo '<tr title=""><td>' . __( 'cURL version', 'wp-time-capsule' ) . '</td><td>' . esc_html( $curlversion['version'] ) . '</td></tr>';
echo '<tr title=""><td>' . __( 'cURL SSL version', 'wp-time-capsule' ) . '</td><td>' . esc_html( $curlversion['ssl_version'] ) . '</td></tr>';
}
else {
} else {
echo '<tr title=""><td>' . __( 'cURL version', 'wp-time-capsule' ) . '</td><td>' . __( 'unavailable', 'wp-time-capsule' ) . '</td></tr>';
}

View file

@ -318,7 +318,8 @@ class MainWP_Child_Updraft_Plus_Backups {
)
);
if ( is_wp_error( $result ) || ( false === $result ) ) { return $result;
if ( is_wp_error( $result ) || ( false === $result ) ) {
return $result;
}
$response = json_decode( $result['body'], true );
@ -336,13 +337,15 @@ class MainWP_Child_Updraft_Plus_Backups {
if ( ! empty( $response['token'] ) ) {
// Store it
$vault_settings = UpdraftPlus_Options::get_updraft_option( 'updraft_updraftvault' );
if ( !is_array( $vault_settings ) ) { $vault_settings = array();
if ( ! is_array( $vault_settings ) ) {
$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'];
if ( isset($response['quota'] ) ) {
$vault_settings['quota'] = $response['quota'];
}
UpdraftPlus_Options::update_updraft_option( 'updraft_updraftvault', $vault_settings );
} elseif ( isset( $response['quota'] ) && ! $response['quota'] ) {
@ -396,7 +399,8 @@ class MainWP_Child_Updraft_Plus_Backups {
'su' => base64_encode( home_url() ),
);
if ( !empty( $vault_settings['token'] ) ) { $post_body['token'] = (string) $vault_settings['token'];
if ( ! empty( $vault_settings['token'] ) ) {
$post_body['token'] = (string) $vault_settings['token'];
}
// Use SSL to prevent snooping
@ -724,7 +728,8 @@ class MainWP_Child_Updraft_Plus_Backups {
function addons_connect() {
if ( ! defined( 'UDADDONS2_SLUG' ) ) {
if (is_file(UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php')) { require_once UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php';
if (is_file(UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php')) {
require_once UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php';
}
if ( ! defined( 'UDADDONS2_SLUG' ) ) {
return array( 'error' => 'NO_PREMIUM' );
@ -2609,13 +2614,15 @@ class MainWP_Child_Updraft_Plus_Backups {
$updraftplus->get_max_packet_size();
$backup = UpdraftPlus_Backup_History::get_history($timestamp);
if (!isset($backup['nonce']) || !isset($backup['db'])) { return array( $mess, $warn, $err, $info );
if ( ! isset($backup['nonce']) || ! isset($backup['db'])) {
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 );
if ( ! is_readable($db_file)) {
return array( $mess, $warn, $err, $info );
}
// Encrypted - decrypt it
@ -2760,14 +2767,16 @@ class MainWP_Child_Updraft_Plus_Backups {
if ( ! $migration_warning && home_url() != $old_home) {
$migration_warning = true;
$powarn = apply_filters('updraftplus_dbscan_urlchange', '<a href="https://updraftplus.com/shop/migrator/">' . __('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') . '</a>', $old_home, $res);
if (!empty($powarn)) { $warn[] = $powarn;
if ( ! empty($powarn)) {
$warn[] = $powarn;
}
}
} elseif ( ! isset($info['created_by_version']) && preg_match('/^\# Created by UpdraftPlus version ([\d\.]+)/', $buffer, $matches)) {
$info['created_by_version'] = trim($matches[1]);
} 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);
if ( ! empty($matches[3])) {
$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);
@ -2812,7 +2821,8 @@ class MainWP_Child_Updraft_Plus_Backups {
$val = $kvmatches[2];
if ('multisite' == $key) {
$info['multisite'] = $val ? true : false;
if ($val) { $mess[] = '<strong>' . __('Site information:', 'updraftplus') . '</strong> ' . 'backup is of a WordPress Network';
if ($val) {
$mess[] = '<strong>' . __('Site information:', 'updraftplus') . '</strong> ' . 'backup is of a WordPress Network';
}
}
$old_siteinfo[ $key ] = $val;
@ -2910,7 +2920,8 @@ class MainWP_Child_Updraft_Plus_Backups {
}
}
$charset_select_html .= '</select>';
if (empty($info['addui'])) { $info['addui'] = '';
if (empty($info['addui'])) {
$info['addui'] = '';
}
$info['addui'] .= $charset_select_html;
}
@ -2996,7 +3007,8 @@ class MainWP_Child_Updraft_Plus_Backups {
CREATE TABLE $wpdb->sitemeta (
CREATE TABLE $wpdb->signups (
*/
if (!isset($skipped_tables)) { $skipped_tables = array();
if ( ! isset($skipped_tables)) {
$skipped_tables = array();
}
$missing_tables = array();
if ($old_table_prefix) {
@ -3186,9 +3198,11 @@ class MainWP_Child_Updraft_Plus_Backups {
$date_label = $this->date_label( $pretty_date, $key, $backup, $jobdata, $non );
$service_title = '';
if (!isset($backup['service'])) { $backup['service'] = array();
if ( ! isset($backup['service'])) {
$backup['service'] = array();
}
if (!is_array($backup['service'])) { $backup['service'] = array( $backup['service'] );
if ( ! is_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 ) )) {
@ -3220,7 +3234,8 @@ ENDHERE;
$db = is_array( $backup['db'] ) ? $backup['db'][0] : $backup['db'];
if ( class_exists( 'UpdraftPlus_Encryption')) {
if ( method_exists('UpdraftPlus_Encryption', 'is_file_encrypted')) {
if (UpdraftPlus_Encryption::is_file_encrypted($db)) { $entities .= '/dbcrypted=1/';
if (UpdraftPlus_Encryption::is_file_encrypted($db)) {
$entities .= '/dbcrypted=1/';
}
}
} elseif ( method_exists($updraftplus, 'is_db_encrypted') && $updraftplus->is_db_encrypted( $db ) ) {

View file

@ -654,7 +654,8 @@ class MainWP_Child_Wordfence {
public function wordfence_init() {
if ( ! $this->is_wordfence_installed ) { return;
if ( ! $this->is_wordfence_installed ) {
return;
}
add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
@ -671,9 +672,11 @@ class MainWP_Child_Wordfence {
}
// ok
public function do_reports_log( $ext = '') {
if ( $ext !== 'wordfence' ) { return;
if ( $ext !== 'wordfence' ) {
return;
}
if ( ! $this->is_wordfence_installed ) { return;
if ( ! $this->is_wordfence_installed ) {
return;
}
global $wpdb;
@ -1602,15 +1605,12 @@ SQL
'ok' => 1,
'token' => $res['token'],
);
}
elseif ($res['err']) {
} elseif ($res['err']) {
return array( 'errorExport' => __('An error occurred: ', 'wordfence') . $res['err'] );
}
else {
} else {
throw new Exception(__('Invalid response: ', 'wordfence') . var_export($res, true));
}
}
catch (Exception $e) {
} catch (Exception $e) {
return array( 'errorExport' => __('An error occurred: ', 'wordfence') . $e->getMessage() );
}
}
@ -1668,15 +1668,12 @@ SQL
'totalSet' => $totalSet,
'settings' => $this->get_settings(),
);
}
elseif ($res['err']) {
} elseif ($res['err']) {
return array( 'errorImport' => 'An error occurred: ' . $res['err'] );
}
else {
} else {
throw new Exception('Invalid response: ' . var_export($res, true));
}
}
catch (Exception $e) {
} catch (Exception $e) {
return array( 'errorImport' => 'An error occurred: ' . $e->getMessage() );
}
}
@ -1938,8 +1935,7 @@ SQL
return array(
'error' => sprintf(__('An error occurred while saving the configuration: %s', 'wordfence'), $errors[0]['error']),
);
}
elseif (count($errors) > 1) {
} elseif (count($errors) > 1) {
$compoundMessage = array();
foreach ($errors as $e) {
$compoundMessage[] = $e['error'];
@ -1956,13 +1952,11 @@ SQL
wfConfig::save($changes);
return array( 'success' => true );
}
catch (wfWAFStorageFileException $e) {
} catch (wfWAFStorageFileException $e) {
return array(
'error' => __('An error occurred while saving the configuration.', 'wordfence'),
);
}
catch (Exception $e) {
} catch (Exception $e) {
return array(
'error' => $e->getMessage(),
);

View file

@ -6,8 +6,7 @@ class MainWP_Child_WPvivid_BackupRestore {
public $is_plugin_installed = false;
public $public_intetface;
static function Instance() {
if ( null === self::$instance )
{
if ( null === self::$instance ) {
self::$instance = new MainWP_Child_WPvivid_BackupRestore();
}
@ -16,8 +15,7 @@ class MainWP_Child_WPvivid_BackupRestore {
public function __construct() {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
if ( is_plugin_active( 'wpvivid-backuprestore/wpvivid-backuprestore.php' ) && defined('WPVIVID_PLUGIN_DIR'))
{
if ( is_plugin_active( 'wpvivid-backuprestore/wpvivid-backuprestore.php' ) && defined('WPVIVID_PLUGIN_DIR')) {
$this->is_plugin_installed = true;
}
@ -35,8 +33,7 @@ class MainWP_Child_WPvivid_BackupRestore {
function syncOthersData( $information, $data = array() ) {
try {
if ( isset( $data['syncWPvividData'] ))
{
if ( isset( $data['syncWPvividData'] )) {
$information['syncWPvividData'] = 1;
$data = WPvivid_Setting::get_sync_data();
$information['syncWPvividSettingData'] = $data['setting'];
@ -54,14 +51,12 @@ class MainWP_Child_WPvivid_BackupRestore {
public function action() {
$information = array();
if ( ! $this->is_plugin_installed )
{
if ( ! $this->is_plugin_installed ) {
$information['error'] = 'NO_WPVIVIDBACKUP';
MainWP_Helper::write( $information );
}
if ( isset( $_POST['mwp_action'] ) )
{
if ( isset( $_POST['mwp_action'] ) ) {
try {
switch ($_POST['mwp_action']) {
case 'prepare_backup':

View file

@ -212,7 +212,8 @@ class MainWP_Child {
$this->update();
$this->load_all_options();
$this->filterFunction = function( $a) {
if ($a == null) { return false; }
if ($a == null) {
return false; }
if (is_object($a) && property_exists($a, 'last_checked') && ! property_exists($a, 'checked')) {
return false;
}
@ -328,7 +329,8 @@ class MainWP_Child {
$alloptions_db = $wpdb->get_results( $query );
$wpdb->suppress_errors($suppress);
if ( !is_array( $alloptions ) ) { $alloptions = array();
if ( ! is_array( $alloptions ) ) {
$alloptions = array();
}
if ( is_array( $alloptions_db ) ) {
foreach ( (array) $alloptions_db as $o ) {
@ -924,22 +926,47 @@ class MainWP_Child {
<div style="clear: both;"></div><br/>
<div class="mainwp-tabs" id="mainwp-tabs">
<?php if ( ! $hide_settings ) { ?>
<a class="nav-tab pos-nav-tab <?php if ( $shownPage === 'settings' ) { echo 'nav-tab-active'; } ?>" tab-slug="settings" href="<?php echo $subpage ? 'options-general.php?page=mainwp_child_tab&tab=settings' : '#'; ?>" style="margin-left: 0 !important;"><?php _e( 'Settings', 'mainwp-child' ); ?></a>
<a class="nav-tab pos-nav-tab
<?php
if ( $shownPage === 'settings' ) {
echo 'nav-tab-active'; }
?>
" tab-slug="settings" href="<?php echo $subpage ? 'options-general.php?page=mainwp_child_tab&tab=settings' : '#'; ?>" style="margin-left: 0 !important;"><?php _e( 'Settings', 'mainwp-child' ); ?></a>
<?php } ?>
<?php if ( ! $hide_restore ) { ?>
<a class="nav-tab pos-nav-tab <?php if ( $shownPage === 'restore-clone' ) { echo 'nav-tab-active'; } ?>" tab-slug="restore-clone" href="<?php echo $subpage ? 'options-general.php?page=mainwp_child_tab&tab=restore-clone' : '#'; ?>"><?php echo ( 0 !== (int) $sitesToClone ) ? __( 'Restore / Clone', 'mainwp-child' ) : __( 'Restore', 'mainwp-child' ); ?></a>
<a class="nav-tab pos-nav-tab
<?php
if ( $shownPage === 'restore-clone' ) {
echo 'nav-tab-active'; }
?>
" tab-slug="restore-clone" href="<?php echo $subpage ? 'options-general.php?page=mainwp_child_tab&tab=restore-clone' : '#'; ?>"><?php echo ( 0 !== (int) $sitesToClone ) ? __( 'Restore / Clone', 'mainwp-child' ) : __( 'Restore', 'mainwp-child' ); ?></a>
<?php } ?>
<?php if ( ! $hide_server_info ) { ?>
<a class="nav-tab pos-nav-tab <?php if ( $shownPage === 'server-info' ) { echo 'nav-tab-active'; } ?>" tab-slug="server-info" href="<?php echo $subpage ? 'options-general.php?page=mainwp_child_tab&tab=server-info' : '#'; ?>"><?php _e( 'Server information', 'mainwp-child' ); ?></a>
<a class="nav-tab pos-nav-tab
<?php
if ( $shownPage === 'server-info' ) {
echo 'nav-tab-active'; }
?>
" tab-slug="server-info" href="<?php echo $subpage ? 'options-general.php?page=mainwp_child_tab&tab=server-info' : '#'; ?>"><?php _e( 'Server information', 'mainwp-child' ); ?></a>
<?php } ?>
<?php if ( ! $hide_connection_detail ) { ?>
<a class="nav-tab pos-nav-tab <?php if ( $shownPage === 'connection-detail' ) { echo 'nav-tab-active'; } ?>" tab-slug="connection-detail" href="<?php echo $subpage ? 'options-general.php?page=mainwp_child_tab&tab=connection-detail' : '#'; ?>"><?php _e( 'Connection Details', 'mainwp-child' ); ?></a>
<a class="nav-tab pos-nav-tab
<?php
if ( $shownPage === 'connection-detail' ) {
echo 'nav-tab-active'; }
?>
" tab-slug="connection-detail" href="<?php echo $subpage ? 'options-general.php?page=mainwp_child_tab&tab=connection-detail' : '#'; ?>"><?php _e( 'Connection Details', 'mainwp-child' ); ?></a>
<?php } ?>
<?php
if ( isset( self::$subPages ) && is_array( self::$subPages ) ) {
foreach ( self::$subPages as $subPage ) {
?>
<a class="nav-tab pos-nav-tab <?php if ( $shownPage == $subPage['slug'] ) { echo 'nav-tab-active'; } ?>" tab-slug="<?php echo esc_attr($subPage['slug']); ?>" href="options-general.php?page=<?php echo rawurlencode($subPage['page']); ?>"><?php echo esc_html($subPage['title']); ?></a>
<a class="nav-tab pos-nav-tab
<?php
if ( $shownPage == $subPage['slug'] ) {
echo 'nav-tab-active'; }
?>
" tab-slug="<?php echo esc_attr($subPage['slug']); ?>" href="options-general.php?page=<?php echo rawurlencode($subPage['page']); ?>"><?php echo esc_html($subPage['title']); ?></a>
<?php
}
}
@ -1029,7 +1056,12 @@ class MainWP_Child {
<div style="margin: 1em 0 4em 0;">
<input name="requireUniqueSecurityId"
type="checkbox"
id="requireUniqueSecurityId" <?php if ( '' != get_option( 'mainwp_child_uniqueId' ) ) { echo 'checked'; } ?> />
id="requireUniqueSecurityId"
<?php
if ( '' != get_option( 'mainwp_child_uniqueId' ) ) {
echo 'checked'; }
?>
/>
<label for="requireUniqueSecurityId"
style="font-size: 15px;"><?php esc_html_e( 'Require unique security ID', 'mainwp-child' ); ?></label>
</div>
@ -3884,8 +3916,7 @@ class MainWP_Child {
$translation_updates = wp_get_translation_updates();
if ( ! empty( $translation_updates ) ) {
$information['translation_updates'] = array();
foreach ($translation_updates as $translation_update)
{
foreach ($translation_updates as $translation_update) {
$new_translation_update = array(
'type' => $translation_update->type,
'slug' => $translation_update->slug,
@ -5791,7 +5822,8 @@ class MainWP_Child {
header( 'Cache-Control: must-revalidate' );
header( 'Pragma: public' );
header( 'Content-Length: ' . filesize( $backupdir . $file ) );
while ( @ob_end_flush() ) {;
while ( @ob_end_flush() ) {
;
}
$this->readfile_chunked( $backupdir . $file, $offset );
}

View file

@ -518,8 +518,7 @@ class MainWP_Clone {
var child_security_nonces = [];
<?php
$security_nonces = self::get()->getSecurityNonces();
foreach ($security_nonces as $k => $v)
{
foreach ($security_nonces as $k => $v) {
echo 'child_security_nonces[' . "'" . $k . "'" . '] = ' . "'" . $v . "';\n";
}
?>

View file

@ -83,19 +83,15 @@ class MainWP_Helper {
$ordered = array();
for ($i = 0;$i < count($blocks[0]);$i++) {
// If @media-block, strip declaration and parenthesis
if(substr($blocks[0][ $i ], 0, 6) === '@media')
{
if (substr($blocks[0][ $i ], 0, 6) === '@media') {
$ordered_key = preg_replace('/^(@media[^\{]+)\{.*\}$/ms', '$1', $blocks[0][ $i ]);
$ordered_value = preg_replace('/^@media[^\{]+\{(.*)\}$/ms', '$1', $blocks[0][ $i ]);
}
// Rule-blocks of the sort @import or @font-face
elseif(substr($blocks[0][ $i ], 0, 1) === '@')
{
elseif (substr($blocks[0][ $i ], 0, 1) === '@') {
$ordered_key = $blocks[0][ $i ];
$ordered_value = $blocks[0][ $i ];
}
else
{
} else {
$ordered_key = 'main';
$ordered_value = $blocks[0][ $i ];
}
@ -111,7 +107,8 @@ class MainWP_Helper {
$selector = trim($val[ $i ], " \r\n\t");
if ( ! empty($selector)) {
if(!isset($new[ $selector ])) { $new[ $selector ] = array();
if ( ! isset($new[ $selector ])) {
$new[ $selector ] = array();
}
$rules = explode(';', $val[ ++$i ]);
foreach ($rules as $rule) {
@ -121,8 +118,10 @@ class MainWP_Helper {
$property = trim(array_pop($rule), " \r\n\t");
$value = implode(':', array_reverse($rule));
if(!isset($new[ $selector ][ $property ]) || !preg_match('/!important/', $new[ $selector ][ $property ])) { $new[ $selector ][ $property ] = $value;
} elseif(preg_match('/!important/', $new[ $selector ][ $property ]) && preg_match('/!important/', $value)) { $new[ $selector ][ $property ] = $value;
if ( ! isset($new[ $selector ][ $property ]) || ! preg_match('/!important/', $new[ $selector ][ $property ])) {
$new[ $selector ][ $property ] = $value;
} elseif (preg_match('/!important/', $new[ $selector ][ $property ]) && preg_match('/!important/', $value)) {
$new[ $selector ][ $property ] = $value;
}
}
}
@ -137,8 +136,8 @@ class MainWP_Helper {
if (substr($media, 0, 6) === '@media') {
$output .= $media . " {\n";
$prefix = "\t";
}
else { $prefix = '';
} else {
$prefix = '';
}
foreach ($content as $selector => $rules) {
@ -1478,7 +1477,8 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
}
public static function sanitize_filename( $filename ) {
if (!function_exists('mb_ereg_replace')) { return sanitize_file_name($filename);
if ( ! function_exists('mb_ereg_replace')) {
return sanitize_file_name($filename);
}
// Remove anything which isn't a word, whitespace, number
@ -1550,7 +1550,8 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
}
public static function isSSLEnabled() {
if ( defined( 'MAINWP_NOSSL' ) ) { return !MAINWP_NOSSL;
if ( defined( 'MAINWP_NOSSL' ) ) {
return ! MAINWP_NOSSL;
}
return function_exists( 'openssl_verify' );
}
@ -1722,8 +1723,7 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
$error = error_get_last();
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'] ) );
}
}

View file

@ -352,7 +352,8 @@ class MainWP_Security {
//Admin user name is not admin
public static function admin_user_ok() {
$user = get_user_by( 'login', 'admin' );
if ( ! $user ) { return true;
if ( ! $user ) {
return true;
}
if ( 10 !== $user->wp_user_level && ( ! isset( $user->user_level ) || 10 !== $user->user_level ) && ! user_can( $user, 'level_10' ) ) {

View file

@ -175,12 +175,10 @@ class MainWP_Wordpress_SEO {
$rank = new WPSEO_Rank( WPSEO_Rank::NO_INDEX );
$title = __( 'Post is set to noindex.', 'wordpress-seo' );
WPSEO_Meta::set_value( 'linkdex', 0, $post_id );
}
elseif ( '' === WPSEO_Meta::get_value( 'focuskw', $post_id ) ) {
} elseif ( '' === WPSEO_Meta::get_value( 'focuskw', $post_id ) ) {
$rank = new WPSEO_Rank( WPSEO_Rank::NO_FOCUS );
$title = __( 'Focus keyword not set.', 'wordpress-seo' );
}
else {
} else {
$score = (int) WPSEO_Meta::get_value( 'linkdex', $post_id );
$rank = WPSEO_Rank::from_numeric_score( $score );
$title = $rank->get_label();