';
-
//***** BEGIN STEPS.
$steps = array();
$steps[] = array( 'Start Time', $start_time, '' );
@@ -1714,14 +1698,13 @@ class MainWP_Child_Back_Up_Buddy {
}
// Step time taken.
- $seconds = (int)( $step['finish_time'] - $step['start_time'] );
+ $seconds = (int) ( $step['finish_time'] - $step['start_time'] );
if ( $seconds < 1 ) {
$step_time = '< 1 second';
} else {
$step_time = $seconds . ' seconds';
}
-
// Compile details for this step into array.
$steps[] = array(
$step_name,
@@ -1735,7 +1718,6 @@ class MainWP_Child_Back_Up_Buddy {
$step_times[] = 'unknown';
} // End if serial in array is NOT set.
-
// Total overall time from initiation to end.
if ( isset( $backup_options->options['finish_time'] ) && isset( $backup_options->options['start_time'] ) && ( $backup_options->options['finish_time'] != 0 ) && ( $backup_options->options['start_time'] != 0 ) ) {
$seconds = ( $backup_options->options['finish_time'] - $backup_options->options['start_time'] );
@@ -1766,8 +1748,8 @@ class MainWP_Child_Back_Up_Buddy {
pb_backupbuddy::$ui->list_table(
$steps,
array(
- 'columns' => $columns,
- 'css' => 'width: 100%; min-width: 200px;',
+ 'columns' => $columns,
+ 'css' => 'width: 100%; min-width: 200px;',
)
);
}
@@ -1830,7 +1812,7 @@ class MainWP_Child_Back_Up_Buddy {
$abspath = str_replace( '\\', '/', ABSPATH );
$backup_dir = str_replace( '\\', '/', backupbuddy_core::getBackupDirectory() );
- if ( FALSE === stristr( $backup_dir, $abspath ) ) {
+ if ( false === stristr( $backup_dir, $abspath ) ) {
die( 'Error #5432532. You cannot download backups stored outside of the WordPress web root. Please use FTP or other means.' );
}
@@ -1914,7 +1896,6 @@ class MainWP_Child_Back_Up_Buddy {
}
return array('ok' => 1);
-
}
function backup_status() {
@@ -1922,7 +1903,7 @@ class MainWP_Child_Back_Up_Buddy {
$result = '';
if (is_array($data) && isset($data['serial'])) {
ob_start();
- backupbuddy_api::getBackupStatus( $data['serial'], $data['specialAction'], $data['initwaitretrycount'], $data['sqlFile'], $echo = true );
+ backupbuddy_api::getBackupStatus( $data['serial'], $data['specialAction'], $data['initwaitretrycount'], $data['sqlFile'], $echo = true );
$result = ob_get_clean();
} else {
return array('error' => 'Invalid backup request.');
@@ -1948,7 +1929,7 @@ class MainWP_Child_Back_Up_Buddy {
'accesskey',
'secretkey',
'bucket',
- 'region'
+ 'region',
);
foreach($not_override as $opt) {
if (isset($data[$opt])) {
@@ -1961,7 +1942,6 @@ class MainWP_Child_Back_Up_Buddy {
unset($data['do_not_override']);
}
-
if (is_array($data)) {
if (isset(pb_backupbuddy::$options['remote_destinations'][$destination_id])) { // update
pb_backupbuddy::$options['remote_destinations'][$destination_id] = array_merge( pb_backupbuddy::$options['remote_destinations'][$destination_id], $data );
@@ -2043,7 +2023,6 @@ class MainWP_Child_Back_Up_Buddy {
return array( 'error' => 'Error #833383: Invalid destination ID `' . htmlentities( $destination_id ) . '`.' );
}
-
// For Stash we will check the quota prior to initiating send.
if ( pb_backupbuddy::$options['remote_destinations'][$destination_id]['type'] == 'stash' ) {
// Pass off to destination handler.
@@ -2079,7 +2058,7 @@ class MainWP_Child_Back_Up_Buddy {
pb_backupbuddy::status( 'details', 'Scheduling cron to send to this remote destination...' );
$schedule_result = backupbuddy_core::schedule_single_event( time(), 'remote_send', array( $destination_id, $backup_file, $trigger, $send_importbuddy, $delete_after ) );
- if ( $schedule_result === FALSE ) {
+ if ( $schedule_result === false ) {
$error = 'Error scheduling file transfer. Please check your BackupBuddy error log for details. A plugin may have prevented scheduling or the database rejected it.';
pb_backupbuddy::status( 'error', $error );
return array( 'error' => $error);
@@ -2120,7 +2099,7 @@ class MainWP_Child_Back_Up_Buddy {
} else if ( 'delete_tempfiles_now' == $other_action) {
$tempDir = backupbuddy_core::getTempDirectory();
$logDir = backupbuddy_core::getLogDirectory();
- $message = 'Deleting all files contained within `' . $tempDir . '` and `' . $logDir . '`.' ;
+ $message = 'Deleting all files contained within `' . $tempDir . '` and `' . $logDir . '`.';
pb_backupbuddy::$filesystem->unlink_recursive( $tempDir );
pb_backupbuddy::$filesystem->unlink_recursive( $logDir );
pb_backupbuddy::anti_directory_browsing( $logDir, $die = false ); // Put log dir back in place.
@@ -2156,7 +2135,7 @@ class MainWP_Child_Back_Up_Buddy {
if ( true !== ( $result = $backup_options->is_ok() ) ) {
pb_backupbuddy::status( 'error', 'Error retrieving fileoptions file `' . $file . '`. Err 335353266.' );
} else {
- if ( empty( $backup_options->options['finish_time'] ) || ( ( FALSE !== $backup_options->options['finish_time'] ) && ( '-1' != $backup_options->options['finish_time'] ) ) ) {
+ if ( empty( $backup_options->options['finish_time'] ) || ( ( false !== $backup_options->options['finish_time'] ) && ( '-1' != $backup_options->options['finish_time'] ) ) ) {
$backup_options->options['finish_time'] = -1; // Force marked as cancelled by user.
$backup_options->save();
$cancelCount++;
@@ -2184,7 +2163,7 @@ class MainWP_Child_Back_Up_Buddy {
$url = home_url();
} else {
$url = str_replace( $_SERVER['QUERY_STRING'], '', $_SERVER['REQUEST_URI'] );
- $url = str_replace( basename( $url ) , '', $url );
+ $url = str_replace( basename( $url ), '', $url );
$url = 'http://' . $_SERVER['HTTP_HOST'] . $url;
}
?>
@@ -2239,12 +2218,12 @@ class MainWP_Child_Back_Up_Buddy {
'blocking' => true,
'headers' => array(),
'body' => null,
- 'cookies' => array()
+ 'cookies' => array(),
)
);
if ( is_wp_error( $scan ) ) {
- pb_backupbuddy::alert( __('ERROR #24452. Unable to load Malware Scan results. Details:', 'it-l10n-backupbuddy' ). ' ' . $scan->get_error_message(), true );
+ pb_backupbuddy::alert( __('ERROR #24452. Unable to load Malware Scan results. Details:', 'it-l10n-backupbuddy' ) . ' ' . $scan->get_error_message(), true );
$scan = 'N;';
} else {
$scan = $scan['body'];
@@ -2255,7 +2234,7 @@ class MainWP_Child_Back_Up_Buddy {
$continue_2 = true;
if ( substr( $scan, 0, 2 ) == 'N;' ) {
- echo __('An error was encountered attempting to scan this site.','it-l10n-backupbuddy' ), ' ';
+ echo __('An error was encountered attempting to scan this site.', 'it-l10n-backupbuddy' ), ' ';
echo __('An internet connection is required and this site must be accessible on the public internet.', 'it-l10n-backupbuddy' );
echo ' ';
$scan = array();
@@ -2276,7 +2255,6 @@ class MainWP_Child_Back_Up_Buddy {
'.__('none', 'it-l10n-backupbuddy' ).' ';
+ return '' . __('none', 'it-l10n-backupbuddy' ) . ' ';
} else {
return $array . ' ';
}
@@ -2312,10 +2290,10 @@ class MainWP_Child_Back_Up_Buddy {
-
-
+
+
-
+
', __('none', 'it-l10n-backupbuddy' ), ' ';
backupbuddy_core::addNotification( 'malware_not_found', 'No malware detected on `' . $url . '`.', 'A malware scan was run on the site and did not detect malware.' );
- } ?>
+ }
+ ?>
+
" );
}
}
-
}
static function time_compare( $a, $b ) {
@@ -1624,27 +1633,27 @@ class MainWP_Child_Server_Information {
'siteurl' => array(
'title' => __('Site URL', 'mainwp-child'),
'value' => get_bloginfo( 'url' ),
- 'desc' => get_bloginfo( 'url' )
+ 'desc' => get_bloginfo( 'url' ),
),
'adminuser' => array(
'title' => __('Administrator name', 'mainwp-child'),
'value' => $current_user->user_login,
- 'desc' => __('This is your Administrator username, however, you can use any existing Administrator username.', 'mainwp-child')
+ 'desc' => __('This is your Administrator username, however, you can use any existing Administrator username.', 'mainwp-child'),
),
'friendly_name' => array(
'title' => __('Friendly site name', 'mainwp-child'),
'value' => get_bloginfo( 'name' ),
- 'desc' => __('For the friendly site name, you can use any name, this is just a suggestion.', 'mainwp-child')
+ 'desc' => __('For the friendly site name, you can use any name, this is just a suggestion.', 'mainwp-child'),
),
'uniqueid' => array(
'title' => __('Child unique security id', 'mainwp-child'),
'value' => !empty($uniqueId) ? $uniqueId : __('Leave the field blank', 'mainwp-child'),
- 'desc' => sprintf(__('Child unique security id is not required, however, since you have enabled it, you need to add it to your %s dashboard.', 'mainwp-child') , stripslashes( $branding_title ) )
+ 'desc' => sprintf(__('Child unique security id is not required, however, since you have enabled it, you need to add it to your %s dashboard.', 'mainwp-child'), stripslashes( $branding_title ) ),
),
'verify_ssl' => array(
'title' => __('Verify certificate', 'mainwp-child'),
'value' => __('Yes', 'mainwp-child'),
- 'desc' => __('If there is an issue with SSL certificate on this site, try to set this option to No.', 'mainwp-child')
+ 'desc' => __('If there is an issue with SSL certificate on this site, try to set this option to No.', 'mainwp-child'),
),
'ssl_version' => array(
'title' => __('SSL version', 'mainwp-child'),
@@ -1659,7 +1668,7 @@ class MainWP_Child_Server_Information {
@@ -1682,4 +1691,4 @@ class MainWP_Child_Server_Information {
ID );
$token = $manager->create( $expiration );
-
$secure = is_ssl();
if ( $secure ) {
$auth_cookie_name = SECURE_AUTH_COOKIE;
diff --git a/class/class-mainwp-child-staging.php b/class/class-mainwp-child-staging.php
index 303a7d5..477a668 100644
--- a/class/class-mainwp-child-staging.php
+++ b/class/class-mainwp-child-staging.php
@@ -22,10 +22,10 @@ class MainWP_Child_Staging {
public $is_plugin_installed = false;
static function Instance() {
- if ( null === MainWP_Child_Staging::$instance ) {
- MainWP_Child_Staging::$instance = new MainWP_Child_Staging();
+ if ( null === self::$instance ) {
+ self::$instance = new MainWP_Child_Staging();
}
- return MainWP_Child_Staging::$instance;
+ return self::$instance;
}
public function __construct() {
@@ -79,7 +79,7 @@ class MainWP_Child_Staging {
}
if (!class_exists( 'WPStaging\WPStaging' )){
- require_once WPSTG_PLUGIN_DIR . "apps/Core/WPStaging.php";
+ require_once WPSTG_PLUGIN_DIR . 'apps/Core/WPStaging.php';
}
\WPStaging\WPStaging::getInstance();
@@ -184,7 +184,7 @@ class MainWP_Child_Staging {
public function get_overview() {
$return = array(
- 'availableClones' => get_option( "wpstg_existing_clones_beta", array())
+ 'availableClones' => get_option( 'wpstg_existing_clones_beta', array()),
);
return $return;
}
@@ -200,31 +200,31 @@ class MainWP_Child_Staging {
$return = array(
'options' => serialize($options),
'directoryListing' => $scan->directoryListing(),
- 'prefix' => WPStaging\WPStaging::getTablePrefix()
+ 'prefix' => WPStaging\WPStaging::getTablePrefix(),
);
return $return;
}
public function ajaxCheckCloneName() {
- $cloneName = sanitize_key( $_POST["cloneID"] );
+ $cloneName = sanitize_key( $_POST['cloneID'] );
$cloneNameLength = strlen( $cloneName );
- $clones = get_option( "wpstg_existing_clones_beta", array() );
+ $clones = get_option( 'wpstg_existing_clones_beta', array() );
// Check clone name length
if( $cloneNameLength < 1 || $cloneNameLength > 16 ) {
echo array(
- "status" => "failed",
- "message" => "Clone name must be between 1 - 16 characters"
+ 'status' => 'failed',
+ 'message' => 'Clone name must be between 1 - 16 characters',
);
} elseif( array_key_exists( $cloneName, $clones ) ) {
return array(
- "status" => "failed",
- "message" => "Clone name is already in use, please choose an another clone name"
+ 'status' => 'failed',
+ 'message' => 'Clone name is already in use, please choose an another clone name',
);
}
- return array("status" => "success");
+ return array('status' => 'success');
}
public function ajaxStartClone() {
@@ -232,13 +232,12 @@ class MainWP_Child_Staging {
$this->url = ''; // to fix warning
$cloning = new WPStaging\Backend\Modules\Jobs\Cloning();
-
if( !$cloning->save() ) {
return;
}
ob_start();
- require_once WPSTG_PLUGIN_DIR . "apps/Backend/views/clone/ajax/start.php";
+ require_once WPSTG_PLUGIN_DIR . 'apps/Backend/views/clone/ajax/start.php';
$result = ob_get_clean();
return $result;
}
@@ -286,7 +285,7 @@ class MainWP_Child_Staging {
$cloning = new WPStaging\Backend\Modules\Jobs\Cloning();
$this->url = ''; // to fix warning
$return = $cloning->start();
- $return->blogInfoName = get_bloginfo("name");
+ $return->blogInfoName = get_bloginfo('name');
return $return;
}
@@ -301,7 +300,7 @@ class MainWP_Child_Staging {
$clone = $delete->getClone();
$result = array(
'clone' => $clone,
- 'deleteTables' => $delete->getTables()
+ 'deleteTables' => $delete->getTables(),
);
return $result;
}
@@ -337,7 +336,7 @@ class MainWP_Child_Staging {
}
ob_start();
- require_once WPSTG_PLUGIN_DIR . "apps/Backend/views/clone/ajax/update.php";
+ require_once WPSTG_PLUGIN_DIR . 'apps/Backend/views/clone/ajax/update.php';
$result = ob_get_clean();
return $result;
}
@@ -348,20 +347,20 @@ class MainWP_Child_Staging {
// from wp-staging plugin
public function hasFreeDiskSpace() {
- if( !function_exists( "disk_free_space" ) ) {
+ if( !function_exists( 'disk_free_space' ) ) {
return null;
}
$freeSpace = @disk_free_space( ABSPATH );
if( false === $freeSpace ) {
$data = array(
'freespace' => false,
- 'usedspace' => $this->formatSize($this->getDirectorySizeInclSubdirs(ABSPATH))
+ 'usedspace' => $this->formatSize($this->getDirectorySizeInclSubdirs(ABSPATH)),
);
return $data;
}
$data = array(
'freespace' => $this->formatSize($freeSpace),
- 'usedspace' => $this->formatSize($this->getDirectorySizeInclSubdirs(ABSPATH))
+ 'usedspace' => $this->formatSize($this->getDirectorySizeInclSubdirs(ABSPATH)),
);
return $data;
}
@@ -376,20 +375,19 @@ class MainWP_Child_Staging {
}
// from wp-staging plugin
- public function formatSize($bytes, $precision = 2)
- {
- if ((double) $bytes < 1)
+ public function formatSize( $bytes, $precision = 2) {
+ if ( (float) $bytes < 1)
{
return '';
}
- $units = array('B', "KB", "MB", "GB", "TB");
+ $units = array('B', 'KB', 'MB', 'GB', 'TB');
- $bytes = (double) $bytes;
+ $bytes = (float) $bytes;
$base = log($bytes) / log(1000); // 1024 would be for MiB KiB etc
$pow = pow(1000, $base - floor($base)); // Same rule for 1000
- return round($pow, $precision) . ' ' . $units[(int) floor($base)];
+ return round($pow, $precision) . ' ' . $units[ (int) floor($base)];
}
diff --git a/class/class-mainwp-child-themes-check.php b/class/class-mainwp-child-themes-check.php
index 8bc87ea..a46a984 100644
--- a/class/class-mainwp-child-themes-check.php
+++ b/class/class-mainwp-child-themes-check.php
@@ -29,11 +29,11 @@ class MainWP_Child_Themes_Check {
private $option_name_last_daily_run = 'mainwp_child_theme_last_daily_run';
public static function Instance() {
- if ( null === MainWP_Child_Themes_Check::$instance ) {
- MainWP_Child_Themes_Check::$instance = new MainWP_Child_Themes_Check();
+ if ( null === self::$instance ) {
+ self::$instance = new MainWP_Child_Themes_Check();
}
- return MainWP_Child_Themes_Check::$instance;
+ return self::$instance;
}
public function __construct() {
@@ -49,7 +49,6 @@ class MainWP_Child_Themes_Check {
add_action( 'mainwp_child_deactivation', array( $this, 'cleanup_deactivation' ) );
}
-
}
private function cleanup_basic() {
@@ -118,7 +117,6 @@ class MainWP_Child_Themes_Check {
if ( ! wp_next_scheduled( $this->cron_name_watcher ) ) {
wp_schedule_event( time(), 'hourly', $this->cron_name_watcher );
}
-
}
public function get_themes_outdate_info() {
@@ -199,7 +197,6 @@ class MainWP_Child_Themes_Check {
$diff_in_days = $now->diff( $theme_last_updated_date )->format( '%a' );
-
if ( $diff_in_days < $tolerance_in_days ) {
continue;
}
diff --git a/class/class-mainwp-child-timecapsule.php b/class/class-mainwp-child-timecapsule.php
index c61d87b..a2ad5cb 100644
--- a/class/class-mainwp-child-timecapsule.php
+++ b/class/class-mainwp-child-timecapsule.php
@@ -19,10 +19,10 @@ class MainWP_Child_Timecapsule {
public $is_plugin_installed = false;
static function Instance() {
- if ( null === MainWP_Child_Timecapsule::$instance ) {
- MainWP_Child_Timecapsule::$instance = new MainWP_Child_Timecapsule();
+ if ( null === self::$instance ) {
+ self::$instance = new MainWP_Child_Timecapsule();
}
- return MainWP_Child_Timecapsule::$instance;
+ return self::$instance;
}
public function __construct() {
@@ -35,7 +35,6 @@ class MainWP_Child_Timecapsule {
return;
add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
-
}
@@ -76,8 +75,6 @@ class MainWP_Child_Timecapsule {
$is_user_logged_in = $options->get_option('is_user_logged_in');
$privileges_wptc = $options_helper->get_unserialized_privileges();
-
-
if ( isset( $_POST['mwp_action'] ) ) {
if ((
@@ -222,7 +219,7 @@ class MainWP_Child_Timecapsule {
public function require_files() {
if (! class_exists('WPTC_Base_Factory') && defined('WPTC_PLUGIN_DIR') ) {
if ( MainWP_Helper::check_files_exists(WPTC_PLUGIN_DIR . 'Base/Factory.php') ) {
- include_once WPTC_PLUGIN_DIR.'Base/Factory.php';
+ include_once WPTC_PLUGIN_DIR . 'Base/Factory.php';
}
}
if ( ! class_exists('Wptc_Options_Helper') && defined('WPTC_PLUGIN_DIR') ) {
@@ -285,7 +282,7 @@ class MainWP_Child_Timecapsule {
'plan_interval' => $options_helper->get_plan_interval_from_subs_info(),
'lastbackup_time' => !empty($last_backup_time) ? $last_backup_time : 0,
'is_user_logged_in' => $options_helper->get_is_user_logged_in(),
- 'backups_count' => $backups_count
+ 'backups_count' => $backups_count,
);
return $return;
} catch ( Exception $e) {
@@ -316,7 +313,7 @@ class MainWP_Child_Timecapsule {
die();
}
- public function exclude_file_list(){
+ public function exclude_file_list() {
if (!isset($_POST['data'])) {
wptc_die_with_json_encode( array('status' => 'no data found') );
}
@@ -370,17 +367,16 @@ class MainWP_Child_Timecapsule {
if (!empty($last_backup_time)) {
$user_time = $config->cnvt_UTC_to_usrTime($last_backup_time);
$processed_files->modify_schedule_backup_time($user_time);
- $formatted_date = date("M d @ g:i a", $user_time);
+ $formatted_date = date('M d @ g:i a', $user_time);
$return_array['last_backup_time'] = $formatted_date;
} else {
$return_array['last_backup_time'] = 'No Backup Taken';
}
return array( 'result' => $return_array );
-
}
- function wptc_cron_status(){
+ function wptc_cron_status() {
$config = WPTC_Factory::get('config');
wptc_own_cron_status();
$status = array();
@@ -459,45 +455,47 @@ function get_sibling_files_callback_wptc() {
$type = $_POST['type'];
switch ($type) {
case 'backups':
- $query = "SELECT * FROM " . $wpdb->base_prefix . "wptc_activity_log WHERE type LIKE '%backup%' AND show_user = 1 GROUP BY action_id";
- break;
+ $query = 'SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE type LIKE '%backup%' AND show_user = 1 GROUP BY action_id";
+ break;
case 'restores':
- $query = "SELECT * FROM " . $wpdb->base_prefix . "wptc_activity_log WHERE type LIKE 'restore%' GROUP BY action_id";
- break;
+ $query = 'SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE type LIKE 'restore%' GROUP BY action_id";
+ break;
case 'staging':
- $query = "SELECT * FROM " . $wpdb->base_prefix . "wptc_activity_log WHERE type LIKE 'staging%' GROUP BY action_id";
- break;
+ $query = 'SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE type LIKE 'staging%' GROUP BY action_id";
+ break;
case 'backup_and_update':
- $query = "SELECT * FROM " . $wpdb->base_prefix . "wptc_activity_log WHERE type LIKE 'backup_and_update%' GROUP BY action_id";
- break;
+ $query = 'SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE type LIKE 'backup_and_update%' GROUP BY action_id";
+ break;
case 'auto_update':
- $query = "SELECT * FROM " . $wpdb->base_prefix . "wptc_activity_log WHERE type LIKE 'auto_update%' GROUP BY action_id";
- break;
+ $query = 'SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE type LIKE 'auto_update%' GROUP BY action_id";
+ break;
case 'others':
- $query = "SELECT * FROM " . $wpdb->base_prefix . "wptc_activity_log WHERE type NOT LIKE 'restore%' AND type NOT LIKE 'backup%' AND show_user = 1";
- break;
+ $query = 'SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE type NOT LIKE 'restore%' AND type NOT LIKE 'backup%' AND show_user = 1";
+ break;
default:
- $query = "SELECT * FROM " . $wpdb->base_prefix . "wptc_activity_log GROUP BY action_id UNION SELECT * FROM " . $wpdb->base_prefix . "wptc_activity_log WHERE action_id='' AND show_user = 1";
- break;
+ $query = 'SELECT * FROM ' . $wpdb->base_prefix . 'wptc_activity_log GROUP BY action_id UNION SELECT * FROM ' . $wpdb->base_prefix . "wptc_activity_log WHERE action_id='' AND show_user = 1";
+ break;
}
} else {
- $query = "SELECT * FROM " . $wpdb->base_prefix . "wptc_activity_log WHERE show_user = 1 GROUP BY action_id ";
+ $query = 'SELECT * FROM ' . $wpdb->base_prefix . 'wptc_activity_log WHERE show_user = 1 GROUP BY action_id ';
}
/* -- Preparing your query -- */
- /* -- Ordering parameters -- */
+ /*
+ -- Ordering parameters -- */
//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';
+ $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;}
- /* -- Pagination parameters -- */
+ /*
+ -- Pagination parameters -- */
//Number of elements in your table?
$totalitems = $wpdb->query($query); //return the total number of affected rows
//How many to display per page?
$perpage = 20;
//Which page is this?
- $paged = !empty($_POST["paged"]) ? $_POST["paged"] : '';
+ $paged = !empty($_POST['paged']) ? $_POST['paged'] : '';
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
@@ -507,14 +505,14 @@ function get_sibling_files_callback_wptc() {
$query .= ' LIMIT ' . (int) $offset . ',' . (int) $perpage;
}
- return array( 'items' => $wpdb->get_results($query) ,
+ return array( 'items' => $wpdb->get_results($query),
'totalitems' => $totalitems,
- 'perpage' => $perpage
+ 'perpage' => $perpage,
);
}
- function lazy_load_activity_log_wptc(){
+ function lazy_load_activity_log_wptc() {
if (!isset($_POST['data'])) {
return false;
@@ -534,7 +532,7 @@ function get_sibling_files_callback_wptc() {
$current_limit = WPTC_Factory::get('config')->get_option('activity_log_lazy_load_limit');
$to_limit = $from_limit + $current_limit;
- $sql = "SELECT * FROM " . $wpdb->base_prefix . "wptc_activity_log WHERE action_id=" . $action_id . ' AND show_user = 1 ORDER BY id DESC LIMIT '.$from_limit.' , '.$current_limit;
+ $sql = 'SELECT * FROM ' . $wpdb->base_prefix . 'wptc_activity_log WHERE action_id=' . $action_id . ' AND show_user = 1 ORDER BY id DESC LIMIT ' . $from_limit . ' , ' . $current_limit;
$sub_records = $wpdb->get_results($sql);
$row_count = count($sub_records);
@@ -546,7 +544,7 @@ function get_sibling_files_callback_wptc() {
$detailed = $this->get_activity_log($sub_records);
if (isset($load_more) && $load_more) {
- $detailed .= '
';
@@ -1221,11 +1209,11 @@ function get_sibling_files_callback_wptc() {
}
- public function update_vulns_settings(){
+ public function update_vulns_settings() {
$vulns_obj = WPTC_Base_Factory::get('Wptc_Vulns');
- $data = isset($_POST['data']) ? $_POST['data'] : array() ;
+ $data = isset($_POST['data']) ? $_POST['data'] : array();
$vulns_obj->update_vulns_settings($data);
return array( 'success' => 1 );
diff --git a/class/class-mainwp-child-updraft-plus-backups.php b/class/class-mainwp-child-updraft-plus-backups.php
index 4e9a037..0a94e76 100644
--- a/class/class-mainwp-child-updraft-plus-backups.php
+++ b/class/class-mainwp-child-updraft-plus-backups.php
@@ -19,11 +19,11 @@ class MainWP_Child_Updraft_Plus_Backups {
public static $instance = null;
public $is_plugin_installed = false;
static function Instance() {
- if ( null === MainWP_Child_Updraft_Plus_Backups::$instance ) {
- MainWP_Child_Updraft_Plus_Backups::$instance = new MainWP_Child_Updraft_Plus_Backups();
+ if ( null === self::$instance ) {
+ self::$instance = new MainWP_Child_Updraft_Plus_Backups();
}
- return MainWP_Child_Updraft_Plus_Backups::$instance;
+ return self::$instance;
}
public function __construct() {
@@ -39,7 +39,7 @@ class MainWP_Child_Updraft_Plus_Backups {
add_filter('updraftplus_save_last_backup', array( __CLASS__, 'hookUpdraftplusSaveLastBackup' ));
}
- public static function hookUpdraftplusSaveLastBackup($last_backup) {
+ public static function hookUpdraftplusSaveLastBackup( $last_backup) {
if (!is_array($last_backup))
return $last_backup;
@@ -250,7 +250,7 @@ class MainWP_Child_Updraft_Plus_Backups {
$response = array( 'connected' => true, 'html' => $this->connected_html() );
} else {
$response = array(
- 'e' => __( 'An unknown error occurred when trying to connect to UpdraftPlus.Com', 'updraftplus' )
+ 'e' => __( 'An unknown error occurred when trying to connect to UpdraftPlus.Com', 'updraftplus' ),
);
if ( is_wp_error( $connect ) ) {
$response['e'] = $connect->get_error_message();
@@ -273,7 +273,7 @@ class MainWP_Child_Updraft_Plus_Backups {
$ret = '';
$ret .= '
';
- $ret .= __( 'This site is connected to UpdraftPlus Vault.', 'updraftplus' ).' '.__( "Well done - there's nothing more needed to set up.", 'updraftplus' ).'
'.__( 'Vault owner', 'updraftplus' ).': ' . htmlspecialchars( $vault_settings['email'] );
+ $ret .= __( 'This site is connected to UpdraftPlus Vault.', 'updraftplus' ) . ' ' . __( "Well done - there's nothing more needed to set up.", 'updraftplus' ) . '
' . __( 'Vault owner', 'updraftplus' ) . ': ' . htmlspecialchars( $vault_settings['email'] );
$ret .= ' ' . __( 'Quota:', 'updraftplus' ) . ' ';
if ( !isset( $vault_settings['quota'] ) || !is_numeric( $vault_settings['quota'] ) || ( $vault_settings['quota'] < 0 ) ) {
@@ -297,15 +297,15 @@ class MainWP_Child_Updraft_Plus_Backups {
$vault_mothership = 'https://vault.updraftplus.com/plugin-info/';
// Use SSL to prevent snooping
- $result = wp_remote_post( $vault_mothership.'/?udm_action=vault_connect',
+ $result = wp_remote_post( $vault_mothership . '/?udm_action=vault_connect',
array(
'timeout' => 20,
'body' => array(
'e' => $email,
'p' => base64_encode( $password ),
'sid' => $updraftplus->siteid(),
- 'su' => base64_encode( home_url() )
- )
+ 'su' => base64_encode( home_url() ),
+ ),
)
);
@@ -340,7 +340,6 @@ class MainWP_Child_Updraft_Plus_Backups {
}
break;
case 'authfailed':
-
if ( !empty( $response['authproblem'] ) ) {
if ( 'invalidpassword' == $response['authproblem'] ) {
$authfail_error = new WP_Error( 'authfailed', __( 'Your email address was valid, but your password was not recognised by UpdraftPlus.Com.', 'updraftplus' ) . ' ' . __( 'If you have forgotten your password, then go here to change your password on updraftplus.com.', 'updraftplus' ) . '' );
@@ -372,7 +371,7 @@ class MainWP_Child_Updraft_Plus_Backups {
delete_transient( 'updraftvault_quota_text' );
MainWP_Helper::close_connection( array( 'disconnected' => 1,
- 'html' => $this->connected_html() )
+ 'html' => $this->connected_html(), )
);
// If $_POST['reset_hash'] is set, then we were alerted by updraftplus.com - no need to notify back
@@ -380,13 +379,13 @@ class MainWP_Child_Updraft_Plus_Backups {
$post_body = array(
'e' => (string) $vault_settings['email'],
'sid' => $updraftplus->siteid(),
- 'su' => base64_encode( home_url() )
+ 'su' => base64_encode( home_url() ),
);
if ( !empty( $vault_settings['token'] ) ) $post_body['token'] = (string) $vault_settings['token'];
// Use SSL to prevent snooping
- wp_remote_post( $vault_mothership.'/?udm_action=vault_disconnect', array(
+ wp_remote_post( $vault_mothership . '/?udm_action=vault_disconnect', array(
'timeout' => 20,
'body' => $post_body,
));
@@ -651,12 +650,10 @@ class MainWP_Child_Updraft_Plus_Backups {
}
}
-
if (!isset($settings['do_not_save_remote_settings']) || empty($settings['do_not_save_remote_settings'])) {
UpdraftPlus_Options::update_updraft_option( 'updraft_service', $settings['updraft_service'] );
}
-
global $updraftplus;
if ( isset( $settings['updraft_interval'] ) ) {
// fix for premium version
@@ -685,26 +682,26 @@ class MainWP_Child_Updraft_Plus_Backups {
return $out;
}
- function replace_tokens($str = '') {
+ function replace_tokens( $str = '') {
if (stripos($str, '%sitename%') !== false) {
$replace_token = get_bloginfo( 'name' );
$replace_token = sanitize_file_name($replace_token);
$replace_token = strtolower($replace_token);
- $str = str_ireplace("%sitename%", $replace_token, $str);
+ $str = str_ireplace('%sitename%', $replace_token, $str);
}
if (stripos($str, '%siteurl%') !== false) {
$replace_token = get_bloginfo( 'url' );
$replace_token = preg_replace('/^https?:\/\//i', '', $replace_token);
$replace_token = sanitize_file_name($replace_token);
- $str = str_ireplace("%siteurl%", $replace_token, $str);
+ $str = str_ireplace('%siteurl%', $replace_token, $str);
}
return $str;
}
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' );
}
@@ -880,7 +877,7 @@ class MainWP_Child_Updraft_Plus_Backups {
$our_prefix ++;
}
}
- $ret_info .= sprintf( __( '%s total table(s) found; %s with the indicated prefix.', 'updraftplus' ), count( $all_tables ), $our_prefix );
+ $ret_info .= sprintf( __( '%1$s total table(s) found; %2$s with the indicated prefix.', 'updraftplus' ), count( $all_tables ), $our_prefix );
}
}
@@ -910,7 +907,7 @@ class MainWP_Child_Updraft_Plus_Backups {
return array( 'r' => $_POST['row'], 'm' => $ret . $ret_after );
}
- private function cb_get_name_base_type($a) {
+ private function cb_get_name_base_type( $a) {
return $a[0];
}
@@ -945,7 +942,6 @@ class MainWP_Child_Updraft_Plus_Backups {
// Control returns when the backup finished; but, the browser connection should have been closed before
die;
-
// not used anymore
// if (wp_schedule_single_event(time()+5, $event, array($backupnow_nocloud)) === false) {
// $updraftplus->log("A backup run failed to schedule");
@@ -1007,7 +1003,6 @@ class MainWP_Child_Updraft_Plus_Backups {
'ds' => $download_status,
'u' => $logupdate_array,
);
-
}
@@ -1063,7 +1058,6 @@ class MainWP_Child_Updraft_Plus_Backups {
}
return array( 'b' => $last_backup_text, 'lasttime_gmt' => $backup_time );
-
}
private function get_updraft_data( $with_hist = true ) {
@@ -1089,8 +1083,7 @@ class MainWP_Child_Updraft_Plus_Backups {
$next_scheduled_backup = 'Nothing currently scheduled';
}
-
- MainWP_Helper::check_classes_exists( array( 'UpdraftPlus_Options', 'UpdraftPlus_Filesystem_Functions' )) ;
+ MainWP_Helper::check_classes_exists( array( 'UpdraftPlus_Options', 'UpdraftPlus_Filesystem_Functions' ));
MainWP_Helper::check_methods('UpdraftPlus_Options', 'get_updraft_option');
MainWP_Helper::check_methods('UpdraftPlus_Filesystem_Functions', 'really_is_writable');
MainWP_Helper::check_methods($updraftplus, array( 'backups_dir_location' ));
@@ -1167,12 +1160,12 @@ class MainWP_Child_Updraft_Plus_Backups {
}
$next_scheduled_backup_database = wp_next_scheduled('updraft_backup_database');
- if (UpdraftPlus_Options::get_updraft_option('updraft_interval_database',UpdraftPlus_Options::get_updraft_option('updraft_interval')) == UpdraftPlus_Options::get_updraft_option('updraft_interval')) {
+ if (UpdraftPlus_Options::get_updraft_option('updraft_interval_database', UpdraftPlus_Options::get_updraft_option('updraft_interval')) == UpdraftPlus_Options::get_updraft_option('updraft_interval')) {
if (isset($files_not_scheduled)) {
$next_scheduled_backup_database = $next_scheduled_backup;
$database_not_scheduled = true;
} else {
- $next_scheduled_backup_database = __("At the same time as the files backup", 'updraftplus');
+ $next_scheduled_backup_database = __('At the same time as the files backup', 'updraftplus');
$next_scheduled_backup_database_same_time = true;
}
} else {
@@ -1195,20 +1188,20 @@ class MainWP_Child_Updraft_Plus_Backups {
';
- MainWP_Helper::check_classes_exists( array( 'UpdraftPlus_Filesystem_Functions' ) ) ;
+ MainWP_Helper::check_classes_exists( array( 'UpdraftPlus_Filesystem_Functions' ) );
MainWP_Helper::check_methods('UpdraftPlus_Filesystem_Functions', 'really_is_writable');
$updraft_dir = $updraftplus->backups_dir_location();
@@ -1334,7 +1327,7 @@ class MainWP_Child_Updraft_Plus_Backups {
$deleted = - 1;
if ( class_exists( $objname ) ) {
# TODO: Re-use the object (i.e. prevent repeated connection setup/teardown)
- $remote_obj = new $objname;
+ $remote_obj = new $objname();
$deleted = $remote_obj->delete( $files );
}
if ( $deleted === - 1 ) {
@@ -1577,7 +1570,6 @@ class MainWP_Child_Updraft_Plus_Backups {
}
return array( 'result' => 'OK' );
-
}
# Pass only a single service, as a string, into this function
@@ -1596,7 +1588,7 @@ class MainWP_Child_Updraft_Plus_Backups {
$objname = "UpdraftPlus_BackupModule_${service}";
if ( method_exists( $objname, 'download' ) ) {
- $remote_obj = new $objname;
+ $remote_obj = new $objname();
return $remote_obj->download( $file );
} else {
@@ -1605,7 +1597,6 @@ class MainWP_Child_Updraft_Plus_Backups {
return false;
}
-
}
// This options filter removes ABSPATH off the front of updraft_dir, if it is given absolutely and contained within it
@@ -1724,7 +1715,7 @@ class MainWP_Child_Updraft_Plus_Backups {
$itext = ( 0 === $index ) ? '' : $index;
if ( ! empty( $backups[ $timestamp ][ $type . $itext . '-size' ] ) && filesize( $updraft_dir . '/' . $file ) !== $backups[ $timestamp ][ $type . $itext . '-size' ] ) {
if ( empty( $warn['doublecompressfixed'] ) ) {
- $warn[] = sprintf( __( 'File (%s) was found, but has a different size (%s) from what was expected (%s) - it may be corrupt.', 'updraftplus' ), $file, filesize( $updraft_dir . '/' . $file ), $backups[ $timestamp ][ $type . $itext . '-size' ] );
+ $warn[] = sprintf( __( 'File (%1$s) was found, but has a different size (%2$s) from what was expected (%3$s) - it may be corrupt.', 'updraftplus' ), $file, filesize( $updraft_dir . '/' . $file ), $backups[ $timestamp ][ $type . $itext . '-size' ] );
}
}
do_action_ref_array( "updraftplus_checkzip_$type", array(
@@ -1815,7 +1806,6 @@ class MainWP_Child_Updraft_Plus_Backups {
$output = ob_get_clean();
return array( 'o' => $output );
-
}
// not used
@@ -1947,7 +1937,7 @@ class MainWP_Child_Updraft_Plus_Backups {
require_once( UPDRAFTPLUS_DIR . '/restorer.php' );
global $updraftplus_restorer;
- $updraftplus_restorer = new Updraft_Restorer( new Updraft_Restorer_Skin, $backup_set );
+ $updraftplus_restorer = new Updraft_Restorer( new Updraft_Restorer_Skin(), $backup_set );
$second_loop = array();
@@ -1997,7 +1987,7 @@ class MainWP_Child_Updraft_Plus_Backups {
foreach ( $files as $ind => $file ) {
$fullpath = $updraft_dir . $file;
- echo sprintf( esc_html__( 'Looking for %s archive: file name: %s', 'updraftplus' ), esc_html( $type ), esc_html( htmlspecialchars( $file ) ) ) . ' ';
+ echo sprintf( esc_html__( 'Looking for %1$s archive: file name: %2$s', 'updraftplus' ), esc_html( $type ), esc_html( htmlspecialchars( $file ) ) ) . ' ';
add_action( 'http_request_args', array( $updraftplus, 'modify_http_options' ) );
foreach ( $service as $serv ) {
@@ -2470,14 +2460,14 @@ class MainWP_Child_Updraft_Plus_Backups {
}
if ( version_compare( $old_wp_version, $wp_version, '>' ) ) {
//$mess[] = sprintf(__('%s version: %s', 'updraftplus'), 'WordPress', $old_wp_version);
- $warn[] = sprintf( __( 'You are importing from a newer version of WordPress (%s) into an older one (%s). There are no guarantees that WordPress can handle this.', 'updraftplus' ), $old_wp_version, $wp_version );
+ $warn[] = sprintf( __( 'You are importing from a newer version of WordPress (%1$s) into an older one (%2$s). There are no guarantees that WordPress can handle this.', 'updraftplus' ), $old_wp_version, $wp_version );
}
if ( preg_match( '/running on PHP ([0-9]+\.[0-9]+)(\s|\.)/', $matches[4], $nmatches ) && preg_match( '/^([0-9]+\.[0-9]+)(\s|\.)/', PHP_VERSION, $cmatches ) ) {
$old_php_version = $nmatches[1];
$current_php_version = $cmatches[1];
if ( version_compare( $old_php_version, $current_php_version, '>' ) ) {
//$mess[] = sprintf(__('%s version: %s', 'updraftplus'), 'WordPress', $old_wp_version);
- $warn[] = sprintf( __( 'The site in this backup was running on a webserver with version %s of %s. ', 'updraftplus' ), $old_php_version, 'PHP' ) . ' ' . sprintf( __( 'This is significantly newer than the server which you are now restoring onto (version %s).', 'updraftplus' ), PHP_VERSION ) . ' ' . sprintf( __( 'You should only proceed if you cannot update the current server and are confident (or willing to risk) that your plugins/themes/etc. are compatible with the older %s version.', 'updraftplus' ), 'PHP' ) . ' ' . sprintf( __( 'Any support requests to do with %s should be raised with your web hosting company.', 'updraftplus' ), 'PHP' );
+ $warn[] = sprintf( __( 'The site in this backup was running on a webserver with version %1$s of %2$s. ', 'updraftplus' ), $old_php_version, 'PHP' ) . ' ' . sprintf( __( 'This is significantly newer than the server which you are now restoring onto (version %s).', 'updraftplus' ), PHP_VERSION ) . ' ' . sprintf( __( 'You should only proceed if you cannot update the current server and are confident (or willing to risk) that your plugins/themes/etc. are compatible with the older %s version.', 'updraftplus' ), 'PHP' ) . ' ' . sprintf( __( 'Any support requests to do with %s should be raised with your web hosting company.', 'updraftplus' ), 'PHP' );
}
}
} elseif ( '' === $old_table_prefix && ( preg_match( '/^\# Table prefix: (\S+)$/', $buffer, $matches ) || preg_match( '/^-- Table prefix: (\S+)$/i', $buffer, $matches ) ) ) {
@@ -2553,11 +2543,10 @@ class MainWP_Child_Updraft_Plus_Backups {
}
return array( $mess, $warn, $err, $info );
-
}
- public function analyse_db_file($timestamp, $res, $db_file = false, $header_only = false) {
+ public function analyse_db_file( $timestamp, $res, $db_file = false, $header_only = false) {
global $updraftplus;
$mess = array();
@@ -2576,7 +2565,7 @@ class MainWP_Child_Updraft_Plus_Backups {
$backup = UpdraftPlus_Backup_History::get_history($timestamp);
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];
+ $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);
@@ -2671,7 +2660,7 @@ class MainWP_Child_Updraft_Plus_Backups {
$processing_create = false;
if ('' == $old_siteurl && preg_match('/^\# Backup of: (http(.*))$/', $buffer, $matches)) {
$old_siteurl = untrailingslashit($matches[1]);
- $mess[] = __('Backup of:', 'updraftplus').' '.htmlspecialchars($old_siteurl).((!empty($old_wp_version)) ? ' '.sprintf(__('(version: %s)', 'updraftplus'), $old_wp_version) : '');
+ $mess[] = __('Backup of:', 'updraftplus') . ' ' . htmlspecialchars($old_siteurl) . ((!empty($old_wp_version)) ? ' ' . sprintf(__('(version: %s)', 'updraftplus'), $old_wp_version) : '');
// Check for should-be migration
if (untrailingslashit(site_url()) != $old_siteurl) {
if (!$migration_warning) {
@@ -2684,16 +2673,16 @@ class MainWP_Child_Updraft_Plus_Backups {
$old_siteurl_parsed = parse_url($old_siteurl);
$actual_siteurl_parsed = parse_url(site_url());
if ((stripos($old_siteurl_parsed['host'], 'www.') === 0 && stripos($actual_siteurl_parsed['host'], 'www.') !== 0) || (stripos($old_siteurl_parsed['host'], 'www.') !== 0 && stripos($actual_siteurl_parsed['host'], 'www.') === 0)) {
- $powarn = sprintf(__('The website address in the backup set (%s) is slightly different from that of the site now (%s). This is not expected to be a problem for restoring the site, as long as visits to the former address still reach the site.', 'updraftplus'), $old_siteurl, site_url()).' ';
+ $powarn = sprintf(__('The website address in the backup set (%1$s) is slightly different from that of the site now (%2$s). This is not expected to be a problem for restoring the site, as long as visits to the former address still reach the site.', 'updraftplus'), $old_siteurl, site_url()) . ' ';
} else {
$powarn = '';
}
if (('https' == $old_siteurl_parsed['scheme'] && 'http' == $actual_siteurl_parsed['scheme']) || ('http' == $old_siteurl_parsed['scheme'] && 'https' == $actual_siteurl_parsed['scheme'])) {
- $powarn .= sprintf(__('This backup set is of this site, but at the time of the backup you were using %s, whereas the site now uses %s.', 'updraftplus'), $old_siteurl_parsed['scheme'], $actual_siteurl_parsed['scheme']);
+ $powarn .= sprintf(__('This backup set is of this site, but at the time of the backup you were using %1$s, whereas the site now uses %2$s.', 'updraftplus'), $old_siteurl_parsed['scheme'], $actual_siteurl_parsed['scheme']);
if ('https' == $old_siteurl_parsed['scheme']) {
- $powarn .= ' '.apply_filters('updraftplus_https_to_http_additional_warning', sprintf(__('This restoration will work if you still have an SSL certificate (i.e. can use https) to access the site. Otherwise, you will want to use %s to search/replace the site address so that the site can be visited without https.', 'updraftplus'), ''.__('the migrator add-on', 'updraftplus').''));
+ $powarn .= ' ' . apply_filters('updraftplus_https_to_http_additional_warning', sprintf(__('This restoration will work if you still have an SSL certificate (i.e. can use https) to access the site. Otherwise, you will want to use %s to search/replace the site address so that the site can be visited without https.', 'updraftplus'), '' . __('the migrator add-on', 'updraftplus') . ''));
} else {
- $powarn .= ' '.apply_filters('updraftplus_http_to_https_additional_warning', sprintf(__('As long as your web hosting allows http (i.e. non-SSL access) or will forward requests to https (which is almost always the case), this is no problem. If that is not yet set up, then you should set it up, or use %s so that the non-https links are automatically replaced.', 'updraftplus'), apply_filters('updraftplus_migrator_addon_link', ''.__('the migrator add-on', 'updraftplus').'')));
+ $powarn .= ' ' . apply_filters('updraftplus_http_to_https_additional_warning', sprintf(__('As long as your web hosting allows http (i.e. non-SSL access) or will forward requests to https (which is almost always the case), this is no problem. If that is not yet set up, then you should set it up, or use %s so that the non-https links are automatically replaced.', 'updraftplus'), apply_filters('updraftplus_migrator_addon_link', '' . __('the migrator add-on', 'updraftplus') . '')));
}
} else {
$powarn .= apply_filters('updraftplus_dbscan_urlchange_www_append_warning', '');
@@ -2702,15 +2691,15 @@ class MainWP_Child_Updraft_Plus_Backups {
} else {
// For completely different site migration
$info['same_url'] = false;
- $warn[] = apply_filters('updraftplus_dbscan_urlchange', ''.__('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').'', $old_siteurl, $res);
+ $warn[] = apply_filters('updraftplus_dbscan_urlchange', '' . __('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') . '', $old_siteurl, $res);
}
if (!class_exists('UpdraftPlus_Addons_Migrator')) {
- $warn[] .= ''.__('You can search and replace your database (for migrating a website to a new location/URL) with the Migrator add-on - follow this link for more information', 'updraftplus').'';
+ $warn[] .= '' . __('You can search and replace your database (for migrating a website to a new location/URL) with the Migrator add-on - follow this link for more information', 'updraftplus') . '';
}
}
if ($updraftplus->mod_rewrite_unavailable(false)) {
- $warn[] = sprintf(__('You are using the %s webserver, but do not seem to have the %s module loaded.', 'updraftplus'), 'Apache', 'mod_rewrite').' '.sprintf(__('You should enable %s to make any pretty permalinks (e.g. %s) work', 'updraftplus'), 'mod_rewrite', 'http://example.com/my-page/');
+ $warn[] = sprintf(__('You are using the %1$s webserver, but do not seem to have the %2$s module loaded.', 'updraftplus'), 'Apache', 'mod_rewrite') . ' ' . sprintf(__('You should enable %1$s to make any pretty permalinks (e.g. %2$s) work', 'updraftplus'), 'mod_rewrite', 'http://example.com/my-page/');
}
} else {
@@ -2722,7 +2711,7 @@ class MainWP_Child_Updraft_Plus_Backups {
// Check for should-be migration
if (!$migration_warning && home_url() != $old_home) {
$migration_warning = true;
- $powarn = apply_filters('updraftplus_dbscan_urlchange', ''.__('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').'', $old_home, $res);
+ $powarn = apply_filters('updraftplus_dbscan_urlchange', '' . __('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') . '', $old_home, $res);
if (!empty($powarn)) $warn[] = $powarn;
}
} elseif (!isset($info['created_by_version']) && preg_match('/^\# Created by UpdraftPlus version ([\d\.]+)/', $buffer, $matches)) {
@@ -2732,14 +2721,14 @@ class MainWP_Child_Updraft_Plus_Backups {
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);
- $warn[] = sprintf(__('You are importing from a newer version of WordPress (%s) into an older one (%s). There are no guarantees that WordPress can handle this.', 'updraftplus'), $old_wp_version, $wp_version);
+ $warn[] = sprintf(__('You are importing from a newer version of WordPress (%1$s) into an older one (%2$s). There are no guarantees that WordPress can handle this.', 'updraftplus'), $old_wp_version, $wp_version);
}
if (preg_match('/running on PHP ([0-9]+\.[0-9]+)(\s|\.)/', $matches[4], $nmatches) && preg_match('/^([0-9]+\.[0-9]+)(\s|\.)/', PHP_VERSION, $cmatches)) {
$old_php_version = $nmatches[1];
$current_php_version = $cmatches[1];
if (version_compare($old_php_version, $current_php_version, '>')) {
// $mess[] = sprintf(__('%s version: %s', 'updraftplus'), 'WordPress', $old_wp_version);
- $warn[] = sprintf(__('The site in this backup was running on a webserver with version %s of %s. ', 'updraftplus'), $old_php_version, 'PHP').' '.sprintf(__('This is significantly newer than the server which you are now restoring onto (version %s).', 'updraftplus'), PHP_VERSION).' '.sprintf(__('You should only proceed if you cannot update the current server and are confident (or willing to risk) that your plugins/themes/etc. are compatible with the older %s version.', 'updraftplus'), 'PHP').' '.sprintf(__('Any support requests to do with %s should be raised with your web hosting company.', 'updraftplus'), 'PHP');
+ $warn[] = sprintf(__('The site in this backup was running on a webserver with version %1$s of %2$s. ', 'updraftplus'), $old_php_version, 'PHP') . ' ' . sprintf(__('This is significantly newer than the server which you are now restoring onto (version %s).', 'updraftplus'), PHP_VERSION) . ' ' . sprintf(__('You should only proceed if you cannot update the current server and are confident (or willing to risk) that your plugins/themes/etc. are compatible with the older %s version.', 'updraftplus'), 'PHP') . ' ' . sprintf(__('Any support requests to do with %s should be raised with your web hosting company.', 'updraftplus'), 'PHP');
}
}
} elseif ('' == $old_table_prefix && (preg_match('/^\# Table prefix: (\S+)$/', $buffer, $matches) || preg_match('/^-- Table prefix: (\S+)$/i', $buffer, $matches))) {
@@ -2747,7 +2736,7 @@ class MainWP_Child_Updraft_Plus_Backups {
// echo ''.__('Old table prefix:', 'updraftplus').' '.htmlspecialchars($old_table_prefix).' ';
} elseif (empty($info['label']) && preg_match('/^\# Label: (.*)$/', $buffer, $matches)) {
$info['label'] = $matches[1];
- $mess[] = __('Backup label:', 'updraftplus').' '.htmlspecialchars($info['label']);
+ $mess[] = __('Backup label:', 'updraftplus') . ' ' . htmlspecialchars($info['label']);
} elseif ($gathering_siteinfo && preg_match('/^\# Site info: (\S+)$/', $buffer, $matches)) {
if ('end' == $matches[1]) {
$gathering_siteinfo = false;
@@ -2758,7 +2747,7 @@ class MainWP_Child_Updraft_Plus_Backups {
// $err[] = sprintf(__('Error: %s', 'updraftplus'), __('You are running on WordPress multisite - but your backup is not of a multisite site.', 'updraftplus'));
// return array($mess, $warn, $err, $info);
// } else {
- $warn[] = __('You are running on WordPress multisite - but your backup is not of a multisite site.', 'updraftplus').' '.__('It will be imported as a new site.', 'updraftplus').' '.__('Please read this link for important information on this process.', 'updraftplus').'';
+ $warn[] = __('You are running on WordPress multisite - but your backup is not of a multisite site.', 'updraftplus') . ' ' . __('It will be imported as a new site.', 'updraftplus') . ' ' . __('Please read this link for important information on this process.', 'updraftplus') . '';
// }
// Got the needed code?
if (!class_exists('UpdraftPlusAddOn_MultiSite') || !class_exists('UpdraftPlus_Addons_Migrator')) {
@@ -2766,14 +2755,14 @@ class MainWP_Child_Updraft_Plus_Backups {
return array($mess, $warn, $err, $info);
}
} elseif (isset($old_siteinfo['multisite']) && $old_siteinfo['multisite'] && !is_multisite()) {
- $warn[] = __('Warning:', 'updraftplus').' '.__('Your backup is of a WordPress multisite install; but this site is not. Only the first site of the network will be accessible.', 'updraftplus').' '.__('If you want to restore a multisite backup, you should first set up your WordPress installation as a multisite.', 'updraftplus').'';
+ $warn[] = __('Warning:', 'updraftplus') . ' ' . __('Your backup is of a WordPress multisite install; but this site is not. Only the first site of the network will be accessible.', 'updraftplus') . ' ' . __('If you want to restore a multisite backup, you should first set up your WordPress installation as a multisite.', 'updraftplus') . '';
}
} elseif (preg_match('/^([^=]+)=(.*)$/', $matches[1], $kvmatches)) {
$key = $kvmatches[1];
$val = $kvmatches[2];
if ('multisite' == $key) {
$info['multisite'] = $val ? true : false;
- if ($val) $mess[] = ''.__('Site information:', 'updraftplus').' '.'backup is of a WordPress Network';
+ if ($val) $mess[] = '' . __('Site information:', 'updraftplus') . ' ' . 'backup is of a WordPress Network';
}
$old_siteinfo[$key] = $val;
}
@@ -2831,7 +2820,7 @@ class MainWP_Child_Updraft_Plus_Backups {
static $mysql_version_warned = false;
if (!$mysql_version_warned && version_compare($db_version, '5.2.0', '<') && preg_match('/(CHARSET|COLLATE)[= ]utf8mb4/', $buffer)) {
$mysql_version_warned = true;
- $err[] = sprintf(__('Error: %s', 'updraftplus'), sprintf(__('The database backup uses MySQL features not available in the old MySQL version (%s) that this site is running on.', 'updraftplus'), $db_version).' '.__('You must upgrade MySQL to be able to use this database.', 'updraftplus'));
+ $err[] = sprintf(__('Error: %s', 'updraftplus'), sprintf(__('The database backup uses MySQL features not available in the old MySQL version (%s) that this site is running on.', 'updraftplus'), $db_version) . ' ' . __('You must upgrade MySQL to be able to use this database.', 'updraftplus'));
}
}
}
@@ -2852,7 +2841,7 @@ class MainWP_Child_Updraft_Plus_Backups {
}
if ($db_charset_forbidden) {
$db_unsupported_charset_unique = array_unique($db_unsupported_charset);
- $warn[] = sprintf(_n("The database server that this WordPress site is running on doesn't support the character set (%s) which you are trying to import.", "The database server that this WordPress site is running on doesn't support the character sets (%s) which you are trying to import.", count($db_unsupported_charset_unique), 'updraftplus'), implode(', ', $db_unsupported_charset_unique)).' '.__('You can choose another suitable character set instead and continue with the restoration at your own risk.', 'updraftplus').' '.__('Go here for more information.', 'updraftplus').''.' '.__('Go here for more information.', 'updraftplus').'';
+ $warn[] = sprintf(_n("The database server that this WordPress site is running on doesn't support the character set (%s) which you are trying to import.", "The database server that this WordPress site is running on doesn't support the character sets (%s) which you are trying to import.", count($db_unsupported_charset_unique), 'updraftplus'), implode(', ', $db_unsupported_charset_unique)) . ' ' . __('You can choose another suitable character set instead and continue with the restoration at your own risk.', 'updraftplus') . ' ' . __('Go here for more information.', 'updraftplus') . '' . ' ' . __('Go here for more information.', 'updraftplus') . '';
$db_supported_character_sets = array_keys($db_supported_character_sets);
$similar_type_charset = UpdraftPlus_Manipulation_Functions::get_matching_str_from_array_elems($db_unsupported_charset_unique, $db_supported_character_sets, true);
if (empty($similar_type_charset)) {
@@ -2862,11 +2851,11 @@ class MainWP_Child_Updraft_Plus_Backups {
if (empty($similar_type_charset) && !empty($db_supported_character_sets[0])) {
$similar_type_charset = $db_supported_character_sets[0];
}
- $charset_select_html = ' ';
+ $charset_select_html = ' ';
$charset_select_html .= '';
@@ -2886,7 +2875,7 @@ class MainWP_Child_Updraft_Plus_Backups {
}
if ($db_collate_forbidden) {
$db_unsupported_collate_unique = array_unique($db_unsupported_collate);
- $warn[] = sprintf(_n("The database server that this WordPress site is running on doesn't support the collation (%s) used in the database which you are trying to import.", "The database server that this WordPress site is running on doesn't support multiple collations (%s) used in the database which you are trying to import.", count($db_unsupported_collate_unique), 'updraftplus'), implode(', ', $db_unsupported_collate_unique)).' '.__('You can choose another suitable collation instead and continue with the restoration (at your own risk).', 'updraftplus');
+ $warn[] = sprintf(_n("The database server that this WordPress site is running on doesn't support the collation (%s) used in the database which you are trying to import.", "The database server that this WordPress site is running on doesn't support multiple collations (%s) used in the database which you are trying to import.", count($db_unsupported_collate_unique), 'updraftplus'), implode(', ', $db_unsupported_collate_unique)) . ' ' . __('You can choose another suitable collation instead and continue with the restoration (at your own risk).', 'updraftplus');
$similar_type_collate = '';
if ($db_charset_forbidden && !empty($similar_type_charset)) {
$similar_type_collate = $updraftplus->get_similar_collate_related_to_charset($db_supported_collations, $db_unsupported_collate_unique, $similar_type_charset);
@@ -2909,21 +2898,21 @@ class MainWP_Child_Updraft_Plus_Backups {
$similar_type_collate = UpdraftPlus_Manipulation_Functions::get_matching_str_from_array_elems($db_unsupported_collate_unique, array_keys($db_supported_collations), false);
}
- $collate_select_html = '';
+ $collate_select_html = '';
$collate_select_html .= '';
- $info['addui'] = empty($info['addui']) ? $collate_select_html : $info['addui'].' '.$collate_select_html;
+ $info['addui'] = empty($info['addui']) ? $collate_select_html : $info['addui'] . ' ' . $collate_select_html;
if ($db_charset_forbidden) {
$collate_change_on_charset_selection_data = array(
@@ -2931,11 +2920,12 @@ class MainWP_Child_Updraft_Plus_Backups {
'db_unsupported_collate_unique' => $db_unsupported_collate_unique,
'db_collates_found' => $db_collates_found,
);
- $info['addui'] .= '';
+ $info['addui'] .= '';
}
}
}
- /* $blog_tables = "CREATE TABLE $wpdb->terms (
+ /*
+ $blog_tables = "CREATE TABLE $wpdb->terms (
CREATE TABLE $wpdb->term_taxonomy (
CREATE TABLE $wpdb->term_relationships (
CREATE TABLE $wpdb->commentmeta (
@@ -2959,13 +2949,13 @@ class MainWP_Child_Updraft_Plus_Backups {
if ($old_table_prefix) {
if (!$header_only) {
foreach ($wanted_tables as $table) {
- if (!in_array($old_table_prefix.$table, $tables_found)) {
+ if (!in_array($old_table_prefix . $table, $tables_found)) {
$missing_tables[] = $table;
}
}
foreach ($missing_tables as $key => $value) {
- if (in_array($old_table_prefix.$value, $skipped_tables)) {
+ if (in_array($old_table_prefix . $value, $skipped_tables)) {
unset($missing_tables[$key]);
}
}
@@ -3124,7 +3114,6 @@ class MainWP_Child_Updraft_Plus_Backups {
$non = $backup['nonce'];
-
// $rawbackup = "
';
// to fix
- $rawbackup = '' ; //$updraftplus_admin->raw_backup_info($backup_history, $key, $non);
+ $rawbackup = ''; //$updraftplus_admin->raw_backup_info($backup_history, $key, $non);
$jobdata = $updraftplus->jobdata_getarray( $non );
@@ -3158,7 +3147,6 @@ class MainWP_Child_Updraft_Plus_Backups {
}
}
-
$ret .= <<
@@ -3534,7 +3522,6 @@ ENDHERE;
} else {
return round( $size, 1 ) . ' b';
}
-
}
private function recursive_directory_size_raw( $prefix_directory, &$exclude = array(), $suffix_directory = '' ) {
@@ -3575,7 +3562,6 @@ ENDHERE;
}
return $size;
-
}
@@ -3695,7 +3681,7 @@ ENDHERE;
$p = min( $jobdata['uploading_substatus']['p'], 1 );
$pd = $i + $p / $t;
$stage = 4 + $pd;
- $curstage .= ' ' . sprintf( __( '(%s%%, file %s of %s)', 'updraftplus' ), floor( 100 * $pd ), $jobdata['uploading_substatus']['i'] + 1, $t );
+ $curstage .= ' ' . sprintf( __( '(%1$s%%, file %2$s of %3$s)', 'updraftplus' ), floor( 100 * $pd ), $jobdata['uploading_substatus']['i'] + 1, $t );
}
break;
case 'pruning':
@@ -3712,7 +3698,6 @@ ENDHERE;
$curstage = __( 'Backup finished', 'updraftplus' );
break;
default:
-
# Database creation and encryption occupies the space from 2 to 4. Databases are created then encrypted, then the next databae is created/encrypted, etc.
if ( 'dbcreated' === substr( $jobstatus, 0, 9 ) ) {
$jobstatus = 'dbcreated';
@@ -3786,7 +3771,7 @@ ENDHERE;
}
$next_res_after = (int) $time - time();
- $next_res_txt = ( $is_oneshot ) ? '' : ' - ' . sprintf( __( 'next resumption: %d (after %ss)', 'updraftplus' ), $next_resumption, $next_res_after ) . ' ';
+ $next_res_txt = ( $is_oneshot ) ? '' : ' - ' . sprintf( __( 'next resumption: %1$d (after %2$ss)', 'updraftplus' ), $next_resumption, $next_res_after ) . ' ';
$last_activity_txt = ( $last_checkin_ago >= 0 ) ? ' - ' . sprintf( __( 'last activity: %ss ago', 'updraftplus' ), floor( $last_checkin_ago ) ) . ' ' : '';
if ( ( $last_checkin_ago < 50 && $next_res_after > 30 ) || $is_oneshot ) {
@@ -3823,7 +3808,6 @@ ENDHERE;
$ret .= '';
return $ret;
-
}
private function fetch_updraft_log() {
@@ -3969,13 +3953,13 @@ ENDHERE;
}
private function close_browser_connection( $txt = '' ) {
-
+
if (isset( $_REQUEST['json_result'] ) && $_REQUEST['json_result'] == true) :
- $output = json_encode( $txt );
+ $output = json_encode( $txt );
else:
$output = serialize( $txt );
- endif;
-
+ endif;
+
$txt = '' . base64_encode( $output ) . '';
// Close browser connection so that it can resume AJAX polling
header( 'Content-Length: ' . ( ( ! empty( $txt ) ) ? strlen( $txt ) : '0' ) );
diff --git a/class/class-mainwp-child-vulnerability-checker.php b/class/class-mainwp-child-vulnerability-checker.php
index 8af1000..a4a06c2 100644
--- a/class/class-mainwp-child-vulnerability-checker.php
+++ b/class/class-mainwp-child-vulnerability-checker.php
@@ -23,19 +23,19 @@ class MainWP_Child_Vulnerability_Checker {
private $wpvulndb_token = false;
static function Instance() {
- if ( null === MainWP_Child_Vulnerability_Checker::$instance ) {
- MainWP_Child_Vulnerability_Checker::$instance = new MainWP_Child_Vulnerability_Checker();
+ if ( null === self::$instance ) {
+ self::$instance = new MainWP_Child_Vulnerability_Checker();
}
- return MainWP_Child_Vulnerability_Checker::$instance;
+ return self::$instance;
}
public function __construct() {
- $this->wpvulndb_token = get_option('mainwp_child_wpvulndb_token', '');
+ $this->wpvulndb_token = get_option('mainwp_child_wpvulndb_token', '');
}
public function action() {
$information = array();
-
+
if ( ! empty( $this->wpvulndb_token ) ) {
if ( isset( $_POST['mwp_action'] ) ) {
switch ( $_POST['mwp_action'] ) {
@@ -45,11 +45,11 @@ class MainWP_Child_Vulnerability_Checker {
}
}
}
-
+
MainWP_Helper::write( $information );
}
- function vulner_recheck(){
+ function vulner_recheck() {
$result = array();
$force = (isset($_POST['force']) && !empty($_POST['force'])) ? true : false;
$result['plugin'] = $this->check_plugins($force);
@@ -59,7 +59,7 @@ class MainWP_Child_Vulnerability_Checker {
return $information;
}
- function check_plugins($force = false){
+ function check_plugins( $force = false) {
$result = array();
$active_plugins = get_option('active_plugins');
@@ -69,11 +69,11 @@ class MainWP_Child_Vulnerability_Checker {
$plugin_file = WP_CONTENT_DIR . '/plugins/' . $plug;
$plugin_info = get_plugin_data($plugin_file);
$plugin_version = isset($plugin_info['Version']) ? $plugin_info['Version'] : '';
- $string = explode('/',$plug);
- $plug_vuln = get_transient('mainwp_vulnche_trans_plug_'.$string[0]);
+ $string = explode('/', $plug);
+ $plug_vuln = get_transient('mainwp_vulnche_trans_plug_' . $string[0]);
if(false === $plug_vuln || $force) {
- $plug_vuln = $this->vulnche_get_content( $this->wpvulndb_api . 'plugins/' . $string[0]);
- set_transient('mainwp_vulnche_trans_plug_'.$string[0],$plug_vuln, 1 * DAY_IN_SECONDS);
+ $plug_vuln = $this->vulnche_get_content( $this->wpvulndb_api . 'plugins/' . $string[0]);
+ set_transient('mainwp_vulnche_trans_plug_' . $string[0], $plug_vuln, 1 * DAY_IN_SECONDS);
}
if ($plug_vuln) {
$plug_vuln = json_decode($plug_vuln, true);
@@ -117,7 +117,7 @@ class MainWP_Child_Vulnerability_Checker {
return $result;
}
- function check_wp($force = false){
+ function check_wp( $force = false) {
$wp_vuln = get_transient('mainwp_vulnche_trans_wp_json');
$wp_version = str_replace('.', '', get_bloginfo('version'));
if(false === $wp_vuln || $force) {
@@ -127,7 +127,7 @@ class MainWP_Child_Vulnerability_Checker {
return $wp_vuln;
}
- function check_themes($force = false){
+ function check_themes( $force = false) {
require_once( ABSPATH . 'wp-admin/includes/misc.php' );
require_once( ABSPATH . 'wp-admin/includes/theme.php' );
@@ -197,14 +197,14 @@ class MainWP_Child_Vulnerability_Checker {
function vulnche_get_content ( $url ) {
-
+
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
+ curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Token token=' . $this->wpvulndb_token));
curl_setopt($ch, CURLOPT_USERAGENT, $this->get_random_user_agent());
- curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
$info = curl_getinfo($ch, CURLINFO_HTTP_CODE);
@@ -212,30 +212,30 @@ class MainWP_Child_Vulnerability_Checker {
curl_close($ch);
if ($output === false || $info != 200) {
$output = null;
- }
+ }
return $output;
}
- function get_random_user_agent ( ) {
+ function get_random_user_agent () {
$someUA = array (
- "Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.9.1b1) Gecko/20081007 Firefox/3.1b1",
- "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.0",
- "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/0.4.154.18 Safari/525.19",
- "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13",
- "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)",
- "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.40607)",
- "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.1.4322)",
- "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.0.3705; Media Center PC 3.1; Alexa Toolbar; .NET CLR 1.1.4322; .NET CLR 2.0.50727)",
- "Mozilla/45.0 (compatible; MSIE 6.0; Windows NT 5.1)",
- "Mozilla/4.08 (compatible; MSIE 6.0; Windows NT 5.1)",
- "Mozilla/4.01 (compatible; MSIE 6.0; Windows NT 5.1)"
+ 'Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.9.1b1) Gecko/20081007 Firefox/3.1b1',
+ 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.0',
+ 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/0.4.154.18 Safari/525.19',
+ 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13',
+ 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)',
+ 'Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.40607)',
+ 'Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.1.4322)',
+ 'Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.0.3705; Media Center PC 3.1; Alexa Toolbar; .NET CLR 1.1.4322; .NET CLR 2.0.50727)',
+ 'Mozilla/45.0 (compatible; MSIE 6.0; Windows NT 5.1)',
+ 'Mozilla/4.08 (compatible; MSIE 6.0; Windows NT 5.1)',
+ 'Mozilla/4.01 (compatible; MSIE 6.0; Windows NT 5.1)',
);
- srand((double)microtime()*1000000);
+ srand( (float) microtime()*1000000);
- return $someUA[rand(0,count($someUA)-1)];
+ return $someUA[rand(0, count($someUA)-1)];
}
diff --git a/class/class-mainwp-child-woocommerce-status.php b/class/class-mainwp-child-woocommerce-status.php
index f5ffa05..9597529 100644
--- a/class/class-mainwp-child-woocommerce-status.php
+++ b/class/class-mainwp-child-woocommerce-status.php
@@ -18,20 +18,18 @@ class MainWP_Child_WooCommerce_Status {
public static $instance = null;
static function Instance() {
- if ( null === MainWP_Child_WooCommerce_Status::$instance ) {
- MainWP_Child_WooCommerce_Status::$instance = new MainWP_Child_WooCommerce_Status();
+ if ( null === self::$instance ) {
+ self::$instance = new MainWP_Child_WooCommerce_Status();
}
- return MainWP_Child_WooCommerce_Status::$instance;
+ return self::$instance;
}
public function __construct() {
add_action( 'mainwp_child_deactivation', array( $this, 'child_deactivation' ) );
-
}
public function child_deactivation() {
-
}
public function action() {
@@ -92,8 +90,6 @@ class MainWP_Child_WooCommerce_Status {
AND posts.post_date <= %s
", date( 'Y-m-01', $start_date ), date( 'Y-m-d H:i:s', $end_date ) ) );
-
-
// Get top seller
$top_seller = $wpdb->get_row( $wpdb->prepare( "SELECT SUM( order_item_meta.meta_value ) as qty, order_item_meta_2.meta_value as product_id
FROM {$wpdb->posts} as posts
@@ -118,7 +114,7 @@ class MainWP_Child_WooCommerce_Status {
GROUP BY product_id
ORDER BY qty DESC
LIMIT 1
- ", date( 'Y-m-01', $start_date ), date( 'Y-m-d H:i:s', $end_date )) );
+ ", date( 'Y-m-01', $start_date ), date( 'Y-m-d H:i:s', $end_date )) );
if ( ! empty( $top_seller ) ) {
$top_seller->name = get_the_title( $top_seller->product_id );
@@ -215,9 +211,6 @@ class MainWP_Child_WooCommerce_Status {
AND posts.post_date <= STR_TO_DATE(" . $wpdb->prepare('%s', $end_date) . ", '%Y-%m-%d %H:%i:%s')
" );
-
-
-
// Get top seller
$top_seller = $wpdb->get_row( "SELECT SUM( order_item_meta.meta_value ) as qty, order_item_meta_2.meta_value as product_id
FROM {$wpdb->posts} as posts
@@ -353,8 +346,8 @@ class MainWP_Child_WooCommerce_Status {
'on-hold',
) ) ) . "' ) ";
$query['where'] .= "AND postmeta.meta_key = '_order_total' ";
- $query['where'] .= "AND posts.post_date >= STR_TO_DATE(" . $wpdb->prepare('%s', $start_date) . ", '%Y-%m-%d %H:%i:%s') ";
- $query['where'] .= "AND posts.post_date <= STR_TO_DATE(" . $wpdb->prepare('%s', $end_date) . ", '%Y-%m-%d %H:%i:%s') ";
+ $query['where'] .= 'AND posts.post_date >= STR_TO_DATE(' . $wpdb->prepare('%s', $start_date) . ", '%Y-%m-%d %H:%i:%s') ";
+ $query['where'] .= 'AND posts.post_date <= STR_TO_DATE(' . $wpdb->prepare('%s', $end_date) . ", '%Y-%m-%d %H:%i:%s') ";
$sales = $wpdb->get_var( implode( ' ', apply_filters( 'woocommerce_dashboard_status_widget_sales_query', $query ) ) );
@@ -373,14 +366,13 @@ class MainWP_Child_WooCommerce_Status {
) ) ) . "' ) ";
$query['where'] .= "AND order_item_meta.meta_key = '_qty' ";
$query['where'] .= "AND order_item_meta_2.meta_key = '_product_id' ";
- $query['where'] .= "AND posts.post_date >= STR_TO_DATE(" . $wpdb->prepare('%s', $start_date) . ", '%Y-%m-%d %H:%i:%s') ";
- $query['where'] .= "AND posts.post_date <= STR_TO_DATE(" . $wpdb->prepare('%s', $end_date) . ", '%Y-%m-%d %H:%i:%s') ";
+ $query['where'] .= 'AND posts.post_date >= STR_TO_DATE(' . $wpdb->prepare('%s', $start_date) . ", '%Y-%m-%d %H:%i:%s') ";
+ $query['where'] .= 'AND posts.post_date <= STR_TO_DATE(' . $wpdb->prepare('%s', $end_date) . ", '%Y-%m-%d %H:%i:%s') ";
$query['groupby'] = 'GROUP BY product_id';
$query['orderby'] = 'ORDER BY qty DESC';
$query['limits'] = 'LIMIT 1';
- $top_seller = $wpdb->get_row( implode( ' ', $query ) );
-
+ $top_seller = $wpdb->get_row( implode( ' ', $query ) );
if ( ! empty( $top_seller ) ) {
$top_seller->name = get_the_title( $top_seller->product_id );
@@ -441,7 +433,7 @@ class MainWP_Child_WooCommerce_Status {
'stock' => $stock,
'nostock' => $nostock,
'lowstock' => $lowinstock_count,
- 'outstock' => $outofstock_count
+ 'outstock' => $outofstock_count,
);
$information['data'] = $data;
$information['need_db_update'] = $this->check_db_update();
diff --git a/class/class-mainwp-child-wordfence.php b/class/class-mainwp-child-wordfence.php
index a7fadda..c3b6190 100644
--- a/class/class-mainwp-child-wordfence.php
+++ b/class/class-mainwp-child-wordfence.php
@@ -52,11 +52,11 @@ class MainWP_Child_Wordfence {
'loginSec_countFailMins',
'loginSec_disableAuthorScan',
'notification_updatesNeeded',
- "notification_securityAlerts",
- "notification_promotions",
- "notification_blogHighlights",
- "notification_productUpdates",
- "notification_scanStatus",
+ 'notification_securityAlerts',
+ 'notification_promotions',
+ 'notification_blogHighlights',
+ 'notification_productUpdates',
+ 'notification_scanStatus',
'loginSec_lockInvalidUsers',
'loginSec_breachPasswds_enabled',
'loginSec_breachPasswds',
@@ -87,7 +87,7 @@ class MainWP_Child_Wordfence {
'lowResourceScansEnabled',
'scansEnabled_malware',
'scansEnabled_oldVersions',
- "scansEnabled_suspiciousAdminUsers",
+ 'scansEnabled_suspiciousAdminUsers',
'scansEnabled_passwds',
'scansEnabled_plugins',
'scansEnabled_coreUnknown',
@@ -138,10 +138,10 @@ class MainWP_Child_Wordfence {
//'addCacheComment', // removed
'disableCodeExecutionUploads',
//'isPaid',
- "advancedCommentScanning",
- "scansEnabled_checkGSB",
- "checkSpamIP",
- "spamvertizeCheck",
+ 'advancedCommentScanning',
+ 'scansEnabled_checkGSB',
+ 'checkSpamIP',
+ 'spamvertizeCheck',
//'scansEnabled_public',
'email_summary_enabled',
'email_summary_dashboard_widget_enabled',
@@ -163,7 +163,7 @@ class MainWP_Child_Wordfence {
'schedMode', // paid, if free then auto
'wafStatus',
'learningModeGracePeriodEnabled',
- 'learningModeGracePeriod'
+ 'learningModeGracePeriod',
);
// for separated saving this values
@@ -179,16 +179,16 @@ class MainWP_Child_Wordfence {
public static $firewall_options_filter = array(
'wafStatus',
'learningModeGracePeriodEnabled',
- 'learningModeGracePeriod'
+ 'learningModeGracePeriod',
);
static function Instance() {
- if ( null === MainWP_Child_Wordfence::$instance ) {
- MainWP_Child_Wordfence::$instance = new MainWP_Child_Wordfence();
+ if ( null === self::$instance ) {
+ self::$instance = new MainWP_Child_Wordfence();
}
- return MainWP_Child_Wordfence::$instance;
+ return self::$instance;
}
@@ -206,7 +206,6 @@ class MainWP_Child_Wordfence {
if ( $this->is_wordfence_installed ) {
add_action( 'wp_ajax_mainwp_wordfence_download_htaccess', array( $this, 'downloadHtaccess' ) );
}
-
}
public function deactivation() {
@@ -329,37 +328,37 @@ class MainWP_Child_Wordfence {
case 'downgrade_license':
$information = $this->downgrade_license();
break;
- case "import_settings":
+ case 'import_settings':
$information = $this->import_settings();
break;
- case "export_settings":
+ case 'export_settings':
$information = $this->export_settings();
break;
- case "save_cache_config":
+ case 'save_cache_config':
$information = $this->saveCacheConfig();
break;
- case "check_falcon_htaccess":
+ case 'check_falcon_htaccess':
$information = $this->checkFalconHtaccess();
break;
- case "checkHtaccess":
+ case 'checkHtaccess':
$information = $this->checkHtaccess();
break;
- case "save_cache_options":
+ case 'save_cache_options':
$information = $this->saveCacheOptions();
break;
- case "clear_page_cache":
+ case 'clear_page_cache':
$information = $this->clearPageCache();
break;
- case "get_cache_stats":
+ case 'get_cache_stats':
$information = $this->getCacheStats();
break;
- case "add_cache_exclusion":
+ case 'add_cache_exclusion':
$information = $this->addCacheExclusion();
break;
- case "load_cache_exclusions":
+ case 'load_cache_exclusions':
$information = $this->loadCacheExclusions();
break;
- case "remove_cache_exclusion":
+ case 'remove_cache_exclusion':
$information = $this->removeCacheExclusion();
break;
case 'get_diagnostics':
@@ -430,20 +429,20 @@ class MainWP_Child_Wordfence {
break;
case 'whitelist_bulk_disable':
$information = $this->whitelistBulkDisable();
- break;
+ break;
case 'update_config':
$information = $this->updateConfig();
- break;
+ break;
case 'save_country_blocking':
$information = $this->saveCountryBlocking();
- break;
+ break;
}
}
MainWP_Helper::write( $information );
}
- public static function getSectionSettings($section) {
+ public static function getSectionSettings( $section) {
$general_opts = array(
'scheduleScan',
'apiKey',
@@ -484,7 +483,7 @@ class MainWP_Child_Wordfence {
'email_summary_dashboard_widget_enabled',
'other_noAnonMemberComments',
'other_scanComments',
- 'advancedCommentScanning' // paid
+ 'advancedCommentScanning', // paid
);
$traffic_opts = array(
@@ -495,7 +494,7 @@ class MainWP_Child_Wordfence {
'liveTraf_ignoreIPs',
'liveTraf_ignoreUA',
'liveTraf_maxRows',
- 'displayTopLevelLiveTraffic'
+ 'displayTopLevelLiveTraffic',
);
$firewall_opts = array(
@@ -539,7 +538,7 @@ class MainWP_Child_Wordfence {
'other_WFNet',
'wafStatus',
'learningModeGracePeriodEnabled',
- 'learningModeGracePeriod'
+ 'learningModeGracePeriod',
);
$scan_opts = array(
@@ -576,13 +575,13 @@ class MainWP_Child_Wordfence {
'scan_exclude',
'scan_include_extra',
'scanType',
- 'schedMode'
+ 'schedMode',
);
$diagnostics_opts = array(
'debugOn',
'startScansRemotely',
'ssl_verify',
- 'betaThreatDefenseFeed'
+ 'betaThreatDefenseFeed',
);
$blocking_opts = array(
@@ -627,8 +626,8 @@ class MainWP_Child_Wordfence {
}
private function kill_scan() {
- wordfence::status(1, 'info', "Scan kill request received.");
- wordfence::status(10, 'info', "SUM_KILLED:A request was received to kill the previous scan.");
+ wordfence::status(1, 'info', 'Scan kill request received.');
+ wordfence::status(10, 'info', 'SUM_KILLED:A request was received to kill the previous scan.');
wfUtils::clearScanLock(); //Clear the lock now because there may not be a scan running to pick up the kill request and clear the lock
wfScanEngine::requestKill();
return array(
@@ -669,7 +668,7 @@ class MainWP_Child_Wordfence {
do_action( 'mainwp_child_reports_log', 'wordfence' );
}
// ok
- public function do_reports_log($ext = '') {
+ public function do_reports_log( $ext = '') {
if ( $ext !== 'wordfence' ) return;
if ( ! $this->is_wordfence_installed ) return;
@@ -695,7 +694,7 @@ class MainWP_Child_Wordfence {
}
if ($scan_time) {
- $message = "Wordfence scan completed";
+ $message = 'Wordfence scan completed';
foreach($scan_time as $ctime => $details) {
$sql = sprintf( "SELECT * FROM {$table_wfStatus} WHERE ctime > %d AND ctime < %d AND level = 10 AND type = 'info' AND msg LIKE ", $ctime, $ctime + 100 ); // to get nearest SUM_FINAL msg
$sql .= " 'SUM_FINAL:Scan complete.%';";
@@ -802,11 +801,11 @@ class MainWP_Child_Wordfence {
'todayAttBlocked' => $this->count_attacks_blocked(1),
'weekAttBlocked' => $this->count_attacks_blocked(7),
'monthAttBlocked' => $this->count_attacks_blocked(30),
- 'wafData' => $this->_getWAFData()
+ 'wafData' => $this->_getWAFData(),
);
}
- public static function ajax_loadIssues_callback(){
+ public static function ajax_loadIssues_callback() {
$offset = isset($_POST['offset']) ? intval($_POST['offset']) : 0;
$limit = isset($_POST['limit']) ? intval($_POST['limit']) : WORDFENCE_SCAN_ISSUES_PER_PAGE;
@@ -819,10 +818,10 @@ class MainWP_Child_Wordfence {
'lastScanCompleted' => wfConfig::get('lastScanCompleted'),
'apiKey' => wfConfig::get( 'apiKey' ),
'isPaid' => wfConfig::get('isPaid'),
- 'lastscan_timestamp' => MainWP_Child_Wordfence::Instance()->get_lastscan(),
- 'todayAttBlocked' => MainWP_Child_Wordfence::Instance()->count_attacks_blocked(1),
- 'weekAttBlocked' => MainWP_Child_Wordfence::Instance()->count_attacks_blocked(7),
- 'monthAttBlocked' => MainWP_Child_Wordfence::Instance()->count_attacks_blocked(30),
+ 'lastscan_timestamp' => self::Instance()->get_lastscan(),
+ 'todayAttBlocked' => self::Instance()->count_attacks_blocked(1),
+ 'weekAttBlocked' => self::Instance()->count_attacks_blocked(7),
+ 'monthAttBlocked' => self::Instance()->count_attacks_blocked(30),
'issueCount' => $i->getIssueCount(),
);
return $return;
@@ -833,8 +832,8 @@ class MainWP_Child_Wordfence {
$return = array(
'wafData' => $this->_getWAFData(),
'ip' => wfUtils::getIP(),
- 'ajaxWatcherDisabled_front' => (bool)wfConfig::get('ajaxWatcherDisabled_front'),
- 'ajaxWatcherDisabled_admin' => (bool)wfConfig::get('ajaxWatcherDisabled_admin')
+ 'ajaxWatcherDisabled_front' => (bool) wfConfig::get('ajaxWatcherDisabled_front'),
+ 'ajaxWatcherDisabled_admin' => (bool) wfConfig::get('ajaxWatcherDisabled_admin'),
);
if (class_exists('wfFirewall')) {
@@ -844,7 +843,7 @@ class MainWP_Child_Wordfence {
return $return;
}
- public function count_attacks_blocked($maxAgeDays) {
+ public function count_attacks_blocked( $maxAgeDays) {
global $wpdb;
$table_wfBlockedIPLog = wfDB::networkTable('wfBlockedIPLog');
$interval = 'FLOOR(UNIX_TIMESTAMP(DATE_SUB(NOW(), interval ' . $maxAgeDays . ' day)) / 86400)';
@@ -885,7 +884,7 @@ SQL
$status = $_POST['status'];
$issueID = $_POST['id'];
if(! preg_match('/^(?:new|delete|ignoreP|ignoreC)$/', $status)){
- return array('errorMsg' => "An invalid status was specified when trying to update that issue.");
+ return array('errorMsg' => 'An invalid status was specified when trying to update that issue.');
}
$wfIssues->updateIssue($issueID, $status);
wfScanEngine::refreshScanNotification($wfIssues);
@@ -1088,7 +1087,7 @@ SQL
);
}
- function simple_crypt($key, $data, $action = 'encrypt'){
+ function simple_crypt( $key, $data, $action = 'encrypt') {
$res = '';
if($action == 'encrypt'){
$string = base64_encode( serialize($data) );
@@ -1112,8 +1111,7 @@ SQL
return $res;
}
- function save_settings_new()
- {
+ function save_settings_new() {
if (isset($_POST['encrypted']))
$settings = $this->simple_crypt( 'thisisakey', $_POST['settings'], 'decrypt' ); // to fix pass through sec rules of Dreamhost
else {
@@ -1276,22 +1274,19 @@ SQL
// Finished saving settings
/////////////////////
-
$result['cacheType'] = wfConfig::get( 'cacheType' );
$result['paidKeyMsg'] = false;
// if saving then validate data
if (in_array('apiKey', $saving_opts)) {
-
+
$apiKey = trim( $_POST['apiKey'] );
- $apiKey = strtolower(trim($apiKey));
+ $apiKey = strtolower(trim($apiKey));
$existingAPIKey = wfConfig::get('apiKey', '');
-
-
-
- $ping = false;
+
+ $ping = false;
if ( empty( $apiKey ) && empty($existingAPIKey) ) { // then try to get one.
-
+
$api = new wfAPI( '', wfUtils::getWPVersion() );
try {
$keyData = $api->call( 'get_anon_api_key' );
@@ -1310,13 +1305,13 @@ SQL
$result['error'] = 'Your options have been saved, but you left your license key blank, so we tried to get you a free license key from the Wordfence servers. There was a problem fetching the free key: ' . wp_kses( $e->getMessage(), array() );
return $result;
}
-
- } else if ( !empty( $apiKey ) && $existingAPIKey != $apiKey ) {
+
+ } else if ( !empty( $apiKey ) && $existingAPIKey != $apiKey ) {
$api = new wfAPI( $apiKey, wfUtils::getWPVersion() );
try {
$res = $api->call('check_api_key', array(), array('previousLicense' => $existingAPIKey));
if ( $res['ok'] && isset( $res['isPaid'] ) ) {
-
+
// wfConfig::set( 'apiKey', $apiKey );
// wfConfig::set( 'isPaid', $res['isPaid'] ); //res['isPaid'] is boolean coming back as JSON and turned back into PHP struct. Assuming JSON to PHP handles bools.
// $result['apiKey'] = $apiKey;
@@ -1324,7 +1319,7 @@ SQL
// if ( $res['isPaid'] ) {
// $result['paidKeyMsg'] = true;
// }
-
+
$isPaid = wfUtils::truthyToBoolean($res['isPaid']);
wfConfig::set('apiKey', $apiKey);
wfConfig::set('isPaid', $isPaid); //res['isPaid'] is boolean coming back as JSON and turned back into PHP struct. Assuming JSON to PHP handles bools.
@@ -1332,14 +1327,13 @@ SQL
if (!$isPaid) {
wfConfig::set('keyType', wfAPI::KEY_TYPE_FREE);
}
-
-
+
$result['apiKey'] = $apiKey;
$result['isPaid'] = $isPaid;
if ( $isPaid ) {
$result['paidKeyMsg'] = true;
}
-
+
$ping = true;
$reload = 'reload';
} else {
@@ -1350,13 +1344,13 @@ SQL
return $result;
}
} else {
- $ping = true;
- $apiKey = $existingAPIKey;
+ $ping = true;
+ $apiKey = $existingAPIKey;
}
-
- if ( $ping ) {
-
- $api = new wfAPI($apiKey, wfUtils::getWPVersion());
+
+ if ( $ping ) {
+
+ $api = new wfAPI($apiKey, wfUtils::getWPVersion());
try {
$keyType = wfAPI::KEY_TYPE_FREE;
$keyData = $api->call('ping_api_key', array(), array('supportHash' => wfConfig::get('supportHash', ''), 'whitelistHash' => wfConfig::get('whitelistHash', '')));
@@ -1383,10 +1377,10 @@ SQL
}
wfConfig::set('keyType', $keyType);
-
+
if (!isset($result['apiKey'])) {
$isPaid = ( $keyType == wfAPI::KEY_TYPE_FREE ) ? false : true;
- $result['apiKey'] = $apiKey;
+ $result['apiKey'] = $apiKey;
$result['isPaid'] = $isPaid;
if ( $isPaid ) {
$result['paidKeyMsg'] = true;
@@ -1394,7 +1388,7 @@ SQL
}
} catch ( Exception $e ) {
- $result['error'] = 'Your options have been saved. However we tried to verify your license key with the Wordfence servers and received an error: ' . wp_kses($e->getMessage(), array()) ;
+ $result['error'] = 'Your options have been saved. However we tried to verify your license key with the Wordfence servers and received an error: ' . wp_kses($e->getMessage(), array());
return $result;
}
}
@@ -1412,7 +1406,7 @@ SQL
}
- public static function recentTraffic(){
+ public static function recentTraffic() {
return wordfence::ajax_recentTraffic_callback();
}
@@ -1572,8 +1566,7 @@ SQL
}
}
- public function export_settings(){
-
+ public function export_settings() {
$export = array();
@@ -1600,18 +1593,18 @@ SQL
);
}
else if ($res['err']) {
- return array('errorExport' => __("An error occurred: ", 'wordfence') . $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') . var_export($res, true));
}
}
catch (Exception $e) {
- return array('errorExport' => __("An error occurred: ", 'wordfence') . $e->getMessage());
+ return array('errorExport' => __('An error occurred: ', 'wordfence') . $e->getMessage());
}
}
- public function import_settings(){
+ public function import_settings() {
$token = $_POST['token'];
try {
$api = new wfAPI(wfConfig::get('apiKey'), wfUtils::getWPVersion());
@@ -1620,7 +1613,7 @@ SQL
$totalSet = 0;
$import = @json_decode($res['export'], true);
if (!is_array($import)) {
- return array('errorImport' => __("An error occurred: Invalid options format received.", 'wordfence'));
+ return array('errorImport' => __('An error occurred: Invalid options format received.', 'wordfence'));
}
//Basic Options
@@ -1662,20 +1655,19 @@ SQL
return array(
'ok' => 1,
'totalSet' => $totalSet,
- 'settings' => $this->get_settings()
+ 'settings' => $this->get_settings(),
);
}
else if ($res['err']) {
- return array('errorImport' => "An error occurred: " . $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: ' . var_export($res, true));
}
}
catch (Exception $e) {
- return array('errorImport' => "An error occurred: " . $e->getMessage());
+ return array('errorImport' => 'An error occurred: ' . $e->getMessage());
}
-
}
function get_settings() {
@@ -1750,7 +1742,7 @@ SQL
return $return;
}
- public static function fixFPD(){
+ public static function fixFPD() {
$return = wordfence::ajax_fixFPD_callback();
return $return;
}
@@ -1838,7 +1830,7 @@ SQL
}
// credit of Wordfence
- private static function _getWAFData($updated = null) {
+ private static function _getWAFData( $updated = null) {
// custom
if(!class_exists('wfWAF'))
return false;
@@ -1906,7 +1898,7 @@ SQL
}
- public function saveOptions(){
+ public function saveOptions() {
if (!empty($_POST['changes']) && ($changes = json_decode(stripslashes($_POST['changes']), true)) !== false) {
try {
if (is_array($changes) && isset($changes['whitelistedURLParams']) && isset($changes['whitelistedURLParams']['add'])) {
@@ -1967,13 +1959,12 @@ SQL
);
}
- public function ajax_getBlocks_callback(){
+ public function ajax_getBlocks_callback() {
$information = wordfence::ajax_getBlocks_callback();
return $information;
}
// credit of Wordfence
- public function ajax_createBlock_callback()
- {
+ public function ajax_createBlock_callback() {
return wordfence::ajax_createBlock_callback();
}
@@ -1987,12 +1978,12 @@ SQL
return $information;
}
- public function ajax_blockIP_callback(){
+ public function ajax_blockIP_callback() {
return wordfence::ajax_blockIP_callback();
}
// credit of Wordfence
- public function whois(){
+ public function whois() {
return wordfence::ajax_whois_callback();
}
@@ -2004,9 +1995,9 @@ SQL
}
}
- public static function saveCountryBlocking(){
+ public static function saveCountryBlocking() {
if(! wfConfig::get('isPaid')){
- return array('error' => "Sorry but this feature is only available for paid customers.");
+ return array('error' => 'Sorry but this feature is only available for paid customers.');
}
$settings = $_POST['settings'];
wfConfig::set('cbl_action', $settings['blockAction']);
@@ -2062,13 +2053,13 @@ SQL
return $return;
}
- public static function saveCacheConfig(){
+ public static function saveCacheConfig() {
$noEditHtaccess = '1';
if (isset($_POST['needToCheckFalconHtaccess']) && !empty($_POST['needToCheckFalconHtaccess'])) {
$checkHtaccess = self::checkFalconHtaccess();
if (isset($checkHtaccess['ok']))
$noEditHtaccess = '0';
- } else if (isset($_POST['noEditHtaccess'])) {
+ } else if (isset($_POST['noEditHtaccess'])) {
$noEditHtaccess = $_POST['noEditHtaccess'];
}
@@ -2079,20 +2070,20 @@ SQL
foreach($plugins as $pluginFile => $data){
if(is_plugin_active($pluginFile)){
if($pluginFile == 'w3-total-cache/w3-total-cache.php'){
- $badPlugins[] = "W3 Total Cache";
+ $badPlugins[] = 'W3 Total Cache';
} else if($pluginFile == 'quick-cache/quick-cache.php'){
- $badPlugins[] = "Quick Cache";
- } else if($pluginFile == "wp-super-cache/wp-cache.php"){
- $badPlugins[] = "WP Super Cache";
- } else if($pluginFile == "wp-fast-cache/wp-fast-cache.php"){
- $badPlugins[] = "WP Fast Cache";
- } else if($pluginFile == "wp-fastest-cache/wpFastestCache.php"){
- $badPlugins[] = "WP Fastest Cache";
+ $badPlugins[] = 'Quick Cache';
+ } else if($pluginFile == 'wp-super-cache/wp-cache.php'){
+ $badPlugins[] = 'WP Super Cache';
+ } else if($pluginFile == 'wp-fast-cache/wp-fast-cache.php'){
+ $badPlugins[] = 'WP Fast Cache';
+ } else if($pluginFile == 'wp-fastest-cache/wpFastestCache.php'){
+ $badPlugins[] = 'WP Fastest Cache';
}
}
}
if(count($badPlugins) > 0){
- return array('errorMsg' => "You can not enable caching in Wordfence with other caching plugins enabled. This may cause conflicts. You need to disable other caching plugins first. Wordfence caching is very fast and does not require other caching plugins to be active. The plugins you have that conflict are: " . implode(', ', $badPlugins) . ". Disable these plugins, then return to this page and enable Wordfence caching.");
+ return array('errorMsg' => 'You can not enable caching in Wordfence with other caching plugins enabled. This may cause conflicts. You need to disable other caching plugins first. Wordfence caching is very fast and does not require other caching plugins to be active. The plugins you have that conflict are: ' . implode(', ', $badPlugins) . '. Disable these plugins, then return to this page and enable Wordfence caching.');
}
$siteURL = site_url();
if(preg_match('/^https?:\/\/[^\/]+\/[^\/]+\/[^\/]+\/.+/i', $siteURL)){
@@ -2101,7 +2092,7 @@ SQL
}
if($cacheType == 'falcon'){
if(! get_option('permalink_structure', '')){
- return array('errorMsg' => "You need to enable Permalinks for your site to use Falcon Engine. You can enable Permalinks in WordPress by going to the Settings - Permalinks menu and enabling it there. Permalinks change your site URL structure from something that looks like /p=123 to pretty URLs like /my-new-post-today/ that are generally more search engine friendly.");
+ return array('errorMsg' => 'You need to enable Permalinks for your site to use Falcon Engine. You can enable Permalinks in WordPress by going to the Settings - Permalinks menu and enabling it there. Permalinks change your site URL structure from something that looks like /p=123 to pretty URLs like /my-new-post-today/ that are generally more search engine friendly.');
}
}
$warnHtaccess = false;
@@ -2115,7 +2106,7 @@ SQL
if($cacheType == 'php' || $cacheType == 'falcon'){
$err = wfCache::cacheDirectoryTest();
if($err){
- return array('ok' => 1, 'heading' => "Could not write to cache directory", 'body' => "To enable caching, Wordfence needs to be able to create and write to the /wp-content/wfcache/ directory. We did some tests that indicate this is not possible. You need to manually create the /wp-content/wfcache/ directory and make it writable by Wordfence. The error we encountered was during our tests was: $err");
+ return array('ok' => 1, 'heading' => 'Could not write to cache directory', 'body' => "To enable caching, Wordfence needs to be able to create and write to the /wp-content/wfcache/ directory. We did some tests that indicate this is not possible. You need to manually create the /wp-content/wfcache/ directory and make it writable by Wordfence. The error we encountered was during our tests was: $err");
}
}
@@ -2123,59 +2114,59 @@ SQL
if($cacheType != wfConfig::get('cacheType', false)){
wfCache::scheduleCacheClear();
}
- $htMsg = "";
+ $htMsg = '';
if($warnHtaccess){
$htMsg = " Warning: We could not remove the caching code from your .htaccess file. you need to remove this manually yourself. ";
}
if($cacheType == 'disable'){
wfConfig::set('cacheType', false);
- return array('ok' => 1, 'heading' => "Caching successfully disabled.", 'body' => "{$htMsg}Caching has been disabled on your system.
");
+ return array('ok' => 1, 'heading' => 'Caching successfully disabled.', 'body' => "{$htMsg}Caching has been disabled on your system.
");
} else if($cacheType == 'php'){
wfConfig::set('cacheType', 'php');
- return array('ok' => 1, 'heading' => "Wordfence Basic Caching Enabled", 'body' => "{$htMsg}Wordfence basic caching has been enabled on your system.
");
+ return array('ok' => 1, 'heading' => 'Wordfence Basic Caching Enabled', 'body' => "{$htMsg}Wordfence basic caching has been enabled on your system.
");
} else if($cacheType == 'falcon'){
if($noEditHtaccess != '1'){
$err = wfCache::addHtaccessCode('add');
if($err){
- return array('ok' => 1, 'heading' => "Wordfence could not edit .htaccess", 'body' => "Wordfence could not edit your .htaccess code. The error was: " . $err);
+ return array('ok' => 1, 'heading' => 'Wordfence could not edit .htaccess', 'body' => 'Wordfence could not edit your .htaccess code. The error was: ' . $err);
}
}
wfConfig::set('cacheType', 'falcon');
wfCache::scheduleUpdateBlockedIPs(); //Runs every 5 mins until we change cachetype
- return array('ok' => 1, 'heading' => "Wordfence Falcon Engine Activated!", 'body' => "Wordfence Falcon Engine has been activated on your system. You will see this icon appear on the Wordfence admin pages as long as Falcon is active indicating your site is running in high performance mode:
");
+ return array('ok' => 1, 'heading' => 'Wordfence Falcon Engine Activated!', 'body' => "Wordfence Falcon Engine has been activated on your system. You will see this icon appear on the Wordfence admin pages as long as Falcon is active indicating your site is running in high performance mode:
");
}
- return array('errorMsg' => "An error occurred.");
+ return array('errorMsg' => 'An error occurred.');
}
- public static function checkFalconHtaccess(){
+ public static function checkFalconHtaccess() {
if(wfUtils::isNginx()){
return array('nginx' => 1);
}
$file = wfCache::getHtaccessPath();
if(! $file){
- return array('err' => "We could not find your .htaccess file to modify it.", 'code' => wfCache::getHtaccessCode() );
+ return array('err' => 'We could not find your .htaccess file to modify it.', 'code' => wfCache::getHtaccessCode() );
}
$fh = @fopen($file, 'r+');
if(! $fh){
$err = error_get_last();
- return array('err' => "We found your .htaccess file but could not open it for writing: " . $err['message'], 'code' => wfCache::getHtaccessCode() );
+ return array('err' => 'We found your .htaccess file but could not open it for writing: ' . $err['message'], 'code' => wfCache::getHtaccessCode() );
}
$download_url = admin_url( 'admin-ajax.php' ) . '?action=mainwp_wordfence_download_htaccess&_wpnonce=' . MainWP_Helper::create_nonce_without_session( 'mainwp_download_htaccess' );
- return array( 'ok' => 1 , 'download_url' => $download_url );
+ return array( 'ok' => 1, 'download_url' => $download_url );
}
- public static function checkHtaccess(){
+ public static function checkHtaccess() {
if(wfUtils::isNginx()){
return array('nginx' => 1);
}
$file = wfCache::getHtaccessPath();
if(! $file){
- return array('err' => "We could not find your .htaccess file to modify it.");
+ return array('err' => 'We could not find your .htaccess file to modify it.');
}
$fh = @fopen($file, 'r+');
if(! $fh){
$err = error_get_last();
- return array('err' => "We found your .htaccess file but could not open it for writing: " . $err['message']);
+ return array('err' => 'We found your .htaccess file but could not open it for writing: ' . $err['message']);
}
return array('ok' => 1);
}
@@ -2201,7 +2192,7 @@ SQL
die();
}
- public static function saveCacheOptions(){
+ public static function saveCacheOptions() {
$changed = false;
if($_POST['allowHTTPSCaching'] != wfConfig::get('allowHTTPSCaching', false)){
$changed = true;
@@ -2212,30 +2203,30 @@ SQL
if($changed && wfConfig::get('cacheType', false) == 'falcon'){
$err = wfCache::addHtaccessCode('add');
if($err){
- return array('updateErr' => "Wordfence could not edit your .htaccess file. The error was: " . $err, 'code' => wfCache::getHtaccessCode() );
+ return array('updateErr' => 'Wordfence could not edit your .htaccess file. The error was: ' . $err, 'code' => wfCache::getHtaccessCode() );
}
}
wfCache::scheduleCacheClear();
return array('ok' => 1);
}
- public static function clearPageCache(){
+ public static function clearPageCache() {
$stats = wfCache::clearPageCache();
if($stats['error']){
- $body = "A total of " . $stats['totalErrors'] . " errors occurred while trying to clear your cache. The last error was: " . $stats['error'];
+ $body = 'A total of ' . $stats['totalErrors'] . ' errors occurred while trying to clear your cache. The last error was: ' . $stats['error'];
return array('ok' => 1, 'heading' => 'Error occurred while clearing cache', 'body' => $body );
}
- $body = "A total of " . $stats['filesDeleted'] . ' files were deleted and ' . $stats['dirsDeleted'] . ' directories were removed. We cleared a total of ' . $stats['totalData'] . 'KB of data in the cache.';
+ $body = 'A total of ' . $stats['filesDeleted'] . ' files were deleted and ' . $stats['dirsDeleted'] . ' directories were removed. We cleared a total of ' . $stats['totalData'] . 'KB of data in the cache.';
if($stats['totalErrors'] > 0){
$body .= ' A total of ' . $stats['totalErrors'] . ' errors were encountered. This probably means that we could not remove some of the files or directories in the cache. Please use your CPanel or file manager to remove the rest of the files in the directory: ' . WP_CONTENT_DIR . '/wfcache/';
}
return array('ok' => 1, 'heading' => 'Page Cache Cleared', 'body' => $body );
}
- public static function getCacheStats(){
+ public static function getCacheStats() {
$s = wfCache::getCacheStats();
if($s['files'] == 0){
- return array('ok' => 1, 'heading' => 'Cache Stats', 'body' => "The cache is currently empty. It may be disabled or it may have been recently cleared.");
+ return array('ok' => 1, 'heading' => 'Cache Stats', 'body' => 'The cache is currently empty. It may be disabled or it may have been recently cleared.');
}
$body = 'Total files in cache: ' . $s['files'] .
' Total directories in cache: ' . $s['dirs'] .
@@ -2269,7 +2260,7 @@ SQL
return array('ok' => 1, 'heading' => 'Cache Stats', 'body' => $body);
}
- public static function addCacheExclusion(){
+ public static function addCacheExclusion() {
$ex = wfConfig::get('cacheExclusions', false);
if($ex){
$ex = unserialize($ex);
@@ -2289,13 +2280,13 @@ SQL
wfCache::scheduleCacheClear();
if(wfConfig::get('cacheType', false) == 'falcon' && preg_match('/^(?:uac|uaeq|cc)$/', $_POST['patternType'])){
if(wfCache::addHtaccessCode('add')){ //rewrites htaccess rules
- return array('errorMsg' => "We added the rule you requested but could not modify your .htaccess file. Please delete this rule, check the permissions on your .htaccess file and then try again.", 'ex' => $ex);
+ return array('errorMsg' => 'We added the rule you requested but could not modify your .htaccess file. Please delete this rule, check the permissions on your .htaccess file and then try again.', 'ex' => $ex);
}
}
return array('ok' => 1, 'ex' => $ex);
}
- public static function loadCacheExclusions(){
+ public static function loadCacheExclusions() {
$ex = wfConfig::get('cacheExclusions', false);
if(! $ex){
return array('ex' => false);
@@ -2304,7 +2295,7 @@ SQL
return array('ok' => 1, 'ex' => $ex);
}
- public static function removeCacheExclusion(){
+ public static function removeCacheExclusion() {
$id = $_POST['id'];
$ex = wfConfig::get('cacheExclusions', false);
if(! $ex){
@@ -2314,7 +2305,7 @@ SQL
$rewriteHtaccess = false;
$removed = false;
for($i = 0; $i < sizeof($ex); $i++){
- if((string)$ex[$i]['id'] == (string)$id){
+ if( (string) $ex[$i]['id'] == (string) $id){
if(wfConfig::get('cacheType', false) == 'falcon' && preg_match('/^(?:uac|uaeq|cc)$/', $ex[$i]['pt'])){
$rewriteHtaccess = true;
}
@@ -2325,7 +2316,7 @@ SQL
}
$return = array('ex' => $ex);
if (!$removed) {
- $return['error'] = "Not found the cache exclusion.";
+ $return['error'] = 'Not found the cache exclusion.';
return $return;
}
@@ -2341,7 +2332,7 @@ SQL
public function getDiagnostics() {
- $diagnostic = new wfDiagnostic;
+ $diagnostic = new wfDiagnostic();
$plugins = get_plugins();
$activePlugins = array_flip(get_option('active_plugins'));
$activeNetworkPlugins = is_multisite() ? array_flip(wp_get_active_network_plugins()) : array();
@@ -2359,7 +2350,8 @@ SQL