diff --git a/class/class-mainwp-backup.php b/class/class-mainwp-backup.php index 504cab5..06f8851 100644 --- a/class/class-mainwp-backup.php +++ b/class/class-mainwp-backup.php @@ -118,7 +118,7 @@ class MainWP_Backup { @ini_set( 'max_execution_time', $this->timeout ); // @codingStandardsIgnoreEnd - if ( !is_array( $files ) ) { + if ( ! is_array( $files ) ) { $files = array( $files ); } @@ -168,7 +168,7 @@ class MainWP_Backup { } } - return !$error; + return ! $error; } /** diff --git a/class/class-mainwp-child-back-up-buddy.php b/class/class-mainwp-child-back-up-buddy.php index bebcc11..4824508 100644 --- a/class/class-mainwp-child-back-up-buddy.php +++ b/class/class-mainwp-child-back-up-buddy.php @@ -34,7 +34,7 @@ class MainWP_Child_Back_Up_Buddy { $this->is_backupbuddy_installed = true; } - if (!$this->is_backupbuddy_installed) { + if ( ! $this->is_backupbuddy_installed) { return; } @@ -61,7 +61,7 @@ class MainWP_Child_Back_Up_Buddy { return $value; } - if (! MainWP_Helper::is_screen_with_update()) { + if ( ! MainWP_Helper::is_screen_with_update()) { return $value; } @@ -109,7 +109,7 @@ class MainWP_Child_Back_Up_Buddy { return; } - if (!$this->is_backupbuddy_installed) { + if ( ! $this->is_backupbuddy_installed) { return; } @@ -132,14 +132,14 @@ class MainWP_Child_Back_Up_Buddy { // Backup type. $pretty_type = array( - 'full' => 'Full', - 'db' => 'Database', - 'files' => 'Files', + 'full' => 'Full', + 'db' => 'Database', + 'files' => 'Files', ); $recentBackups_list = glob( backupbuddy_core::getLogDirectory() . 'fileoptions/*.txt' ); - foreach( $recentBackups_list as $backup_fileoptions ) { + foreach ( $recentBackups_list as $backup_fileoptions ) { $backup = new pb_backupbuddy_fileoptions( $backup_fileoptions, $read_only = true ); if ( method_exists($backup, 'is_ok') && true !== ( $result = $backup->is_ok() ) ) { @@ -148,7 +148,7 @@ class MainWP_Child_Back_Up_Buddy { $backup = &$backup->options; - if ( !isset( $backup['serial'] ) || ( $backup['serial'] == '' ) ) { + if ( ! isset( $backup['serial'] ) || ( $backup['serial'] == '' ) ) { continue; } @@ -177,7 +177,7 @@ class MainWP_Child_Back_Up_Buddy { $finish_time = $backup['finish_time']; $message = 'BackupBuddy ' . $backupType . ' finished'; - if (!empty($finish_time)) { + if ( ! empty($finish_time)) { do_action( 'mainwp_reports_backupbuddy_backup', $message, $backupType, $finish_time); } } @@ -198,7 +198,7 @@ class MainWP_Child_Back_Up_Buddy { $finish_time = $state['stats']['last_remote_snapshot']; $backupType = 'Live Backup to cloud'; $message = 'BackupBuddy ' . $backupType . ' finished'; - if (!empty($finish_time)) { + if ( ! empty($finish_time)) { do_action( 'mainwp_reports_backupbuddy_backup', $message, $backupType, $finish_time); } @@ -208,7 +208,7 @@ class MainWP_Child_Back_Up_Buddy { } } - } catch( Exception $e ) { + } catch ( Exception $e ) { } } @@ -223,7 +223,7 @@ class MainWP_Child_Back_Up_Buddy { require_once pb_backupbuddy::plugin_path() . '/classes/core.php'; } - if ( !isset( pb_backupbuddy::$options ) ) { + if ( ! isset( pb_backupbuddy::$options ) ) { pb_backupbuddy::load(); } @@ -489,26 +489,26 @@ class MainWP_Child_Back_Up_Buddy { if (is_array($settings)) { if ($type === 'all' || 'general_settings' === $type) { - foreach($filter_general_settings as $field) { - if(isset($settings[ $field ])) { + foreach ($filter_general_settings as $field) { + if (isset($settings[ $field ])) { $save_settings[ $field ] = $settings[ $field ]; } } } if ($type === 'all' || 'advanced_settings' === $type) { - foreach($filter_advanced_settings as $field) { - if(isset($settings[ $field ])) { + foreach ($filter_advanced_settings as $field) { + if (isset($settings[ $field ])) { $save_settings[ $field ] = $settings[ $field ]; } } } } - if (!empty($save_settings)) { + if ( ! empty($save_settings)) { $newOptions = pb_backupbuddy::$options; - foreach($newOptions as $key => $val) { + foreach ($newOptions as $key => $val) { if (isset($save_settings[ $key ])) { $newOptions[ $key ] = $save_settings[ $key ]; } @@ -632,7 +632,7 @@ class MainWP_Child_Back_Up_Buddy { $schedule_id = (int) $_POST['schedule_id']; - if ( !isset( pb_backupbuddy::$options['schedules'][ $schedule_id ] ) || ! is_array( pb_backupbuddy::$options['schedules'][ $schedule_id ] ) ) { + if ( ! isset( pb_backupbuddy::$options['schedules'][ $schedule_id ] ) || ! is_array( pb_backupbuddy::$options['schedules'][ $schedule_id ] ) ) { return array( 'error' => __( 'Error: not found the backup schedule or invalid data', 'mainwp-child' ) ); } @@ -650,12 +650,12 @@ class MainWP_Child_Back_Up_Buddy { $schedule_id = intval($_POST['schedule_id']); $schedule = unserialize(base64_decode($_POST['data'])); - if (!is_array($schedule)) { + if ( ! is_array($schedule)) { return array( 'error' => __( 'Invalid schedule data', 'mainwp-child' ) ); } $information = array(); // add new - if (!isset(pb_backupbuddy::$options['schedules'][ $schedule_id ])) { + if ( ! isset(pb_backupbuddy::$options['schedules'][ $schedule_id ])) { $next_index = pb_backupbuddy::$options['next_schedule_index']; pb_backupbuddy::$options['next_schedule_index']++; // This change will be saved in savesettings function below. pb_backupbuddy::$options['schedules'][ $schedule_id ] = $schedule; @@ -683,7 +683,7 @@ class MainWP_Child_Back_Up_Buddy { $profile_id = $_POST['profile_id']; $profile = unserialize(base64_decode($_POST['data'])); - if (!is_array($profile)) { + if ( ! is_array($profile)) { return array( 'error' => __( 'Invalid profile data', 'mainwp-child' ) ); } @@ -714,7 +714,7 @@ class MainWP_Child_Back_Up_Buddy { if ( is_array( $item_ids ) && count( $item_ids ) > 0 ) { $needs_save = false; $deleted_files = array(); - foreach( $item_ids as $item ) { + foreach ( $item_ids as $item ) { if ( file_exists( backupbuddy_core::getBackupDirectory() . $item ) ) { if ( @unlink( backupbuddy_core::getBackupDirectory() . $item ) === true ) { $deleted_files[] = $item; @@ -755,7 +755,7 @@ class MainWP_Child_Back_Up_Buddy { if ( isset( $data['syncBackupBuddy'] ) && $data['syncBackupBuddy'] ) { try { $information['syncBackupBuddy'] = $this->get_sync_data(); - } catch(Exception $e) { + } catch (Exception $e) { } } @@ -781,14 +781,14 @@ class MainWP_Child_Back_Up_Buddy { MainWP_Helper::check_methods('backupbuddy_api', array( 'getOverview' ) ); $data = array(); - $data['plugins_root'] = backupbuddy_core::get_plugins_root(); - $data['themes_root'] = backupbuddy_core::get_themes_root(); - $data['media_root'] = backupbuddy_core::get_media_root(); + $data['plugins_root'] = backupbuddy_core::get_plugins_root(); + $data['themes_root'] = backupbuddy_core::get_themes_root(); + $data['media_root'] = backupbuddy_core::get_media_root(); $data['additional_tables'] = $this->pb_additional_tables(); - $data['abspath'] = ABSPATH; + $data['abspath'] = ABSPATH; $getOverview = backupbuddy_api::getOverview(); - $data['editsSinceLastBackup'] = $getOverview['editsSinceLastBackup']; + $data['editsSinceLastBackup'] = $getOverview['editsSinceLastBackup']; if ( isset( $getOverview['lastBackupStats']['finish'] ) ) { $finish_time = $getOverview['lastBackupStats']['finish']; @@ -801,7 +801,7 @@ class MainWP_Child_Back_Up_Buddy { } return $data; - } catch(Exception $e) { + } catch (Exception $e) { // not exit here } @@ -832,7 +832,7 @@ class MainWP_Child_Back_Up_Buddy { } function save_note() { - if ( !isset( pb_backupbuddy::$classes['zipbuddy'] ) ) { + if ( ! isset( pb_backupbuddy::$classes['zipbuddy'] ) ) { require_once pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php'; pb_backupbuddy::$classes['zipbuddy'] = new pluginbuddy_zipbuddy( backupbuddy_core::getBackupDirectory() ); } @@ -874,11 +874,11 @@ class MainWP_Child_Back_Up_Buddy { $file = backupbuddy_core::getBackupDirectory() . $callback_data; if (file_exists($file)) { return array( - 'result' =>'SUCCESS', + 'result' => 'SUCCESS', 'hash' => md5_file( $file ), ); } else { - return array( 'error' =>'Not found the file' ); + return array( 'error' => 'Not found the file' ); } } @@ -929,7 +929,7 @@ class MainWP_Child_Back_Up_Buddy { $subdirs = array(); // Strip out any files/subdirs that are not actually directly under the given root - foreach( $files as $key => $file ) { + foreach ( $files as $key => $file ) { // If shorter than root length then certainly is not within this (root) directory. // It's a quick test that is more effective the longer the root (the deeper you go @@ -976,7 +976,7 @@ class MainWP_Child_Back_Up_Buddy { $subdir = substr( $unrooted_file, 0, ( $pos + 1 ) ); // Have we already seen it - if ( !in_array( $subdir, $subdirs ) ) { + if ( ! in_array( $subdir, $subdirs ) ) { // Not already seen so record we have seen it and modify this entry to be // specific for the subdir/ @@ -1012,7 +1012,7 @@ class MainWP_Child_Back_Up_Buddy { function exclude_tree() { $root = substr( ABSPATH, 0, strlen( ABSPATH ) - 1 ) . '/' . ltrim( urldecode( $_POST['dir'] ), '/\\' ); - if( file_exists( $root ) ) { + if ( file_exists( $root ) ) { $files = scandir( $root ); natcasesort( $files ); @@ -1020,11 +1020,11 @@ class MainWP_Child_Back_Up_Buddy { // Sort with directories first. $sorted_files = array(); // Temporary holder for sorting files. $sorted_directories = array(); // Temporary holder for sorting directories. - foreach( $files as $file ) { + foreach ( $files as $file ) { if ( ( $file == '.' ) || ( $file == '..' ) ) { continue; } - if( is_file( str_replace( '//', '/', $root . $file ) ) ) { + if ( is_file( str_replace( '//', '/', $root . $file ) ) ) { array_push( $sorted_files, $file ); } else { array_unshift( $sorted_directories, $file ); @@ -1037,10 +1037,10 @@ class MainWP_Child_Back_Up_Buddy { ob_start(); - if( count( $files ) > 0 ) { // Files found. + if ( count( $files ) > 0 ) { // Files found. echo '