@@ -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) : ''; ?>"> |
@@ -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 | ?> |
@@ -175,6 +175,9 @@ |
||
| 175 | 175 | return $wpdb->prefix; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | + /** |
|
| 179 | + * @param string $option |
|
| 180 | + */ |
|
| 178 | 181 | public function get_xcloner_option($option) |
| 179 | 182 | { |
| 180 | 183 | $data = get_option($option); |
@@ -4,18 +4,18 @@ 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 | private $xcloner_sanitization; |
| 9 | 9 | |
| 10 | 10 | public function __construct($hash = "") |
| 11 | 11 | { |
| 12 | - if(isset($hash)) |
|
| 12 | + if (isset($hash)) |
|
| 13 | 13 | $this->set_hash($hash); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public function get_logger_filename($include_hash = 0) |
| 17 | 17 | { |
| 18 | - if($include_hash) |
|
| 18 | + if ($include_hash) |
|
| 19 | 19 | $filename = sprintf($this->logger_file_hash, $this->get_hash()); |
| 20 | 20 | else |
| 21 | 21 | $filename = sprintf($this->logger_file, $this->get_server_unique_hash(5)); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | public function get_xcloner_start_path() |
| 27 | 27 | { |
| 28 | - if(!get_option('xcloner_start_path') or !is_dir(get_option('xcloner_start_path'))) |
|
| 28 | + if (!get_option('xcloner_start_path') or !is_dir(get_option('xcloner_start_path'))) |
|
| 29 | 29 | $path = realpath(ABSPATH); |
| 30 | 30 | else |
| 31 | 31 | $path = get_option('xcloner_start_path'); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | public function get_xcloner_store_path() |
| 44 | 44 | { |
| 45 | - if(!get_option('xcloner_store_path') or !is_dir(get_option('xcloner_store_path'))) |
|
| 45 | + if (!get_option('xcloner_store_path') or !is_dir(get_option('xcloner_store_path'))) |
|
| 46 | 46 | $path = realpath(XCLONER_STORAGE_PATH); |
| 47 | 47 | else |
| 48 | 48 | $path = get_option('xcloner_store_path'); |
@@ -59,13 +59,13 @@ discard block |
||
| 59 | 59 | public function get_xcloner_tmp_path() |
| 60 | 60 | { |
| 61 | 61 | $path = sys_get_temp_dir().DS.".".$this->get_xcloner_tmp_path_suffix(); |
| 62 | - if(!is_dir($path)) |
|
| 62 | + if (!is_dir($path)) |
|
| 63 | 63 | { |
| 64 | 64 | @mkdir($path); |
| 65 | 65 | @chmod($path, 0777); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - if(!is_dir($path) or !is_writeable($path) or get_option('xcloner_force_tmp_path_site_root')) |
|
| 68 | + if (!is_dir($path) or !is_writeable($path) or get_option('xcloner_force_tmp_path_site_root')) |
|
| 69 | 69 | $path = $this->get_xcloner_store_path().DS.".".$this->get_xcloner_tmp_path_suffix(); |
| 70 | 70 | |
| 71 | 71 | return $path; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | public function get_enable_mysql_backup() |
| 75 | 75 | { |
| 76 | - if(get_option('xcloner_enable_mysql_backup')) |
|
| 76 | + if (get_option('xcloner_enable_mysql_backup')) |
|
| 77 | 77 | return true; |
| 78 | 78 | |
| 79 | 79 | return false; |
@@ -81,9 +81,9 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | public function get_backup_extension_name($ext = "") |
| 83 | 83 | { |
| 84 | - if(!$ext) |
|
| 84 | + if (!$ext) |
|
| 85 | 85 | { |
| 86 | - if(get_option('xcloner_backup_compression_level')) |
|
| 86 | + if (get_option('xcloner_backup_compression_level')) |
|
| 87 | 87 | $ext = ".tgz"; |
| 88 | 88 | else |
| 89 | 89 | $ext = ".tar"; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | public function get_hash() |
| 95 | 95 | { |
| 96 | - if(!$this->hash){ |
|
| 96 | + if (!$this->hash) { |
|
| 97 | 97 | $this->set_hash("-".$this->get_server_unique_hash(5)); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -105,17 +105,17 @@ discard block |
||
| 105 | 105 | { |
| 106 | 106 | $hash = "-".md5(rand()); |
| 107 | 107 | |
| 108 | - $this->set_hash(substr( $hash, 0, 6)); |
|
| 108 | + $this->set_hash(substr($hash, 0, 6)); |
|
| 109 | 109 | |
| 110 | 110 | return $hash; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | public function set_hash($hash = "") |
| 114 | 114 | { |
| 115 | - if(substr($hash, 0, 1) != "-" and strlen($hash)) |
|
| 115 | + if (substr($hash, 0, 1) != "-" and strlen($hash)) |
|
| 116 | 116 | $hash = "-".$hash; |
| 117 | 117 | |
| 118 | - $this->hash = substr( $hash, 0, 6); |
|
| 118 | + $this->hash = substr($hash, 0, 6); |
|
| 119 | 119 | |
| 120 | 120 | return $this; |
| 121 | 121 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | { |
| 125 | 125 | $data = parse_url(get_site_url()); |
| 126 | 126 | |
| 127 | - $backup_name = "backup_[domain]".(isset($data['port'])?":".$data['port']:"")."-[time]-".($this->get_enable_mysql_backup()?"sql":"nosql"); |
|
| 127 | + $backup_name = "backup_[domain]".(isset($data['port']) ? ":".$data['port'] : "")."-[time]-".($this->get_enable_mysql_backup() ? "sql" : "nosql"); |
|
| 128 | 128 | |
| 129 | 129 | return $backup_name; |
| 130 | 130 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | { |
| 134 | 134 | global $wpdb; |
| 135 | 135 | |
| 136 | - if(!$data = get_option('xcloner_mysql_hostname')) |
|
| 136 | + if (!$data = get_option('xcloner_mysql_hostname')) |
|
| 137 | 137 | $data = $wpdb->dbhost; |
| 138 | 138 | |
| 139 | 139 | return $data; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | { |
| 144 | 144 | global $wpdb; |
| 145 | 145 | |
| 146 | - if(!$data = get_option('xcloner_mysql_username')) |
|
| 146 | + if (!$data = get_option('xcloner_mysql_username')) |
|
| 147 | 147 | $data = $wpdb->dbuser; |
| 148 | 148 | |
| 149 | 149 | return $data; |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | { |
| 154 | 154 | global $wpdb; |
| 155 | 155 | |
| 156 | - if(!$data = get_option('xcloner_mysql_password')) |
|
| 156 | + if (!$data = get_option('xcloner_mysql_password')) |
|
| 157 | 157 | $data = $wpdb->dbpassword; |
| 158 | 158 | |
| 159 | 159 | return $data; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | { |
| 164 | 164 | global $wpdb; |
| 165 | 165 | |
| 166 | - if(!$data = get_option('xcloner_mysql_database')) |
|
| 166 | + if (!$data = get_option('xcloner_mysql_database')) |
|
| 167 | 167 | $data = $wpdb->dbname; |
| 168 | 168 | |
| 169 | 169 | return $data; |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | { |
| 188 | 188 | $hash = md5(get_home_url().__DIR__); |
| 189 | 189 | |
| 190 | - if($strlen) |
|
| 190 | + if ($strlen) |
|
| 191 | 191 | $hash = substr($hash, 0, $strlen); |
| 192 | 192 | |
| 193 | 193 | return $hash; |
@@ -199,20 +199,20 @@ discard block |
||
| 199 | 199 | $this->xcloner_sanitization = new Xcloner_Sanitization(); |
| 200 | 200 | |
| 201 | 201 | //ADDING MISSING OPTIONS |
| 202 | - if( false == get_option( 'xcloner_mysql_settings_page' ) ) { |
|
| 203 | - add_option( 'xcloner_mysql_settings_page' ); |
|
| 202 | + if (false == get_option('xcloner_mysql_settings_page')) { |
|
| 203 | + add_option('xcloner_mysql_settings_page'); |
|
| 204 | 204 | } // end if |
| 205 | 205 | |
| 206 | - if( false == get_option( 'xcloner_cron_settings_page' ) ) { |
|
| 207 | - add_option( 'xcloner_cron_settings_page' ); |
|
| 206 | + if (false == get_option('xcloner_cron_settings_page')) { |
|
| 207 | + add_option('xcloner_cron_settings_page'); |
|
| 208 | 208 | } // end if |
| 209 | 209 | |
| 210 | - if( false == get_option( 'xcloner_system_settings_page' ) ) { |
|
| 211 | - add_option( 'xcloner_system_settings_page' ); |
|
| 210 | + if (false == get_option('xcloner_system_settings_page')) { |
|
| 211 | + add_option('xcloner_system_settings_page'); |
|
| 212 | 212 | } // end if |
| 213 | 213 | |
| 214 | - if( false == get_option( 'xcloner_cleanup_settings_page' ) ) { |
|
| 215 | - add_option( 'xcloner_cleanup_settings_page' ); |
|
| 214 | + if (false == get_option('xcloner_cleanup_settings_page')) { |
|
| 215 | + add_option('xcloner_cleanup_settings_page'); |
|
| 216 | 216 | } // end if |
| 217 | 217 | |
| 218 | 218 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | //SYSTEM section |
| 236 | 236 | add_settings_section( |
| 237 | 237 | 'xcloner_system_settings_group', |
| 238 | - __('These are advanced options recommended for developers!','xcloner-backup-and-restore'), |
|
| 238 | + __('These are advanced options recommended for developers!', 'xcloner-backup-and-restore'), |
|
| 239 | 239 | array($this, 'xcloner_settings_section_cb'), |
| 240 | 240 | 'xcloner_system_settings_page' |
| 241 | 241 | ); |
@@ -263,12 +263,12 @@ discard block |
||
| 263 | 263 | register_setting('xcloner_general_settings_group', 'xcloner_backup_compression_level', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 264 | 264 | add_settings_field( |
| 265 | 265 | 'xcloner_backup_compression_level', |
| 266 | - __('Backup Compression Level','xcloner-backup-and-restore'), |
|
| 266 | + __('Backup Compression Level', 'xcloner-backup-and-restore'), |
|
| 267 | 267 | array($this, 'do_form_range_field'), |
| 268 | 268 | 'xcloner_settings_page', |
| 269 | 269 | 'xcloner_general_settings_group', |
| 270 | 270 | array('xcloner_backup_compression_level', |
| 271 | - __('Options between [0-9]. Value 0 means no compression, while 9 is maximum compression affecting cpu load','xcloner-backup-and-restore'), |
|
| 271 | + __('Options between [0-9]. Value 0 means no compression, while 9 is maximum compression affecting cpu load', 'xcloner-backup-and-restore'), |
|
| 272 | 272 | 0, |
| 273 | 273 | 9 |
| 274 | 274 | ) |
@@ -277,12 +277,12 @@ discard block |
||
| 277 | 277 | register_setting('xcloner_general_settings_group', 'xcloner_start_path', array($this->xcloner_sanitization, "sanitize_input_as_absolute_path")); |
| 278 | 278 | add_settings_field( |
| 279 | 279 | 'xcloner_start_path', |
| 280 | - __('Backup Start Location','xcloner-backup-and-restore'), |
|
| 280 | + __('Backup Start Location', 'xcloner-backup-and-restore'), |
|
| 281 | 281 | array($this, 'do_form_text_field'), |
| 282 | 282 | 'xcloner_settings_page', |
| 283 | 283 | 'xcloner_general_settings_group', |
| 284 | 284 | array('xcloner_start_path', |
| 285 | - __('Base path location from where XCloner can start the Backup.','xcloner-backup-and-restore'), |
|
| 285 | + __('Base path location from where XCloner can start the Backup.', 'xcloner-backup-and-restore'), |
|
| 286 | 286 | $this->get_xcloner_start_path(), |
| 287 | 287 | //'disabled' |
| 288 | 288 | ) |
@@ -291,12 +291,12 @@ discard block |
||
| 291 | 291 | register_setting('xcloner_general_settings_group', 'xcloner_store_path', array($this->xcloner_sanitization, "sanitize_input_as_absolute_path")); |
| 292 | 292 | add_settings_field( |
| 293 | 293 | 'xcloner_store_path', |
| 294 | - __('Backup Storage Location','xcloner-backup-and-restore'), |
|
| 294 | + __('Backup Storage Location', 'xcloner-backup-and-restore'), |
|
| 295 | 295 | array($this, 'do_form_text_field'), |
| 296 | 296 | 'xcloner_settings_page', |
| 297 | 297 | 'xcloner_general_settings_group', |
| 298 | 298 | array('xcloner_store_path', |
| 299 | - __('Location where XCloner will store the Backup archives.','xcloner-backup-and-restore'), |
|
| 299 | + __('Location where XCloner will store the Backup archives.', 'xcloner-backup-and-restore'), |
|
| 300 | 300 | $this->get_xcloner_store_path(), |
| 301 | 301 | //'disabled' |
| 302 | 302 | ) |
@@ -305,24 +305,24 @@ discard block |
||
| 305 | 305 | register_setting('xcloner_general_settings_group', 'xcloner_enable_log', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 306 | 306 | add_settings_field( |
| 307 | 307 | 'xcloner_enable_log', |
| 308 | - __('Enable XCloner Backup Log','xcloner-backup-and-restore'), |
|
| 308 | + __('Enable XCloner Backup Log', 'xcloner-backup-and-restore'), |
|
| 309 | 309 | array($this, 'do_form_switch_field'), |
| 310 | 310 | 'xcloner_settings_page', |
| 311 | 311 | 'xcloner_general_settings_group', |
| 312 | 312 | array('xcloner_enable_log', |
| 313 | - 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 | + 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()) |
|
| 314 | 314 | ) |
| 315 | 315 | ); |
| 316 | 316 | |
| 317 | 317 | register_setting('xcloner_general_settings_group', 'xcloner_regex_exclude', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
| 318 | 318 | add_settings_field( |
| 319 | 319 | 'xcloner_regex_exclude', |
| 320 | - __('Regex Exclude Files','xcloner-backup-and-restore'), |
|
| 320 | + __('Regex Exclude Files', 'xcloner-backup-and-restore'), |
|
| 321 | 321 | array($this, 'do_form_textarea_field'), |
| 322 | 322 | 'xcloner_settings_page', |
| 323 | 323 | 'xcloner_general_settings_group', |
| 324 | 324 | array('xcloner_regex_exclude', |
| 325 | - __('Regular expression match to exclude files and folders, example patterns provided below, one pattern per line','xcloner-backup-and-restore'), |
|
| 325 | + __('Regular expression match to exclude files and folders, example patterns provided below, one pattern per line', 'xcloner-backup-and-restore'), |
|
| 326 | 326 | //$this->get_xcloner_store_path(), |
| 327 | 327 | //'disabled' |
| 328 | 328 | ) |
@@ -332,36 +332,36 @@ discard block |
||
| 332 | 332 | register_setting('xcloner_mysql_settings_group', 'xcloner_enable_mysql_backup', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 333 | 333 | add_settings_field( |
| 334 | 334 | 'xcloner_enable_mysql_backup', |
| 335 | - __('Enable Mysql Backup','xcloner-backup-and-restore'), |
|
| 335 | + __('Enable Mysql Backup', 'xcloner-backup-and-restore'), |
|
| 336 | 336 | array($this, 'do_form_switch_field'), |
| 337 | 337 | 'xcloner_mysql_settings_page', |
| 338 | 338 | 'xcloner_mysql_settings_group', |
| 339 | 339 | array('xcloner_enable_mysql_backup', |
| 340 | - __('Enable Mysql Backup Option. If you don\'t want to backup the database, you can disable this.','xcloner-backup-and-restore') |
|
| 340 | + __('Enable Mysql Backup Option. If you don\'t want to backup the database, you can disable this.', 'xcloner-backup-and-restore') |
|
| 341 | 341 | ) |
| 342 | 342 | ); |
| 343 | 343 | |
| 344 | 344 | register_setting('xcloner_mysql_settings_group', 'xcloner_backup_only_wp_tables'); |
| 345 | 345 | add_settings_field( |
| 346 | 346 | 'xcloner_backup_only_wp_tables', |
| 347 | - __('Backup only WP tables','xcloner-backup-and-restore'), |
|
| 347 | + __('Backup only WP tables', 'xcloner-backup-and-restore'), |
|
| 348 | 348 | array($this, 'do_form_switch_field'), |
| 349 | 349 | 'xcloner_mysql_settings_page', |
| 350 | 350 | 'xcloner_mysql_settings_group', |
| 351 | 351 | array('xcloner_backup_only_wp_tables', |
| 352 | - sprintf(__('Enable this if you only want to Backup only tables starting with \'%s\' prefix','xcloner-backup-and-restore'), $this->get_table_prefix()) |
|
| 352 | + sprintf(__('Enable this if you only want to Backup only tables starting with \'%s\' prefix', 'xcloner-backup-and-restore'), $this->get_table_prefix()) |
|
| 353 | 353 | ) |
| 354 | 354 | ); |
| 355 | 355 | |
| 356 | 356 | register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_hostname', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
| 357 | 357 | add_settings_field( |
| 358 | 358 | 'xcloner_mysql_hostname', |
| 359 | - __('Mysql Hostname','xcloner-backup-and-restore'), |
|
| 359 | + __('Mysql Hostname', 'xcloner-backup-and-restore'), |
|
| 360 | 360 | array($this, 'do_form_text_field'), |
| 361 | 361 | 'xcloner_mysql_settings_page', |
| 362 | 362 | 'xcloner_mysql_settings_group', |
| 363 | 363 | array('xcloner_mysql_hostname', |
| 364 | - __('Wordpress mysql hostname','xcloner-backup-and-restore'), |
|
| 364 | + __('Wordpress mysql hostname', 'xcloner-backup-and-restore'), |
|
| 365 | 365 | $this->get_db_hostname(), |
| 366 | 366 | 'disabled' |
| 367 | 367 | ) |
@@ -370,12 +370,12 @@ discard block |
||
| 370 | 370 | register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_username', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
| 371 | 371 | add_settings_field( |
| 372 | 372 | 'xcloner_mysql_username', |
| 373 | - __('Mysql Username','xcloner-backup-and-restore'), |
|
| 373 | + __('Mysql Username', 'xcloner-backup-and-restore'), |
|
| 374 | 374 | array($this, 'do_form_text_field'), |
| 375 | 375 | 'xcloner_mysql_settings_page', |
| 376 | 376 | 'xcloner_mysql_settings_group', |
| 377 | 377 | array('xcloner_mysql_username', |
| 378 | - __('Wordpress mysql username','xcloner-backup-and-restore'), |
|
| 378 | + __('Wordpress mysql username', 'xcloner-backup-and-restore'), |
|
| 379 | 379 | $this->get_db_username(), |
| 380 | 380 | 'disabled' |
| 381 | 381 | ) |
@@ -384,12 +384,12 @@ discard block |
||
| 384 | 384 | register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_database', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
| 385 | 385 | add_settings_field( |
| 386 | 386 | 'xcloner_mysql_database', |
| 387 | - __('Mysql Database','xcloner-backup-and-restore'), |
|
| 387 | + __('Mysql Database', 'xcloner-backup-and-restore'), |
|
| 388 | 388 | array($this, 'do_form_text_field'), |
| 389 | 389 | 'xcloner_mysql_settings_page', |
| 390 | 390 | 'xcloner_mysql_settings_group', |
| 391 | 391 | array('xcloner_mysql_database', |
| 392 | - __('Wordpress mysql database','xcloner-backup-and-restore'), |
|
| 392 | + __('Wordpress mysql database', 'xcloner-backup-and-restore'), |
|
| 393 | 393 | $this->get_db_database(), |
| 394 | 394 | 'disabled' |
| 395 | 395 | ) |
@@ -399,12 +399,12 @@ discard block |
||
| 399 | 399 | register_setting('xcloner_system_settings_group', 'xcloner_size_limit_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 400 | 400 | add_settings_field( |
| 401 | 401 | 'xcloner_size_limit_per_request', |
| 402 | - __('Data Size Limit Per Request','xcloner-backup-and-restore'), |
|
| 402 | + __('Data Size Limit Per Request', 'xcloner-backup-and-restore'), |
|
| 403 | 403 | array($this, 'do_form_range_field'), |
| 404 | 404 | 'xcloner_system_settings_page', |
| 405 | 405 | 'xcloner_system_settings_group', |
| 406 | 406 | array('xcloner_size_limit_per_request', |
| 407 | - __('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 | + __('Use this option to set how much file data can XCloner backup in one AJAX request. Range 0-1024 MB', 'xcloner-backup-and-restore'), |
|
| 408 | 408 | 0, |
| 409 | 409 | 1024 |
| 410 | 410 | ) |
@@ -413,12 +413,12 @@ discard block |
||
| 413 | 413 | register_setting('xcloner_system_settings_group', 'xcloner_files_to_process_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 414 | 414 | add_settings_field( |
| 415 | 415 | 'xcloner_files_to_process_per_request', |
| 416 | - __('Files To Process Per Request','xcloner-backup-and-restore'), |
|
| 416 | + __('Files To Process Per Request', 'xcloner-backup-and-restore'), |
|
| 417 | 417 | array($this, 'do_form_range_field'), |
| 418 | 418 | 'xcloner_system_settings_page', |
| 419 | 419 | 'xcloner_system_settings_group', |
| 420 | 420 | array('xcloner_files_to_process_per_request', |
| 421 | - __('Use this option to set how many files XCloner should process at one time before doing another AJAX call','xcloner-backup-and-restore'), |
|
| 421 | + __('Use this option to set how many files XCloner should process at one time before doing another AJAX call', 'xcloner-backup-and-restore'), |
|
| 422 | 422 | 0, |
| 423 | 423 | 1000 |
| 424 | 424 | ) |
@@ -427,12 +427,12 @@ discard block |
||
| 427 | 427 | register_setting('xcloner_system_settings_group', 'xcloner_directories_to_scan_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 428 | 428 | add_settings_field( |
| 429 | 429 | 'xcloner_directories_to_scan_per_request', |
| 430 | - __('Directories To Scan Per Request','xcloner-backup-and-restore'), |
|
| 430 | + __('Directories To Scan Per Request', 'xcloner-backup-and-restore'), |
|
| 431 | 431 | array($this, 'do_form_range_field'), |
| 432 | 432 | 'xcloner_system_settings_page', |
| 433 | 433 | 'xcloner_system_settings_group', |
| 434 | 434 | array('xcloner_directories_to_scan_per_request', |
| 435 | - __('Use this option to set how many directories XCloner should scan at one time before doing another AJAX call','xcloner-backup-and-restore'), |
|
| 435 | + __('Use this option to set how many directories XCloner should scan at one time before doing another AJAX call', 'xcloner-backup-and-restore'), |
|
| 436 | 436 | 0, |
| 437 | 437 | 1000 |
| 438 | 438 | ) |
@@ -441,12 +441,12 @@ discard block |
||
| 441 | 441 | register_setting('xcloner_system_settings_group', 'xcloner_database_records_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 442 | 442 | add_settings_field( |
| 443 | 443 | 'xcloner_database_records_per_request', |
| 444 | - __('Database Records Per Request','xcloner-backup-and-restore'), |
|
| 444 | + __('Database Records Per Request', 'xcloner-backup-and-restore'), |
|
| 445 | 445 | array($this, 'do_form_range_field'), |
| 446 | 446 | 'xcloner_system_settings_page', |
| 447 | 447 | 'xcloner_system_settings_group', |
| 448 | 448 | array('xcloner_database_records_per_request', |
| 449 | - __('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 | + __('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'), |
|
| 450 | 450 | 0, |
| 451 | 451 | 100000 |
| 452 | 452 | ) |
@@ -455,36 +455,36 @@ discard block |
||
| 455 | 455 | register_setting('xcloner_system_settings_group', 'xcloner_exclude_files_larger_than_mb', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 456 | 456 | add_settings_field( |
| 457 | 457 | 'xcloner_exclude_files_larger_than_mb', |
| 458 | - __('Exclude files larger than (MB)','xcloner-backup-and-restore'), |
|
| 458 | + __('Exclude files larger than (MB)', 'xcloner-backup-and-restore'), |
|
| 459 | 459 | array($this, 'do_form_number_field'), |
| 460 | 460 | 'xcloner_system_settings_page', |
| 461 | 461 | 'xcloner_system_settings_group', |
| 462 | 462 | array('xcloner_exclude_files_larger_than_mb', |
| 463 | - __('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 | + __('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'), |
|
| 464 | 464 | ) |
| 465 | 465 | ); |
| 466 | 466 | |
| 467 | 467 | register_setting('xcloner_system_settings_group', 'xcloner_split_backup_limit', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 468 | 468 | add_settings_field( |
| 469 | 469 | 'xcloner_split_backup_limit', |
| 470 | - __('Split Backup Archive Limit (MB)','xcloner-backup-and-restore'), |
|
| 470 | + __('Split Backup Archive Limit (MB)', 'xcloner-backup-and-restore'), |
|
| 471 | 471 | array($this, 'do_form_number_field'), |
| 472 | 472 | 'xcloner_system_settings_page', |
| 473 | 473 | 'xcloner_system_settings_group', |
| 474 | 474 | array('xcloner_split_backup_limit', |
| 475 | - __('Use this option to automatically split the backup archive into smaller parts. Range 0-10000 MB','xcloner-backup-and-restore'), |
|
| 475 | + __('Use this option to automatically split the backup archive into smaller parts. Range 0-10000 MB', 'xcloner-backup-and-restore'), |
|
| 476 | 476 | ) |
| 477 | 477 | ); |
| 478 | 478 | |
| 479 | 479 | register_setting('xcloner_system_settings_group', 'xcloner_force_tmp_path_site_root'); |
| 480 | 480 | add_settings_field( |
| 481 | 481 | 'xcloner_force_tmp_path_site_root', |
| 482 | - __('Force Temporary Path Within XCloner Storage','xcloner-backup-and-restore'), |
|
| 482 | + __('Force Temporary Path Within XCloner Storage', 'xcloner-backup-and-restore'), |
|
| 483 | 483 | array($this, 'do_form_switch_field'), |
| 484 | 484 | 'xcloner_system_settings_page', |
| 485 | 485 | 'xcloner_system_settings_group', |
| 486 | 486 | array('xcloner_force_tmp_path_site_root', |
| 487 | - 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 | + 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()) |
|
| 488 | 488 | ) |
| 489 | 489 | ); |
| 490 | 490 | |
@@ -492,36 +492,36 @@ discard block |
||
| 492 | 492 | register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_retention_limit_days', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 493 | 493 | add_settings_field( |
| 494 | 494 | 'xcloner_cleanup_retention_limit_days', |
| 495 | - __('Cleanup by Date(days)','xcloner-backup-and-restore'), |
|
| 495 | + __('Cleanup by Date(days)', 'xcloner-backup-and-restore'), |
|
| 496 | 496 | array($this, 'do_form_number_field'), |
| 497 | 497 | 'xcloner_cleanup_settings_page', |
| 498 | 498 | 'xcloner_cleanup_settings_group', |
| 499 | 499 | array('xcloner_cleanup_retention_limit_days', |
| 500 | - __('Specify the maximum number of days a backup archive can be kept on the server. 0 disables this option','xcloner-backup-and-restore') |
|
| 500 | + __('Specify the maximum number of days a backup archive can be kept on the server. 0 disables this option', 'xcloner-backup-and-restore') |
|
| 501 | 501 | ) |
| 502 | 502 | ); |
| 503 | 503 | |
| 504 | 504 | register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_retention_limit_archives', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 505 | 505 | add_settings_field( |
| 506 | 506 | 'xcloner_cleanup_retention_limit_archives', |
| 507 | - __('Cleanup by Quantity','xcloner-backup-and-restore'), |
|
| 507 | + __('Cleanup by Quantity', 'xcloner-backup-and-restore'), |
|
| 508 | 508 | array($this, 'do_form_number_field'), |
| 509 | 509 | 'xcloner_cleanup_settings_page', |
| 510 | 510 | 'xcloner_cleanup_settings_group', |
| 511 | 511 | array('xcloner_cleanup_retention_limit_archives', |
| 512 | - __('Specify the maximum number of backup archives to keep on the server. 0 disables this option','xcloner-backup-and-restore') |
|
| 512 | + __('Specify the maximum number of backup archives to keep on the server. 0 disables this option', 'xcloner-backup-and-restore') |
|
| 513 | 513 | ) |
| 514 | 514 | ); |
| 515 | 515 | |
| 516 | 516 | register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_capacity_limit', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 517 | 517 | add_settings_field( |
| 518 | 518 | 'xcloner_cleanup_capacity_limit', |
| 519 | - __('Cleanup by Capacity(MB)','xcloner-backup-and-restore'), |
|
| 519 | + __('Cleanup by Capacity(MB)', 'xcloner-backup-and-restore'), |
|
| 520 | 520 | array($this, 'do_form_number_field'), |
| 521 | 521 | 'xcloner_cleanup_settings_page', |
| 522 | 522 | 'xcloner_cleanup_settings_group', |
| 523 | 523 | array('xcloner_cleanup_capacity_limit', |
| 524 | - __('Remove oldest backups if all created backups exceed the configured limit in Megabytes. 0 disables this option','xcloner-backup-and-restore') |
|
| 524 | + __('Remove oldest backups if all created backups exceed the configured limit in Megabytes. 0 disables this option', 'xcloner-backup-and-restore') |
|
| 525 | 525 | ) |
| 526 | 526 | ); |
| 527 | 527 | |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | register_setting('xcloner_cron_settings_group', 'xcloner_cron_frequency'); |
| 530 | 530 | add_settings_field( |
| 531 | 531 | 'xcloner_cron_frequency', |
| 532 | - __('Cron frequency','xcloner-backup-and-restore'), |
|
| 532 | + __('Cron frequency', 'xcloner-backup-and-restore'), |
|
| 533 | 533 | array($this, 'do_form_text_field'), |
| 534 | 534 | 'xcloner_cron_settings_page', |
| 535 | 535 | 'xcloner_cron_settings_group', |
@@ -555,20 +555,20 @@ discard block |
||
| 555 | 555 | // text field content cb |
| 556 | 556 | public function do_form_text_field($params) |
| 557 | 557 | { |
| 558 | - if(!isset($params['3'])) |
|
| 558 | + if (!isset($params['3'])) |
|
| 559 | 559 | $params[3] = 0; |
| 560 | - if(!isset($params['2'])) |
|
| 560 | + if (!isset($params['2'])) |
|
| 561 | 561 | $params[2] = 0; |
| 562 | 562 | |
| 563 | 563 | list($fieldname, $label, $value, $disabled) = $params; |
| 564 | 564 | |
| 565 | - if(!$value) |
|
| 565 | + if (!$value) |
|
| 566 | 566 | $value = get_option($fieldname); |
| 567 | 567 | // output the field |
| 568 | 568 | ?> |
| 569 | 569 | <div class="row"> |
| 570 | 570 | <div class="input-field col s10 m10 l8"> |
| 571 | - <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 | + <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) : ''; ?>"> |
|
| 572 | 572 | </div> |
| 573 | 573 | <div class="col s2 m2 "> |
| 574 | 574 | <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> |
@@ -582,20 +582,20 @@ discard block |
||
| 582 | 582 | // textarea field content cb |
| 583 | 583 | public function do_form_textarea_field($params) |
| 584 | 584 | { |
| 585 | - if(!isset($params['3'])) |
|
| 585 | + if (!isset($params['3'])) |
|
| 586 | 586 | $params[3] = 0; |
| 587 | - if(!isset($params['2'])) |
|
| 587 | + if (!isset($params['2'])) |
|
| 588 | 588 | $params[2] = 0; |
| 589 | 589 | |
| 590 | 590 | list($fieldname, $label, $value, $disabled) = $params; |
| 591 | 591 | |
| 592 | - if(!$value) |
|
| 592 | + if (!$value) |
|
| 593 | 593 | $value = get_option($fieldname); |
| 594 | 594 | // output the field |
| 595 | 595 | ?> |
| 596 | 596 | <div class="row"> |
| 597 | 597 | <div class="input-field col s10 m10 l8"> |
| 598 | - <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 | + <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> |
|
| 599 | 599 | </div> |
| 600 | 600 | <div class="col s2 m2 "> |
| 601 | 601 | <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> |
@@ -625,20 +625,20 @@ discard block |
||
| 625 | 625 | // number field content cb |
| 626 | 626 | public function do_form_number_field($params) |
| 627 | 627 | { |
| 628 | - if(!isset($params['3'])) |
|
| 628 | + if (!isset($params['3'])) |
|
| 629 | 629 | $params[3] = 0; |
| 630 | - if(!isset($params['2'])) |
|
| 630 | + if (!isset($params['2'])) |
|
| 631 | 631 | $params[2] = 0; |
| 632 | 632 | |
| 633 | 633 | list($fieldname, $label, $value, $disabled) = $params; |
| 634 | 634 | |
| 635 | - if(!$value) |
|
| 635 | + if (!$value) |
|
| 636 | 636 | $value = get_option($fieldname); |
| 637 | 637 | // output the field |
| 638 | 638 | ?> |
| 639 | 639 | <div class="row"> |
| 640 | 640 | <div class="input-field col s10 m5 l3"> |
| 641 | - <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 | + <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) : ''; ?>"> |
|
| 642 | 642 | </div> |
| 643 | 643 | <div class="col s2 m2 "> |
| 644 | 644 | <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> |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | |
| 652 | 652 | public function do_form_range_field($params) |
| 653 | 653 | { |
| 654 | - if(!isset($params['4'])) |
|
| 654 | + if (!isset($params['4'])) |
|
| 655 | 655 | $params[4] = 0; |
| 656 | 656 | |
| 657 | 657 | list($fieldname, $label, $range_start, $range_end, $disabled) = $params; |
@@ -660,7 +660,7 @@ discard block |
||
| 660 | 660 | <div class="row"> |
| 661 | 661 | <div class="input-field col s10 m10 l8"> |
| 662 | 662 | <p class="range-field"> |
| 663 | - <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 | + <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) : ''; ?>" /> |
|
| 664 | 664 | </p> |
| 665 | 665 | </div> |
| 666 | 666 | <div class="col s2 m2 "> |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | |
| 674 | 674 | public function do_form_switch_field($params) |
| 675 | 675 | { |
| 676 | - if(!isset($params['2'])) |
|
| 676 | + if (!isset($params['2'])) |
|
| 677 | 677 | $params[2] = 0; |
| 678 | 678 | list($fieldname, $label, $disabled) = $params; |
| 679 | 679 | $value = get_option($fieldname); |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | <div class="switch"> |
| 684 | 684 | <label> |
| 685 | 685 | Off |
| 686 | - <input <?php echo ($disabled)?"disabled":""?> type="checkbox" name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" value="1" <?php echo ($value) ? 'checked="checked"' : ''; ?>"> |
|
| 686 | + <input <?php echo ($disabled) ? "disabled" : ""?> type="checkbox" name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" value="1" <?php echo ($value) ? 'checked="checked"' : ''; ?>"> |
|
| 687 | 687 | <span class="lever"></span> |
| 688 | 688 | On |
| 689 | 689 | </label> |
@@ -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}"); |
@@ -332,27 +332,27 @@ discard block |
||
| 332 | 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 | 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 | } |
@@ -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 | } |
@@ -3,31 +3,31 @@ 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 | private $xcloner_settings; |
| 10 | 10 | |
| 11 | 11 | public function __construct() |
| 12 | 12 | { |
| 13 | - $this->xcloner_settings = new Xcloner_Settings(); |
|
| 13 | + $this->xcloner_settings = new Xcloner_Settings(); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public function check_backup_ready_status() |
| 17 | 17 | { |
| 18 | - if(!$this->check_min_php_version(1)) |
|
| 18 | + if (!$this->check_min_php_version(1)) |
|
| 19 | 19 | return false; |
| 20 | 20 | |
| 21 | - if(!$this->check_safe_mode(1)) |
|
| 21 | + if (!$this->check_safe_mode(1)) |
|
| 22 | 22 | return false; |
| 23 | 23 | |
| 24 | - if(!$this->check_xcloner_start_path(1)) |
|
| 24 | + if (!$this->check_xcloner_start_path(1)) |
|
| 25 | 25 | return false; |
| 26 | 26 | |
| 27 | - if(!$this->check_xcloner_store_path(1)) |
|
| 27 | + if (!$this->check_xcloner_store_path(1)) |
|
| 28 | 28 | return false; |
| 29 | 29 | |
| 30 | - if(!$this->check_xcloner_tmp_path(1)) |
|
| 30 | + if (!$this->check_xcloner_tmp_path(1)) |
|
| 31 | 31 | return false; |
| 32 | 32 | |
| 33 | 33 | return true; |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | public function check_min_php_version($return_bool = 0) |
| 42 | 42 | { |
| 43 | 43 | |
| 44 | - if($return_bool == 1) |
|
| 44 | + if ($return_bool == 1) |
|
| 45 | 45 | { |
| 46 | - if(version_compare(phpversion(), $this->min_php_version, '<')) |
|
| 46 | + if (version_compare(phpversion(), $this->min_php_version, '<')) |
|
| 47 | 47 | return false; |
| 48 | 48 | else |
| 49 | 49 | return true; |
@@ -52,31 +52,31 @@ discard block |
||
| 52 | 52 | return phpversion(); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function check_safe_mode($return_bool=0) |
|
| 55 | + public function check_safe_mode($return_bool = 0) |
|
| 56 | 56 | { |
| 57 | 57 | $safe_mode = "Off"; |
| 58 | 58 | |
| 59 | - if($return_bool) |
|
| 59 | + if ($return_bool) |
|
| 60 | 60 | { |
| 61 | - if( ini_get('safe_mode') ) |
|
| 61 | + if (ini_get('safe_mode')) |
|
| 62 | 62 | return false; |
| 63 | 63 | else |
| 64 | 64 | return true; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - if( ini_get('safe_mode') ) |
|
| 67 | + if (ini_get('safe_mode')) |
|
| 68 | 68 | $safe_mode = "On"; |
| 69 | 69 | |
| 70 | 70 | return $safe_mode; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - public function check_xcloner_start_path($return_bool=0) |
|
| 73 | + public function check_xcloner_start_path($return_bool = 0) |
|
| 74 | 74 | { |
| 75 | 75 | $path = $this->xcloner_settings->get_xcloner_start_path(); |
| 76 | 76 | |
| 77 | - if($return_bool) |
|
| 77 | + if ($return_bool) |
|
| 78 | 78 | { |
| 79 | - if(!file_exists($path)) |
|
| 79 | + if (!file_exists($path)) |
|
| 80 | 80 | return false; |
| 81 | 81 | |
| 82 | 82 | return is_readable($path); |
@@ -85,16 +85,16 @@ discard block |
||
| 85 | 85 | return $path; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - public function check_xcloner_tmp_path($return_bool=0) |
|
| 88 | + public function check_xcloner_tmp_path($return_bool = 0) |
|
| 89 | 89 | { |
| 90 | 90 | $path = $this->xcloner_settings->get_xcloner_tmp_path(); |
| 91 | 91 | |
| 92 | - if($return_bool) |
|
| 92 | + if ($return_bool) |
|
| 93 | 93 | { |
| 94 | - if(!file_exists($path)) |
|
| 94 | + if (!file_exists($path)) |
|
| 95 | 95 | return false; |
| 96 | 96 | |
| 97 | - if(!is_writeable($path)) |
|
| 97 | + if (!is_writeable($path)) |
|
| 98 | 98 | @chmod($path, 0777); |
| 99 | 99 | |
| 100 | 100 | return is_writeable($path); |
@@ -103,16 +103,16 @@ discard block |
||
| 103 | 103 | return $path; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - public function check_xcloner_store_path($return_bool=0) |
|
| 106 | + public function check_xcloner_store_path($return_bool = 0) |
|
| 107 | 107 | { |
| 108 | 108 | $path = $this->xcloner_settings->get_xcloner_store_path(); |
| 109 | 109 | |
| 110 | - if($return_bool) |
|
| 110 | + if ($return_bool) |
|
| 111 | 111 | { |
| 112 | - if(!file_exists($path)) |
|
| 112 | + if (!file_exists($path)) |
|
| 113 | 113 | return false; |
| 114 | 114 | |
| 115 | - if(!is_writeable($path)) |
|
| 115 | + if (!is_writeable($path)) |
|
| 116 | 116 | @chmod($path, 0777); |
| 117 | 117 | |
| 118 | 118 | return is_writeable($path); |
@@ -133,9 +133,9 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | public function get_open_basedir() |
| 135 | 135 | { |
| 136 | - $open_basedir = ini_get('open_basedir'); |
|
| 136 | + $open_basedir = ini_get('open_basedir'); |
|
| 137 | 137 | |
| 138 | - if(!$open_basedir) |
|
| 138 | + if (!$open_basedir) |
|
| 139 | 139 | $open_basedir = "none"; |
| 140 | 140 | return $open_basedir; |
| 141 | 141 | } |
@@ -149,14 +149,14 @@ discard block |
||
| 149 | 149 | $unit_list = array('B', 'KB', 'MB', 'GB', 'PB'); |
| 150 | 150 | |
| 151 | 151 | if ($bytes == 0) { |
| 152 | - return $bytes . ' ' . $unit_list[0]; |
|
| 152 | + return $bytes.' '.$unit_list[0]; |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | $unit_count = count($unit_list); |
| 156 | 156 | for ($i = $unit_count - 1; $i >= 0; $i--) { |
| 157 | 157 | $power = $i * 10; |
| 158 | 158 | if (($bytes >> $power) >= 1) |
| 159 | - return round($bytes / (1 << $power), $decimals) . ' ' . $unit_list[$i]; |
|
| 159 | + return round($bytes / (1 << $power), $decimals).' '.$unit_list[$i]; |
|
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | } |
@@ -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 | } |
@@ -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> |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$xcloner_file_system = new Xcloner_File_System(); |
|
| 3 | +$xcloner_file_system = new Xcloner_File_System(); |
|
| 4 | 4 | |
| 5 | 5 | $backup_list = $xcloner_file_system->get_backup_archives_list(); |
| 6 | 6 | |
@@ -19,10 +19,10 @@ discard block |
||
| 19 | 19 | <label for="select_all"> </label> |
| 20 | 20 | </p> |
| 21 | 21 | </th> |
| 22 | - <th data-field="id"><?php echo __("Backup Name",'xcloner-backup-and-restore')?></th> |
|
| 23 | - <th data-field="name"><?php echo __("Created Time",'xcloner-backup-and-restore')?></th> |
|
| 24 | - <th data-field="name"><?php echo __("Size",'xcloner-backup-and-restore')?></th> |
|
| 25 | - <th class="no-sort" data-field="price"><?php echo __("Action",'xcloner-backup-and-restore')?></th> |
|
| 22 | + <th data-field="id"><?php echo __("Backup Name", 'xcloner-backup-and-restore')?></th> |
|
| 23 | + <th data-field="name"><?php echo __("Created Time", 'xcloner-backup-and-restore')?></th> |
|
| 24 | + <th data-field="name"><?php echo __("Size", 'xcloner-backup-and-restore')?></th> |
|
| 25 | + <th class="no-sort" data-field="price"><?php echo __("Action", 'xcloner-backup-and-restore')?></th> |
|
| 26 | 26 | |
| 27 | 27 | </tr> |
| 28 | 28 | </thead> |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | <?php |
| 34 | 34 | $i = 0; |
| 35 | -foreach($backup_list as $file_info):?> |
|
| 36 | -<?php if(!isset($file_info['parent'])):?> |
|
| 35 | +foreach ($backup_list as $file_info):?> |
|
| 36 | +<?php if (!isset($file_info['parent'])):?> |
|
| 37 | 37 | |
| 38 | 38 | <tr> |
| 39 | 39 | <td class="checkbox"> |
@@ -45,31 +45,31 @@ discard block |
||
| 45 | 45 | <td> |
| 46 | 46 | <?php echo $file_info['path']?> |
| 47 | 47 | <?php |
| 48 | - if(isset($file_info['childs']) and is_array($file_info['childs'])): |
|
| 48 | + if (isset($file_info['childs']) and is_array($file_info['childs'])): |
|
| 49 | 49 | ?> |
| 50 | 50 | <a href="#" title="expand" class="expand-multipart add"><i class="material-icons">add</i></a> |
| 51 | 51 | <a href="#" title="collapse" class="expand-multipart remove"><i class="material-icons">remove</i></a> |
| 52 | 52 | <ul class="multipart"> |
| 53 | - <?php foreach($file_info['childs'] as $child):?> |
|
| 53 | + <?php foreach ($file_info['childs'] as $child):?> |
|
| 54 | 54 | <?php #$download_file .= "|".$child[0];?> |
| 55 | 55 | <li> |
| 56 | 56 | <?php echo $child[0]?> (<?php echo size_format($child[2])?>) |
| 57 | - <a href="#<?php echo $child[0];?>" class="download" title="Download Backup"><i class="material-icons">file_download</i></a> |
|
| 58 | - <a href="#<?php echo $child[0]?>" class="list-backup-content" title="<?php echo __('List Backup Content','xcloner-backup-and-restore')?>"><i class="material-icons">folder_open</i></a> |
|
| 57 | + <a href="#<?php echo $child[0]; ?>" class="download" title="Download Backup"><i class="material-icons">file_download</i></a> |
|
| 58 | + <a href="#<?php echo $child[0]?>" class="list-backup-content" title="<?php echo __('List Backup Content', 'xcloner-backup-and-restore')?>"><i class="material-icons">folder_open</i></a> |
|
| 59 | 59 | </li> |
| 60 | - <?php endforeach;?> |
|
| 60 | + <?php endforeach; ?> |
|
| 61 | 61 | </ul> |
| 62 | - <?php endif;?> |
|
| 62 | + <?php endif; ?> |
|
| 63 | 63 | </td> |
| 64 | 64 | <td><?php echo date("d M, Y H:i", $file_info['timestamp'])?></td> |
| 65 | 65 | <td><?php echo size_format($file_info['size'])?></td> |
| 66 | 66 | <td> |
| 67 | - <a href="#<?php echo $file_info['path'];?>" class="download" title="<?php echo __('Download Backup','xcloner-backup-and-restore')?>"><i class="material-icons">file_download</i></a> |
|
| 68 | - <?php if(sizeof($available_storages)):?> |
|
| 69 | - <a href="#<?php echo $file_info['path']?>" class="cloud-upload" title="<?php echo __('Send Backup To Remote Storage','xcloner-backup-and-restore')?>"><i class="material-icons">cloud_upload</i></a> |
|
| 67 | + <a href="#<?php echo $file_info['path']; ?>" class="download" title="<?php echo __('Download Backup', 'xcloner-backup-and-restore')?>"><i class="material-icons">file_download</i></a> |
|
| 68 | + <?php if (sizeof($available_storages)):?> |
|
| 69 | + <a href="#<?php echo $file_info['path']?>" class="cloud-upload" title="<?php echo __('Send Backup To Remote Storage', 'xcloner-backup-and-restore')?>"><i class="material-icons">cloud_upload</i></a> |
|
| 70 | 70 | <?php endif?> |
| 71 | - <a href="#<?php echo $file_info['path']?>" class="list-backup-content" title="<?php echo __('List Backup Content','xcloner-backup-and-restore')?>"><i class="material-icons">folder_open</i></a> |
|
| 72 | - <a href="#<?php echo $file_info['path']?>" class="delete" title="<?php echo __('Delete Backup','xcloner-backup-and-restore')?>"><i class="material-icons">delete</i></a> |
|
| 71 | + <a href="#<?php echo $file_info['path']?>" class="list-backup-content" title="<?php echo __('List Backup Content', 'xcloner-backup-and-restore')?>"><i class="material-icons">folder_open</i></a> |
|
| 72 | + <a href="#<?php echo $file_info['path']?>" class="delete" title="<?php echo __('Delete Backup', 'xcloner-backup-and-restore')?>"><i class="material-icons">delete</i></a> |
|
| 73 | 73 | </td> |
| 74 | 74 | |
| 75 | 75 | </tr> |
@@ -80,13 +80,13 @@ discard block |
||
| 80 | 80 | </tbody> |
| 81 | 81 | </table> |
| 82 | 82 | |
| 83 | -<a class="waves-effect waves-light btn delete-all"><i class="material-icons left">delete</i><?php echo __("Delete",'xcloner-backup-and-restore')?></a> |
|
| 83 | +<a class="waves-effect waves-light btn delete-all"><i class="material-icons left">delete</i><?php echo __("Delete", 'xcloner-backup-and-restore')?></a> |
|
| 84 | 84 | |
| 85 | 85 | <!-- List Backup Content Modal--> |
| 86 | 86 | |
| 87 | 87 | <div id="backup_cotent_modal" class="modal"> |
| 88 | 88 | <div class="modal-content"> |
| 89 | - <h4><?php echo sprintf(__("Listing Backup Content ",'xcloner-backup-and-restore'), "")?></h4> |
|
| 89 | + <h4><?php echo sprintf(__("Listing Backup Content ", 'xcloner-backup-and-restore'), "")?></h4> |
|
| 90 | 90 | <h5 class="backup-name"></h5> |
| 91 | 91 | |
| 92 | 92 | <div class="progress"> |
@@ -101,17 +101,17 @@ discard block |
||
| 101 | 101 | <form method="POST" class="remote-storage-form"> |
| 102 | 102 | <input type="hidden" name="file" class="backup_name"> |
| 103 | 103 | <div class="modal-content"> |
| 104 | - <h4><?php echo __("Remote Storage Transfer",'xcloner-backup-and-restore')?></h4> |
|
| 104 | + <h4><?php echo __("Remote Storage Transfer", 'xcloner-backup-and-restore')?></h4> |
|
| 105 | 105 | <p> |
| 106 | - <?php if(sizeof($available_storages)):?> |
|
| 106 | + <?php if (sizeof($available_storages)):?> |
|
| 107 | 107 | <div class="row"> |
| 108 | 108 | <div class="col s12 label"> |
| 109 | - <label><?php echo sprintf(__('Send %s to remote storage','xcloner-backup-and-restore'), "<span class='backup_name'></span>") ?></label> |
|
| 109 | + <label><?php echo sprintf(__('Send %s to remote storage', 'xcloner-backup-and-restore'), "<span class='backup_name'></span>") ?></label> |
|
| 110 | 110 | </div> |
| 111 | 111 | <div class="input-field col s8 m10"> |
| 112 | 112 | <select name="transfer_storage" id="transfer_storage" class="validate" required > |
| 113 | 113 | <option value="" selected><?php echo __('please select...', 'xcloner-backup-and-restore') ?></option> |
| 114 | - <?php foreach($available_storages as $storage=>$text):?> |
|
| 114 | + <?php foreach ($available_storages as $storage=>$text):?> |
|
| 115 | 115 | <option value="<?php echo $storage?>"><?php echo $text?></option> |
| 116 | 116 | <?php endforeach?> |
| 117 | 117 | </select> |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | </div> |
| 123 | 123 | </div> |
| 124 | 124 | <div class="row status"> |
| 125 | - <?php echo __("Uploading backup to the selected remote storage...",'xcloner-backup-and-restore')?> <span class="status-text"></span> |
|
| 125 | + <?php echo __("Uploading backup to the selected remote storage...", 'xcloner-backup-and-restore')?> <span class="status-text"></span> |
|
| 126 | 126 | <div class="progress"> |
| 127 | 127 | <div class="indeterminate"></div> |
| 128 | 128 | </div> |