@@ -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 | } |
@@ -69,44 +69,57 @@ |
||
| 69 | 69 | update_option( "xcloner_db_version", $xcloner_db_version ); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - if(!get_option('xcloner_backup_compression_level')) |
|
| 73 | - update_option('xcloner_backup_compression_level', 0); |
|
| 72 | + if(!get_option('xcloner_backup_compression_level')) { |
|
| 73 | + update_option('xcloner_backup_compression_level', 0); |
|
| 74 | + } |
|
| 74 | 75 | |
| 75 | - if(!get_option('xcloner_enable_log')) |
|
| 76 | - update_option('xcloner_enable_log', 1); |
|
| 76 | + if(!get_option('xcloner_enable_log')) { |
|
| 77 | + update_option('xcloner_enable_log', 1); |
|
| 78 | + } |
|
| 77 | 79 | |
| 78 | - if(!get_option('xcloner_enable_mysql_backup')) |
|
| 79 | - update_option('xcloner_enable_mysql_backup', 1); |
|
| 80 | + if(!get_option('xcloner_enable_mysql_backup')) { |
|
| 81 | + update_option('xcloner_enable_mysql_backup', 1); |
|
| 82 | + } |
|
| 80 | 83 | |
| 81 | - if(!get_option('xcloner_system_settings_page')) |
|
| 82 | - update_option('xcloner_system_settings_page', 100); |
|
| 84 | + if(!get_option('xcloner_system_settings_page')) { |
|
| 85 | + update_option('xcloner_system_settings_page', 100); |
|
| 86 | + } |
|
| 83 | 87 | |
| 84 | - if(!get_option('xcloner_files_to_process_per_request')) |
|
| 85 | - update_option('xcloner_files_to_process_per_request', 250); |
|
| 88 | + if(!get_option('xcloner_files_to_process_per_request')) { |
|
| 89 | + update_option('xcloner_files_to_process_per_request', 250); |
|
| 90 | + } |
|
| 86 | 91 | |
| 87 | - if(!get_option('xcloner_database_records_per_request')) |
|
| 88 | - update_option('xcloner_database_records_per_request', 10000); |
|
| 92 | + if(!get_option('xcloner_database_records_per_request')) { |
|
| 93 | + update_option('xcloner_database_records_per_request', 10000); |
|
| 94 | + } |
|
| 89 | 95 | |
| 90 | - if(!get_option('xcloner_exclude_files_larger_than_mb')) |
|
| 91 | - update_option('xcloner_exclude_files_larger_than_mb', 0); |
|
| 96 | + if(!get_option('xcloner_exclude_files_larger_than_mb')) { |
|
| 97 | + update_option('xcloner_exclude_files_larger_than_mb', 0); |
|
| 98 | + } |
|
| 92 | 99 | |
| 93 | - if(!get_option('xcloner_split_backup_limit')) |
|
| 94 | - update_option('xcloner_split_backup_limit', 2048); |
|
| 100 | + if(!get_option('xcloner_split_backup_limit')) { |
|
| 101 | + update_option('xcloner_split_backup_limit', 2048); |
|
| 102 | + } |
|
| 95 | 103 | |
| 96 | - if(!get_option('xcloner_size_limit_per_request')) |
|
| 97 | - update_option('xcloner_size_limit_per_request', 50); |
|
| 104 | + if(!get_option('xcloner_size_limit_per_request')) { |
|
| 105 | + update_option('xcloner_size_limit_per_request', 50); |
|
| 106 | + } |
|
| 98 | 107 | |
| 99 | - if(!get_option('xcloner_cleanup_retention_limit_days')) |
|
| 100 | - update_option('xcloner_cleanup_retention_limit_days', 60); |
|
| 108 | + if(!get_option('xcloner_cleanup_retention_limit_days')) { |
|
| 109 | + update_option('xcloner_cleanup_retention_limit_days', 60); |
|
| 110 | + } |
|
| 101 | 111 | |
| 102 | - if(!get_option('xcloner_cleanup_retention_limit_archives')) |
|
| 103 | - update_option('xcloner_cleanup_retention_limit_archives', 100); |
|
| 112 | + if(!get_option('xcloner_cleanup_retention_limit_archives')) { |
|
| 113 | + update_option('xcloner_cleanup_retention_limit_archives', 100); |
|
| 114 | + } |
|
| 104 | 115 | |
| 105 | - if(!get_option('xcloner_directories_to_scan_per_request')) |
|
| 106 | - update_option('xcloner_directories_to_scan_per_request', 25); |
|
| 116 | + if(!get_option('xcloner_directories_to_scan_per_request')) { |
|
| 117 | + update_option('xcloner_directories_to_scan_per_request', 25); |
|
| 118 | + } |
|
| 107 | 119 | |
| 108 | - if(!get_option('xcloner_regex_exclude')) |
|
| 109 | - update_option('xcloner_regex_exclude', "(wp-content\/updraft|wp-content\/uploads\/wp_all_backup)(.*)$".PHP_EOL."(.*)\.(svn|git)(.*)$".PHP_EOL."wp-content\/cache(.*)$"); |
|
| 120 | + if(!get_option('xcloner_regex_exclude')) { |
|
| 121 | + update_option('xcloner_regex_exclude', "(wp-content\/updraft|wp-content\/uploads\/wp_all_backup)(.*)$".PHP_EOL."(.*)\.(svn|git)(.*)$".PHP_EOL."wp-content\/cache(.*)$"); |
|
| 122 | + } |
|
| 110 | 123 | |
| 111 | 124 | } |
| 112 | 125 | |
@@ -194,348 +194,348 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | public function settings_init() |
| 196 | 196 | { |
| 197 | - global $wpdb; |
|
| 198 | - $this->xcloner_sanitization = new Xcloner_Sanitization(); |
|
| 197 | + global $wpdb; |
|
| 198 | + $this->xcloner_sanitization = new Xcloner_Sanitization(); |
|
| 199 | 199 | |
| 200 | - //ADDING MISSING OPTIONS |
|
| 201 | - if( false == get_option( 'xcloner_mysql_settings_page' ) ) { |
|
| 200 | + //ADDING MISSING OPTIONS |
|
| 201 | + if( false == get_option( 'xcloner_mysql_settings_page' ) ) { |
|
| 202 | 202 | add_option( 'xcloner_mysql_settings_page' ); |
| 203 | 203 | } // end if |
| 204 | 204 | |
| 205 | - if( false == get_option( 'xcloner_cron_settings_page' ) ) { |
|
| 205 | + if( false == get_option( 'xcloner_cron_settings_page' ) ) { |
|
| 206 | 206 | add_option( 'xcloner_cron_settings_page' ); |
| 207 | 207 | } // end if |
| 208 | 208 | |
| 209 | - if( false == get_option( 'xcloner_system_settings_page' ) ) { |
|
| 209 | + if( false == get_option( 'xcloner_system_settings_page' ) ) { |
|
| 210 | 210 | add_option( 'xcloner_system_settings_page' ); |
| 211 | 211 | } // end if |
| 212 | 212 | |
| 213 | - if( false == get_option( 'xcloner_cleanup_settings_page' ) ) { |
|
| 213 | + if( false == get_option( 'xcloner_cleanup_settings_page' ) ) { |
|
| 214 | 214 | add_option( 'xcloner_cleanup_settings_page' ); |
| 215 | 215 | } // end if |
| 216 | 216 | |
| 217 | 217 | |
| 218 | - //ADDING SETTING SECTIONS |
|
| 219 | - //GENERAL section |
|
| 220 | - add_settings_section( |
|
| 221 | - 'xcloner_general_settings_group', |
|
| 222 | - __(' '), |
|
| 223 | - array($this, 'xcloner_settings_section_cb'), |
|
| 224 | - 'xcloner_settings_page' |
|
| 225 | - ); |
|
| 226 | - //MYSQL section |
|
| 227 | - add_settings_section( |
|
| 228 | - 'xcloner_mysql_settings_group', |
|
| 229 | - __(' '), |
|
| 230 | - array($this, 'xcloner_settings_section_cb'), |
|
| 231 | - 'xcloner_mysql_settings_page' |
|
| 232 | - ); |
|
| 218 | + //ADDING SETTING SECTIONS |
|
| 219 | + //GENERAL section |
|
| 220 | + add_settings_section( |
|
| 221 | + 'xcloner_general_settings_group', |
|
| 222 | + __(' '), |
|
| 223 | + array($this, 'xcloner_settings_section_cb'), |
|
| 224 | + 'xcloner_settings_page' |
|
| 225 | + ); |
|
| 226 | + //MYSQL section |
|
| 227 | + add_settings_section( |
|
| 228 | + 'xcloner_mysql_settings_group', |
|
| 229 | + __(' '), |
|
| 230 | + array($this, 'xcloner_settings_section_cb'), |
|
| 231 | + 'xcloner_mysql_settings_page' |
|
| 232 | + ); |
|
| 233 | 233 | |
| 234 | - //SYSTEM section |
|
| 235 | - add_settings_section( |
|
| 236 | - 'xcloner_system_settings_group', |
|
| 237 | - __('These are advanced options recommended for developers!','xcloner-backup-and-restore'), |
|
| 238 | - array($this, 'xcloner_settings_section_cb'), |
|
| 239 | - 'xcloner_system_settings_page' |
|
| 240 | - ); |
|
| 234 | + //SYSTEM section |
|
| 235 | + add_settings_section( |
|
| 236 | + 'xcloner_system_settings_group', |
|
| 237 | + __('These are advanced options recommended for developers!','xcloner-backup-and-restore'), |
|
| 238 | + array($this, 'xcloner_settings_section_cb'), |
|
| 239 | + 'xcloner_system_settings_page' |
|
| 240 | + ); |
|
| 241 | 241 | |
| 242 | - //CLEANUP section |
|
| 243 | - add_settings_section( |
|
| 244 | - 'xcloner_cleanup_settings_group', |
|
| 245 | - __(' '), |
|
| 246 | - array($this, 'xcloner_settings_section_cb'), |
|
| 247 | - 'xcloner_cleanup_settings_page' |
|
| 248 | - ); |
|
| 242 | + //CLEANUP section |
|
| 243 | + add_settings_section( |
|
| 244 | + 'xcloner_cleanup_settings_group', |
|
| 245 | + __(' '), |
|
| 246 | + array($this, 'xcloner_settings_section_cb'), |
|
| 247 | + 'xcloner_cleanup_settings_page' |
|
| 248 | + ); |
|
| 249 | 249 | |
| 250 | 250 | |
| 251 | 251 | //CRON section |
| 252 | - add_settings_section( |
|
| 253 | - 'xcloner_cron_settings_group', |
|
| 254 | - __(' '), |
|
| 255 | - array($this, 'xcloner_settings_section_cb'), |
|
| 256 | - 'xcloner_cron_settings_page' |
|
| 257 | - ); |
|
| 252 | + add_settings_section( |
|
| 253 | + 'xcloner_cron_settings_group', |
|
| 254 | + __(' '), |
|
| 255 | + array($this, 'xcloner_settings_section_cb'), |
|
| 256 | + 'xcloner_cron_settings_page' |
|
| 257 | + ); |
|
| 258 | 258 | |
| 259 | 259 | |
| 260 | 260 | |
| 261 | 261 | //REGISTERING THE 'GENERAL SECTION' FIELDS |
| 262 | 262 | register_setting('xcloner_general_settings_group', 'xcloner_backup_compression_level', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 263 | - add_settings_field( |
|
| 264 | - 'xcloner_backup_compression_level', |
|
| 265 | - __('Backup Compression Level','xcloner-backup-and-restore'), |
|
| 266 | - array($this, 'do_form_range_field'), |
|
| 267 | - 'xcloner_settings_page', |
|
| 268 | - 'xcloner_general_settings_group', |
|
| 269 | - array('xcloner_backup_compression_level', |
|
| 270 | - __('Options between [0-9]. Value 0 means no compression, while 9 is maximum compression affecting cpu load','xcloner-backup-and-restore'), |
|
| 271 | - 0, |
|
| 272 | - 9 |
|
| 273 | - ) |
|
| 274 | - ); |
|
| 263 | + add_settings_field( |
|
| 264 | + 'xcloner_backup_compression_level', |
|
| 265 | + __('Backup Compression Level','xcloner-backup-and-restore'), |
|
| 266 | + array($this, 'do_form_range_field'), |
|
| 267 | + 'xcloner_settings_page', |
|
| 268 | + 'xcloner_general_settings_group', |
|
| 269 | + array('xcloner_backup_compression_level', |
|
| 270 | + __('Options between [0-9]. Value 0 means no compression, while 9 is maximum compression affecting cpu load','xcloner-backup-and-restore'), |
|
| 271 | + 0, |
|
| 272 | + 9 |
|
| 273 | + ) |
|
| 274 | + ); |
|
| 275 | 275 | |
| 276 | - register_setting('xcloner_general_settings_group', 'xcloner_start_path', array($this->xcloner_sanitization, "sanitize_input_as_absolute_path")); |
|
| 277 | - add_settings_field( |
|
| 278 | - 'xcloner_start_path', |
|
| 279 | - __('Backup Start Location','xcloner-backup-and-restore'), |
|
| 280 | - array($this, 'do_form_text_field'), |
|
| 281 | - 'xcloner_settings_page', |
|
| 282 | - 'xcloner_general_settings_group', |
|
| 283 | - array('xcloner_start_path', |
|
| 276 | + register_setting('xcloner_general_settings_group', 'xcloner_start_path', array($this->xcloner_sanitization, "sanitize_input_as_absolute_path")); |
|
| 277 | + add_settings_field( |
|
| 278 | + 'xcloner_start_path', |
|
| 279 | + __('Backup Start Location','xcloner-backup-and-restore'), |
|
| 280 | + array($this, 'do_form_text_field'), |
|
| 281 | + 'xcloner_settings_page', |
|
| 282 | + 'xcloner_general_settings_group', |
|
| 283 | + array('xcloner_start_path', |
|
| 284 | 284 | __('Base path location from where XCloner can start the Backup.','xcloner-backup-and-restore'), |
| 285 | 285 | $this->get_xcloner_start_path(), |
| 286 | 286 | //'disabled' |
| 287 | 287 | ) |
| 288 | - ); |
|
| 288 | + ); |
|
| 289 | 289 | |
| 290 | - register_setting('xcloner_general_settings_group', 'xcloner_store_path', array($this->xcloner_sanitization, "sanitize_input_as_absolute_path")); |
|
| 291 | - add_settings_field( |
|
| 292 | - 'xcloner_store_path', |
|
| 293 | - __('Backup Storage Location','xcloner-backup-and-restore'), |
|
| 294 | - array($this, 'do_form_text_field'), |
|
| 295 | - 'xcloner_settings_page', |
|
| 296 | - 'xcloner_general_settings_group', |
|
| 297 | - array('xcloner_store_path', |
|
| 290 | + register_setting('xcloner_general_settings_group', 'xcloner_store_path', array($this->xcloner_sanitization, "sanitize_input_as_absolute_path")); |
|
| 291 | + add_settings_field( |
|
| 292 | + 'xcloner_store_path', |
|
| 293 | + __('Backup Storage Location','xcloner-backup-and-restore'), |
|
| 294 | + array($this, 'do_form_text_field'), |
|
| 295 | + 'xcloner_settings_page', |
|
| 296 | + 'xcloner_general_settings_group', |
|
| 297 | + array('xcloner_store_path', |
|
| 298 | 298 | __('Location where XCloner will store the Backup archives.','xcloner-backup-and-restore'), |
| 299 | 299 | $this->get_xcloner_store_path(), |
| 300 | 300 | //'disabled' |
| 301 | 301 | ) |
| 302 | - ); |
|
| 302 | + ); |
|
| 303 | 303 | |
| 304 | - register_setting('xcloner_general_settings_group', 'xcloner_enable_log', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
|
| 305 | - add_settings_field( |
|
| 306 | - 'xcloner_enable_log', |
|
| 307 | - __('Enable XCloner Backup Log','xcloner-backup-and-restore'), |
|
| 308 | - array($this, 'do_form_switch_field'), |
|
| 309 | - 'xcloner_settings_page', |
|
| 310 | - 'xcloner_general_settings_group', |
|
| 311 | - array('xcloner_enable_log', |
|
| 304 | + register_setting('xcloner_general_settings_group', 'xcloner_enable_log', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
|
| 305 | + add_settings_field( |
|
| 306 | + 'xcloner_enable_log', |
|
| 307 | + __('Enable XCloner Backup Log','xcloner-backup-and-restore'), |
|
| 308 | + array($this, 'do_form_switch_field'), |
|
| 309 | + 'xcloner_settings_page', |
|
| 310 | + 'xcloner_general_settings_group', |
|
| 311 | + array('xcloner_enable_log', |
|
| 312 | 312 | sprintf(__('Enable the XCloner Backup log. You will find it stored unde the Backup Storage Location, file %s','xcloner-backup-and-restore'), $this->get_logger_filename()) |
| 313 | 313 | ) |
| 314 | 314 | ); |
| 315 | 315 | |
| 316 | 316 | register_setting('xcloner_general_settings_group', 'xcloner_regex_exclude', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
| 317 | - add_settings_field( |
|
| 318 | - 'xcloner_regex_exclude', |
|
| 319 | - __('Regex Exclude Files','xcloner-backup-and-restore'), |
|
| 320 | - array($this, 'do_form_textarea_field'), |
|
| 321 | - 'xcloner_settings_page', |
|
| 322 | - 'xcloner_general_settings_group', |
|
| 323 | - array('xcloner_regex_exclude', |
|
| 317 | + add_settings_field( |
|
| 318 | + 'xcloner_regex_exclude', |
|
| 319 | + __('Regex Exclude Files','xcloner-backup-and-restore'), |
|
| 320 | + array($this, 'do_form_textarea_field'), |
|
| 321 | + 'xcloner_settings_page', |
|
| 322 | + 'xcloner_general_settings_group', |
|
| 323 | + array('xcloner_regex_exclude', |
|
| 324 | 324 | __('Regular expression match to exclude files and folders, example patterns provided below, one pattern per line','xcloner-backup-and-restore'), |
| 325 | 325 | //$this->get_xcloner_store_path(), |
| 326 | 326 | //'disabled' |
| 327 | 327 | ) |
| 328 | - ); |
|
| 328 | + ); |
|
| 329 | 329 | |
| 330 | 330 | //REGISTERING THE 'MYSQL SECTION' FIELDS |
| 331 | 331 | register_setting('xcloner_mysql_settings_group', 'xcloner_enable_mysql_backup', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 332 | - add_settings_field( |
|
| 333 | - 'xcloner_enable_mysql_backup', |
|
| 334 | - __('Enable Mysql Backup','xcloner-backup-and-restore'), |
|
| 335 | - array($this, 'do_form_switch_field'), |
|
| 336 | - 'xcloner_mysql_settings_page', |
|
| 337 | - 'xcloner_mysql_settings_group', |
|
| 338 | - array('xcloner_enable_mysql_backup', |
|
| 332 | + add_settings_field( |
|
| 333 | + 'xcloner_enable_mysql_backup', |
|
| 334 | + __('Enable Mysql Backup','xcloner-backup-and-restore'), |
|
| 335 | + array($this, 'do_form_switch_field'), |
|
| 336 | + 'xcloner_mysql_settings_page', |
|
| 337 | + 'xcloner_mysql_settings_group', |
|
| 338 | + array('xcloner_enable_mysql_backup', |
|
| 339 | 339 | __('Enable Mysql Backup Option. If you don\'t want to backup the database, you can disable this.','xcloner-backup-and-restore') |
| 340 | 340 | ) |
| 341 | - ); |
|
| 341 | + ); |
|
| 342 | 342 | |
| 343 | - register_setting('xcloner_mysql_settings_group', 'xcloner_backup_only_wp_tables'); |
|
| 344 | - add_settings_field( |
|
| 345 | - 'xcloner_backup_only_wp_tables', |
|
| 346 | - __('Backup only WP tables','xcloner-backup-and-restore'), |
|
| 347 | - array($this, 'do_form_switch_field'), |
|
| 348 | - 'xcloner_mysql_settings_page', |
|
| 349 | - 'xcloner_mysql_settings_group', |
|
| 350 | - array('xcloner_backup_only_wp_tables', |
|
| 343 | + register_setting('xcloner_mysql_settings_group', 'xcloner_backup_only_wp_tables'); |
|
| 344 | + add_settings_field( |
|
| 345 | + 'xcloner_backup_only_wp_tables', |
|
| 346 | + __('Backup only WP tables','xcloner-backup-and-restore'), |
|
| 347 | + array($this, 'do_form_switch_field'), |
|
| 348 | + 'xcloner_mysql_settings_page', |
|
| 349 | + 'xcloner_mysql_settings_group', |
|
| 350 | + array('xcloner_backup_only_wp_tables', |
|
| 351 | 351 | sprintf(__('Enable this if you only want to Backup only tables starting with \'%s\' prefix','xcloner-backup-and-restore'), $this->get_table_prefix()) |
| 352 | 352 | ) |
| 353 | - ); |
|
| 353 | + ); |
|
| 354 | 354 | |
| 355 | - register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_hostname', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
|
| 356 | - add_settings_field( |
|
| 357 | - 'xcloner_mysql_hostname', |
|
| 358 | - __('Mysql Hostname','xcloner-backup-and-restore'), |
|
| 359 | - array($this, 'do_form_text_field'), |
|
| 360 | - 'xcloner_mysql_settings_page', |
|
| 361 | - 'xcloner_mysql_settings_group', |
|
| 362 | - array('xcloner_mysql_hostname', |
|
| 355 | + register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_hostname', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
|
| 356 | + add_settings_field( |
|
| 357 | + 'xcloner_mysql_hostname', |
|
| 358 | + __('Mysql Hostname','xcloner-backup-and-restore'), |
|
| 359 | + array($this, 'do_form_text_field'), |
|
| 360 | + 'xcloner_mysql_settings_page', |
|
| 361 | + 'xcloner_mysql_settings_group', |
|
| 362 | + array('xcloner_mysql_hostname', |
|
| 363 | 363 | __('Wordpress mysql hostname','xcloner-backup-and-restore'), |
| 364 | 364 | $this->get_db_hostname(), |
| 365 | 365 | 'disabled' |
| 366 | 366 | ) |
| 367 | - ); |
|
| 367 | + ); |
|
| 368 | 368 | |
| 369 | - register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_username', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
|
| 370 | - add_settings_field( |
|
| 371 | - 'xcloner_mysql_username', |
|
| 372 | - __('Mysql Username','xcloner-backup-and-restore'), |
|
| 373 | - array($this, 'do_form_text_field'), |
|
| 374 | - 'xcloner_mysql_settings_page', |
|
| 375 | - 'xcloner_mysql_settings_group', |
|
| 376 | - array('xcloner_mysql_username', |
|
| 369 | + register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_username', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
|
| 370 | + add_settings_field( |
|
| 371 | + 'xcloner_mysql_username', |
|
| 372 | + __('Mysql Username','xcloner-backup-and-restore'), |
|
| 373 | + array($this, 'do_form_text_field'), |
|
| 374 | + 'xcloner_mysql_settings_page', |
|
| 375 | + 'xcloner_mysql_settings_group', |
|
| 376 | + array('xcloner_mysql_username', |
|
| 377 | 377 | __('Wordpress mysql username','xcloner-backup-and-restore'), |
| 378 | 378 | $this->get_db_username(), |
| 379 | 379 | 'disabled' |
| 380 | 380 | ) |
| 381 | - ); |
|
| 381 | + ); |
|
| 382 | 382 | |
| 383 | - register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_database', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
|
| 384 | - add_settings_field( |
|
| 385 | - 'xcloner_mysql_database', |
|
| 386 | - __('Mysql Database','xcloner-backup-and-restore'), |
|
| 387 | - array($this, 'do_form_text_field'), |
|
| 388 | - 'xcloner_mysql_settings_page', |
|
| 389 | - 'xcloner_mysql_settings_group', |
|
| 390 | - array('xcloner_mysql_database', |
|
| 383 | + register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_database', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
|
| 384 | + add_settings_field( |
|
| 385 | + 'xcloner_mysql_database', |
|
| 386 | + __('Mysql Database','xcloner-backup-and-restore'), |
|
| 387 | + array($this, 'do_form_text_field'), |
|
| 388 | + 'xcloner_mysql_settings_page', |
|
| 389 | + 'xcloner_mysql_settings_group', |
|
| 390 | + array('xcloner_mysql_database', |
|
| 391 | 391 | __('Wordpress mysql database','xcloner-backup-and-restore'), |
| 392 | 392 | $this->get_db_database(), |
| 393 | 393 | 'disabled' |
| 394 | 394 | ) |
| 395 | - ); |
|
| 395 | + ); |
|
| 396 | 396 | |
| 397 | - //REGISTERING THE 'SYSTEM SECTION' FIELDS |
|
| 398 | - register_setting('xcloner_system_settings_group', 'xcloner_size_limit_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
|
| 399 | - add_settings_field( |
|
| 400 | - 'xcloner_size_limit_per_request', |
|
| 401 | - __('Data Size Limit Per Request','xcloner-backup-and-restore'), |
|
| 402 | - array($this, 'do_form_range_field'), |
|
| 403 | - 'xcloner_system_settings_page', |
|
| 404 | - 'xcloner_system_settings_group', |
|
| 405 | - array('xcloner_size_limit_per_request', |
|
| 406 | - __('Use this option to set how much file data can XCloner backup in one AJAX request. Range 0-1024 MB','xcloner-backup-and-restore'), |
|
| 407 | - 0, |
|
| 408 | - 1024 |
|
| 409 | - ) |
|
| 410 | - ); |
|
| 397 | + //REGISTERING THE 'SYSTEM SECTION' FIELDS |
|
| 398 | + register_setting('xcloner_system_settings_group', 'xcloner_size_limit_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
|
| 399 | + add_settings_field( |
|
| 400 | + 'xcloner_size_limit_per_request', |
|
| 401 | + __('Data Size Limit Per Request','xcloner-backup-and-restore'), |
|
| 402 | + array($this, 'do_form_range_field'), |
|
| 403 | + 'xcloner_system_settings_page', |
|
| 404 | + 'xcloner_system_settings_group', |
|
| 405 | + array('xcloner_size_limit_per_request', |
|
| 406 | + __('Use this option to set how much file data can XCloner backup in one AJAX request. Range 0-1024 MB','xcloner-backup-and-restore'), |
|
| 407 | + 0, |
|
| 408 | + 1024 |
|
| 409 | + ) |
|
| 410 | + ); |
|
| 411 | 411 | |
| 412 | 412 | register_setting('xcloner_system_settings_group', 'xcloner_files_to_process_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 413 | - add_settings_field( |
|
| 414 | - 'xcloner_files_to_process_per_request', |
|
| 415 | - __('Files To Process Per Request','xcloner-backup-and-restore'), |
|
| 416 | - array($this, 'do_form_range_field'), |
|
| 417 | - 'xcloner_system_settings_page', |
|
| 418 | - 'xcloner_system_settings_group', |
|
| 419 | - array('xcloner_files_to_process_per_request', |
|
| 420 | - __('Use this option to set how many files XCloner should process at one time before doing another AJAX call','xcloner-backup-and-restore'), |
|
| 421 | - 0, |
|
| 422 | - 1000 |
|
| 423 | - ) |
|
| 424 | - ); |
|
| 413 | + add_settings_field( |
|
| 414 | + 'xcloner_files_to_process_per_request', |
|
| 415 | + __('Files To Process Per Request','xcloner-backup-and-restore'), |
|
| 416 | + array($this, 'do_form_range_field'), |
|
| 417 | + 'xcloner_system_settings_page', |
|
| 418 | + 'xcloner_system_settings_group', |
|
| 419 | + array('xcloner_files_to_process_per_request', |
|
| 420 | + __('Use this option to set how many files XCloner should process at one time before doing another AJAX call','xcloner-backup-and-restore'), |
|
| 421 | + 0, |
|
| 422 | + 1000 |
|
| 423 | + ) |
|
| 424 | + ); |
|
| 425 | 425 | |
| 426 | 426 | register_setting('xcloner_system_settings_group', 'xcloner_directories_to_scan_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 427 | - add_settings_field( |
|
| 428 | - 'xcloner_directories_to_scan_per_request', |
|
| 429 | - __('Directories To Scan Per Request','xcloner-backup-and-restore'), |
|
| 430 | - array($this, 'do_form_range_field'), |
|
| 431 | - 'xcloner_system_settings_page', |
|
| 432 | - 'xcloner_system_settings_group', |
|
| 433 | - array('xcloner_directories_to_scan_per_request', |
|
| 434 | - __('Use this option to set how many directories XCloner should scan at one time before doing another AJAX call','xcloner-backup-and-restore'), |
|
| 435 | - 0, |
|
| 436 | - 1000 |
|
| 437 | - ) |
|
| 438 | - ); |
|
| 427 | + add_settings_field( |
|
| 428 | + 'xcloner_directories_to_scan_per_request', |
|
| 429 | + __('Directories To Scan Per Request','xcloner-backup-and-restore'), |
|
| 430 | + array($this, 'do_form_range_field'), |
|
| 431 | + 'xcloner_system_settings_page', |
|
| 432 | + 'xcloner_system_settings_group', |
|
| 433 | + array('xcloner_directories_to_scan_per_request', |
|
| 434 | + __('Use this option to set how many directories XCloner should scan at one time before doing another AJAX call','xcloner-backup-and-restore'), |
|
| 435 | + 0, |
|
| 436 | + 1000 |
|
| 437 | + ) |
|
| 438 | + ); |
|
| 439 | 439 | |
| 440 | 440 | register_setting('xcloner_system_settings_group', 'xcloner_database_records_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 441 | - add_settings_field( |
|
| 442 | - 'xcloner_database_records_per_request', |
|
| 443 | - __('Database Records Per Request','xcloner-backup-and-restore'), |
|
| 444 | - array($this, 'do_form_range_field'), |
|
| 445 | - 'xcloner_system_settings_page', |
|
| 446 | - 'xcloner_system_settings_group', |
|
| 447 | - array('xcloner_database_records_per_request', |
|
| 448 | - __('Use this option to set how many database table records should be fetched per AJAX request, or set to 0 to fetch all. Range 0-100000 records','xcloner-backup-and-restore'), |
|
| 449 | - 0, |
|
| 450 | - 100000 |
|
| 451 | - ) |
|
| 452 | - ); |
|
| 441 | + add_settings_field( |
|
| 442 | + 'xcloner_database_records_per_request', |
|
| 443 | + __('Database Records Per Request','xcloner-backup-and-restore'), |
|
| 444 | + array($this, 'do_form_range_field'), |
|
| 445 | + 'xcloner_system_settings_page', |
|
| 446 | + 'xcloner_system_settings_group', |
|
| 447 | + array('xcloner_database_records_per_request', |
|
| 448 | + __('Use this option to set how many database table records should be fetched per AJAX request, or set to 0 to fetch all. Range 0-100000 records','xcloner-backup-and-restore'), |
|
| 449 | + 0, |
|
| 450 | + 100000 |
|
| 451 | + ) |
|
| 452 | + ); |
|
| 453 | 453 | |
| 454 | 454 | register_setting('xcloner_system_settings_group', 'xcloner_exclude_files_larger_than_mb', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 455 | - add_settings_field( |
|
| 456 | - 'xcloner_exclude_files_larger_than_mb', |
|
| 457 | - __('Exclude files larger than (MB)','xcloner-backup-and-restore'), |
|
| 458 | - array($this, 'do_form_number_field'), |
|
| 459 | - 'xcloner_system_settings_page', |
|
| 460 | - 'xcloner_system_settings_group', |
|
| 461 | - array('xcloner_exclude_files_larger_than_mb', |
|
| 462 | - __('Use this option to automatically exclude files larger than a certain size in MB, or set to -1 to include all. Range 0-1000 MB','xcloner-backup-and-restore'), |
|
| 463 | - ) |
|
| 464 | - ); |
|
| 455 | + add_settings_field( |
|
| 456 | + 'xcloner_exclude_files_larger_than_mb', |
|
| 457 | + __('Exclude files larger than (MB)','xcloner-backup-and-restore'), |
|
| 458 | + array($this, 'do_form_number_field'), |
|
| 459 | + 'xcloner_system_settings_page', |
|
| 460 | + 'xcloner_system_settings_group', |
|
| 461 | + array('xcloner_exclude_files_larger_than_mb', |
|
| 462 | + __('Use this option to automatically exclude files larger than a certain size in MB, or set to -1 to include all. Range 0-1000 MB','xcloner-backup-and-restore'), |
|
| 463 | + ) |
|
| 464 | + ); |
|
| 465 | 465 | |
| 466 | 466 | register_setting('xcloner_system_settings_group', 'xcloner_split_backup_limit', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 467 | - add_settings_field( |
|
| 468 | - 'xcloner_split_backup_limit', |
|
| 469 | - __('Split Backup Archive Limit (MB)','xcloner-backup-and-restore'), |
|
| 470 | - array($this, 'do_form_number_field'), |
|
| 471 | - 'xcloner_system_settings_page', |
|
| 472 | - 'xcloner_system_settings_group', |
|
| 473 | - array('xcloner_split_backup_limit', |
|
| 474 | - __('Use this option to automatically split the backup archive into smaller parts. Range 0-10000 MB','xcloner-backup-and-restore'), |
|
| 475 | - ) |
|
| 476 | - ); |
|
| 467 | + add_settings_field( |
|
| 468 | + 'xcloner_split_backup_limit', |
|
| 469 | + __('Split Backup Archive Limit (MB)','xcloner-backup-and-restore'), |
|
| 470 | + array($this, 'do_form_number_field'), |
|
| 471 | + 'xcloner_system_settings_page', |
|
| 472 | + 'xcloner_system_settings_group', |
|
| 473 | + array('xcloner_split_backup_limit', |
|
| 474 | + __('Use this option to automatically split the backup archive into smaller parts. Range 0-10000 MB','xcloner-backup-and-restore'), |
|
| 475 | + ) |
|
| 476 | + ); |
|
| 477 | 477 | |
| 478 | - register_setting('xcloner_system_settings_group', 'xcloner_force_tmp_path_site_root'); |
|
| 479 | - add_settings_field( |
|
| 480 | - 'xcloner_force_tmp_path_site_root', |
|
| 481 | - __('Force Temporary Path Within XCloner Storage','xcloner-backup-and-restore'), |
|
| 482 | - array($this, 'do_form_switch_field'), |
|
| 483 | - 'xcloner_system_settings_page', |
|
| 484 | - 'xcloner_system_settings_group', |
|
| 485 | - array('xcloner_force_tmp_path_site_root', |
|
| 478 | + register_setting('xcloner_system_settings_group', 'xcloner_force_tmp_path_site_root'); |
|
| 479 | + add_settings_field( |
|
| 480 | + 'xcloner_force_tmp_path_site_root', |
|
| 481 | + __('Force Temporary Path Within XCloner Storage','xcloner-backup-and-restore'), |
|
| 482 | + array($this, 'do_form_switch_field'), |
|
| 483 | + 'xcloner_system_settings_page', |
|
| 484 | + 'xcloner_system_settings_group', |
|
| 485 | + array('xcloner_force_tmp_path_site_root', |
|
| 486 | 486 | sprintf(__('Enable this option if you want the XCloner Temporary Path to be within your XCloner Storage Location','xcloner-backup-and-restore'), $this->get_table_prefix()) |
| 487 | 487 | ) |
| 488 | - ); |
|
| 488 | + ); |
|
| 489 | 489 | |
| 490 | 490 | //REGISTERING THE 'CLEANUP SECTION' FIELDS |
| 491 | 491 | register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_retention_limit_days', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 492 | - add_settings_field( |
|
| 493 | - 'xcloner_cleanup_retention_limit_days', |
|
| 494 | - __('Cleanup by Date(days)','xcloner-backup-and-restore'), |
|
| 495 | - array($this, 'do_form_number_field'), |
|
| 496 | - 'xcloner_cleanup_settings_page', |
|
| 497 | - 'xcloner_cleanup_settings_group', |
|
| 498 | - array('xcloner_cleanup_retention_limit_days', |
|
| 492 | + add_settings_field( |
|
| 493 | + 'xcloner_cleanup_retention_limit_days', |
|
| 494 | + __('Cleanup by Date(days)','xcloner-backup-and-restore'), |
|
| 495 | + array($this, 'do_form_number_field'), |
|
| 496 | + 'xcloner_cleanup_settings_page', |
|
| 497 | + 'xcloner_cleanup_settings_group', |
|
| 498 | + array('xcloner_cleanup_retention_limit_days', |
|
| 499 | 499 | __('Specify the maximum number of days a backup archive can be kept on the server. 0 disables this option','xcloner-backup-and-restore') |
| 500 | 500 | ) |
| 501 | - ); |
|
| 501 | + ); |
|
| 502 | 502 | |
| 503 | 503 | register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_retention_limit_archives', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 504 | - add_settings_field( |
|
| 505 | - 'xcloner_cleanup_retention_limit_archives', |
|
| 506 | - __('Cleanup by Quantity','xcloner-backup-and-restore'), |
|
| 507 | - array($this, 'do_form_number_field'), |
|
| 508 | - 'xcloner_cleanup_settings_page', |
|
| 509 | - 'xcloner_cleanup_settings_group', |
|
| 510 | - array('xcloner_cleanup_retention_limit_archives', |
|
| 504 | + add_settings_field( |
|
| 505 | + 'xcloner_cleanup_retention_limit_archives', |
|
| 506 | + __('Cleanup by Quantity','xcloner-backup-and-restore'), |
|
| 507 | + array($this, 'do_form_number_field'), |
|
| 508 | + 'xcloner_cleanup_settings_page', |
|
| 509 | + 'xcloner_cleanup_settings_group', |
|
| 510 | + array('xcloner_cleanup_retention_limit_archives', |
|
| 511 | 511 | __('Specify the maximum number of backup archives to keep on the server. 0 disables this option','xcloner-backup-and-restore') |
| 512 | 512 | ) |
| 513 | - ); |
|
| 513 | + ); |
|
| 514 | 514 | |
| 515 | 515 | register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_capacity_limit', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 516 | - add_settings_field( |
|
| 517 | - 'xcloner_cleanup_capacity_limit', |
|
| 518 | - __('Cleanup by Capacity(MB)','xcloner-backup-and-restore'), |
|
| 519 | - array($this, 'do_form_number_field'), |
|
| 520 | - 'xcloner_cleanup_settings_page', |
|
| 521 | - 'xcloner_cleanup_settings_group', |
|
| 522 | - array('xcloner_cleanup_capacity_limit', |
|
| 516 | + add_settings_field( |
|
| 517 | + 'xcloner_cleanup_capacity_limit', |
|
| 518 | + __('Cleanup by Capacity(MB)','xcloner-backup-and-restore'), |
|
| 519 | + array($this, 'do_form_number_field'), |
|
| 520 | + 'xcloner_cleanup_settings_page', |
|
| 521 | + 'xcloner_cleanup_settings_group', |
|
| 522 | + array('xcloner_cleanup_capacity_limit', |
|
| 523 | 523 | __('Remove oldest backups if all created backups exceed the configured limit in Megabytes. 0 disables this option','xcloner-backup-and-restore') |
| 524 | 524 | ) |
| 525 | - ); |
|
| 525 | + ); |
|
| 526 | 526 | |
| 527 | 527 | //REGISTERING THE 'CRON SECTION' FIELDS |
| 528 | 528 | register_setting('xcloner_cron_settings_group', 'xcloner_cron_frequency'); |
| 529 | - add_settings_field( |
|
| 530 | - 'xcloner_cron_frequency', |
|
| 531 | - __('Cron frequency','xcloner-backup-and-restore'), |
|
| 532 | - array($this, 'do_form_text_field'), |
|
| 533 | - 'xcloner_cron_settings_page', |
|
| 534 | - 'xcloner_cron_settings_group', |
|
| 535 | - array('xcloner_cron_frequency', |
|
| 529 | + add_settings_field( |
|
| 530 | + 'xcloner_cron_frequency', |
|
| 531 | + __('Cron frequency','xcloner-backup-and-restore'), |
|
| 532 | + array($this, 'do_form_text_field'), |
|
| 533 | + 'xcloner_cron_settings_page', |
|
| 534 | + 'xcloner_cron_settings_group', |
|
| 535 | + array('xcloner_cron_frequency', |
|
| 536 | 536 | __('Cron frequency') |
| 537 | 537 | ) |
| 538 | - ); |
|
| 538 | + ); |
|
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | // section content cb |
| 549 | 549 | public function xcloner_settings_section_cb() |
| 550 | 550 | { |
| 551 | - //echo '<p>WPOrg Section Introduction.</p>'; |
|
| 551 | + //echo '<p>WPOrg Section Introduction.</p>'; |
|
| 552 | 552 | } |
| 553 | 553 | |
| 554 | 554 | // text field content cb |
@@ -563,8 +563,8 @@ discard block |
||
| 563 | 563 | |
| 564 | 564 | if(!$value) |
| 565 | 565 | $value = get_option($fieldname); |
| 566 | - // output the field |
|
| 567 | - ?> |
|
| 566 | + // output the field |
|
| 567 | + ?> |
|
| 568 | 568 | <div class="row"> |
| 569 | 569 | <div class="input-field col s10 m10 l8"> |
| 570 | 570 | <input class="validate" <?php echo ($disabled)?"disabled":""?> name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" type="text" class="validate" value="<?php echo isset($value) ? esc_attr($value) : ''; ?>"> |
@@ -590,8 +590,8 @@ discard block |
||
| 590 | 590 | |
| 591 | 591 | if(!$value) |
| 592 | 592 | $value = get_option($fieldname); |
| 593 | - // output the field |
|
| 594 | - ?> |
|
| 593 | + // output the field |
|
| 594 | + ?> |
|
| 595 | 595 | <div class="row"> |
| 596 | 596 | <div class="input-field col s10 m10 l8"> |
| 597 | 597 | <textarea class="validate" <?php echo ($disabled)?"disabled":""?> name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" type="text" class="validate" value=""><?php echo isset($value) ? esc_attr($value) : ''; ?></textarea> |
@@ -633,8 +633,8 @@ discard block |
||
| 633 | 633 | |
| 634 | 634 | if(!$value) |
| 635 | 635 | $value = get_option($fieldname); |
| 636 | - // output the field |
|
| 637 | - ?> |
|
| 636 | + // output the field |
|
| 637 | + ?> |
|
| 638 | 638 | <div class="row"> |
| 639 | 639 | <div class="input-field col s10 m5 l3"> |
| 640 | 640 | <input class="validate" <?php echo ($disabled)?"disabled":""?> name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" type="number" class="validate" value="<?php echo isset($value) ? esc_attr($value) : ''; ?>"> |
@@ -4,17 +4,17 @@ discard block |
||
| 4 | 4 | { |
| 5 | 5 | private $logger_file = "xcloner_main_%s.log"; |
| 6 | 6 | private $logger_file_hash = "xcloner%s.log"; |
| 7 | - private $hash ; |
|
| 7 | + private $hash; |
|
| 8 | 8 | |
| 9 | 9 | public function __construct($hash = "") |
| 10 | 10 | { |
| 11 | - if(isset($hash)) |
|
| 11 | + if (isset($hash)) |
|
| 12 | 12 | $this->set_hash($hash); |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | public function get_logger_filename($include_hash = 0) |
| 16 | 16 | { |
| 17 | - if($include_hash) |
|
| 17 | + if ($include_hash) |
|
| 18 | 18 | $filename = sprintf($this->logger_file_hash, $this->get_hash()); |
| 19 | 19 | else |
| 20 | 20 | $filename = sprintf($this->logger_file, $this->get_server_unique_hash(5)); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | public function get_xcloner_start_path() |
| 26 | 26 | { |
| 27 | - if(!get_option('xcloner_start_path') or !is_dir(get_option('xcloner_start_path'))) |
|
| 27 | + if (!get_option('xcloner_start_path') or !is_dir(get_option('xcloner_start_path'))) |
|
| 28 | 28 | $path = realpath(ABSPATH); |
| 29 | 29 | else |
| 30 | 30 | $path = get_option('xcloner_start_path'); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function get_xcloner_store_path() |
| 43 | 43 | { |
| 44 | - if(!get_option('xcloner_store_path') or !is_dir(get_option('xcloner_store_path'))) |
|
| 44 | + if (!get_option('xcloner_store_path') or !is_dir(get_option('xcloner_store_path'))) |
|
| 45 | 45 | $path = realpath(XCLONER_STORAGE_PATH); |
| 46 | 46 | else |
| 47 | 47 | $path = get_option('xcloner_store_path'); |
@@ -58,13 +58,13 @@ discard block |
||
| 58 | 58 | public function get_xcloner_tmp_path() |
| 59 | 59 | { |
| 60 | 60 | $path = sys_get_temp_dir().DS.".".$this->get_xcloner_tmp_path_suffix(); |
| 61 | - if(!is_dir($path)) |
|
| 61 | + if (!is_dir($path)) |
|
| 62 | 62 | { |
| 63 | 63 | @mkdir($path); |
| 64 | 64 | @chmod($path, 0777); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - if(!is_dir($path) or !is_writeable($path) or get_option('xcloner_force_tmp_path_site_root')) |
|
| 67 | + if (!is_dir($path) or !is_writeable($path) or get_option('xcloner_force_tmp_path_site_root')) |
|
| 68 | 68 | $path = $this->get_xcloner_store_path().DS.".".$this->get_xcloner_tmp_path_suffix(); |
| 69 | 69 | |
| 70 | 70 | return $path; |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | public function get_enable_mysql_backup() |
| 74 | 74 | { |
| 75 | - if(get_option('xcloner_enable_mysql_backup')) |
|
| 75 | + if (get_option('xcloner_enable_mysql_backup')) |
|
| 76 | 76 | return true; |
| 77 | 77 | |
| 78 | 78 | return false; |
@@ -80,9 +80,9 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | public function get_backup_extension_name($ext = "") |
| 82 | 82 | { |
| 83 | - if(!$ext) |
|
| 83 | + if (!$ext) |
|
| 84 | 84 | { |
| 85 | - if(get_option('xcloner_backup_compression_level')) |
|
| 85 | + if (get_option('xcloner_backup_compression_level')) |
|
| 86 | 86 | $ext = ".tgz"; |
| 87 | 87 | else |
| 88 | 88 | $ext = ".tar"; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | public function get_hash() |
| 94 | 94 | { |
| 95 | - if(!$this->hash){ |
|
| 95 | + if (!$this->hash) { |
|
| 96 | 96 | $this->set_hash("-".$this->get_server_unique_hash(5)); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -104,17 +104,17 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | $hash = "-".md5(rand()); |
| 106 | 106 | |
| 107 | - $this->set_hash(substr( $hash, 0, 6)); |
|
| 107 | + $this->set_hash(substr($hash, 0, 6)); |
|
| 108 | 108 | |
| 109 | 109 | return $hash; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | public function set_hash($hash = "") |
| 113 | 113 | { |
| 114 | - if(substr($hash, 0, 1) != "-" and strlen($hash)) |
|
| 114 | + if (substr($hash, 0, 1) != "-" and strlen($hash)) |
|
| 115 | 115 | $hash = "-".$hash; |
| 116 | 116 | |
| 117 | - $this->hash = substr( $hash, 0, 6); |
|
| 117 | + $this->hash = substr($hash, 0, 6); |
|
| 118 | 118 | |
| 119 | 119 | return $this; |
| 120 | 120 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | { |
| 124 | 124 | $data = parse_url(get_site_url()); |
| 125 | 125 | |
| 126 | - $backup_name = "backup_[domain]".(isset($data['port'])?":".$data['port']:"")."-[time]-".($this->get_enable_mysql_backup()?"sql":"nosql"); |
|
| 126 | + $backup_name = "backup_[domain]".(isset($data['port']) ? ":".$data['port'] : "")."-[time]-".($this->get_enable_mysql_backup() ? "sql" : "nosql"); |
|
| 127 | 127 | |
| 128 | 128 | return $backup_name; |
| 129 | 129 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | { |
| 133 | 133 | global $wpdb; |
| 134 | 134 | |
| 135 | - if(!$data = get_option('xcloner_mysql_hostname')) |
|
| 135 | + if (!$data = get_option('xcloner_mysql_hostname')) |
|
| 136 | 136 | $data = $wpdb->dbhost; |
| 137 | 137 | |
| 138 | 138 | return $data; |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | { |
| 143 | 143 | global $wpdb; |
| 144 | 144 | |
| 145 | - if(!$data = get_option('xcloner_mysql_username')) |
|
| 145 | + if (!$data = get_option('xcloner_mysql_username')) |
|
| 146 | 146 | $data = $wpdb->dbuser; |
| 147 | 147 | |
| 148 | 148 | return $data; |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | { |
| 153 | 153 | global $wpdb; |
| 154 | 154 | |
| 155 | - if(!$data = get_option('xcloner_mysql_password')) |
|
| 155 | + if (!$data = get_option('xcloner_mysql_password')) |
|
| 156 | 156 | $data = $wpdb->dbpassword; |
| 157 | 157 | |
| 158 | 158 | return $data; |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | { |
| 163 | 163 | global $wpdb; |
| 164 | 164 | |
| 165 | - if(!$data = get_option('xcloner_mysql_database')) |
|
| 165 | + if (!$data = get_option('xcloner_mysql_database')) |
|
| 166 | 166 | $data = $wpdb->dbname; |
| 167 | 167 | |
| 168 | 168 | return $data; |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | { |
| 187 | 187 | $hash = md5(get_home_url().__DIR__); |
| 188 | 188 | |
| 189 | - if($strlen) |
|
| 189 | + if ($strlen) |
|
| 190 | 190 | $hash = substr($hash, 0, $strlen); |
| 191 | 191 | |
| 192 | 192 | return $hash; |
@@ -198,20 +198,20 @@ discard block |
||
| 198 | 198 | $this->xcloner_sanitization = new Xcloner_Sanitization(); |
| 199 | 199 | |
| 200 | 200 | //ADDING MISSING OPTIONS |
| 201 | - if( false == get_option( 'xcloner_mysql_settings_page' ) ) { |
|
| 202 | - add_option( 'xcloner_mysql_settings_page' ); |
|
| 201 | + if (false == get_option('xcloner_mysql_settings_page')) { |
|
| 202 | + add_option('xcloner_mysql_settings_page'); |
|
| 203 | 203 | } // end if |
| 204 | 204 | |
| 205 | - if( false == get_option( 'xcloner_cron_settings_page' ) ) { |
|
| 206 | - add_option( 'xcloner_cron_settings_page' ); |
|
| 205 | + if (false == get_option('xcloner_cron_settings_page')) { |
|
| 206 | + add_option('xcloner_cron_settings_page'); |
|
| 207 | 207 | } // end if |
| 208 | 208 | |
| 209 | - if( false == get_option( 'xcloner_system_settings_page' ) ) { |
|
| 210 | - add_option( 'xcloner_system_settings_page' ); |
|
| 209 | + if (false == get_option('xcloner_system_settings_page')) { |
|
| 210 | + add_option('xcloner_system_settings_page'); |
|
| 211 | 211 | } // end if |
| 212 | 212 | |
| 213 | - if( false == get_option( 'xcloner_cleanup_settings_page' ) ) { |
|
| 214 | - add_option( 'xcloner_cleanup_settings_page' ); |
|
| 213 | + if (false == get_option('xcloner_cleanup_settings_page')) { |
|
| 214 | + add_option('xcloner_cleanup_settings_page'); |
|
| 215 | 215 | } // end if |
| 216 | 216 | |
| 217 | 217 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | //SYSTEM section |
| 235 | 235 | add_settings_section( |
| 236 | 236 | 'xcloner_system_settings_group', |
| 237 | - __('These are advanced options recommended for developers!','xcloner-backup-and-restore'), |
|
| 237 | + __('These are advanced options recommended for developers!', 'xcloner-backup-and-restore'), |
|
| 238 | 238 | array($this, 'xcloner_settings_section_cb'), |
| 239 | 239 | 'xcloner_system_settings_page' |
| 240 | 240 | ); |
@@ -262,12 +262,12 @@ discard block |
||
| 262 | 262 | register_setting('xcloner_general_settings_group', 'xcloner_backup_compression_level', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 263 | 263 | add_settings_field( |
| 264 | 264 | 'xcloner_backup_compression_level', |
| 265 | - __('Backup Compression Level','xcloner-backup-and-restore'), |
|
| 265 | + __('Backup Compression Level', 'xcloner-backup-and-restore'), |
|
| 266 | 266 | array($this, 'do_form_range_field'), |
| 267 | 267 | 'xcloner_settings_page', |
| 268 | 268 | 'xcloner_general_settings_group', |
| 269 | 269 | array('xcloner_backup_compression_level', |
| 270 | - __('Options between [0-9]. Value 0 means no compression, while 9 is maximum compression affecting cpu load','xcloner-backup-and-restore'), |
|
| 270 | + __('Options between [0-9]. Value 0 means no compression, while 9 is maximum compression affecting cpu load', 'xcloner-backup-and-restore'), |
|
| 271 | 271 | 0, |
| 272 | 272 | 9 |
| 273 | 273 | ) |
@@ -276,12 +276,12 @@ discard block |
||
| 276 | 276 | register_setting('xcloner_general_settings_group', 'xcloner_start_path', array($this->xcloner_sanitization, "sanitize_input_as_absolute_path")); |
| 277 | 277 | add_settings_field( |
| 278 | 278 | 'xcloner_start_path', |
| 279 | - __('Backup Start Location','xcloner-backup-and-restore'), |
|
| 279 | + __('Backup Start Location', 'xcloner-backup-and-restore'), |
|
| 280 | 280 | array($this, 'do_form_text_field'), |
| 281 | 281 | 'xcloner_settings_page', |
| 282 | 282 | 'xcloner_general_settings_group', |
| 283 | 283 | array('xcloner_start_path', |
| 284 | - __('Base path location from where XCloner can start the Backup.','xcloner-backup-and-restore'), |
|
| 284 | + __('Base path location from where XCloner can start the Backup.', 'xcloner-backup-and-restore'), |
|
| 285 | 285 | $this->get_xcloner_start_path(), |
| 286 | 286 | //'disabled' |
| 287 | 287 | ) |
@@ -290,12 +290,12 @@ discard block |
||
| 290 | 290 | register_setting('xcloner_general_settings_group', 'xcloner_store_path', array($this->xcloner_sanitization, "sanitize_input_as_absolute_path")); |
| 291 | 291 | add_settings_field( |
| 292 | 292 | 'xcloner_store_path', |
| 293 | - __('Backup Storage Location','xcloner-backup-and-restore'), |
|
| 293 | + __('Backup Storage Location', 'xcloner-backup-and-restore'), |
|
| 294 | 294 | array($this, 'do_form_text_field'), |
| 295 | 295 | 'xcloner_settings_page', |
| 296 | 296 | 'xcloner_general_settings_group', |
| 297 | 297 | array('xcloner_store_path', |
| 298 | - __('Location where XCloner will store the Backup archives.','xcloner-backup-and-restore'), |
|
| 298 | + __('Location where XCloner will store the Backup archives.', 'xcloner-backup-and-restore'), |
|
| 299 | 299 | $this->get_xcloner_store_path(), |
| 300 | 300 | //'disabled' |
| 301 | 301 | ) |
@@ -304,24 +304,24 @@ discard block |
||
| 304 | 304 | register_setting('xcloner_general_settings_group', 'xcloner_enable_log', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 305 | 305 | add_settings_field( |
| 306 | 306 | 'xcloner_enable_log', |
| 307 | - __('Enable XCloner Backup Log','xcloner-backup-and-restore'), |
|
| 307 | + __('Enable XCloner Backup Log', 'xcloner-backup-and-restore'), |
|
| 308 | 308 | array($this, 'do_form_switch_field'), |
| 309 | 309 | 'xcloner_settings_page', |
| 310 | 310 | 'xcloner_general_settings_group', |
| 311 | 311 | array('xcloner_enable_log', |
| 312 | - sprintf(__('Enable the XCloner Backup log. You will find it stored unde the Backup Storage Location, file %s','xcloner-backup-and-restore'), $this->get_logger_filename()) |
|
| 312 | + sprintf(__('Enable the XCloner Backup log. You will find it stored unde the Backup Storage Location, file %s', 'xcloner-backup-and-restore'), $this->get_logger_filename()) |
|
| 313 | 313 | ) |
| 314 | 314 | ); |
| 315 | 315 | |
| 316 | 316 | register_setting('xcloner_general_settings_group', 'xcloner_regex_exclude', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
| 317 | 317 | add_settings_field( |
| 318 | 318 | 'xcloner_regex_exclude', |
| 319 | - __('Regex Exclude Files','xcloner-backup-and-restore'), |
|
| 319 | + __('Regex Exclude Files', 'xcloner-backup-and-restore'), |
|
| 320 | 320 | array($this, 'do_form_textarea_field'), |
| 321 | 321 | 'xcloner_settings_page', |
| 322 | 322 | 'xcloner_general_settings_group', |
| 323 | 323 | array('xcloner_regex_exclude', |
| 324 | - __('Regular expression match to exclude files and folders, example patterns provided below, one pattern per line','xcloner-backup-and-restore'), |
|
| 324 | + __('Regular expression match to exclude files and folders, example patterns provided below, one pattern per line', 'xcloner-backup-and-restore'), |
|
| 325 | 325 | //$this->get_xcloner_store_path(), |
| 326 | 326 | //'disabled' |
| 327 | 327 | ) |
@@ -331,36 +331,36 @@ discard block |
||
| 331 | 331 | register_setting('xcloner_mysql_settings_group', 'xcloner_enable_mysql_backup', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 332 | 332 | add_settings_field( |
| 333 | 333 | 'xcloner_enable_mysql_backup', |
| 334 | - __('Enable Mysql Backup','xcloner-backup-and-restore'), |
|
| 334 | + __('Enable Mysql Backup', 'xcloner-backup-and-restore'), |
|
| 335 | 335 | array($this, 'do_form_switch_field'), |
| 336 | 336 | 'xcloner_mysql_settings_page', |
| 337 | 337 | 'xcloner_mysql_settings_group', |
| 338 | 338 | array('xcloner_enable_mysql_backup', |
| 339 | - __('Enable Mysql Backup Option. If you don\'t want to backup the database, you can disable this.','xcloner-backup-and-restore') |
|
| 339 | + __('Enable Mysql Backup Option. If you don\'t want to backup the database, you can disable this.', 'xcloner-backup-and-restore') |
|
| 340 | 340 | ) |
| 341 | 341 | ); |
| 342 | 342 | |
| 343 | 343 | register_setting('xcloner_mysql_settings_group', 'xcloner_backup_only_wp_tables'); |
| 344 | 344 | add_settings_field( |
| 345 | 345 | 'xcloner_backup_only_wp_tables', |
| 346 | - __('Backup only WP tables','xcloner-backup-and-restore'), |
|
| 346 | + __('Backup only WP tables', 'xcloner-backup-and-restore'), |
|
| 347 | 347 | array($this, 'do_form_switch_field'), |
| 348 | 348 | 'xcloner_mysql_settings_page', |
| 349 | 349 | 'xcloner_mysql_settings_group', |
| 350 | 350 | array('xcloner_backup_only_wp_tables', |
| 351 | - sprintf(__('Enable this if you only want to Backup only tables starting with \'%s\' prefix','xcloner-backup-and-restore'), $this->get_table_prefix()) |
|
| 351 | + sprintf(__('Enable this if you only want to Backup only tables starting with \'%s\' prefix', 'xcloner-backup-and-restore'), $this->get_table_prefix()) |
|
| 352 | 352 | ) |
| 353 | 353 | ); |
| 354 | 354 | |
| 355 | 355 | register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_hostname', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
| 356 | 356 | add_settings_field( |
| 357 | 357 | 'xcloner_mysql_hostname', |
| 358 | - __('Mysql Hostname','xcloner-backup-and-restore'), |
|
| 358 | + __('Mysql Hostname', 'xcloner-backup-and-restore'), |
|
| 359 | 359 | array($this, 'do_form_text_field'), |
| 360 | 360 | 'xcloner_mysql_settings_page', |
| 361 | 361 | 'xcloner_mysql_settings_group', |
| 362 | 362 | array('xcloner_mysql_hostname', |
| 363 | - __('Wordpress mysql hostname','xcloner-backup-and-restore'), |
|
| 363 | + __('Wordpress mysql hostname', 'xcloner-backup-and-restore'), |
|
| 364 | 364 | $this->get_db_hostname(), |
| 365 | 365 | 'disabled' |
| 366 | 366 | ) |
@@ -369,12 +369,12 @@ discard block |
||
| 369 | 369 | register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_username', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
| 370 | 370 | add_settings_field( |
| 371 | 371 | 'xcloner_mysql_username', |
| 372 | - __('Mysql Username','xcloner-backup-and-restore'), |
|
| 372 | + __('Mysql Username', 'xcloner-backup-and-restore'), |
|
| 373 | 373 | array($this, 'do_form_text_field'), |
| 374 | 374 | 'xcloner_mysql_settings_page', |
| 375 | 375 | 'xcloner_mysql_settings_group', |
| 376 | 376 | array('xcloner_mysql_username', |
| 377 | - __('Wordpress mysql username','xcloner-backup-and-restore'), |
|
| 377 | + __('Wordpress mysql username', 'xcloner-backup-and-restore'), |
|
| 378 | 378 | $this->get_db_username(), |
| 379 | 379 | 'disabled' |
| 380 | 380 | ) |
@@ -383,12 +383,12 @@ discard block |
||
| 383 | 383 | register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_database', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
| 384 | 384 | add_settings_field( |
| 385 | 385 | 'xcloner_mysql_database', |
| 386 | - __('Mysql Database','xcloner-backup-and-restore'), |
|
| 386 | + __('Mysql Database', 'xcloner-backup-and-restore'), |
|
| 387 | 387 | array($this, 'do_form_text_field'), |
| 388 | 388 | 'xcloner_mysql_settings_page', |
| 389 | 389 | 'xcloner_mysql_settings_group', |
| 390 | 390 | array('xcloner_mysql_database', |
| 391 | - __('Wordpress mysql database','xcloner-backup-and-restore'), |
|
| 391 | + __('Wordpress mysql database', 'xcloner-backup-and-restore'), |
|
| 392 | 392 | $this->get_db_database(), |
| 393 | 393 | 'disabled' |
| 394 | 394 | ) |
@@ -398,12 +398,12 @@ discard block |
||
| 398 | 398 | register_setting('xcloner_system_settings_group', 'xcloner_size_limit_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 399 | 399 | add_settings_field( |
| 400 | 400 | 'xcloner_size_limit_per_request', |
| 401 | - __('Data Size Limit Per Request','xcloner-backup-and-restore'), |
|
| 401 | + __('Data Size Limit Per Request', 'xcloner-backup-and-restore'), |
|
| 402 | 402 | array($this, 'do_form_range_field'), |
| 403 | 403 | 'xcloner_system_settings_page', |
| 404 | 404 | 'xcloner_system_settings_group', |
| 405 | 405 | array('xcloner_size_limit_per_request', |
| 406 | - __('Use this option to set how much file data can XCloner backup in one AJAX request. Range 0-1024 MB','xcloner-backup-and-restore'), |
|
| 406 | + __('Use this option to set how much file data can XCloner backup in one AJAX request. Range 0-1024 MB', 'xcloner-backup-and-restore'), |
|
| 407 | 407 | 0, |
| 408 | 408 | 1024 |
| 409 | 409 | ) |
@@ -412,12 +412,12 @@ discard block |
||
| 412 | 412 | register_setting('xcloner_system_settings_group', 'xcloner_files_to_process_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 413 | 413 | add_settings_field( |
| 414 | 414 | 'xcloner_files_to_process_per_request', |
| 415 | - __('Files To Process Per Request','xcloner-backup-and-restore'), |
|
| 415 | + __('Files To Process Per Request', 'xcloner-backup-and-restore'), |
|
| 416 | 416 | array($this, 'do_form_range_field'), |
| 417 | 417 | 'xcloner_system_settings_page', |
| 418 | 418 | 'xcloner_system_settings_group', |
| 419 | 419 | array('xcloner_files_to_process_per_request', |
| 420 | - __('Use this option to set how many files XCloner should process at one time before doing another AJAX call','xcloner-backup-and-restore'), |
|
| 420 | + __('Use this option to set how many files XCloner should process at one time before doing another AJAX call', 'xcloner-backup-and-restore'), |
|
| 421 | 421 | 0, |
| 422 | 422 | 1000 |
| 423 | 423 | ) |
@@ -426,12 +426,12 @@ discard block |
||
| 426 | 426 | register_setting('xcloner_system_settings_group', 'xcloner_directories_to_scan_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 427 | 427 | add_settings_field( |
| 428 | 428 | 'xcloner_directories_to_scan_per_request', |
| 429 | - __('Directories To Scan Per Request','xcloner-backup-and-restore'), |
|
| 429 | + __('Directories To Scan Per Request', 'xcloner-backup-and-restore'), |
|
| 430 | 430 | array($this, 'do_form_range_field'), |
| 431 | 431 | 'xcloner_system_settings_page', |
| 432 | 432 | 'xcloner_system_settings_group', |
| 433 | 433 | array('xcloner_directories_to_scan_per_request', |
| 434 | - __('Use this option to set how many directories XCloner should scan at one time before doing another AJAX call','xcloner-backup-and-restore'), |
|
| 434 | + __('Use this option to set how many directories XCloner should scan at one time before doing another AJAX call', 'xcloner-backup-and-restore'), |
|
| 435 | 435 | 0, |
| 436 | 436 | 1000 |
| 437 | 437 | ) |
@@ -440,12 +440,12 @@ discard block |
||
| 440 | 440 | register_setting('xcloner_system_settings_group', 'xcloner_database_records_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 441 | 441 | add_settings_field( |
| 442 | 442 | 'xcloner_database_records_per_request', |
| 443 | - __('Database Records Per Request','xcloner-backup-and-restore'), |
|
| 443 | + __('Database Records Per Request', 'xcloner-backup-and-restore'), |
|
| 444 | 444 | array($this, 'do_form_range_field'), |
| 445 | 445 | 'xcloner_system_settings_page', |
| 446 | 446 | 'xcloner_system_settings_group', |
| 447 | 447 | array('xcloner_database_records_per_request', |
| 448 | - __('Use this option to set how many database table records should be fetched per AJAX request, or set to 0 to fetch all. Range 0-100000 records','xcloner-backup-and-restore'), |
|
| 448 | + __('Use this option to set how many database table records should be fetched per AJAX request, or set to 0 to fetch all. Range 0-100000 records', 'xcloner-backup-and-restore'), |
|
| 449 | 449 | 0, |
| 450 | 450 | 100000 |
| 451 | 451 | ) |
@@ -454,36 +454,36 @@ discard block |
||
| 454 | 454 | register_setting('xcloner_system_settings_group', 'xcloner_exclude_files_larger_than_mb', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 455 | 455 | add_settings_field( |
| 456 | 456 | 'xcloner_exclude_files_larger_than_mb', |
| 457 | - __('Exclude files larger than (MB)','xcloner-backup-and-restore'), |
|
| 457 | + __('Exclude files larger than (MB)', 'xcloner-backup-and-restore'), |
|
| 458 | 458 | array($this, 'do_form_number_field'), |
| 459 | 459 | 'xcloner_system_settings_page', |
| 460 | 460 | 'xcloner_system_settings_group', |
| 461 | 461 | array('xcloner_exclude_files_larger_than_mb', |
| 462 | - __('Use this option to automatically exclude files larger than a certain size in MB, or set to -1 to include all. Range 0-1000 MB','xcloner-backup-and-restore'), |
|
| 462 | + __('Use this option to automatically exclude files larger than a certain size in MB, or set to -1 to include all. Range 0-1000 MB', 'xcloner-backup-and-restore'), |
|
| 463 | 463 | ) |
| 464 | 464 | ); |
| 465 | 465 | |
| 466 | 466 | register_setting('xcloner_system_settings_group', 'xcloner_split_backup_limit', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 467 | 467 | add_settings_field( |
| 468 | 468 | 'xcloner_split_backup_limit', |
| 469 | - __('Split Backup Archive Limit (MB)','xcloner-backup-and-restore'), |
|
| 469 | + __('Split Backup Archive Limit (MB)', 'xcloner-backup-and-restore'), |
|
| 470 | 470 | array($this, 'do_form_number_field'), |
| 471 | 471 | 'xcloner_system_settings_page', |
| 472 | 472 | 'xcloner_system_settings_group', |
| 473 | 473 | array('xcloner_split_backup_limit', |
| 474 | - __('Use this option to automatically split the backup archive into smaller parts. Range 0-10000 MB','xcloner-backup-and-restore'), |
|
| 474 | + __('Use this option to automatically split the backup archive into smaller parts. Range 0-10000 MB', 'xcloner-backup-and-restore'), |
|
| 475 | 475 | ) |
| 476 | 476 | ); |
| 477 | 477 | |
| 478 | 478 | register_setting('xcloner_system_settings_group', 'xcloner_force_tmp_path_site_root'); |
| 479 | 479 | add_settings_field( |
| 480 | 480 | 'xcloner_force_tmp_path_site_root', |
| 481 | - __('Force Temporary Path Within XCloner Storage','xcloner-backup-and-restore'), |
|
| 481 | + __('Force Temporary Path Within XCloner Storage', 'xcloner-backup-and-restore'), |
|
| 482 | 482 | array($this, 'do_form_switch_field'), |
| 483 | 483 | 'xcloner_system_settings_page', |
| 484 | 484 | 'xcloner_system_settings_group', |
| 485 | 485 | array('xcloner_force_tmp_path_site_root', |
| 486 | - sprintf(__('Enable this option if you want the XCloner Temporary Path to be within your XCloner Storage Location','xcloner-backup-and-restore'), $this->get_table_prefix()) |
|
| 486 | + sprintf(__('Enable this option if you want the XCloner Temporary Path to be within your XCloner Storage Location', 'xcloner-backup-and-restore'), $this->get_table_prefix()) |
|
| 487 | 487 | ) |
| 488 | 488 | ); |
| 489 | 489 | |
@@ -491,36 +491,36 @@ discard block |
||
| 491 | 491 | register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_retention_limit_days', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 492 | 492 | add_settings_field( |
| 493 | 493 | 'xcloner_cleanup_retention_limit_days', |
| 494 | - __('Cleanup by Date(days)','xcloner-backup-and-restore'), |
|
| 494 | + __('Cleanup by Date(days)', 'xcloner-backup-and-restore'), |
|
| 495 | 495 | array($this, 'do_form_number_field'), |
| 496 | 496 | 'xcloner_cleanup_settings_page', |
| 497 | 497 | 'xcloner_cleanup_settings_group', |
| 498 | 498 | array('xcloner_cleanup_retention_limit_days', |
| 499 | - __('Specify the maximum number of days a backup archive can be kept on the server. 0 disables this option','xcloner-backup-and-restore') |
|
| 499 | + __('Specify the maximum number of days a backup archive can be kept on the server. 0 disables this option', 'xcloner-backup-and-restore') |
|
| 500 | 500 | ) |
| 501 | 501 | ); |
| 502 | 502 | |
| 503 | 503 | register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_retention_limit_archives', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 504 | 504 | add_settings_field( |
| 505 | 505 | 'xcloner_cleanup_retention_limit_archives', |
| 506 | - __('Cleanup by Quantity','xcloner-backup-and-restore'), |
|
| 506 | + __('Cleanup by Quantity', 'xcloner-backup-and-restore'), |
|
| 507 | 507 | array($this, 'do_form_number_field'), |
| 508 | 508 | 'xcloner_cleanup_settings_page', |
| 509 | 509 | 'xcloner_cleanup_settings_group', |
| 510 | 510 | array('xcloner_cleanup_retention_limit_archives', |
| 511 | - __('Specify the maximum number of backup archives to keep on the server. 0 disables this option','xcloner-backup-and-restore') |
|
| 511 | + __('Specify the maximum number of backup archives to keep on the server. 0 disables this option', 'xcloner-backup-and-restore') |
|
| 512 | 512 | ) |
| 513 | 513 | ); |
| 514 | 514 | |
| 515 | 515 | register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_capacity_limit', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 516 | 516 | add_settings_field( |
| 517 | 517 | 'xcloner_cleanup_capacity_limit', |
| 518 | - __('Cleanup by Capacity(MB)','xcloner-backup-and-restore'), |
|
| 518 | + __('Cleanup by Capacity(MB)', 'xcloner-backup-and-restore'), |
|
| 519 | 519 | array($this, 'do_form_number_field'), |
| 520 | 520 | 'xcloner_cleanup_settings_page', |
| 521 | 521 | 'xcloner_cleanup_settings_group', |
| 522 | 522 | array('xcloner_cleanup_capacity_limit', |
| 523 | - __('Remove oldest backups if all created backups exceed the configured limit in Megabytes. 0 disables this option','xcloner-backup-and-restore') |
|
| 523 | + __('Remove oldest backups if all created backups exceed the configured limit in Megabytes. 0 disables this option', 'xcloner-backup-and-restore') |
|
| 524 | 524 | ) |
| 525 | 525 | ); |
| 526 | 526 | |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | register_setting('xcloner_cron_settings_group', 'xcloner_cron_frequency'); |
| 529 | 529 | add_settings_field( |
| 530 | 530 | 'xcloner_cron_frequency', |
| 531 | - __('Cron frequency','xcloner-backup-and-restore'), |
|
| 531 | + __('Cron frequency', 'xcloner-backup-and-restore'), |
|
| 532 | 532 | array($this, 'do_form_text_field'), |
| 533 | 533 | 'xcloner_cron_settings_page', |
| 534 | 534 | 'xcloner_cron_settings_group', |
@@ -554,20 +554,20 @@ discard block |
||
| 554 | 554 | // text field content cb |
| 555 | 555 | public function do_form_text_field($params) |
| 556 | 556 | { |
| 557 | - if(!isset($params['3'])) |
|
| 557 | + if (!isset($params['3'])) |
|
| 558 | 558 | $params[3] = 0; |
| 559 | - if(!isset($params['2'])) |
|
| 559 | + if (!isset($params['2'])) |
|
| 560 | 560 | $params[2] = 0; |
| 561 | 561 | |
| 562 | 562 | list($fieldname, $label, $value, $disabled) = $params; |
| 563 | 563 | |
| 564 | - if(!$value) |
|
| 564 | + if (!$value) |
|
| 565 | 565 | $value = get_option($fieldname); |
| 566 | 566 | // output the field |
| 567 | 567 | ?> |
| 568 | 568 | <div class="row"> |
| 569 | 569 | <div class="input-field col s10 m10 l8"> |
| 570 | - <input class="validate" <?php echo ($disabled)?"disabled":""?> name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" type="text" class="validate" value="<?php echo isset($value) ? esc_attr($value) : ''; ?>"> |
|
| 570 | + <input class="validate" <?php echo ($disabled) ? "disabled" : ""?> name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" type="text" class="validate" value="<?php echo isset($value) ? esc_attr($value) : ''; ?>"> |
|
| 571 | 571 | </div> |
| 572 | 572 | <div class="col s2 m2 "> |
| 573 | 573 | <a class="btn-floating tooltipped btn-small" data-position="left" data-delay="50" data-tooltip="<?php echo $label?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
@@ -581,20 +581,20 @@ discard block |
||
| 581 | 581 | // textarea field content cb |
| 582 | 582 | public function do_form_textarea_field($params) |
| 583 | 583 | { |
| 584 | - if(!isset($params['3'])) |
|
| 584 | + if (!isset($params['3'])) |
|
| 585 | 585 | $params[3] = 0; |
| 586 | - if(!isset($params['2'])) |
|
| 586 | + if (!isset($params['2'])) |
|
| 587 | 587 | $params[2] = 0; |
| 588 | 588 | |
| 589 | 589 | list($fieldname, $label, $value, $disabled) = $params; |
| 590 | 590 | |
| 591 | - if(!$value) |
|
| 591 | + if (!$value) |
|
| 592 | 592 | $value = get_option($fieldname); |
| 593 | 593 | // output the field |
| 594 | 594 | ?> |
| 595 | 595 | <div class="row"> |
| 596 | 596 | <div class="input-field col s10 m10 l8"> |
| 597 | - <textarea class="validate" <?php echo ($disabled)?"disabled":""?> name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" type="text" class="validate" value=""><?php echo isset($value) ? esc_attr($value) : ''; ?></textarea> |
|
| 597 | + <textarea class="validate" <?php echo ($disabled) ? "disabled" : ""?> name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" type="text" class="validate" value=""><?php echo isset($value) ? esc_attr($value) : ''; ?></textarea> |
|
| 598 | 598 | </div> |
| 599 | 599 | <div class="col s2 m2 "> |
| 600 | 600 | <a class="btn-floating tooltipped btn-small" data-position="center" data-html="true" data-delay="50" data-tooltip="<?php echo $label?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
@@ -624,20 +624,20 @@ discard block |
||
| 624 | 624 | // number field content cb |
| 625 | 625 | public function do_form_number_field($params) |
| 626 | 626 | { |
| 627 | - if(!isset($params['3'])) |
|
| 627 | + if (!isset($params['3'])) |
|
| 628 | 628 | $params[3] = 0; |
| 629 | - if(!isset($params['2'])) |
|
| 629 | + if (!isset($params['2'])) |
|
| 630 | 630 | $params[2] = 0; |
| 631 | 631 | |
| 632 | 632 | list($fieldname, $label, $value, $disabled) = $params; |
| 633 | 633 | |
| 634 | - if(!$value) |
|
| 634 | + if (!$value) |
|
| 635 | 635 | $value = get_option($fieldname); |
| 636 | 636 | // output the field |
| 637 | 637 | ?> |
| 638 | 638 | <div class="row"> |
| 639 | 639 | <div class="input-field col s10 m5 l3"> |
| 640 | - <input class="validate" <?php echo ($disabled)?"disabled":""?> name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" type="number" class="validate" value="<?php echo isset($value) ? esc_attr($value) : ''; ?>"> |
|
| 640 | + <input class="validate" <?php echo ($disabled) ? "disabled" : ""?> name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" type="number" class="validate" value="<?php echo isset($value) ? esc_attr($value) : ''; ?>"> |
|
| 641 | 641 | </div> |
| 642 | 642 | <div class="col s2 m2 "> |
| 643 | 643 | <a class="btn-floating tooltipped btn-small" data-position="center" data-delay="50" data-tooltip="<?php echo $label?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | |
| 651 | 651 | public function do_form_range_field($params) |
| 652 | 652 | { |
| 653 | - if(!isset($params['4'])) |
|
| 653 | + if (!isset($params['4'])) |
|
| 654 | 654 | $params[4] = 0; |
| 655 | 655 | |
| 656 | 656 | list($fieldname, $label, $range_start, $range_end, $disabled) = $params; |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | <div class="row"> |
| 660 | 660 | <div class="input-field col s10 m10 l8"> |
| 661 | 661 | <p class="range-field"> |
| 662 | - <input <?php echo ($disabled)?"disabled":""?> type="range" name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" min="<?php echo $range_start?>" max="<?php echo $range_end?>" value="<?php echo isset($value) ? esc_attr($value) : ''; ?>" /> |
|
| 662 | + <input <?php echo ($disabled) ? "disabled" : ""?> type="range" name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" min="<?php echo $range_start?>" max="<?php echo $range_end?>" value="<?php echo isset($value) ? esc_attr($value) : ''; ?>" /> |
|
| 663 | 663 | </p> |
| 664 | 664 | </div> |
| 665 | 665 | <div class="col s2 m2 "> |
@@ -672,7 +672,7 @@ discard block |
||
| 672 | 672 | |
| 673 | 673 | public function do_form_switch_field($params) |
| 674 | 674 | { |
| 675 | - if(!isset($params['2'])) |
|
| 675 | + if (!isset($params['2'])) |
|
| 676 | 676 | $params[2] = 0; |
| 677 | 677 | list($fieldname, $label, $disabled) = $params; |
| 678 | 678 | $value = get_option($fieldname); |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | <div class="switch"> |
| 683 | 683 | <label> |
| 684 | 684 | Off |
| 685 | - <input <?php echo ($disabled)?"disabled":""?> type="checkbox" name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" value="1" <?php echo ($value) ? 'checked="checked"' : ''; ?>"> |
|
| 685 | + <input <?php echo ($disabled) ? "disabled" : ""?> type="checkbox" name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" value="1" <?php echo ($value) ? 'checked="checked"' : ''; ?>"> |
|
| 686 | 686 | <span class="lever"></span> |
| 687 | 687 | On |
| 688 | 688 | </label> |
@@ -8,26 +8,29 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | public function __construct($hash = "") |
| 10 | 10 | { |
| 11 | - if(isset($hash)) |
|
| 12 | - $this->set_hash($hash); |
|
| 11 | + if(isset($hash)) { |
|
| 12 | + $this->set_hash($hash); |
|
| 13 | + } |
|
| 13 | 14 | } |
| 14 | 15 | |
| 15 | 16 | public function get_logger_filename($include_hash = 0) |
| 16 | 17 | { |
| 17 | - if($include_hash) |
|
| 18 | - $filename = sprintf($this->logger_file_hash, $this->get_hash()); |
|
| 19 | - else |
|
| 20 | - $filename = sprintf($this->logger_file, $this->get_server_unique_hash(5)); |
|
| 18 | + if($include_hash) { |
|
| 19 | + $filename = sprintf($this->logger_file_hash, $this->get_hash()); |
|
| 20 | + } else { |
|
| 21 | + $filename = sprintf($this->logger_file, $this->get_server_unique_hash(5)); |
|
| 22 | + } |
|
| 21 | 23 | |
| 22 | 24 | return $filename; |
| 23 | 25 | } |
| 24 | 26 | |
| 25 | 27 | public function get_xcloner_start_path() |
| 26 | 28 | { |
| 27 | - if(!get_option('xcloner_start_path') or !is_dir(get_option('xcloner_start_path'))) |
|
| 28 | - $path = realpath(ABSPATH); |
|
| 29 | - else |
|
| 30 | - $path = get_option('xcloner_start_path'); |
|
| 29 | + if(!get_option('xcloner_start_path') or !is_dir(get_option('xcloner_start_path'))) { |
|
| 30 | + $path = realpath(ABSPATH); |
|
| 31 | + } else { |
|
| 32 | + $path = get_option('xcloner_start_path'); |
|
| 33 | + } |
|
| 31 | 34 | |
| 32 | 35 | return $path; |
| 33 | 36 | } |
@@ -41,10 +44,11 @@ discard block |
||
| 41 | 44 | |
| 42 | 45 | public function get_xcloner_store_path() |
| 43 | 46 | { |
| 44 | - if(!get_option('xcloner_store_path') or !is_dir(get_option('xcloner_store_path'))) |
|
| 45 | - $path = realpath(XCLONER_STORAGE_PATH); |
|
| 46 | - else |
|
| 47 | - $path = get_option('xcloner_store_path'); |
|
| 47 | + if(!get_option('xcloner_store_path') or !is_dir(get_option('xcloner_store_path'))) { |
|
| 48 | + $path = realpath(XCLONER_STORAGE_PATH); |
|
| 49 | + } else { |
|
| 50 | + $path = get_option('xcloner_store_path'); |
|
| 51 | + } |
|
| 48 | 52 | |
| 49 | 53 | return $path; |
| 50 | 54 | } |
@@ -64,16 +68,18 @@ discard block |
||
| 64 | 68 | @chmod($path, 0777); |
| 65 | 69 | } |
| 66 | 70 | |
| 67 | - if(!is_dir($path) or !is_writeable($path) or get_option('xcloner_force_tmp_path_site_root')) |
|
| 68 | - $path = $this->get_xcloner_store_path().DS.".".$this->get_xcloner_tmp_path_suffix(); |
|
| 71 | + if(!is_dir($path) or !is_writeable($path) or get_option('xcloner_force_tmp_path_site_root')) { |
|
| 72 | + $path = $this->get_xcloner_store_path().DS.".".$this->get_xcloner_tmp_path_suffix(); |
|
| 73 | + } |
|
| 69 | 74 | |
| 70 | 75 | return $path; |
| 71 | 76 | } |
| 72 | 77 | |
| 73 | 78 | public function get_enable_mysql_backup() |
| 74 | 79 | { |
| 75 | - if(get_option('xcloner_enable_mysql_backup')) |
|
| 76 | - return true; |
|
| 80 | + if(get_option('xcloner_enable_mysql_backup')) { |
|
| 81 | + return true; |
|
| 82 | + } |
|
| 77 | 83 | |
| 78 | 84 | return false; |
| 79 | 85 | } |
@@ -82,10 +88,11 @@ discard block |
||
| 82 | 88 | { |
| 83 | 89 | if(!$ext) |
| 84 | 90 | { |
| 85 | - if(get_option('xcloner_backup_compression_level')) |
|
| 86 | - $ext = ".tgz"; |
|
| 87 | - else |
|
| 88 | - $ext = ".tar"; |
|
| 91 | + if(get_option('xcloner_backup_compression_level')) { |
|
| 92 | + $ext = ".tgz"; |
|
| 93 | + } else { |
|
| 94 | + $ext = ".tar"; |
|
| 95 | + } |
|
| 89 | 96 | } |
| 90 | 97 | return ($this->get_hash()).$ext; |
| 91 | 98 | } |
@@ -111,8 +118,9 @@ discard block |
||
| 111 | 118 | |
| 112 | 119 | public function set_hash($hash = "") |
| 113 | 120 | { |
| 114 | - if(substr($hash, 0, 1) != "-" and strlen($hash)) |
|
| 115 | - $hash = "-".$hash; |
|
| 121 | + if(substr($hash, 0, 1) != "-" and strlen($hash)) { |
|
| 122 | + $hash = "-".$hash; |
|
| 123 | + } |
|
| 116 | 124 | |
| 117 | 125 | $this->hash = substr( $hash, 0, 6); |
| 118 | 126 | |
@@ -132,8 +140,9 @@ discard block |
||
| 132 | 140 | { |
| 133 | 141 | global $wpdb; |
| 134 | 142 | |
| 135 | - if(!$data = get_option('xcloner_mysql_hostname')) |
|
| 136 | - $data = $wpdb->dbhost; |
|
| 143 | + if(!$data = get_option('xcloner_mysql_hostname')) { |
|
| 144 | + $data = $wpdb->dbhost; |
|
| 145 | + } |
|
| 137 | 146 | |
| 138 | 147 | return $data; |
| 139 | 148 | } |
@@ -142,8 +151,9 @@ discard block |
||
| 142 | 151 | { |
| 143 | 152 | global $wpdb; |
| 144 | 153 | |
| 145 | - if(!$data = get_option('xcloner_mysql_username')) |
|
| 146 | - $data = $wpdb->dbuser; |
|
| 154 | + if(!$data = get_option('xcloner_mysql_username')) { |
|
| 155 | + $data = $wpdb->dbuser; |
|
| 156 | + } |
|
| 147 | 157 | |
| 148 | 158 | return $data; |
| 149 | 159 | } |
@@ -152,8 +162,9 @@ discard block |
||
| 152 | 162 | { |
| 153 | 163 | global $wpdb; |
| 154 | 164 | |
| 155 | - if(!$data = get_option('xcloner_mysql_password')) |
|
| 156 | - $data = $wpdb->dbpassword; |
|
| 165 | + if(!$data = get_option('xcloner_mysql_password')) { |
|
| 166 | + $data = $wpdb->dbpassword; |
|
| 167 | + } |
|
| 157 | 168 | |
| 158 | 169 | return $data; |
| 159 | 170 | } |
@@ -162,8 +173,9 @@ discard block |
||
| 162 | 173 | { |
| 163 | 174 | global $wpdb; |
| 164 | 175 | |
| 165 | - if(!$data = get_option('xcloner_mysql_database')) |
|
| 166 | - $data = $wpdb->dbname; |
|
| 176 | + if(!$data = get_option('xcloner_mysql_database')) { |
|
| 177 | + $data = $wpdb->dbname; |
|
| 178 | + } |
|
| 167 | 179 | |
| 168 | 180 | return $data; |
| 169 | 181 | } |
@@ -186,8 +198,9 @@ discard block |
||
| 186 | 198 | { |
| 187 | 199 | $hash = md5(get_home_url().__DIR__); |
| 188 | 200 | |
| 189 | - if($strlen) |
|
| 190 | - $hash = substr($hash, 0, $strlen); |
|
| 201 | + if($strlen) { |
|
| 202 | + $hash = substr($hash, 0, $strlen); |
|
| 203 | + } |
|
| 191 | 204 | |
| 192 | 205 | return $hash; |
| 193 | 206 | } |
@@ -554,15 +567,18 @@ discard block |
||
| 554 | 567 | // text field content cb |
| 555 | 568 | public function do_form_text_field($params) |
| 556 | 569 | { |
| 557 | - if(!isset($params['3'])) |
|
| 558 | - $params[3] = 0; |
|
| 559 | - if(!isset($params['2'])) |
|
| 560 | - $params[2] = 0; |
|
| 570 | + if(!isset($params['3'])) { |
|
| 571 | + $params[3] = 0; |
|
| 572 | + } |
|
| 573 | + if(!isset($params['2'])) { |
|
| 574 | + $params[2] = 0; |
|
| 575 | + } |
|
| 561 | 576 | |
| 562 | 577 | list($fieldname, $label, $value, $disabled) = $params; |
| 563 | 578 | |
| 564 | - if(!$value) |
|
| 565 | - $value = get_option($fieldname); |
|
| 579 | + if(!$value) { |
|
| 580 | + $value = get_option($fieldname); |
|
| 581 | + } |
|
| 566 | 582 | // output the field |
| 567 | 583 | ?> |
| 568 | 584 | <div class="row"> |
@@ -581,15 +597,18 @@ discard block |
||
| 581 | 597 | // textarea field content cb |
| 582 | 598 | public function do_form_textarea_field($params) |
| 583 | 599 | { |
| 584 | - if(!isset($params['3'])) |
|
| 585 | - $params[3] = 0; |
|
| 586 | - if(!isset($params['2'])) |
|
| 587 | - $params[2] = 0; |
|
| 600 | + if(!isset($params['3'])) { |
|
| 601 | + $params[3] = 0; |
|
| 602 | + } |
|
| 603 | + if(!isset($params['2'])) { |
|
| 604 | + $params[2] = 0; |
|
| 605 | + } |
|
| 588 | 606 | |
| 589 | 607 | list($fieldname, $label, $value, $disabled) = $params; |
| 590 | 608 | |
| 591 | - if(!$value) |
|
| 592 | - $value = get_option($fieldname); |
|
| 609 | + if(!$value) { |
|
| 610 | + $value = get_option($fieldname); |
|
| 611 | + } |
|
| 593 | 612 | // output the field |
| 594 | 613 | ?> |
| 595 | 614 | <div class="row"> |
@@ -624,15 +643,18 @@ discard block |
||
| 624 | 643 | // number field content cb |
| 625 | 644 | public function do_form_number_field($params) |
| 626 | 645 | { |
| 627 | - if(!isset($params['3'])) |
|
| 628 | - $params[3] = 0; |
|
| 629 | - if(!isset($params['2'])) |
|
| 630 | - $params[2] = 0; |
|
| 646 | + if(!isset($params['3'])) { |
|
| 647 | + $params[3] = 0; |
|
| 648 | + } |
|
| 649 | + if(!isset($params['2'])) { |
|
| 650 | + $params[2] = 0; |
|
| 651 | + } |
|
| 631 | 652 | |
| 632 | 653 | list($fieldname, $label, $value, $disabled) = $params; |
| 633 | 654 | |
| 634 | - if(!$value) |
|
| 635 | - $value = get_option($fieldname); |
|
| 655 | + if(!$value) { |
|
| 656 | + $value = get_option($fieldname); |
|
| 657 | + } |
|
| 636 | 658 | // output the field |
| 637 | 659 | ?> |
| 638 | 660 | <div class="row"> |
@@ -650,8 +672,9 @@ discard block |
||
| 650 | 672 | |
| 651 | 673 | public function do_form_range_field($params) |
| 652 | 674 | { |
| 653 | - if(!isset($params['4'])) |
|
| 654 | - $params[4] = 0; |
|
| 675 | + if(!isset($params['4'])) { |
|
| 676 | + $params[4] = 0; |
|
| 677 | + } |
|
| 655 | 678 | |
| 656 | 679 | list($fieldname, $label, $range_start, $range_end, $disabled) = $params; |
| 657 | 680 | $value = get_option($fieldname); |
@@ -672,8 +695,9 @@ discard block |
||
| 672 | 695 | |
| 673 | 696 | public function do_form_switch_field($params) |
| 674 | 697 | { |
| 675 | - if(!isset($params['2'])) |
|
| 676 | - $params[2] = 0; |
|
| 698 | + if(!isset($params['2'])) { |
|
| 699 | + $params[2] = 0; |
|
| 700 | + } |
|
| 677 | 701 | list($fieldname, $label, $disabled) = $params; |
| 678 | 702 | $value = get_option($fieldname); |
| 679 | 703 | ?> |
@@ -39,6 +39,9 @@ discard block |
||
| 39 | 39 | return $path; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | + /** |
|
| 43 | + * @return string |
|
| 44 | + */ |
|
| 42 | 45 | public function get_xcloner_store_path() |
| 43 | 46 | { |
| 44 | 47 | if(!get_option('xcloner_store_path') or !is_dir(get_option('xcloner_store_path'))) |
@@ -175,6 +178,9 @@ discard block |
||
| 175 | 178 | return $wpdb->prefix; |
| 176 | 179 | } |
| 177 | 180 | |
| 181 | + /** |
|
| 182 | + * @param string $option |
|
| 183 | + */ |
|
| 178 | 184 | public function get_xcloner_option($option) |
| 179 | 185 | { |
| 180 | 186 | $data = get_option($option); |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 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 | - // array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); |
|
| 250 | + // array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); |
|
| 251 | 251 | |
| 252 | 252 | } |
| 253 | 253 | |
@@ -281,8 +281,8 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | private function define_plugin_settings(){ |
| 283 | 283 | /** |
| 284 | - * register wporg_settings_init to the admin_init action hook |
|
| 285 | - */ |
|
| 284 | + * register wporg_settings_init to the admin_init action hook |
|
| 285 | + */ |
|
| 286 | 286 | $settings = new Xcloner_Settings(); |
| 287 | 287 | add_action('admin_init', array($settings, 'settings_init')); |
| 288 | 288 | } |
@@ -316,15 +316,15 @@ discard block |
||
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | function friendly_error_type($type) { |
| 319 | - static $levels=null; |
|
| 320 | - if ($levels===null) { |
|
| 321 | - $levels=[]; |
|
| 322 | - foreach (get_defined_constants() as $key=>$value) { |
|
| 323 | - if (strpos($key,'E_')!==0) {continue;} |
|
| 319 | + static $levels=null; |
|
| 320 | + if ($levels===null) { |
|
| 321 | + $levels=[]; |
|
| 322 | + foreach (get_defined_constants() as $key=>$value) { |
|
| 323 | + if (strpos($key,'E_')!==0) {continue;} |
|
| 324 | 324 | $levels[$value]= $key; //substr($key,2); |
| 325 | - } |
|
| 326 | - } |
|
| 327 | - return (isset($levels[$type]) ? $levels[$type] : "Error #{$type}"); |
|
| 325 | + } |
|
| 326 | + } |
|
| 327 | + return (isset($levels[$type]) ? $levels[$type] : "Error #{$type}"); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | private function define_ajax_hooks() |
@@ -355,20 +355,20 @@ discard block |
||
| 355 | 355 | add_action( 'admin_notices', array($this, 'xcloner_error_admin_notices' )); |
| 356 | 356 | |
| 357 | 357 | //if (is_admin()) { |
| 358 | - add_filter('plugin_action_links', array($this, 'add_plugin_action_links'), 10, 2); |
|
| 359 | - } |
|
| 358 | + add_filter('plugin_action_links', array($this, 'add_plugin_action_links'), 10, 2); |
|
| 359 | + } |
|
| 360 | 360 | |
| 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>'; |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - return $links; |
|
| 371 | - } |
|
| 370 | + return $links; |
|
| 371 | + } |
|
| 372 | 372 | |
| 373 | 373 | public function xcloner_error_admin_notices() { |
| 374 | 374 | settings_errors( 'xcloner_error_message' ); |
@@ -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()); |
@@ -147,14 +147,14 @@ |
||
| 147 | 147 | $unit_list = array('B', 'KB', 'MB', 'GB', 'PB'); |
| 148 | 148 | |
| 149 | 149 | if ($bytes == 0) { |
| 150 | - return $bytes . ' ' . $unit_list[0]; |
|
| 150 | + return $bytes . ' ' . $unit_list[0]; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | $unit_count = count($unit_list); |
| 154 | 154 | for ($i = $unit_count - 1; $i >= 0; $i--) { |
| 155 | - $power = $i * 10; |
|
| 156 | - if (($bytes >> $power) >= 1) |
|
| 157 | - return round($bytes / (1 << $power), $decimals) . ' ' . $unit_list[$i]; |
|
| 155 | + $power = $i * 10; |
|
| 156 | + if (($bytes >> $power) >= 1) |
|
| 157 | + return round($bytes / (1 << $power), $decimals) . ' ' . $unit_list[$i]; |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -3,29 +3,29 @@ discard block |
||
| 3 | 3 | class XCloner_Requirements |
| 4 | 4 | { |
| 5 | 5 | |
| 6 | - var $min_php_version = "5.4.0"; |
|
| 7 | - var $safe_mode = "Off"; |
|
| 6 | + var $min_php_version = "5.4.0"; |
|
| 7 | + var $safe_mode = "Off"; |
|
| 8 | 8 | |
| 9 | 9 | public function __construct() |
| 10 | 10 | { |
| 11 | - $this->xcloner_settings = new Xcloner_Settings(); |
|
| 11 | + $this->xcloner_settings = new Xcloner_Settings(); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | public function check_backup_ready_status() |
| 15 | 15 | { |
| 16 | - if(!$this->check_min_php_version(1)) |
|
| 16 | + if (!$this->check_min_php_version(1)) |
|
| 17 | 17 | return false; |
| 18 | 18 | |
| 19 | - if(!$this->check_safe_mode(1)) |
|
| 19 | + if (!$this->check_safe_mode(1)) |
|
| 20 | 20 | return false; |
| 21 | 21 | |
| 22 | - if(!$this->check_xcloner_start_path(1)) |
|
| 22 | + if (!$this->check_xcloner_start_path(1)) |
|
| 23 | 23 | return false; |
| 24 | 24 | |
| 25 | - if(!$this->check_xcloner_store_path(1)) |
|
| 25 | + if (!$this->check_xcloner_store_path(1)) |
|
| 26 | 26 | return false; |
| 27 | 27 | |
| 28 | - if(!$this->check_xcloner_tmp_path(1)) |
|
| 28 | + if (!$this->check_xcloner_tmp_path(1)) |
|
| 29 | 29 | return false; |
| 30 | 30 | |
| 31 | 31 | return true; |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | public function check_min_php_version($return_bool = 0) |
| 40 | 40 | { |
| 41 | 41 | |
| 42 | - if($return_bool == 1) |
|
| 42 | + if ($return_bool == 1) |
|
| 43 | 43 | { |
| 44 | - if(version_compare(phpversion(), $this->min_php_version, '<')) |
|
| 44 | + if (version_compare(phpversion(), $this->min_php_version, '<')) |
|
| 45 | 45 | return false; |
| 46 | 46 | else |
| 47 | 47 | return true; |
@@ -50,31 +50,31 @@ discard block |
||
| 50 | 50 | return phpversion(); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - public function check_safe_mode($return_bool=0) |
|
| 53 | + public function check_safe_mode($return_bool = 0) |
|
| 54 | 54 | { |
| 55 | 55 | $safe_mode = "Off"; |
| 56 | 56 | |
| 57 | - if($return_bool) |
|
| 57 | + if ($return_bool) |
|
| 58 | 58 | { |
| 59 | - if( ini_get('safe_mode') ) |
|
| 59 | + if (ini_get('safe_mode')) |
|
| 60 | 60 | return false; |
| 61 | 61 | else |
| 62 | 62 | return true; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - if( ini_get('safe_mode') ) |
|
| 65 | + if (ini_get('safe_mode')) |
|
| 66 | 66 | $safe_mode = "On"; |
| 67 | 67 | |
| 68 | 68 | return $safe_mode; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function check_xcloner_start_path($return_bool=0) |
|
| 71 | + public function check_xcloner_start_path($return_bool = 0) |
|
| 72 | 72 | { |
| 73 | 73 | $path = $this->xcloner_settings->get_xcloner_start_path(); |
| 74 | 74 | |
| 75 | - if($return_bool) |
|
| 75 | + if ($return_bool) |
|
| 76 | 76 | { |
| 77 | - if(!file_exists($path)) |
|
| 77 | + if (!file_exists($path)) |
|
| 78 | 78 | return false; |
| 79 | 79 | |
| 80 | 80 | return is_readable($path); |
@@ -83,16 +83,16 @@ discard block |
||
| 83 | 83 | return $path; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - public function check_xcloner_tmp_path($return_bool=0) |
|
| 86 | + public function check_xcloner_tmp_path($return_bool = 0) |
|
| 87 | 87 | { |
| 88 | 88 | $path = $this->xcloner_settings->get_xcloner_tmp_path(); |
| 89 | 89 | |
| 90 | - if($return_bool) |
|
| 90 | + if ($return_bool) |
|
| 91 | 91 | { |
| 92 | - if(!file_exists($path)) |
|
| 92 | + if (!file_exists($path)) |
|
| 93 | 93 | return false; |
| 94 | 94 | |
| 95 | - if(!is_writeable($path)) |
|
| 95 | + if (!is_writeable($path)) |
|
| 96 | 96 | @chmod($path, 0777); |
| 97 | 97 | |
| 98 | 98 | return is_writeable($path); |
@@ -101,16 +101,16 @@ discard block |
||
| 101 | 101 | return $path; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - public function check_xcloner_store_path($return_bool=0) |
|
| 104 | + public function check_xcloner_store_path($return_bool = 0) |
|
| 105 | 105 | { |
| 106 | 106 | $path = $this->xcloner_settings->get_xcloner_store_path(); |
| 107 | 107 | |
| 108 | - if($return_bool) |
|
| 108 | + if ($return_bool) |
|
| 109 | 109 | { |
| 110 | - if(!file_exists($path)) |
|
| 110 | + if (!file_exists($path)) |
|
| 111 | 111 | return false; |
| 112 | 112 | |
| 113 | - if(!is_writeable($path)) |
|
| 113 | + if (!is_writeable($path)) |
|
| 114 | 114 | @chmod($path, 0777); |
| 115 | 115 | |
| 116 | 116 | return is_writeable($path); |
@@ -131,9 +131,9 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | public function get_open_basedir() |
| 133 | 133 | { |
| 134 | - $open_basedir = ini_get('open_basedir'); |
|
| 134 | + $open_basedir = ini_get('open_basedir'); |
|
| 135 | 135 | |
| 136 | - if(!$open_basedir) |
|
| 136 | + if (!$open_basedir) |
|
| 137 | 137 | $open_basedir = "none"; |
| 138 | 138 | return $open_basedir; |
| 139 | 139 | } |
@@ -147,14 +147,14 @@ discard block |
||
| 147 | 147 | $unit_list = array('B', 'KB', 'MB', 'GB', 'PB'); |
| 148 | 148 | |
| 149 | 149 | if ($bytes == 0) { |
| 150 | - return $bytes . ' ' . $unit_list[0]; |
|
| 150 | + return $bytes.' '.$unit_list[0]; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | $unit_count = count($unit_list); |
| 154 | 154 | for ($i = $unit_count - 1; $i >= 0; $i--) { |
| 155 | 155 | $power = $i * 10; |
| 156 | 156 | if (($bytes >> $power) >= 1) |
| 157 | - return round($bytes / (1 << $power), $decimals) . ' ' . $unit_list[$i]; |
|
| 157 | + return round($bytes / (1 << $power), $decimals).' '.$unit_list[$i]; |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -13,20 +13,25 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | public function check_backup_ready_status() |
| 15 | 15 | { |
| 16 | - if(!$this->check_min_php_version(1)) |
|
| 17 | - return false; |
|
| 16 | + if(!$this->check_min_php_version(1)) { |
|
| 17 | + return false; |
|
| 18 | + } |
|
| 18 | 19 | |
| 19 | - if(!$this->check_safe_mode(1)) |
|
| 20 | - return false; |
|
| 20 | + if(!$this->check_safe_mode(1)) { |
|
| 21 | + return false; |
|
| 22 | + } |
|
| 21 | 23 | |
| 22 | - if(!$this->check_xcloner_start_path(1)) |
|
| 23 | - return false; |
|
| 24 | + if(!$this->check_xcloner_start_path(1)) { |
|
| 25 | + return false; |
|
| 26 | + } |
|
| 24 | 27 | |
| 25 | - if(!$this->check_xcloner_store_path(1)) |
|
| 26 | - return false; |
|
| 28 | + if(!$this->check_xcloner_store_path(1)) { |
|
| 29 | + return false; |
|
| 30 | + } |
|
| 27 | 31 | |
| 28 | - if(!$this->check_xcloner_tmp_path(1)) |
|
| 29 | - return false; |
|
| 32 | + if(!$this->check_xcloner_tmp_path(1)) { |
|
| 33 | + return false; |
|
| 34 | + } |
|
| 30 | 35 | |
| 31 | 36 | return true; |
| 32 | 37 | } |
@@ -41,10 +46,11 @@ discard block |
||
| 41 | 46 | |
| 42 | 47 | if($return_bool == 1) |
| 43 | 48 | { |
| 44 | - if(version_compare(phpversion(), $this->min_php_version, '<')) |
|
| 45 | - return false; |
|
| 46 | - else |
|
| 47 | - return true; |
|
| 49 | + if(version_compare(phpversion(), $this->min_php_version, '<')) { |
|
| 50 | + return false; |
|
| 51 | + } else { |
|
| 52 | + return true; |
|
| 53 | + } |
|
| 48 | 54 | } |
| 49 | 55 | |
| 50 | 56 | return phpversion(); |
@@ -56,14 +62,16 @@ discard block |
||
| 56 | 62 | |
| 57 | 63 | if($return_bool) |
| 58 | 64 | { |
| 59 | - if( ini_get('safe_mode') ) |
|
| 60 | - return false; |
|
| 61 | - else |
|
| 62 | - return true; |
|
| 65 | + if( ini_get('safe_mode') ) { |
|
| 66 | + return false; |
|
| 67 | + } else { |
|
| 68 | + return true; |
|
| 69 | + } |
|
| 63 | 70 | } |
| 64 | 71 | |
| 65 | - if( ini_get('safe_mode') ) |
|
| 66 | - $safe_mode = "On"; |
|
| 72 | + if( ini_get('safe_mode') ) { |
|
| 73 | + $safe_mode = "On"; |
|
| 74 | + } |
|
| 67 | 75 | |
| 68 | 76 | return $safe_mode; |
| 69 | 77 | } |
@@ -74,8 +82,9 @@ discard block |
||
| 74 | 82 | |
| 75 | 83 | if($return_bool) |
| 76 | 84 | { |
| 77 | - if(!file_exists($path)) |
|
| 78 | - return false; |
|
| 85 | + if(!file_exists($path)) { |
|
| 86 | + return false; |
|
| 87 | + } |
|
| 79 | 88 | |
| 80 | 89 | return is_readable($path); |
| 81 | 90 | } |
@@ -89,11 +98,13 @@ discard block |
||
| 89 | 98 | |
| 90 | 99 | if($return_bool) |
| 91 | 100 | { |
| 92 | - if(!file_exists($path)) |
|
| 93 | - return false; |
|
| 101 | + if(!file_exists($path)) { |
|
| 102 | + return false; |
|
| 103 | + } |
|
| 94 | 104 | |
| 95 | - if(!is_writeable($path)) |
|
| 96 | - @chmod($path, 0777); |
|
| 105 | + if(!is_writeable($path)) { |
|
| 106 | + @chmod($path, 0777); |
|
| 107 | + } |
|
| 97 | 108 | |
| 98 | 109 | return is_writeable($path); |
| 99 | 110 | } |
@@ -107,11 +118,13 @@ discard block |
||
| 107 | 118 | |
| 108 | 119 | if($return_bool) |
| 109 | 120 | { |
| 110 | - if(!file_exists($path)) |
|
| 111 | - return false; |
|
| 121 | + if(!file_exists($path)) { |
|
| 122 | + return false; |
|
| 123 | + } |
|
| 112 | 124 | |
| 113 | - if(!is_writeable($path)) |
|
| 114 | - @chmod($path, 0777); |
|
| 125 | + if(!is_writeable($path)) { |
|
| 126 | + @chmod($path, 0777); |
|
| 127 | + } |
|
| 115 | 128 | |
| 116 | 129 | return is_writeable($path); |
| 117 | 130 | } |
@@ -133,8 +146,9 @@ discard block |
||
| 133 | 146 | { |
| 134 | 147 | $open_basedir = ini_get('open_basedir'); |
| 135 | 148 | |
| 136 | - if(!$open_basedir) |
|
| 137 | - $open_basedir = "none"; |
|
| 149 | + if(!$open_basedir) { |
|
| 150 | + $open_basedir = "none"; |
|
| 151 | + } |
|
| 138 | 152 | return $open_basedir; |
| 139 | 153 | } |
| 140 | 154 | |
@@ -153,8 +167,9 @@ discard block |
||
| 153 | 167 | $unit_count = count($unit_list); |
| 154 | 168 | for ($i = $unit_count - 1; $i >= 0; $i--) { |
| 155 | 169 | $power = $i * 10; |
| 156 | - if (($bytes >> $power) >= 1) |
|
| 157 | - return round($bytes / (1 << $power), $decimals) . ' ' . $unit_list[$i]; |
|
| 170 | + if (($bytes >> $power) >= 1) { |
|
| 171 | + return round($bytes / (1 << $power), $decimals) . ' ' . $unit_list[$i]; |
|
| 172 | + } |
|
| 158 | 173 | } |
| 159 | 174 | } |
| 160 | 175 | } |
@@ -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 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class Xcloner_Scheduler{ |
|
| 3 | +class Xcloner_Scheduler { |
|
| 4 | 4 | |
| 5 | 5 | private $db; |
| 6 | 6 | private $scheduler_table = "xcloner_scheduler"; |
@@ -15,23 +15,23 @@ discard block |
||
| 15 | 15 | global $wpdb; |
| 16 | 16 | $this->db = $wpdb; |
| 17 | 17 | |
| 18 | - $wpdb->show_errors = false; |
|
| 18 | + $wpdb->show_errors = false; |
|
| 19 | 19 | |
| 20 | 20 | $this->xcloner_settings = new Xcloner_Settings(); |
| 21 | 21 | |
| 22 | 22 | $this->scheduler_table = $this->db->prefix.$this->scheduler_table; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function get_scheduler_list($return_only_enabled = 0 ) |
|
| 25 | + public function get_scheduler_list($return_only_enabled = 0) |
|
| 26 | 26 | { |
| 27 | 27 | $list = $this->db->get_results("SELECT * FROM ".$this->scheduler_table); |
| 28 | 28 | |
| 29 | - if($return_only_enabled) |
|
| 29 | + if ($return_only_enabled) |
|
| 30 | 30 | { |
| 31 | - $new_list= array(); |
|
| 31 | + $new_list = array(); |
|
| 32 | 32 | |
| 33 | - foreach($list as $res) |
|
| 34 | - if($res->status) |
|
| 33 | + foreach ($list as $res) |
|
| 34 | + if ($res->status) |
|
| 35 | 35 | { |
| 36 | 36 | $res->next_run_time = wp_next_scheduled('xcloner_scheduler_'.$res->id, array($res->id)); |
| 37 | 37 | $new_list[] = $res; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | $data = $this->db->get_row("SELECT * FROM ".$this->scheduler_table." WHERE id=".$id, ARRAY_A); |
| 61 | 61 | |
| 62 | - if(!$data) |
|
| 62 | + if (!$data) |
|
| 63 | 63 | return false; |
| 64 | 64 | |
| 65 | 65 | $params = json_decode($data['params']); |
@@ -76,10 +76,10 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | public function delete_schedule_by_id($id) |
| 78 | 78 | { |
| 79 | - $hook = 'xcloner_scheduler_'.$id; |
|
| 80 | - wp_clear_scheduled_hook( $hook, array($id) ); |
|
| 79 | + $hook = 'xcloner_scheduler_'.$id; |
|
| 80 | + wp_clear_scheduled_hook($hook, array($id)); |
|
| 81 | 81 | |
| 82 | - $data = $this->db->delete( $this->scheduler_table , array( 'id' => $id ) ); |
|
| 82 | + $data = $this->db->delete($this->scheduler_table, array('id' => $id)); |
|
| 83 | 83 | |
| 84 | 84 | return $data; |
| 85 | 85 | } |
@@ -88,12 +88,12 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | $list = $this->get_scheduler_list(); |
| 90 | 90 | |
| 91 | - foreach($list as $schedule) |
|
| 91 | + foreach ($list as $schedule) |
|
| 92 | 92 | { |
| 93 | - $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 93 | + $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 94 | 94 | |
| 95 | - $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
|
| 96 | - wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
|
| 95 | + $timestamp = wp_next_scheduled($hook, array($schedule->id)); |
|
| 96 | + wp_unschedule_event($timestamp, $hook, array($schedule->id)); |
|
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
@@ -101,24 +101,24 @@ discard block |
||
| 101 | 101 | { |
| 102 | 102 | $list = $this->get_scheduler_list(); |
| 103 | 103 | |
| 104 | - foreach($list as $schedule) |
|
| 104 | + foreach ($list as $schedule) |
|
| 105 | 105 | { |
| 106 | - $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 106 | + $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 107 | 107 | |
| 108 | 108 | //adding the xcloner_scheduler hook with xcloner_scheduler_callback callback |
| 109 | - add_action( $hook, array($this, 'xcloner_scheduler_callback'), 10, 1 ); |
|
| 109 | + add_action($hook, array($this, 'xcloner_scheduler_callback'), 10, 1); |
|
| 110 | 110 | |
| 111 | - if ( ! wp_next_scheduled( $hook, array($schedule->id) ) and $schedule->status) { |
|
| 111 | + if (!wp_next_scheduled($hook, array($schedule->id)) and $schedule->status) { |
|
| 112 | 112 | |
| 113 | - if($schedule->recurrence == "single") |
|
| 114 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 113 | + if ($schedule->recurrence == "single") |
|
| 114 | + wp_schedule_single_event(strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 115 | 115 | else |
| 116 | - wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
| 116 | + wp_schedule_event(strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id)); |
|
| 117 | 117 | |
| 118 | - }elseif(!$schedule->status) |
|
| 118 | + }elseif (!$schedule->status) |
|
| 119 | 119 | { |
| 120 | - $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
|
| 121 | - wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
|
| 120 | + $timestamp = wp_next_scheduled($hook, array($schedule->id)); |
|
| 121 | + wp_unschedule_event($timestamp, $hook, array($schedule->id)); |
|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | |
@@ -127,17 +127,17 @@ discard block |
||
| 127 | 127 | public function update_cron_hook($id) |
| 128 | 128 | { |
| 129 | 129 | $schedule = $this->get_schedule_by_id_object($id); |
| 130 | - $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 130 | + $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 131 | 131 | |
| 132 | - $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
|
| 133 | - wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
|
| 132 | + $timestamp = wp_next_scheduled($hook, array($schedule->id)); |
|
| 133 | + wp_unschedule_event($timestamp, $hook, array($schedule->id)); |
|
| 134 | 134 | |
| 135 | 135 | if ($schedule->status) { |
| 136 | 136 | |
| 137 | - if($schedule->recurrence == "single") |
|
| 138 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 139 | - else{ |
|
| 140 | - wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
| 137 | + if ($schedule->recurrence == "single") |
|
| 138 | + wp_schedule_single_event(strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 139 | + else { |
|
| 140 | + wp_schedule_event(strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id)); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | } |
@@ -145,16 +145,16 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | public function disable_single_cron($schedule_id) |
| 147 | 147 | { |
| 148 | - $hook = 'xcloner_scheduler_'.$schedule_id; |
|
| 149 | - $timestamp = wp_next_scheduled( $hook , array($schedule_id) ); |
|
| 150 | - wp_unschedule_event( $timestamp, $hook, array($schedule_id) ); |
|
| 148 | + $hook = 'xcloner_scheduler_'.$schedule_id; |
|
| 149 | + $timestamp = wp_next_scheduled($hook, array($schedule_id)); |
|
| 150 | + wp_unschedule_event($timestamp, $hook, array($schedule_id)); |
|
| 151 | 151 | |
| 152 | 152 | $schedule['status'] = 0; |
| 153 | 153 | |
| 154 | 154 | $update = $this->db->update( |
| 155 | 155 | $this->scheduler_table, |
| 156 | 156 | $schedule, |
| 157 | - array( 'id' => $schedule_id ), |
|
| 157 | + array('id' => $schedule_id), |
|
| 158 | 158 | array( |
| 159 | 159 | '%s', |
| 160 | 160 | '%s' |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $update = $this->db->update( |
| 171 | 171 | $this->scheduler_table, |
| 172 | 172 | $schedule, |
| 173 | - array( 'id' => $schedule_id ), |
|
| 173 | + array('id' => $schedule_id), |
|
| 174 | 174 | array( |
| 175 | 175 | '%s', |
| 176 | 176 | '%s' |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $update = $this->db->update( |
| 187 | 187 | $this->scheduler_table, |
| 188 | 188 | $schedule, |
| 189 | - array( 'id' => $schedule_id ), |
|
| 189 | + array('id' => $schedule_id), |
|
| 190 | 190 | array( |
| 191 | 191 | '%s', |
| 192 | 192 | '%s' |
@@ -201,20 +201,20 @@ discard block |
||
| 201 | 201 | |
| 202 | 202 | $this->xcloner_settings->generate_new_hash(); |
| 203 | 203 | |
| 204 | - $this->xcloner_file_system = new Xcloner_File_System($this->xcloner_settings->get_hash()); |
|
| 205 | - $this->xcloner_database = new XCloner_Database($this->xcloner_settings->get_hash()); |
|
| 206 | - $this->archive_system = new Xcloner_Archive($this->xcloner_settings->get_hash()); |
|
| 207 | - $this->logger = new XCloner_Logger('xcloner_scheduler', $this->xcloner_settings->get_hash()); |
|
| 208 | - $this->xcloner_remote_storage = new Xcloner_Remote_Storage($this->xcloner_settings->get_hash()); |
|
| 204 | + $this->xcloner_file_system = new Xcloner_File_System($this->xcloner_settings->get_hash()); |
|
| 205 | + $this->xcloner_database = new XCloner_Database($this->xcloner_settings->get_hash()); |
|
| 206 | + $this->archive_system = new Xcloner_Archive($this->xcloner_settings->get_hash()); |
|
| 207 | + $this->logger = new XCloner_Logger('xcloner_scheduler', $this->xcloner_settings->get_hash()); |
|
| 208 | + $this->xcloner_remote_storage = new Xcloner_Remote_Storage($this->xcloner_settings->get_hash()); |
|
| 209 | 209 | |
| 210 | 210 | //$schedule = $this->get_schedule_by_id($id); |
| 211 | 211 | |
| 212 | - if($schedule['recurrence'] == "single") |
|
| 212 | + if ($schedule['recurrence'] == "single") |
|
| 213 | 213 | { |
| 214 | 214 | $this->disable_single_cron($schedule['id']); |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | - if(!$schedule) |
|
| 217 | + if (!$schedule) |
|
| 218 | 218 | { |
| 219 | 219 | $this->logger->info(sprintf("Could not load schedule with id'%s'", $id), array("CRON")); |
| 220 | 220 | return; |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $init = 1; |
| 230 | 230 | $continue = 1; |
| 231 | 231 | |
| 232 | - while($continue) |
|
| 232 | + while ($continue) |
|
| 233 | 233 | { |
| 234 | 234 | $continue = $this->xcloner_file_system->start_file_recursion($init); |
| 235 | 235 | |
@@ -244,9 +244,9 @@ discard block |
||
| 244 | 244 | $extra = array(); |
| 245 | 245 | $return['finished'] = 0; |
| 246 | 246 | |
| 247 | - while(!$return['finished']) |
|
| 247 | + while (!$return['finished']) |
|
| 248 | 248 | { |
| 249 | - $return = $this->xcloner_database->start_database_recursion((array)json_decode($schedule['table_params']), $return, $init); |
|
| 249 | + $return = $this->xcloner_database->start_database_recursion((array)json_decode($schedule['table_params']), $return, $init); |
|
| 250 | 250 | $init = 0; |
| 251 | 251 | } |
| 252 | 252 | |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | $return['finished'] = 0; |
| 260 | 260 | $return['extra'] = array(); |
| 261 | 261 | |
| 262 | - while(!$return['finished']) |
|
| 262 | + while (!$return['finished']) |
|
| 263 | 263 | { |
| 264 | 264 | $return = $this->archive_system->start_incremental_backup((array)$schedule['backup_params'], $return['extra'], $init); |
| 265 | 265 | $init = 0; |
@@ -268,28 +268,28 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | //getting the last backup archive file |
| 270 | 270 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_with_extension(); |
| 271 | - if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
| 271 | + if ($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
| 272 | 272 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
| 273 | 273 | |
| 274 | 274 | $this->update_last_backup($schedule['id'], $return['extra']['backup_parent']); |
| 275 | 275 | |
| 276 | - if($schedule['remote_storage'] and array_key_exists($schedule['remote_storage'], $this->xcloner_remote_storage->get_available_storages())) |
|
| 276 | + if ($schedule['remote_storage'] and array_key_exists($schedule['remote_storage'], $this->xcloner_remote_storage->get_available_storages())) |
|
| 277 | 277 | { |
| 278 | 278 | $backup_file = $return['extra']['backup_parent']; |
| 279 | 279 | |
| 280 | 280 | $this->logger->info(sprintf("Transferring backup to remote storage %s", strtoupper($schedule['remote_storage'])), array("CRON")); |
| 281 | 281 | |
| 282 | - if(method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) |
|
| 282 | + if (method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) |
|
| 283 | 283 | $return_storage = call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage'])); |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | |
| 287 | - if(isset($schedule['backup_params']->email_notification) and $to=$schedule['backup_params']->email_notification) |
|
| 287 | + if (isset($schedule['backup_params']->email_notification) and $to = $schedule['backup_params']->email_notification) |
|
| 288 | 288 | { |
| 289 | - try{ |
|
| 289 | + try { |
|
| 290 | 290 | $from = "XCloner Schedule - ".$schedule['name']; |
| 291 | 291 | $this->archive_system->send_notification($to, $from, "", $return['extra']['backup_parent'], $schedule); |
| 292 | - }catch(Exception $e) |
|
| 292 | + }catch (Exception $e) |
|
| 293 | 293 | { |
| 294 | 294 | $this->logger->error($e->getMessage()); |
| 295 | 295 | } |
@@ -304,16 +304,16 @@ discard block |
||
| 304 | 304 | { |
| 305 | 305 | $schedule = $this->get_schedule_by_id($id); |
| 306 | 306 | |
| 307 | - try{ |
|
| 307 | + try { |
|
| 308 | 308 | |
| 309 | 309 | $this->__xcloner_scheduler_callback($id, $schedule); |
| 310 | 310 | |
| 311 | - }catch(Exception $e){ |
|
| 311 | + }catch (Exception $e) { |
|
| 312 | 312 | |
| 313 | - if(isset($schedule['backup_params']->email_notification) and $to=$schedule['backup_params']->email_notification) |
|
| 313 | + if (isset($schedule['backup_params']->email_notification) and $to = $schedule['backup_params']->email_notification) |
|
| 314 | 314 | { |
| 315 | 315 | $from = "XCloner Schedule - ".$schedule['name']; |
| 316 | - $this->archive_system->send_notification($to, $from, "Scheduled backup error","", "", $e->getMessage()); |
|
| 316 | + $this->archive_system->send_notification($to, $from, "Scheduled backup error", "", "", $e->getMessage()); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | } |
@@ -30,10 +30,11 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | $new_list= array(); |
| 32 | 32 | |
| 33 | - foreach($list as $res) |
|
| 34 | - if($res->status) |
|
| 33 | + foreach($list as $res) { |
|
| 34 | + if($res->status) |
|
| 35 | 35 | { |
| 36 | 36 | $res->next_run_time = wp_next_scheduled('xcloner_scheduler_'.$res->id, array($res->id)); |
| 37 | + } |
|
| 37 | 38 | $new_list[] = $res; |
| 38 | 39 | } |
| 39 | 40 | $list = $new_list; |
@@ -59,8 +60,9 @@ discard block |
||
| 59 | 60 | { |
| 60 | 61 | $data = $this->db->get_row("SELECT * FROM ".$this->scheduler_table." WHERE id=".$id, ARRAY_A); |
| 61 | 62 | |
| 62 | - if(!$data) |
|
| 63 | - return false; |
|
| 63 | + if(!$data) { |
|
| 64 | + return false; |
|
| 65 | + } |
|
| 64 | 66 | |
| 65 | 67 | $params = json_decode($data['params']); |
| 66 | 68 | |
@@ -110,12 +112,13 @@ discard block |
||
| 110 | 112 | |
| 111 | 113 | if ( ! wp_next_scheduled( $hook, array($schedule->id) ) and $schedule->status) { |
| 112 | 114 | |
| 113 | - if($schedule->recurrence == "single") |
|
| 114 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 115 | - else |
|
| 116 | - wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
| 115 | + if($schedule->recurrence == "single") { |
|
| 116 | + wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 117 | + } else { |
|
| 118 | + wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
| 119 | + } |
|
| 117 | 120 | |
| 118 | - }elseif(!$schedule->status) |
|
| 121 | + } elseif(!$schedule->status) |
|
| 119 | 122 | { |
| 120 | 123 | $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
| 121 | 124 | wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
@@ -134,9 +137,9 @@ discard block |
||
| 134 | 137 | |
| 135 | 138 | if ($schedule->status) { |
| 136 | 139 | |
| 137 | - if($schedule->recurrence == "single") |
|
| 138 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 139 | - else{ |
|
| 140 | + if($schedule->recurrence == "single") { |
|
| 141 | + wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 142 | + } else{ |
|
| 140 | 143 | wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
| 141 | 144 | } |
| 142 | 145 | |
@@ -268,8 +271,9 @@ discard block |
||
| 268 | 271 | |
| 269 | 272 | //getting the last backup archive file |
| 270 | 273 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_with_extension(); |
| 271 | - if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
| 272 | - $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
|
| 274 | + if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) { |
|
| 275 | + $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
|
| 276 | + } |
|
| 273 | 277 | |
| 274 | 278 | $this->update_last_backup($schedule['id'], $return['extra']['backup_parent']); |
| 275 | 279 | |
@@ -279,8 +283,9 @@ discard block |
||
| 279 | 283 | |
| 280 | 284 | $this->logger->info(sprintf("Transferring backup to remote storage %s", strtoupper($schedule['remote_storage'])), array("CRON")); |
| 281 | 285 | |
| 282 | - if(method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) |
|
| 283 | - $return_storage = call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage'])); |
|
| 286 | + if(method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) { |
|
| 287 | + $return_storage = call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage'])); |
|
| 288 | + } |
|
| 284 | 289 | } |
| 285 | 290 | |
| 286 | 291 | |
@@ -289,7 +294,7 @@ discard block |
||
| 289 | 294 | try{ |
| 290 | 295 | $from = "XCloner Schedule - ".$schedule['name']; |
| 291 | 296 | $this->archive_system->send_notification($to, $from, "", $return['extra']['backup_parent'], $schedule); |
| 292 | - }catch(Exception $e) |
|
| 297 | + } catch(Exception $e) |
|
| 293 | 298 | { |
| 294 | 299 | $this->logger->error($e->getMessage()); |
| 295 | 300 | } |
@@ -308,7 +313,7 @@ discard block |
||
| 308 | 313 | |
| 309 | 314 | $this->__xcloner_scheduler_callback($id, $schedule); |
| 310 | 315 | |
| 311 | - }catch(Exception $e){ |
|
| 316 | + } catch(Exception $e){ |
|
| 312 | 317 | |
| 313 | 318 | if(isset($schedule['backup_params']->email_notification) and $to=$schedule['backup_params']->email_notification) |
| 314 | 319 | { |
@@ -99,9 +99,9 @@ |
||
| 99 | 99 | function xcloner_display() |
| 100 | 100 | { |
| 101 | 101 | // check user capabilities |
| 102 | - if (!current_user_can('manage_options')) { |
|
| 103 | - return; |
|
| 104 | - } |
|
| 102 | + if (!current_user_can('manage_options')) { |
|
| 103 | + return; |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | 106 | $page = sanitize_key($_GET['page']); |
| 107 | 107 | $plugin = new Xcloner(); |
@@ -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 | } |
@@ -31,8 +31,9 @@ discard block |
||
| 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 | 38 | define("DS", DIRECTORY_SEPARATOR); |
| 38 | 39 | |
@@ -135,7 +136,7 @@ discard block |
||
| 135 | 136 | |
| 136 | 137 | try{ |
| 137 | 138 | run_xcloner(); |
| 138 | -}catch(Exception $e) |
|
| 139 | +} catch(Exception $e) |
|
| 139 | 140 | { |
| 140 | 141 | echo $e->getMessage(); |
| 141 | 142 | } |
@@ -33,7 +33,10 @@ |
||
| 33 | 33 | <li class="active"> |
| 34 | 34 | <div class="collapsible-header active"><i class="material-icons">bug_report</i>XCloner Debugger</div> |
| 35 | 35 | <div class="collapsible-body"> |
| 36 | - <div class="console" id="xcloner-console"><?php if(isset($logger_content)) echo implode("<br />\n", $logger_content); ?></div> |
|
| 36 | + <div class="console" id="xcloner-console"><?php if(isset($logger_content)) { |
|
| 37 | + echo implode("<br />\n", $logger_content); |
|
| 38 | +} |
|
| 39 | +?></div> |
|
| 37 | 40 | </div> |
| 38 | 41 | </li> |
| 39 | 42 | </ul> |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$xcloner_settings = new Xcloner_Settings(); |
|
| 4 | -$logger = new Xcloner_Logger(); |
|
| 3 | +$xcloner_settings = new Xcloner_Settings(); |
|
| 4 | +$logger = new Xcloner_Logger(); |
|
| 5 | 5 | |
| 6 | 6 | |
| 7 | 7 | $xcloner_scheduler = new Xcloner_Scheduler(); |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | $xcloner_file_transfer->set_target("http://thinkovi.com/xcloner/xcloner_restore.php"); |
| 12 | 12 | |
| 13 | -$start = 0 ; |
|
| 13 | +$start = 0; |
|
| 14 | 14 | ?> |
| 15 | 15 | <div class="col s12 "> |
| 16 | 16 | <div> |
@@ -18,12 +18,12 @@ discard block |
||
| 18 | 18 | <?php echo __('XCloner Debugger Dashboard', 'xcloner-backup-and-restore') ?> |
| 19 | 19 | </h5> |
| 20 | 20 | |
| 21 | - <?php if($xcloner_settings->get_xcloner_option('xcloner_enable_log')) :?> |
|
| 21 | + <?php if ($xcloner_settings->get_xcloner_option('xcloner_enable_log')) :?> |
|
| 22 | 22 | <ul class="collapsible xcloner-debugger" data-collapsible="accordion"> |
| 23 | 23 | <li class="active"> |
| 24 | 24 | <div class="collapsible-header active"><i class="material-icons">bug_report</i>XCloner Debugger</div> |
| 25 | 25 | <div class="collapsible-body"> |
| 26 | - <div class="console" id="xcloner-console"><?php if(isset($logger_content)) echo implode("<br />\n", $logger_content); ?></div> |
|
| 26 | + <div class="console" id="xcloner-console"><?php if (isset($logger_content)) echo implode("<br />\n", $logger_content); ?></div> |
|
| 27 | 27 | </div> |
| 28 | 28 | </li> |
| 29 | 29 | </ul> |
@@ -36,6 +36,6 @@ discard block |
||
| 36 | 36 | }, 2000);*/ |
| 37 | 37 | }) |
| 38 | 38 | </script> |
| 39 | - <?php endif;?> |
|
| 39 | + <?php endif; ?> |
|
| 40 | 40 | </div> |
| 41 | 41 | </div> |