@@ -26,6 +26,6 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | 28 | // If uninstall not called from WordPress, then exit. |
| 29 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
| 29 | +if (!defined('WP_UNINSTALL_PLUGIN')) { |
|
| 30 | 30 | exit; |
| 31 | 31 | } |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if(!isset($argv)) |
|
| 3 | +if (!isset($argv)) |
|
| 4 | 4 | die('Access denied from web.'); |
| 5 | 5 | |
| 6 | 6 | $file = 'restore/vendor.phar'; |
| 7 | 7 | |
| 8 | -if(file_exists($file)) |
|
| 8 | +if (file_exists($file)) |
|
| 9 | 9 | unlink($file); |
| 10 | 10 | $phar2 = new Phar($file, 0, 'vendor.phar'); |
| 11 | 11 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * @param string $plugin_name The name of the plugin. |
| 48 | 48 | * @param string $version The version of this plugin. |
| 49 | 49 | */ |
| 50 | - public function __construct( $plugin_name, $version ) { |
|
| 50 | + public function __construct($plugin_name, $version) { |
|
| 51 | 51 | |
| 52 | 52 | $this->plugin_name = $plugin_name; |
| 53 | 53 | $this->version = $version; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * class. |
| 74 | 74 | */ |
| 75 | 75 | |
| 76 | - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/xcloner-public.css', array(), $this->version, 'all' ); |
|
| 76 | + wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/xcloner-public.css', array(), $this->version, 'all'); |
|
| 77 | 77 | |
| 78 | 78 | } |
| 79 | 79 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * class. |
| 97 | 97 | */ |
| 98 | 98 | |
| 99 | - wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/xcloner-public.js', array( 'jquery' ), $this->version, false ); |
|
| 99 | + wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__).'js/xcloner-public.js', array('jquery'), $this->version, false); |
|
| 100 | 100 | |
| 101 | 101 | } |
| 102 | 102 | |
@@ -22,14 +22,14 @@ |
||
| 22 | 22 | { |
| 23 | 23 | $path = filter_var($option, FILTER_SANITIZE_URL); |
| 24 | 24 | |
| 25 | - try{ |
|
| 25 | + try { |
|
| 26 | 26 | $option = Util::normalizePath($path); |
| 27 | - }catch(Exception $e){ |
|
| 27 | + }catch (Exception $e) { |
|
| 28 | 28 | add_settings_error('xcloner_error_message', '', __($e->getMessage()), 'error'); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - if($path and !is_dir($path)){ |
|
| 32 | - add_settings_error('xcloner_error_message', '', __(sprintf('Invalid Server Path %s',$option)), 'error'); |
|
| 31 | + if ($path and !is_dir($path)) { |
|
| 32 | + add_settings_error('xcloner_error_message', '', __(sprintf('Invalid Server Path %s', $option)), 'error'); |
|
| 33 | 33 | return false; |
| 34 | 34 | } |
| 35 | 35 | |
@@ -35,22 +35,22 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | global $wpdb; |
| 37 | 37 | |
| 38 | - if(version_compare(phpversion(), Xcloner_Activator::xcloner_minimum_version, '<')) |
|
| 38 | + if (version_compare(phpversion(), Xcloner_Activator::xcloner_minimum_version, '<')) |
|
| 39 | 39 | { |
| 40 | - wp_die('<p>'.sprintf(__("XCloner requires minimum PHP version %s in order to run correctly. We have detected your version as %s"),Xcloner_Activator::xcloner_minimum_version, phpversion()).'</p>', __("XCloner Activation Error"), array( 'response'=>500, 'back_link'=>TRUE ) ); |
|
| 40 | + wp_die('<p>'.sprintf(__("XCloner requires minimum PHP version %s in order to run correctly. We have detected your version as %s"), Xcloner_Activator::xcloner_minimum_version, phpversion()).'</p>', __("XCloner Activation Error"), array('response'=>500, 'back_link'=>TRUE)); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | $charset_collate = $wpdb->get_charset_collate(); |
| 44 | 44 | |
| 45 | - $installed_ver = get_option( "xcloner_db_version" ); |
|
| 45 | + $installed_ver = get_option("xcloner_db_version"); |
|
| 46 | 46 | |
| 47 | 47 | $xcloner_db_version = Xcloner_Activator::xcloner_db_version; |
| 48 | 48 | |
| 49 | - if($installed_ver != $xcloner_db_version) |
|
| 49 | + if ($installed_ver != $xcloner_db_version) |
|
| 50 | 50 | { |
| 51 | - $table_name = $wpdb->prefix . "xcloner_scheduler"; |
|
| 51 | + $table_name = $wpdb->prefix."xcloner_scheduler"; |
|
| 52 | 52 | |
| 53 | - $xcloner_schedule_sql="CREATE TABLE IF NOT EXISTS `".$table_name."` ( |
|
| 53 | + $xcloner_schedule_sql = "CREATE TABLE IF NOT EXISTS `".$table_name."` ( |
|
| 54 | 54 | `id` int(11) NOT NULL AUTO_INCREMENT, |
| 55 | 55 | `name` varchar(255) NOT NULL, |
| 56 | 56 | `recurrence` varchar(10) NOT NULL, |
@@ -63,49 +63,49 @@ discard block |
||
| 63 | 63 | PRIMARY KEY (`id`) |
| 64 | 64 | ) ".$charset_collate."; |
| 65 | 65 | "; |
| 66 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
| 67 | - dbDelta( $xcloner_schedule_sql ); |
|
| 66 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
| 67 | + dbDelta($xcloner_schedule_sql); |
|
| 68 | 68 | |
| 69 | - update_option( "xcloner_db_version", $xcloner_db_version ); |
|
| 69 | + update_option("xcloner_db_version", $xcloner_db_version); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - if(!get_option('xcloner_backup_compression_level')) |
|
| 72 | + if (!get_option('xcloner_backup_compression_level')) |
|
| 73 | 73 | update_option('xcloner_backup_compression_level', 0); |
| 74 | 74 | |
| 75 | - if(!get_option('xcloner_enable_log')) |
|
| 75 | + if (!get_option('xcloner_enable_log')) |
|
| 76 | 76 | update_option('xcloner_enable_log', 1); |
| 77 | 77 | |
| 78 | - if(!get_option('xcloner_enable_mysql_backup')) |
|
| 78 | + if (!get_option('xcloner_enable_mysql_backup')) |
|
| 79 | 79 | update_option('xcloner_enable_mysql_backup', 1); |
| 80 | 80 | |
| 81 | - if(!get_option('xcloner_system_settings_page')) |
|
| 81 | + if (!get_option('xcloner_system_settings_page')) |
|
| 82 | 82 | update_option('xcloner_system_settings_page', 100); |
| 83 | 83 | |
| 84 | - if(!get_option('xcloner_files_to_process_per_request')) |
|
| 84 | + if (!get_option('xcloner_files_to_process_per_request')) |
|
| 85 | 85 | update_option('xcloner_files_to_process_per_request', 250); |
| 86 | 86 | |
| 87 | - if(!get_option('xcloner_database_records_per_request')) |
|
| 87 | + if (!get_option('xcloner_database_records_per_request')) |
|
| 88 | 88 | update_option('xcloner_database_records_per_request', 10000); |
| 89 | 89 | |
| 90 | - if(!get_option('xcloner_exclude_files_larger_than_mb')) |
|
| 90 | + if (!get_option('xcloner_exclude_files_larger_than_mb')) |
|
| 91 | 91 | update_option('xcloner_exclude_files_larger_than_mb', 0); |
| 92 | 92 | |
| 93 | - if(!get_option('xcloner_split_backup_limit')) |
|
| 93 | + if (!get_option('xcloner_split_backup_limit')) |
|
| 94 | 94 | update_option('xcloner_split_backup_limit', 2048); |
| 95 | 95 | |
| 96 | - if(!get_option('xcloner_size_limit_per_request')) |
|
| 96 | + if (!get_option('xcloner_size_limit_per_request')) |
|
| 97 | 97 | update_option('xcloner_size_limit_per_request', 50); |
| 98 | 98 | |
| 99 | - if(!get_option('xcloner_cleanup_retention_limit_days')) |
|
| 99 | + if (!get_option('xcloner_cleanup_retention_limit_days')) |
|
| 100 | 100 | update_option('xcloner_cleanup_retention_limit_days', 60); |
| 101 | 101 | |
| 102 | - if(!get_option('xcloner_cleanup_retention_limit_archives')) |
|
| 102 | + if (!get_option('xcloner_cleanup_retention_limit_archives')) |
|
| 103 | 103 | update_option('xcloner_cleanup_retention_limit_archives', 100); |
| 104 | 104 | |
| 105 | - if(!get_option('xcloner_directories_to_scan_per_request')) |
|
| 105 | + if (!get_option('xcloner_directories_to_scan_per_request')) |
|
| 106 | 106 | update_option('xcloner_directories_to_scan_per_request', 25); |
| 107 | 107 | |
| 108 | - if(!get_option('xcloner_regex_exclude')) |
|
| 108 | + if (!get_option('xcloner_regex_exclude')) |
|
| 109 | 109 | update_option('xcloner_regex_exclude', "(wp-content\/updraft|wp-content\/uploads\/wp_all_backup)(.*)$".PHP_EOL."(.*)\.(svn|git)(.*)$".PHP_EOL."wp-content\/cache(.*)$"); |
| 110 | 110 | |
| 111 | 111 | } |
@@ -88,15 +88,15 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - public function check_dependencies(){ |
|
| 91 | + public function check_dependencies() { |
|
| 92 | 92 | |
| 93 | 93 | $backup_storage_path = realpath(__DIR__.DS."..".DS."..".DS."..").DS."backups".DS; |
| 94 | 94 | |
| 95 | 95 | define("XCLONER_STORAGE_PATH", realpath($backup_storage_path)); |
| 96 | 96 | |
| 97 | - if(!is_dir($backup_storage_path)) |
|
| 97 | + if (!is_dir($backup_storage_path)) |
|
| 98 | 98 | { |
| 99 | - if(!@mkdir($backup_storage_path)) |
|
| 99 | + if (!@mkdir($backup_storage_path)) |
|
| 100 | 100 | { |
| 101 | 101 | $status = "error"; |
| 102 | 102 | $message = sprintf(__("Unable to create the Backup Storage Location Folder %s . Please fix this before starting the backup process."), $backup_storage_path); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | return; |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | - if(!is_writable($backup_storage_path)) |
|
| 107 | + if (!is_writable($backup_storage_path)) |
|
| 108 | 108 | { |
| 109 | 109 | $status = "error"; |
| 110 | 110 | $message = sprintf(__("Unable to write to the Backup Storage Location Folder %s . Please fix this before starting the backup process."), $backup_storage_path); |
@@ -118,15 +118,15 @@ discard block |
||
| 118 | 118 | public function trigger_message($message, $status = "error", $message_param1 = "", $message_param2 = "", $message_param3 = "") |
| 119 | 119 | { |
| 120 | 120 | $message = sprintf(__($message), $message_param1, $message_param2, $message_param3); |
| 121 | - add_action( 'xcloner_admin_notices', array($this,"trigger_message_notice"), 10, 2); |
|
| 122 | - do_action( 'xcloner_admin_notices', $message, $status); |
|
| 121 | + add_action('xcloner_admin_notices', array($this, "trigger_message_notice"), 10, 2); |
|
| 122 | + do_action('xcloner_admin_notices', $message, $status); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | public function trigger_message_notice($message, $status = "success") |
| 126 | 126 | { |
| 127 | 127 | ?> |
| 128 | 128 | <div class="notice notice-<?php echo $status?> is-dismissible"> |
| 129 | - <p><?php _e( $message, 'xcloner-backup-and-restore' ); ?></p> |
|
| 129 | + <p><?php _e($message, 'xcloner-backup-and-restore'); ?></p> |
|
| 130 | 130 | </div> |
| 131 | 131 | <?php |
| 132 | 132 | } |
@@ -153,79 +153,79 @@ discard block |
||
| 153 | 153 | * The class responsible for orchestrating the actions and filters of the |
| 154 | 154 | * core plugin. |
| 155 | 155 | */ |
| 156 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-loader.php'; |
|
| 156 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-loader.php'; |
|
| 157 | 157 | |
| 158 | 158 | /** |
| 159 | 159 | * The class responsible for defining internationalization functionality |
| 160 | 160 | * of the plugin. |
| 161 | 161 | */ |
| 162 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-i18n.php'; |
|
| 162 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-i18n.php'; |
|
| 163 | 163 | |
| 164 | 164 | /** |
| 165 | 165 | * The class responsible for defining all actions that occur in the admin area. |
| 166 | 166 | */ |
| 167 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-xcloner-admin.php'; |
|
| 167 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-xcloner-admin.php'; |
|
| 168 | 168 | |
| 169 | 169 | /** |
| 170 | 170 | * The class responsible for debugging XCloner. |
| 171 | 171 | */ |
| 172 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-logger.php'; |
|
| 172 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-logger.php'; |
|
| 173 | 173 | |
| 174 | 174 | /** |
| 175 | 175 | * The class responsible for defining the admin settings area. |
| 176 | 176 | */ |
| 177 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-settings.php'; |
|
| 177 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-settings.php'; |
|
| 178 | 178 | |
| 179 | 179 | /** |
| 180 | 180 | * The class responsible for defining the Remote Storage settings area. |
| 181 | 181 | */ |
| 182 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-remote-storage.php'; |
|
| 182 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-remote-storage.php'; |
|
| 183 | 183 | |
| 184 | 184 | /** |
| 185 | 185 | * The class responsible for implementing the database backup methods. |
| 186 | 186 | */ |
| 187 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-database.php'; |
|
| 187 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-database.php'; |
|
| 188 | 188 | |
| 189 | 189 | /** |
| 190 | 190 | * The class responsible for sanitization of users input. |
| 191 | 191 | */ |
| 192 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-sanitization.php'; |
|
| 192 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-sanitization.php'; |
|
| 193 | 193 | |
| 194 | 194 | /** |
| 195 | 195 | * The class responsible for XCloner system requirements validation. |
| 196 | 196 | */ |
| 197 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-requirements.php'; |
|
| 197 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-requirements.php'; |
|
| 198 | 198 | |
| 199 | 199 | /** |
| 200 | 200 | * The class responsible for XCloner backup archive creation. |
| 201 | 201 | */ |
| 202 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-archive.php'; |
|
| 202 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-archive.php'; |
|
| 203 | 203 | |
| 204 | 204 | /** |
| 205 | 205 | * The class responsible for XCloner API requests. |
| 206 | 206 | */ |
| 207 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-api.php'; |
|
| 207 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-api.php'; |
|
| 208 | 208 | |
| 209 | 209 | /** |
| 210 | 210 | * The class responsible for the XCloner File System methods. |
| 211 | 211 | */ |
| 212 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-file-system.php'; |
|
| 212 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-file-system.php'; |
|
| 213 | 213 | |
| 214 | 214 | /** |
| 215 | 215 | * The class responsible for the XCloner File Transfer methods. |
| 216 | 216 | */ |
| 217 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-file-transfer.php'; |
|
| 217 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-file-transfer.php'; |
|
| 218 | 218 | |
| 219 | 219 | /** |
| 220 | 220 | * The class responsible for the XCloner Scheduler methods. |
| 221 | 221 | */ |
| 222 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-scheduler.php'; |
|
| 222 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-scheduler.php'; |
|
| 223 | 223 | |
| 224 | 224 | /** |
| 225 | 225 | * The class responsible for defining all actions that occur in the public-facing |
| 226 | 226 | * side of the site. |
| 227 | 227 | */ |
| 228 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-xcloner-public.php'; |
|
| 228 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-xcloner-public.php'; |
|
| 229 | 229 | |
| 230 | 230 | $this->loader = new Xcloner_Loader(); |
| 231 | 231 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | $plugin_i18n = new Xcloner_i18n(); |
| 246 | 246 | |
| 247 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 247 | + $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
|
| 248 | 248 | |
| 249 | 249 | //wp_localize_script( 'ajax-script', 'my_ajax_object', |
| 250 | 250 | // array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); |
@@ -260,11 +260,11 @@ discard block |
||
| 260 | 260 | */ |
| 261 | 261 | private function define_admin_hooks() { |
| 262 | 262 | |
| 263 | - $plugin_admin = new Xcloner_Admin( $this->get_plugin_name(), $this->get_version() ); |
|
| 263 | + $plugin_admin = new Xcloner_Admin($this->get_plugin_name(), $this->get_version()); |
|
| 264 | 264 | $this->plugin_admin = $plugin_admin; |
| 265 | 265 | |
| 266 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 267 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 266 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
|
| 267 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts'); |
|
| 268 | 268 | |
| 269 | 269 | } |
| 270 | 270 | |
@@ -273,13 +273,13 @@ discard block |
||
| 273 | 273 | * |
| 274 | 274 | * @access private |
| 275 | 275 | */ |
| 276 | - private function define_admin_menu(){ |
|
| 276 | + private function define_admin_menu() { |
|
| 277 | 277 | |
| 278 | 278 | add_action('admin_menu', array($this->loader, 'xcloner_backup_add_admin_menu')); |
| 279 | 279 | |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - private function define_plugin_settings(){ |
|
| 282 | + private function define_plugin_settings() { |
|
| 283 | 283 | /** |
| 284 | 284 | * register wporg_settings_init to the admin_init action hook |
| 285 | 285 | */ |
@@ -296,10 +296,10 @@ discard block |
||
| 296 | 296 | */ |
| 297 | 297 | private function define_public_hooks() { |
| 298 | 298 | |
| 299 | - $plugin_public = new Xcloner_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 299 | + $plugin_public = new Xcloner_Public($this->get_plugin_name(), $this->get_version()); |
|
| 300 | 300 | |
| 301 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 302 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 301 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
| 302 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
| 303 | 303 | |
| 304 | 304 | } |
| 305 | 305 | |
@@ -308,20 +308,20 @@ discard block |
||
| 308 | 308 | $logger = new XCloner_Logger("php_system"); |
| 309 | 309 | $error = error_get_last(); |
| 310 | 310 | |
| 311 | - if($error['type'] and $logger) |
|
| 311 | + if ($error['type'] and $logger) |
|
| 312 | 312 | { |
| 313 | - $logger->info($this->friendly_error_type ($error['type']).": ".var_export($error, true)); |
|
| 313 | + $logger->info($this->friendly_error_type($error['type']).": ".var_export($error, true)); |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | function friendly_error_type($type) { |
| 319 | - static $levels=null; |
|
| 320 | - if ($levels===null) { |
|
| 321 | - $levels=[]; |
|
| 319 | + static $levels = null; |
|
| 320 | + if ($levels === null) { |
|
| 321 | + $levels = []; |
|
| 322 | 322 | foreach (get_defined_constants() as $key=>$value) { |
| 323 | - if (strpos($key,'E_')!==0) {continue;} |
|
| 324 | - $levels[$value]= $key; //substr($key,2); |
|
| 323 | + if (strpos($key, 'E_') !== 0) {continue; } |
|
| 324 | + $levels[$value] = $key; //substr($key,2); |
|
| 325 | 325 | } |
| 326 | 326 | } |
| 327 | 327 | return (isset($levels[$type]) ? $levels[$type] : "Error #{$type}"); |
@@ -329,30 +329,30 @@ discard block |
||
| 329 | 329 | |
| 330 | 330 | private function define_ajax_hooks() |
| 331 | 331 | { |
| 332 | - $plugin_public = new Xcloner_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 332 | + $plugin_public = new Xcloner_Public($this->get_plugin_name(), $this->get_version()); |
|
| 333 | 333 | //$this->loader->add_action( 'wp_ajax_get_database_tables_action', $plugin_public, array('Xcloner_Api','get_database_tables_action') ); |
| 334 | 334 | |
| 335 | - if(is_admin()) |
|
| 335 | + if (is_admin()) |
|
| 336 | 336 | { |
| 337 | 337 | $xcloner_api = new Xcloner_Api(); |
| 338 | 338 | |
| 339 | - add_action( 'wp_ajax_get_database_tables_action' , array($xcloner_api,'get_database_tables_action') ); |
|
| 340 | - add_action( 'wp_ajax_get_file_system_action' , array($xcloner_api,'get_file_system_action') ); |
|
| 341 | - add_action( 'wp_ajax_scan_filesystem' , array($xcloner_api,'scan_filesystem') ); |
|
| 342 | - add_action( 'wp_ajax_backup_database' , array($xcloner_api,'backup_database') ); |
|
| 343 | - add_action( 'wp_ajax_backup_files' , array($xcloner_api,'backup_files') ); |
|
| 344 | - add_action( 'wp_ajax_save_schedule' , array($xcloner_api,'save_schedule') ); |
|
| 345 | - add_action( 'wp_ajax_get_schedule_by_id' , array($xcloner_api,'get_schedule_by_id') ); |
|
| 346 | - add_action( 'wp_ajax_get_scheduler_list' , array($xcloner_api,'get_scheduler_list') ); |
|
| 347 | - add_action( 'wp_ajax_delete_schedule_by_id' , array($xcloner_api,'delete_schedule_by_id') ); |
|
| 348 | - add_action( 'wp_ajax_delete_backup_by_name' , array($xcloner_api,'delete_backup_by_name') ); |
|
| 349 | - add_action( 'wp_ajax_download_backup_by_name' , array($xcloner_api,'download_backup_by_name') ); |
|
| 350 | - add_action( 'wp_ajax_remote_storage_save_status' , array($xcloner_api,'remote_storage_save_status') ); |
|
| 351 | - add_action( 'wp_ajax_upload_backup_to_remote' , array($xcloner_api,'upload_backup_to_remote') ); |
|
| 352 | - add_action( 'wp_ajax_list_backup_files' , array($xcloner_api,'list_backup_files') ); |
|
| 353 | - add_action( 'wp_ajax_restore_upload_backup' , array($xcloner_api,'restore_upload_backup') ); |
|
| 354 | - add_action( 'wp_ajax_download_restore_script' , array($xcloner_api,'download_restore_script') ); |
|
| 355 | - add_action( 'admin_notices', array($this, 'xcloner_error_admin_notices' )); |
|
| 339 | + add_action('wp_ajax_get_database_tables_action', array($xcloner_api, 'get_database_tables_action')); |
|
| 340 | + add_action('wp_ajax_get_file_system_action', array($xcloner_api, 'get_file_system_action')); |
|
| 341 | + add_action('wp_ajax_scan_filesystem', array($xcloner_api, 'scan_filesystem')); |
|
| 342 | + add_action('wp_ajax_backup_database', array($xcloner_api, 'backup_database')); |
|
| 343 | + add_action('wp_ajax_backup_files', array($xcloner_api, 'backup_files')); |
|
| 344 | + add_action('wp_ajax_save_schedule', array($xcloner_api, 'save_schedule')); |
|
| 345 | + add_action('wp_ajax_get_schedule_by_id', array($xcloner_api, 'get_schedule_by_id')); |
|
| 346 | + add_action('wp_ajax_get_scheduler_list', array($xcloner_api, 'get_scheduler_list')); |
|
| 347 | + add_action('wp_ajax_delete_schedule_by_id', array($xcloner_api, 'delete_schedule_by_id')); |
|
| 348 | + add_action('wp_ajax_delete_backup_by_name', array($xcloner_api, 'delete_backup_by_name')); |
|
| 349 | + add_action('wp_ajax_download_backup_by_name', array($xcloner_api, 'download_backup_by_name')); |
|
| 350 | + add_action('wp_ajax_remote_storage_save_status', array($xcloner_api, 'remote_storage_save_status')); |
|
| 351 | + add_action('wp_ajax_upload_backup_to_remote', array($xcloner_api, 'upload_backup_to_remote')); |
|
| 352 | + add_action('wp_ajax_list_backup_files', array($xcloner_api, 'list_backup_files')); |
|
| 353 | + add_action('wp_ajax_restore_upload_backup', array($xcloner_api, 'restore_upload_backup')); |
|
| 354 | + add_action('wp_ajax_download_restore_script', array($xcloner_api, 'download_restore_script')); |
|
| 355 | + add_action('admin_notices', array($this, 'xcloner_error_admin_notices')); |
|
| 356 | 356 | |
| 357 | 357 | //if (is_admin()) { |
| 358 | 358 | add_filter('plugin_action_links', array($this, 'add_plugin_action_links'), 10, 2); |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | function add_plugin_action_links($links, $file) { |
| 364 | - if ($file == plugin_basename(dirname(dirname(__FILE__)) . '/xcloner.php')) |
|
| 364 | + if ($file == plugin_basename(dirname(dirname(__FILE__)).'/xcloner.php')) |
|
| 365 | 365 | { |
| 366 | 366 | $links[] = '<a href="admin.php?page=xcloner_settings_page">'.__('Settings', 'xcloner-backup-and-restore').'</a>'; |
| 367 | 367 | $links[] = '<a href="admin.php?page=xcloner_generate_backups_page">'.__('Generate Backup', 'xcloner-backup-and-restore').'</a>'; |
@@ -371,13 +371,13 @@ discard block |
||
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | public function xcloner_error_admin_notices() { |
| 374 | - settings_errors( 'xcloner_error_message' ); |
|
| 374 | + settings_errors('xcloner_error_message'); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | public function define_cron_hooks() |
| 378 | 378 | { |
| 379 | 379 | //registering new schedule intervals |
| 380 | - add_filter( 'cron_schedules', array($this, 'add_new_intervals')); |
|
| 380 | + add_filter('cron_schedules', array($this, 'add_new_intervals')); |
|
| 381 | 381 | |
| 382 | 382 | |
| 383 | 383 | $xcloner_scheduler = new Xcloner_Scheduler(); |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | |
| 452 | 452 | public function display($page) |
| 453 | 453 | { |
| 454 | - $plugin_admin = new Xcloner_Admin( $this->get_plugin_name(), $this->get_version() ); |
|
| 454 | + $plugin_admin = new Xcloner_Admin($this->get_plugin_name(), $this->get_version()); |
|
| 455 | 455 | $this->plugin_admin = $plugin_admin; |
| 456 | 456 | |
| 457 | 457 | $view = call_user_func_array(array($this->plugin_admin, $page), array()); |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | * @since 1.0.0 |
| 31 | 31 | */ |
| 32 | 32 | public static function deactivate() { |
| 33 | - if(class_exists('Xcloner_Scheduler')) |
|
| 33 | + if (class_exists('Xcloner_Scheduler')) |
|
| 34 | 34 | { |
| 35 | 35 | $xcloner_scheduler = new Xcloner_Scheduler(); |
| 36 | 36 | $xcloner_scheduler->deactivate_wp_cron_hooks(); |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | load_plugin_textdomain( |
| 38 | 38 | 'xcloner-backup-and-restore', |
| 39 | 39 | false, |
| 40 | - dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' |
|
| 40 | + dirname(dirname(plugin_basename(__FILE__))).'/languages/' |
|
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | 43 | } |
@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | 28 | // If this file is called directly, abort. |
| 29 | -if ( ! defined( 'WPINC' ) ) { |
|
| 29 | +if (!defined('WPINC')) { |
|
| 30 | 30 | die; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | //i will not load the plugin outside admin or cron |
| 34 | -if(!is_admin() and !defined('DOING_CRON')) |
|
| 34 | +if (!is_admin() and !defined('DOING_CRON')) |
|
| 35 | 35 | return; |
| 36 | 36 | |
| 37 | 37 | define("DS", DIRECTORY_SEPARATOR); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | function activate_xcloner() |
| 44 | 44 | { |
| 45 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-xcloner-activator.php'; |
|
| 45 | + require_once plugin_dir_path(__FILE__).'includes/class-xcloner-activator.php'; |
|
| 46 | 46 | Xcloner_Activator::activate(); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -52,31 +52,31 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | function deactivate_xcloner() |
| 54 | 54 | { |
| 55 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-xcloner-deactivator.php'; |
|
| 55 | + require_once plugin_dir_path(__FILE__).'includes/class-xcloner-deactivator.php'; |
|
| 56 | 56 | Xcloner_Deactivator::deactivate(); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | -register_activation_hook( __FILE__, 'activate_xcloner' ); |
|
| 60 | -register_deactivation_hook( __FILE__, 'deactivate_xcloner' ); |
|
| 59 | +register_activation_hook(__FILE__, 'activate_xcloner'); |
|
| 60 | +register_deactivation_hook(__FILE__, 'deactivate_xcloner'); |
|
| 61 | 61 | |
| 62 | -require_once plugin_dir_path( __FILE__ ) . 'includes/class-xcloner-activator.php'; |
|
| 62 | +require_once plugin_dir_path(__FILE__).'includes/class-xcloner-activator.php'; |
|
| 63 | 63 | |
| 64 | -if(version_compare(phpversion(), Xcloner_Activator::xcloner_minimum_version, '<')) |
|
| 64 | +if (version_compare(phpversion(), Xcloner_Activator::xcloner_minimum_version, '<')) |
|
| 65 | 65 | { |
| 66 | 66 | ?> |
| 67 | 67 | <div class="error notice"> |
| 68 | - <p><?php echo sprintf(__("XCloner requires minimum PHP version %s in order to run correctly. We have detected your version as %s. Plugin is now deactivated."),Xcloner_Activator::xcloner_minimum_version, phpversion())?></p> |
|
| 68 | + <p><?php echo sprintf(__("XCloner requires minimum PHP version %s in order to run correctly. We have detected your version as %s. Plugin is now deactivated."), Xcloner_Activator::xcloner_minimum_version, phpversion())?></p> |
|
| 69 | 69 | </div> |
| 70 | 70 | <?php |
| 71 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
| 72 | - deactivate_plugins( plugin_basename( __FILE__ ) ); |
|
| 71 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
| 72 | + deactivate_plugins(plugin_basename(__FILE__)); |
|
| 73 | 73 | return; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | -$db_installed_ver = get_option( "xcloner_db_version" ); |
|
| 76 | +$db_installed_ver = get_option("xcloner_db_version"); |
|
| 77 | 77 | $xcloner_db_version = Xcloner_Activator::xcloner_db_version; |
| 78 | 78 | |
| 79 | -if($db_installed_ver != $xcloner_db_version) |
|
| 79 | +if ($db_installed_ver != $xcloner_db_version) |
|
| 80 | 80 | { |
| 81 | 81 | Xcloner_Activator::activate(); |
| 82 | 82 | } |
@@ -91,9 +91,9 @@ discard block |
||
| 91 | 91 | wp_deregister_script('heartbeat'); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | -if(isset($_GET['page']) and stristr($_GET['page'] , "xcloner_")) |
|
| 94 | +if (isset($_GET['page']) and stristr($_GET['page'], "xcloner_")) |
|
| 95 | 95 | { |
| 96 | - add_action( 'init', 'stop_heartbeat', 1 ); |
|
| 96 | + add_action('init', 'stop_heartbeat', 1); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | function xcloner_display() |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | $page = sanitize_key($_GET['page']); |
| 107 | 107 | $plugin = new Xcloner(); |
| 108 | - if($page) |
|
| 108 | + if ($page) |
|
| 109 | 109 | { |
| 110 | 110 | $plugin->display($page); |
| 111 | 111 | } |
@@ -130,12 +130,12 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | -require_once(plugin_dir_path( __FILE__ ) . '/vendor/autoload.php'); |
|
| 134 | -require plugin_dir_path( __FILE__ ) . 'includes/class-xcloner.php'; |
|
| 133 | +require_once(plugin_dir_path(__FILE__).'/vendor/autoload.php'); |
|
| 134 | +require plugin_dir_path(__FILE__).'includes/class-xcloner.php'; |
|
| 135 | 135 | |
| 136 | -try{ |
|
| 136 | +try { |
|
| 137 | 137 | run_xcloner(); |
| 138 | -}catch(Exception $e) |
|
| 138 | +}catch (Exception $e) |
|
| 139 | 139 | { |
| 140 | 140 | echo $e->getMessage(); |
| 141 | 141 | } |