GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Branch dev (c13330)
by Liuta
03:02
created
includes/class-xcloner.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -233,84 +233,84 @@  discard block
 block discarded – undo
233 233
 		 * The class responsible for orchestrating the actions and filters of the
234 234
 		 * core plugin.
235 235
 		 */
236
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-loader.php';
236
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-loader.php';
237 237
 
238 238
 		/**
239 239
 		 * The class responsible for defining internationalization functionality
240 240
 		 * of the plugin.
241 241
 		 */
242
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-i18n.php';
242
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-i18n.php';
243 243
 
244 244
 		/**
245 245
 		 * The class responsible for defining all actions that occur in the admin area.
246 246
 		 */
247
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-xcloner-admin.php';
247
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-xcloner-admin.php';
248 248
 
249 249
 		/**
250 250
 		 * The class responsible for debugging XCloner.
251 251
 		 */
252
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-logger.php';
252
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-logger.php';
253 253
 
254 254
 		/**
255 255
 		 * The class responsible for defining the admin settings area.
256 256
 		 */
257
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-settings.php';
257
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-settings.php';
258 258
 
259 259
 		/**
260 260
 		 * The class responsible for defining the Remote Storage settings area.
261 261
 		 */
262
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-remote-storage.php';
262
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-remote-storage.php';
263 263
 
264 264
 		/**
265 265
 		 * The class responsible for implementing the database backup methods.
266 266
 		 */
267
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-database.php';
267
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-database.php';
268 268
 
269 269
 		/**
270 270
 		 * The class responsible for sanitization of users input.
271 271
 		 */
272
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-sanitization.php';
272
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-sanitization.php';
273 273
 
274 274
 		/**
275 275
 		 * The class responsible for XCloner system requirements validation.
276 276
 		 */
277
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-requirements.php';
277
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-requirements.php';
278 278
 
279 279
 		/**
280 280
 		 * The class responsible for XCloner backup archive creation.
281 281
 		 */
282
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-archive.php';
282
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-archive.php';
283 283
 
284 284
 		/**
285 285
 		 * The class responsible for XCloner API requests.
286 286
 		 */
287
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-api.php';
287
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-api.php';
288 288
 
289 289
 		/**
290 290
 		 * The class responsible for the XCloner File System methods.
291 291
 		 */
292
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-file-system.php';
292
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-file-system.php';
293 293
 
294 294
 		/**
295 295
 		 * The class responsible for the XCloner File Transfer methods.
296 296
 		 */
297
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-file-transfer.php';
297
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-file-transfer.php';
298 298
 
299 299
 		/**
300 300
 		 * The class responsible for the XCloner Scheduler methods.
301 301
 		 */
302
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-scheduler.php';
302
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-scheduler.php';
303 303
 
304 304
 		/**
305 305
 		 * The class responsible for the XCloner Encryption methods.
306 306
 		 */
307
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-encryption.php';
307
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-encryption.php';
308 308
 
309 309
 		/**
310 310
 		 * The class responsible for defining all actions that occur in the public-facing
311 311
 		 * side of the site.
312 312
 		 */
313
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-xcloner-public.php';
313
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-xcloner-public.php';
314 314
 
315 315
 		$this->loader = new Xcloner_Loader($this);
316 316
 
@@ -360,31 +360,31 @@  discard block
 block discarded – undo
360 360
 	 * @access    private
361 361
 	 *
362 362
 	 */
363
-	private function define_admin_menu(){
363
+	private function define_admin_menu() {
364 364
 
365 365
 		add_action('admin_menu', array($this->loader, 'xcloner_backup_add_admin_menu'));
366 366
 
367 367
 	}
368 368
 
369
-	private function define_plugin_settings(){
369
+	private function define_plugin_settings() {
370 370
 		/**
371 371
 		 * register wporg_settings_init to the admin_init action hook
372 372
 		 */
373 373
 
374 374
 		$this->xcloner_settings = new XCloner_Settings($this);
375 375
 
376
-		if(defined('DOING_CRON') || isset($_POST['hash'])){
376
+		if (defined('DOING_CRON') || isset($_POST['hash'])) {
377 377
 
378
-			if(defined('DOING_CRON') || $_POST['hash'] == "generate_hash"){
378
+			if (defined('DOING_CRON') || $_POST['hash'] == "generate_hash") {
379 379
 				$this->xcloner_settings->generate_new_hash();
380
-			}else{
380
+			} else {
381 381
 				$this->xcloner_settings->set_hash($_POST['hash']);
382 382
 			}
383 383
 		}
384 384
 
385
-		if(defined('DOING_CRON') || !isset($_POST['hash']))
385
+		if (defined('DOING_CRON') || !isset($_POST['hash']))
386 386
 		{
387
-			add_action( 'shutdown', function(){
387
+			add_action('shutdown', function() {
388 388
 				$this->xcloner_filesystem = new Xcloner_File_System($this);
389 389
 				$this->xcloner_filesystem->remove_tmp_filesystem();
390 390
 			});
@@ -516,20 +516,20 @@  discard block
 block discarded – undo
516 516
 		$logger = new XCloner_Logger($this, "php_system");
517 517
 		$error = error_get_last();
518 518
 
519
-		if($error['type'] and $logger)
519
+		if ($error['type'] and $logger)
520 520
 		{
521
-			$logger->info($this->friendly_error_type ($error['type']).": ".var_export($error, true));
521
+			$logger->info($this->friendly_error_type($error['type']).": ".var_export($error, true));
522 522
 		}
523 523
 
524 524
 	}
525 525
 
526 526
 	function friendly_error_type($type) {
527
-		static $levels=null;
528
-		if ($levels===null) {
529
-			$levels=[];
527
+		static $levels = null;
528
+		if ($levels === null) {
529
+			$levels = [];
530 530
 			foreach (get_defined_constants() as $key=>$value) {
531
-				if (strpos($key,'E_')!==0) {continue;}
532
-					$levels[$value]= $key; //substr($key,2);
531
+				if (strpos($key, 'E_') !== 0) {continue; }
532
+					$levels[$value] = $key; //substr($key,2);
533 533
 			}
534 534
 		}
535 535
 		return (isset($levels[$type]) ? $levels[$type] : "Error #{$type}");
@@ -539,56 +539,56 @@  discard block
 block discarded – undo
539 539
 	{
540 540
 		//adding the pre-update hook
541 541
 
542
-		if(is_admin() || defined('DOING_CRON'))
542
+		if (is_admin() || defined('DOING_CRON'))
543 543
 		{
544
-			$this->xcloner_logger 			= new XCloner_Logger($this, "xcloner_api");
545
-			$this->xcloner_filesystem 		= new Xcloner_File_System($this);
544
+			$this->xcloner_logger = new XCloner_Logger($this, "xcloner_api");
545
+			$this->xcloner_filesystem = new Xcloner_File_System($this);
546 546
 
547 547
 			//$this->xcloner_filesystem->set_diff_timestamp_start (strtotime("-15 days"));
548 548
 
549
-			$this->archive_system 			= new Xcloner_Archive($this);
550
-			$this->xcloner_database 		= new Xcloner_Database($this);
551
-			$this->xcloner_scheduler 		= new Xcloner_Scheduler($this);
552
-			$this->xcloner_remote_storage 	= new Xcloner_Remote_Storage($this);
549
+			$this->archive_system = new Xcloner_Archive($this);
550
+			$this->xcloner_database = new Xcloner_Database($this);
551
+			$this->xcloner_scheduler = new Xcloner_Scheduler($this);
552
+			$this->xcloner_remote_storage = new Xcloner_Remote_Storage($this);
553 553
 			$this->xcloner_file_transfer 	= new Xcloner_File_Transfer($this);
554 554
 			$this->xcloner_encryption    	= new Xcloner_Encryption($this);
555 555
 
556
-			$xcloner_api 					= new Xcloner_Api($this);
557
-
558
-			add_action( 'wp_ajax_get_database_tables_action', 	array($xcloner_api,'get_database_tables_action')  );
559
-			add_action( 'wp_ajax_get_file_system_action', 		array($xcloner_api,'get_file_system_action')  );
560
-			add_action( 'wp_ajax_scan_filesystem', 				array($xcloner_api,'scan_filesystem')  );
561
-			add_action( 'wp_ajax_backup_database', 				array($xcloner_api,'backup_database')  );
562
-			add_action( 'wp_ajax_backup_files'	, 				array($xcloner_api,'backup_files')  );
563
-			add_action( 'wp_ajax_save_schedule'	, 				array($xcloner_api,'save_schedule')  );
564
-			add_action( 'wp_ajax_get_schedule_by_id',	 		array($xcloner_api,'get_schedule_by_id')  );
565
-			add_action( 'wp_ajax_get_scheduler_list',	 		array($xcloner_api,'get_scheduler_list')  );
566
-			add_action( 'wp_ajax_delete_schedule_by_id'	, 		array($xcloner_api,'delete_schedule_by_id')  );
567
-			add_action( 'wp_ajax_delete_backup_by_name'	, 		array($xcloner_api,'delete_backup_by_name')  );
568
-			add_action( 'wp_ajax_download_backup_by_name', 		array($xcloner_api,'download_backup_by_name')  );
569
-			add_action( 'wp_ajax_remote_storage_save_status', 	array($xcloner_api,'remote_storage_save_status')  );
570
-			add_action( 'wp_ajax_upload_backup_to_remote', 		array($xcloner_api,'upload_backup_to_remote')  );
571
-			add_action( 'wp_ajax_list_backup_files'	,			array($xcloner_api,'list_backup_files')  );
572
-			add_action( 'wp_ajax_restore_upload_backup'	, 		array($xcloner_api,'restore_upload_backup')  );
573
-			add_action( 'wp_ajax_download_restore_script', 		array($xcloner_api,'download_restore_script')  );
574
-			add_action( 'wp_ajax_copy_backup_remote_to_local', 	array($xcloner_api,'copy_backup_remote_to_local')  );
575
-			add_action( 'wp_ajax_restore_backup', 				array($xcloner_api,'restore_backup')  );
576
-			add_action( 'wp_ajax_backup_encryption', 			array($xcloner_api,'backup_encryption')  );
577
-			add_action( 'wp_ajax_backup_decryption', 			array($xcloner_api,'backup_decryption')  );
578
-			add_action( 'wp_ajax_get_manage_backups_list', 		array($xcloner_api,'get_manage_backups_list')  );
579
-			add_action( 'admin_notices', 						array($this, 'xcloner_error_admin_notices' ));
556
+			$xcloner_api = new Xcloner_Api($this);
557
+
558
+			add_action('wp_ajax_get_database_tables_action', array($xcloner_api, 'get_database_tables_action'));
559
+			add_action('wp_ajax_get_file_system_action', array($xcloner_api, 'get_file_system_action'));
560
+			add_action('wp_ajax_scan_filesystem', array($xcloner_api, 'scan_filesystem'));
561
+			add_action('wp_ajax_backup_database', array($xcloner_api, 'backup_database'));
562
+			add_action('wp_ajax_backup_files', array($xcloner_api, 'backup_files'));
563
+			add_action('wp_ajax_save_schedule', array($xcloner_api, 'save_schedule'));
564
+			add_action('wp_ajax_get_schedule_by_id', array($xcloner_api, 'get_schedule_by_id'));
565
+			add_action('wp_ajax_get_scheduler_list', array($xcloner_api, 'get_scheduler_list'));
566
+			add_action('wp_ajax_delete_schedule_by_id', array($xcloner_api, 'delete_schedule_by_id'));
567
+			add_action('wp_ajax_delete_backup_by_name', array($xcloner_api, 'delete_backup_by_name'));
568
+			add_action('wp_ajax_download_backup_by_name', array($xcloner_api, 'download_backup_by_name'));
569
+			add_action('wp_ajax_remote_storage_save_status', array($xcloner_api, 'remote_storage_save_status'));
570
+			add_action('wp_ajax_upload_backup_to_remote', array($xcloner_api, 'upload_backup_to_remote'));
571
+			add_action('wp_ajax_list_backup_files', array($xcloner_api, 'list_backup_files'));
572
+			add_action('wp_ajax_restore_upload_backup', array($xcloner_api, 'restore_upload_backup'));
573
+			add_action('wp_ajax_download_restore_script', array($xcloner_api, 'download_restore_script'));
574
+			add_action('wp_ajax_copy_backup_remote_to_local', array($xcloner_api, 'copy_backup_remote_to_local'));
575
+			add_action('wp_ajax_restore_backup', array($xcloner_api, 'restore_backup'));
576
+			add_action('wp_ajax_backup_encryption', array($xcloner_api, 'backup_encryption'));
577
+			add_action('wp_ajax_backup_decryption', array($xcloner_api, 'backup_decryption'));
578
+			add_action('wp_ajax_get_manage_backups_list', array($xcloner_api, 'get_manage_backups_list'));
579
+			add_action('admin_notices', array($this, 'xcloner_error_admin_notices'));
580 580
 
581 581
 		}
582 582
 
583 583
 		//Do a pre-update backup of targeted files
584
-		if($this->get_xcloner_settings()->get_xcloner_option('xcloner_enable_pre_update_backup'))
584
+		if ($this->get_xcloner_settings()->get_xcloner_option('xcloner_enable_pre_update_backup'))
585 585
 		{
586 586
 			add_action("pre_auto_update", array($this, "pre_auto_update"), 1, 3);
587 587
 		}
588 588
 	}
589 589
 
590 590
 	function add_plugin_action_links($links, $file) {
591
-		if ($file == plugin_basename(dirname(dirname(__FILE__)) . '/xcloner.php'))
591
+		if ($file == plugin_basename(dirname(dirname(__FILE__)).'/xcloner.php'))
592 592
 		{
593 593
 			$links[] = '<a href="admin.php?page=xcloner_settings_page">'.__('Settings', 'xcloner-backup-and-restore').'</a>';
594 594
 			$links[] = '<a href="admin.php?page=xcloner_generate_backups_page">'.__('Generate Backup', 'xcloner-backup-and-restore').'</a>';
Please login to merge, or discard this patch.
includes/class-xcloner-activator.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -61,22 +61,22 @@  discard block
 block discarded – undo
61 61
 
62 62
 		global $wpdb;
63 63
 
64
-		if ( version_compare( phpversion(), Xcloner_Activator::xcloner_minimum_version, '<' ) ) {
65
-			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,
64
+		if (version_compare(phpversion(), Xcloner_Activator::xcloner_minimum_version, '<')) {
65
+			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,
66 66
 																																																																   'back_link' => true
67
-			) );
67
+			));
68 68
 		}
69 69
 
70 70
 		$charset_collate = $wpdb->get_charset_collate();
71 71
 
72
-		$installed_ver = get_option( "xcloner_db_version" );
72
+		$installed_ver = get_option("xcloner_db_version");
73 73
 
74 74
 		$xcloner_db_version = Xcloner_Activator::xcloner_db_version;
75 75
 
76
-		$xcloner_scheduler_table = $wpdb->prefix . "xcloner_scheduler";
76
+		$xcloner_scheduler_table = $wpdb->prefix."xcloner_scheduler";
77 77
 
78
-		if ( $installed_ver != $xcloner_db_version ) {
79
-			$xcloner_schedule_sql = "CREATE TABLE `" . $xcloner_scheduler_table . "` (
78
+		if ($installed_ver != $xcloner_db_version) {
79
+			$xcloner_schedule_sql = "CREATE TABLE `".$xcloner_scheduler_table."` (
80 80
 				  `id` int(11) NOT NULL AUTO_INCREMENT,
81 81
 				  `name` varchar(255) NOT NULL,
82 82
 				  `recurrence` varchar(25) NOT NULL,
@@ -87,73 +87,73 @@  discard block
 block discarded – undo
87 87
 				  `status` int(1) NOT NULL,
88 88
 				  `last_backup` varchar(100) DEFAULT NULL,
89 89
 				  PRIMARY KEY  (`id`)
90
-				) " . $charset_collate . ";
90
+				) " . $charset_collate.";
91 91
 				";
92 92
 
93
-			require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
94
-			dbDelta( $xcloner_schedule_sql );
93
+			require_once(ABSPATH.'wp-admin/includes/upgrade.php');
94
+			dbDelta($xcloner_schedule_sql);
95 95
 
96
-			update_option( "xcloner_db_version", $xcloner_db_version );
96
+			update_option("xcloner_db_version", $xcloner_db_version);
97 97
 		}
98 98
 
99
-		if ( get_option( 'xcloner_backup_compression_level' ) === false ) {
100
-			update_option( 'xcloner_backup_compression_level', 0 );
99
+		if (get_option('xcloner_backup_compression_level') === false) {
100
+			update_option('xcloner_backup_compression_level', 0);
101 101
 		}
102 102
 
103
-		if ( get_option( 'xcloner_enable_log' ) === false ) {
104
-			update_option( 'xcloner_enable_log', 1 );
103
+		if (get_option('xcloner_enable_log') === false) {
104
+			update_option('xcloner_enable_log', 1);
105 105
 		}
106 106
 
107
-		if ( get_option( 'xcloner_enable_mysql_backup' ) === false ) {
108
-			update_option( 'xcloner_enable_mysql_backup', 1 );
107
+		if (get_option('xcloner_enable_mysql_backup') === false) {
108
+			update_option('xcloner_enable_mysql_backup', 1);
109 109
 		}
110 110
 
111
-		if ( get_option( 'xcloner_system_settings_page' ) === false ) {
112
-			update_option( 'xcloner_system_settings_page', 100 );
111
+		if (get_option('xcloner_system_settings_page') === false) {
112
+			update_option('xcloner_system_settings_page', 100);
113 113
 		}
114 114
 
115
-		if ( get_option( 'xcloner_files_to_process_per_request' ) === false ) {
116
-			update_option( 'xcloner_files_to_process_per_request', 250 );
115
+		if (get_option('xcloner_files_to_process_per_request') === false) {
116
+			update_option('xcloner_files_to_process_per_request', 250);
117 117
 		}
118 118
 
119
-		if ( get_option( 'xcloner_database_records_per_request' ) === false ) {
120
-			update_option( 'xcloner_database_records_per_request', 10000 );
119
+		if (get_option('xcloner_database_records_per_request') === false) {
120
+			update_option('xcloner_database_records_per_request', 10000);
121 121
 		}
122 122
 
123
-		if ( get_option( 'xcloner_exclude_files_larger_than_mb' ) === false ) {
124
-			update_option( 'xcloner_exclude_files_larger_than_mb', 0 );
123
+		if (get_option('xcloner_exclude_files_larger_than_mb') === false) {
124
+			update_option('xcloner_exclude_files_larger_than_mb', 0);
125 125
 		}
126 126
 
127
-		if ( get_option( 'xcloner_split_backup_limit' ) === false ) {
128
-			update_option( 'xcloner_split_backup_limit', 2048 );
127
+		if (get_option('xcloner_split_backup_limit') === false) {
128
+			update_option('xcloner_split_backup_limit', 2048);
129 129
 		}
130 130
 
131
-		if ( get_option( 'xcloner_size_limit_per_request' ) === false ) {
132
-			update_option( 'xcloner_size_limit_per_request', 50 );
131
+		if (get_option('xcloner_size_limit_per_request') === false) {
132
+			update_option('xcloner_size_limit_per_request', 50);
133 133
 		}
134 134
 
135
-		if ( get_option( 'xcloner_cleanup_retention_limit_days' ) === false ) {
136
-			update_option( 'xcloner_cleanup_retention_limit_days', 60 );
135
+		if (get_option('xcloner_cleanup_retention_limit_days') === false) {
136
+			update_option('xcloner_cleanup_retention_limit_days', 60);
137 137
 		}
138 138
 
139
-		if ( get_option( 'xcloner_cleanup_retention_limit_archives' ) === false ) {
140
-			update_option( 'xcloner_cleanup_retention_limit_archives', 100 );
139
+		if (get_option('xcloner_cleanup_retention_limit_archives') === false) {
140
+			update_option('xcloner_cleanup_retention_limit_archives', 100);
141 141
 		}
142 142
 
143
-		if ( get_option( 'xcloner_directories_to_scan_per_request' ) === false ) {
144
-			update_option( 'xcloner_directories_to_scan_per_request', 25 );
143
+		if (get_option('xcloner_directories_to_scan_per_request') === false) {
144
+			update_option('xcloner_directories_to_scan_per_request', 25);
145 145
 		}
146 146
 
147 147
 		/*if(!get_option('xcloner_diff_backup_recreate_period'))
148 148
 			update_option('xcloner_diff_backup_recreate_period', 10);
149 149
 			* */
150 150
 
151
-		if ( ! get_option( 'xcloner_regex_exclude' ) ) {
152
-			update_option( 'xcloner_regex_exclude', "(wp-content\/updraft|wp-content\/uploads\/wp_all_backup)(.*)$" . PHP_EOL . "(.*)\.(svn|git)(.*)$" . PHP_EOL . "wp-content\/cache(.*)$" . PHP_EOL . "(.*)error_log$" );
151
+		if (!get_option('xcloner_regex_exclude')) {
152
+			update_option('xcloner_regex_exclude', "(wp-content\/updraft|wp-content\/uploads\/wp_all_backup)(.*)$".PHP_EOL."(.*)\.(svn|git)(.*)$".PHP_EOL."wp-content\/cache(.*)$".PHP_EOL."(.*)error_log$");
153 153
 		}
154 154
 
155
-		if ( ! get_option( 'xcloner_regex_exclude' ) ) {
156
-			update_option( 'xcloner_regex_exclude', "(wp-content\/updraft|wp-content\/uploads\/wp_all_backup)(.*)$" . PHP_EOL . "(.*)\.(svn|git)(.*)$" . PHP_EOL . "wp-content\/cache(.*)$" . PHP_EOL . "(.*)error_log$" );
155
+		if (!get_option('xcloner_regex_exclude')) {
156
+			update_option('xcloner_regex_exclude', "(wp-content\/updraft|wp-content\/uploads\/wp_all_backup)(.*)$".PHP_EOL."(.*)\.(svn|git)(.*)$".PHP_EOL."wp-content\/cache(.*)$".PHP_EOL."(.*)error_log$");
157 157
 		}
158 158
 
159 159
 	}
Please login to merge, or discard this patch.
includes/class-xcloner-i18n.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 		load_plugin_textdomain(
53 53
 			'xcloner-backup-and-restore',
54 54
 			false,
55
-			dirname(dirname(plugin_basename(__FILE__))) . '/languages/'
55
+			dirname(dirname(plugin_basename(__FILE__))).'/languages/'
56 56
 		);
57 57
 
58 58
 	}
Please login to merge, or discard this patch.
includes/class-xcloner-database.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -337,7 +337,7 @@
 block discarded – undo
337 337
 
338 338
 			$result = $this->get_var("SELECT count(*) FROM $table;");
339 339
 
340
-			return intval($result) ;// not max limit on 32 bit systems 2147483647; on 64 bit 999999999999
340
+			return intval($result); // not max limit on 32 bit systems 2147483647; on 64 bit 999999999999
341 341
 
342 342
 	}
343 343
 
Please login to merge, or discard this patch.
includes/class-xcloner-archive.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 			$new_name = $this->archive_name;
149 149
 
150 150
 			if (!stristr($new_name, "-diff")) {
151
-				$new_name = $this->archive_name . "-diff" . date("Y-m-d_H-i", $diff_timestamp_start);
151
+				$new_name = $this->archive_name."-diff".date("Y-m-d_H-i", $diff_timestamp_start);
152 152
 			}
153 153
 
154 154
 			$this->archive_name = $new_name;
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 		}
157 157
 
158 158
 		if (isset($part) and $part) {
159
-			$new_name = preg_replace('/-part(\d*)/', "-part" . $part, $this->archive_name);
159
+			$new_name = preg_replace('/-part(\d*)/', "-part".$part, $this->archive_name);
160 160
 			if (!stristr($new_name, "-part")) {
161
-				$new_name = $this->archive_name . "-part" . $part;
161
+				$new_name = $this->archive_name."-part".$part;
162 162
 			}
163 163
 
164 164
 			$this->archive_name = $new_name;
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	public function get_archive_name_multipart()
188 188
 	{
189 189
 		$new_name = preg_replace('/-part(\d*)/', "", $this->archive_name);
190
-		return $new_name . "-multipart" . $this->xcloner_settings->get_backup_extension_name(".csv");
190
+		return $new_name."-multipart".$this->xcloner_settings->get_backup_extension_name(".csv");
191 191
 	}
192 192
 
193 193
 	/*
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
      */
198 198
 	public function get_archive_name_with_extension()
199 199
 	{
200
-		return $this->archive_name . $this->xcloner_settings->get_backup_extension_name();
200
+		return $this->archive_name.$this->xcloner_settings->get_backup_extension_name();
201 201
 	}
202 202
 
203 203
 	/*
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 		$headers = array('Content-Type: text/html; charset=UTF-8');
234 234
 
235 235
 		if ($admin_email and $from) {
236
-			$headers[] = 'From: ' . $from . ' <' . $admin_email . '>';
236
+			$headers[] = 'From: '.$from.' <'.$admin_email.'>';
237 237
 		}
238 238
 
239 239
 		$return = wp_mail($to, $subject, $body, $headers);
Please login to merge, or discard this patch.
includes/class-xcloner-settings.php 1 patch
Spacing   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
 	public function get_xcloner_encryption_key() {
58 58
 
59
-		if(!get_option('xcloner_encryption_key') )
59
+		if (!get_option('xcloner_encryption_key'))
60 60
 		{
61 61
 			return $this->randomString(35);
62 62
 		}
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	private function randomString($length = 6) {
74 74
 		$str = "";
75
-		$characters = array_merge(range('A','Z'), range('a','z'), range('0','9'));
75
+		$characters = array_merge(range('A', 'Z'), range('a', 'z'), range('0', '9'));
76 76
 		$max = count($characters) - 1;
77 77
 		for ($i = 0; $i < $length; $i++) {
78 78
 			$rand = mt_rand(0, $max);
@@ -213,17 +213,17 @@  discard block
 block discarded – undo
213 213
 	/**
214 214
 	 * @param string $option
215 215
 	 */
216
-	public function get_xcloner_option( $option ) {
217
-		$data = get_option( $option );
216
+	public function get_xcloner_option($option) {
217
+		$data = get_option($option);
218 218
 
219 219
 		return $data;
220 220
 	}
221 221
 
222
-	public function get_server_unique_hash( $strlen = 0 ) {
223
-		$hash = md5( get_home_url() . __DIR__ );
222
+	public function get_server_unique_hash($strlen = 0) {
223
+		$hash = md5(get_home_url().__DIR__);
224 224
 
225
-		if ( $strlen ) {
226
-			$hash = substr( $hash, 0, $strlen );
225
+		if ($strlen) {
226
+			$hash = substr($hash, 0, $strlen);
227 227
 		}
228 228
 
229 229
 		return $hash;
@@ -287,287 +287,287 @@  discard block
 block discarded – undo
287 287
 		//CRON section
288 288
 		add_settings_section(
289 289
 			'xcloner_cron_settings_group',
290
-			__( ' ' ),
291
-			array( $this, 'xcloner_settings_section_cb' ),
290
+			__(' '),
291
+			array($this, 'xcloner_settings_section_cb'),
292 292
 			'xcloner_cron_settings_page'
293 293
 		);
294 294
 
295 295
 
296 296
 		//REGISTERING THE 'GENERAL SECTION' FIELDS
297
-		register_setting( 'xcloner_general_settings_group', 'xcloner_backup_compression_level', array(
297
+		register_setting('xcloner_general_settings_group', 'xcloner_backup_compression_level', array(
298 298
 			$this->xcloner_sanitization,
299 299
 			"sanitize_input_as_int"
300
-		) );
300
+		));
301 301
 		add_settings_field(
302 302
 			'xcloner_backup_compression_level',
303
-			__( 'Backup Compression Level', 'xcloner-backup-and-restore' ),
304
-			array( $this, 'do_form_range_field' ),
303
+			__('Backup Compression Level', 'xcloner-backup-and-restore'),
304
+			array($this, 'do_form_range_field'),
305 305
 			'xcloner_settings_page',
306 306
 			'xcloner_general_settings_group',
307 307
 			array(
308 308
 				'xcloner_backup_compression_level',
309
-				__( 'Options between [0-9]. Value 0 means no compression, while 9 is maximum compression affecting cpu load', 'xcloner-backup-and-restore' ),
309
+				__('Options between [0-9]. Value 0 means no compression, while 9 is maximum compression affecting cpu load', 'xcloner-backup-and-restore'),
310 310
 				0,
311 311
 				9
312 312
 			)
313 313
 		);
314 314
 
315
-		register_setting( 'xcloner_general_settings_group', 'xcloner_start_path', array(
315
+		register_setting('xcloner_general_settings_group', 'xcloner_start_path', array(
316 316
 			$this->xcloner_sanitization,
317 317
 			"sanitize_input_as_absolute_path"
318
-		) );
318
+		));
319 319
 		add_settings_field(
320 320
 			'xcloner_start_path',
321
-			__( 'Backup Start Location', 'xcloner-backup-and-restore' ),
322
-			array( $this, 'do_form_text_field' ),
321
+			__('Backup Start Location', 'xcloner-backup-and-restore'),
322
+			array($this, 'do_form_text_field'),
323 323
 			'xcloner_settings_page',
324 324
 			'xcloner_general_settings_group',
325 325
 			array(
326 326
 				'xcloner_start_path',
327
-				__( 'Base path location from where XCloner can start the Backup.', 'xcloner-backup-and-restore' ),
327
+				__('Base path location from where XCloner can start the Backup.', 'xcloner-backup-and-restore'),
328 328
 				$this->get_xcloner_start_path(),
329 329
 				//'disabled'
330 330
 			)
331 331
 		);
332 332
 
333
-		register_setting( 'xcloner_general_settings_group', 'xcloner_store_path', array(
333
+		register_setting('xcloner_general_settings_group', 'xcloner_store_path', array(
334 334
 			$this->xcloner_sanitization,
335 335
 			"sanitize_input_as_absolute_path"
336
-		) );
336
+		));
337 337
 		add_settings_field(
338 338
 			'xcloner_store_path',
339
-			__( 'Backup Storage Location', 'xcloner-backup-and-restore' ),
340
-			array( $this, 'do_form_text_field' ),
339
+			__('Backup Storage Location', 'xcloner-backup-and-restore'),
340
+			array($this, 'do_form_text_field'),
341 341
 			'xcloner_settings_page',
342 342
 			'xcloner_general_settings_group',
343 343
 			array(
344 344
 				'xcloner_store_path',
345
-				__( 'Location where XCloner will store the Backup archives.', 'xcloner-backup-and-restore' ),
345
+				__('Location where XCloner will store the Backup archives.', 'xcloner-backup-and-restore'),
346 346
 				$this->get_xcloner_store_path(),
347 347
 				//'disabled'
348 348
 			)
349 349
 		);
350 350
 
351
-		register_setting( 'xcloner_general_settings_group', 'xcloner_encryption_key', array(
351
+		register_setting('xcloner_general_settings_group', 'xcloner_encryption_key', array(
352 352
 			$this->xcloner_sanitization,
353 353
 			"sanitize_input_as_string"
354
-		) );
354
+		));
355 355
 		add_settings_field(
356 356
 			'xcloner_encryption_key',
357
-			__( 'Backup Encryption Key', 'xcloner-backup-and-restore' ),
358
-			array( $this, 'do_form_text_field' ),
357
+			__('Backup Encryption Key', 'xcloner-backup-and-restore'),
358
+			array($this, 'do_form_text_field'),
359 359
 			'xcloner_settings_page',
360 360
 			'xcloner_general_settings_group',
361 361
 			array(
362 362
 				'xcloner_encryption_key',
363
-				__( 'Backup Encryption Key used to Encrypt/Decrypt backups, you might want to save this somewhere else as well.', 'xcloner-backup-and-restore' ),
363
+				__('Backup Encryption Key used to Encrypt/Decrypt backups, you might want to save this somewhere else as well.', 'xcloner-backup-and-restore'),
364 364
 				$this->get_xcloner_encryption_key(),
365 365
 				//'disabled'
366 366
 			)
367 367
 		);
368 368
 
369
-		register_setting( 'xcloner_general_settings_group', 'xcloner_enable_log', array(
369
+		register_setting('xcloner_general_settings_group', 'xcloner_enable_log', array(
370 370
 			$this->xcloner_sanitization,
371 371
 			"sanitize_input_as_int"
372
-		) );
372
+		));
373 373
 		add_settings_field(
374 374
 			'xcloner_enable_log',
375
-			__( 'Enable XCloner Backup Log', 'xcloner-backup-and-restore' ),
376
-			array( $this, 'do_form_switch_field' ),
375
+			__('Enable XCloner Backup Log', 'xcloner-backup-and-restore'),
376
+			array($this, 'do_form_switch_field'),
377 377
 			'xcloner_settings_page',
378 378
 			'xcloner_general_settings_group',
379 379
 			array(
380 380
 				'xcloner_enable_log',
381
-				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() )
381
+				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())
382 382
 			)
383 383
 		);
384 384
 
385
-		register_setting( 'xcloner_general_settings_group', 'xcloner_enable_pre_update_backup', array(
385
+		register_setting('xcloner_general_settings_group', 'xcloner_enable_pre_update_backup', array(
386 386
 			$this->xcloner_sanitization,
387 387
 			"sanitize_input_as_int"
388
-		) );
388
+		));
389 389
 		add_settings_field(
390 390
 			'xcloner_enable_pre_update_backup',
391
-			__( 'Generate Backups before Automatic WP Upgrades', 'xcloner-backup-and-restore' ),
392
-			array( $this, 'do_form_switch_field' ),
391
+			__('Generate Backups before Automatic WP Upgrades', 'xcloner-backup-and-restore'),
392
+			array($this, 'do_form_switch_field'),
393 393
 			'xcloner_settings_page',
394 394
 			'xcloner_general_settings_group',
395 395
 			array(
396 396
 				'xcloner_enable_pre_update_backup',
397
-				sprintf( __( 'Attempt to generate a core, plugins, themes or languages files backup before the automatic update of Wordpress core, plugins, themes or languages files.', 'xcloner-backup-and-restore' ), $this->get_logger_filename() )
397
+				sprintf(__('Attempt to generate a core, plugins, themes or languages files backup before the automatic update of Wordpress core, plugins, themes or languages files.', 'xcloner-backup-and-restore'), $this->get_logger_filename())
398 398
 			)
399 399
 		);
400 400
 
401
-		register_setting( 'xcloner_general_settings_group', 'xcloner_regex_exclude', array(
401
+		register_setting('xcloner_general_settings_group', 'xcloner_regex_exclude', array(
402 402
 			$this->xcloner_sanitization,
403 403
 			"sanitize_input_as_raw"
404
-		) );
404
+		));
405 405
 		add_settings_field(
406 406
 			'xcloner_regex_exclude',
407
-			__( 'Regex Exclude Files', 'xcloner-backup-and-restore' ),
408
-			array( $this, 'do_form_textarea_field' ),
407
+			__('Regex Exclude Files', 'xcloner-backup-and-restore'),
408
+			array($this, 'do_form_textarea_field'),
409 409
 			'xcloner_settings_page',
410 410
 			'xcloner_general_settings_group',
411 411
 			array(
412 412
 				'xcloner_regex_exclude',
413
-				__( 'Regular expression match to exclude files and folders, example patterns provided below, one pattern per line', 'xcloner-backup-and-restore' ),
413
+				__('Regular expression match to exclude files and folders, example patterns provided below, one pattern per line', 'xcloner-backup-and-restore'),
414 414
 				//$this->get_xcloner_store_path(), 
415 415
 				//'disabled'
416 416
 			)
417 417
 		);
418 418
 
419 419
 		//REGISTERING THE 'MYSQL SECTION' FIELDS
420
-		register_setting( 'xcloner_mysql_settings_group', 'xcloner_enable_mysql_backup', array(
420
+		register_setting('xcloner_mysql_settings_group', 'xcloner_enable_mysql_backup', array(
421 421
 			$this->xcloner_sanitization,
422 422
 			"sanitize_input_as_int"
423
-		) );
423
+		));
424 424
 		add_settings_field(
425 425
 			'xcloner_enable_mysql_backup',
426
-			__( 'Enable Mysql Backup', 'xcloner-backup-and-restore' ),
427
-			array( $this, 'do_form_switch_field' ),
426
+			__('Enable Mysql Backup', 'xcloner-backup-and-restore'),
427
+			array($this, 'do_form_switch_field'),
428 428
 			'xcloner_mysql_settings_page',
429 429
 			'xcloner_mysql_settings_group',
430 430
 			array(
431 431
 				'xcloner_enable_mysql_backup',
432
-				__( 'Enable Mysql Backup Option. If you don\'t want to backup the database, you can disable this.', 'xcloner-backup-and-restore' )
432
+				__('Enable Mysql Backup Option. If you don\'t want to backup the database, you can disable this.', 'xcloner-backup-and-restore')
433 433
 			)
434 434
 		);
435 435
 
436
-		register_setting( 'xcloner_mysql_settings_group', 'xcloner_backup_only_wp_tables' );
436
+		register_setting('xcloner_mysql_settings_group', 'xcloner_backup_only_wp_tables');
437 437
 		add_settings_field(
438 438
 			'xcloner_backup_only_wp_tables',
439
-			__( 'Backup only WP tables', 'xcloner-backup-and-restore' ),
440
-			array( $this, 'do_form_switch_field' ),
439
+			__('Backup only WP tables', 'xcloner-backup-and-restore'),
440
+			array($this, 'do_form_switch_field'),
441 441
 			'xcloner_mysql_settings_page',
442 442
 			'xcloner_mysql_settings_group',
443 443
 			array(
444 444
 				'xcloner_backup_only_wp_tables',
445
-				sprintf( __( 'Enable this if you only want to Backup only tables starting with \'%s\' prefix', 'xcloner-backup-and-restore' ), $this->get_table_prefix() )
445
+				sprintf(__('Enable this if you only want to Backup only tables starting with \'%s\' prefix', 'xcloner-backup-and-restore'), $this->get_table_prefix())
446 446
 			)
447 447
 		);
448 448
 
449
-		register_setting( 'xcloner_mysql_settings_group', 'xcloner_mysql_hostname', array(
449
+		register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_hostname', array(
450 450
 			$this->xcloner_sanitization,
451 451
 			"sanitize_input_as_raw"
452
-		) );
452
+		));
453 453
 		add_settings_field(
454 454
 			'xcloner_mysql_hostname',
455
-			__( 'Mysql Hostname', 'xcloner-backup-and-restore' ),
456
-			array( $this, 'do_form_text_field' ),
455
+			__('Mysql Hostname', 'xcloner-backup-and-restore'),
456
+			array($this, 'do_form_text_field'),
457 457
 			'xcloner_mysql_settings_page',
458 458
 			'xcloner_mysql_settings_group',
459 459
 			array(
460 460
 				'xcloner_mysql_hostname',
461
-				__( 'Wordpress mysql hostname', 'xcloner-backup-and-restore' ),
461
+				__('Wordpress mysql hostname', 'xcloner-backup-and-restore'),
462 462
 				$this->get_db_hostname(),
463 463
 				'disabled'
464 464
 			)
465 465
 		);
466 466
 
467
-		register_setting( 'xcloner_mysql_settings_group', 'xcloner_mysql_username', array(
467
+		register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_username', array(
468 468
 			$this->xcloner_sanitization,
469 469
 			"sanitize_input_as_raw"
470
-		) );
470
+		));
471 471
 		add_settings_field(
472 472
 			'xcloner_mysql_username',
473
-			__( 'Mysql Username', 'xcloner-backup-and-restore' ),
474
-			array( $this, 'do_form_text_field' ),
473
+			__('Mysql Username', 'xcloner-backup-and-restore'),
474
+			array($this, 'do_form_text_field'),
475 475
 			'xcloner_mysql_settings_page',
476 476
 			'xcloner_mysql_settings_group',
477 477
 			array(
478 478
 				'xcloner_mysql_username',
479
-				__( 'Wordpress mysql username', 'xcloner-backup-and-restore' ),
479
+				__('Wordpress mysql username', 'xcloner-backup-and-restore'),
480 480
 				$this->get_db_username(),
481 481
 				'disabled'
482 482
 			)
483 483
 		);
484 484
 
485
-		register_setting( 'xcloner_mysql_settings_group', 'xcloner_mysql_database', array(
485
+		register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_database', array(
486 486
 			$this->xcloner_sanitization,
487 487
 			"sanitize_input_as_raw"
488
-		) );
488
+		));
489 489
 		add_settings_field(
490 490
 			'xcloner_mysql_database',
491
-			__( 'Mysql Database', 'xcloner-backup-and-restore' ),
492
-			array( $this, 'do_form_text_field' ),
491
+			__('Mysql Database', 'xcloner-backup-and-restore'),
492
+			array($this, 'do_form_text_field'),
493 493
 			'xcloner_mysql_settings_page',
494 494
 			'xcloner_mysql_settings_group',
495 495
 			array(
496 496
 				'xcloner_mysql_database',
497
-				__( 'Wordpress mysql database', 'xcloner-backup-and-restore' ),
497
+				__('Wordpress mysql database', 'xcloner-backup-and-restore'),
498 498
 				$this->get_db_database(),
499 499
 				'disabled'
500 500
 			)
501 501
 		);
502 502
 
503 503
 		//REGISTERING THE 'SYSTEM SECTION' FIELDS
504
-		register_setting( 'xcloner_system_settings_group', 'xcloner_size_limit_per_request', array(
504
+		register_setting('xcloner_system_settings_group', 'xcloner_size_limit_per_request', array(
505 505
 			$this->xcloner_sanitization,
506 506
 			"sanitize_input_as_int"
507
-		) );
507
+		));
508 508
 		add_settings_field(
509 509
 			'xcloner_size_limit_per_request',
510
-			__( 'Data Size Limit Per Request', 'xcloner-backup-and-restore' ),
511
-			array( $this, 'do_form_range_field' ),
510
+			__('Data Size Limit Per Request', 'xcloner-backup-and-restore'),
511
+			array($this, 'do_form_range_field'),
512 512
 			'xcloner_system_settings_page',
513 513
 			'xcloner_system_settings_group',
514 514
 			array(
515 515
 				'xcloner_size_limit_per_request',
516
-				__( 'Use this option to set how much file data can XCloner backup in one AJAX request. Range 0-1024 MB', 'xcloner-backup-and-restore' ),
516
+				__('Use this option to set how much file data can XCloner backup in one AJAX request. Range 0-1024 MB', 'xcloner-backup-and-restore'),
517 517
 				0,
518 518
 				1024
519 519
 			)
520 520
 		);
521 521
 
522
-		register_setting( 'xcloner_system_settings_group', 'xcloner_files_to_process_per_request', array(
522
+		register_setting('xcloner_system_settings_group', 'xcloner_files_to_process_per_request', array(
523 523
 			$this->xcloner_sanitization,
524 524
 			"sanitize_input_as_int"
525
-		) );
525
+		));
526 526
 		add_settings_field(
527 527
 			'xcloner_files_to_process_per_request',
528
-			__( 'Files To Process Per Request', 'xcloner-backup-and-restore' ),
529
-			array( $this, 'do_form_range_field' ),
528
+			__('Files To Process Per Request', 'xcloner-backup-and-restore'),
529
+			array($this, 'do_form_range_field'),
530 530
 			'xcloner_system_settings_page',
531 531
 			'xcloner_system_settings_group',
532 532
 			array(
533 533
 				'xcloner_files_to_process_per_request',
534
-				__( 'Use this option to set how many files XCloner should process at one time before doing another AJAX call', 'xcloner-backup-and-restore' ),
534
+				__('Use this option to set how many files XCloner should process at one time before doing another AJAX call', 'xcloner-backup-and-restore'),
535 535
 				0,
536 536
 				1000
537 537
 			)
538 538
 		);
539 539
 
540
-		register_setting( 'xcloner_system_settings_group', 'xcloner_directories_to_scan_per_request', array(
540
+		register_setting('xcloner_system_settings_group', 'xcloner_directories_to_scan_per_request', array(
541 541
 			$this->xcloner_sanitization,
542 542
 			"sanitize_input_as_int"
543
-		) );
543
+		));
544 544
 		add_settings_field(
545 545
 			'xcloner_directories_to_scan_per_request',
546
-			__( 'Directories To Scan Per Request', 'xcloner-backup-and-restore' ),
547
-			array( $this, 'do_form_range_field' ),
546
+			__('Directories To Scan Per Request', 'xcloner-backup-and-restore'),
547
+			array($this, 'do_form_range_field'),
548 548
 			'xcloner_system_settings_page',
549 549
 			'xcloner_system_settings_group',
550 550
 			array(
551 551
 				'xcloner_directories_to_scan_per_request',
552
-				__( 'Use this option to set how many directories XCloner should scan at one time before doing another AJAX call', 'xcloner-backup-and-restore' ),
552
+				__('Use this option to set how many directories XCloner should scan at one time before doing another AJAX call', 'xcloner-backup-and-restore'),
553 553
 				0,
554 554
 				1000
555 555
 			)
556 556
 		);
557 557
 
558
-		register_setting( 'xcloner_system_settings_group', 'xcloner_database_records_per_request', array(
558
+		register_setting('xcloner_system_settings_group', 'xcloner_database_records_per_request', array(
559 559
 			$this->xcloner_sanitization,
560 560
 			"sanitize_input_as_int"
561
-		) );
561
+		));
562 562
 		add_settings_field(
563 563
 			'xcloner_database_records_per_request',
564
-			__( 'Database Records Per Request', 'xcloner-backup-and-restore' ),
565
-			array( $this, 'do_form_range_field' ),
564
+			__('Database Records Per Request', 'xcloner-backup-and-restore'),
565
+			array($this, 'do_form_range_field'),
566 566
 			'xcloner_system_settings_page',
567 567
 			'xcloner_system_settings_group',
568 568
 			array(
569 569
 				'xcloner_database_records_per_request',
570
-				__( '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' ),
570
+				__('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'),
571 571
 				0,
572 572
 				100000
573 573
 			)
@@ -585,140 +585,140 @@  discard block
 block discarded – undo
585 585
 	         )
586 586
 	    );*/
587 587
 
588
-		register_setting( 'xcloner_system_settings_group', 'xcloner_exclude_files_larger_than_mb', array(
588
+		register_setting('xcloner_system_settings_group', 'xcloner_exclude_files_larger_than_mb', array(
589 589
 			$this->xcloner_sanitization,
590 590
 			"sanitize_input_as_int"
591
-		) );
591
+		));
592 592
 		add_settings_field(
593 593
 			'xcloner_exclude_files_larger_than_mb',
594
-			__( 'Exclude files larger than (MB)', 'xcloner-backup-and-restore' ),
595
-			array( $this, 'do_form_number_field' ),
594
+			__('Exclude files larger than (MB)', 'xcloner-backup-and-restore'),
595
+			array($this, 'do_form_number_field'),
596 596
 			'xcloner_system_settings_page',
597 597
 			'xcloner_system_settings_group',
598 598
 			array(
599 599
 				'xcloner_exclude_files_larger_than_mb',
600
-				__( 'Use this option to automatically exclude files larger than a certain size in MB, or set to 0 to include all. Range 0-1000 MB', 'xcloner-backup-and-restore' ),
600
+				__('Use this option to automatically exclude files larger than a certain size in MB, or set to 0 to include all. Range 0-1000 MB', 'xcloner-backup-and-restore'),
601 601
 			)
602 602
 		);
603 603
 
604
-		register_setting( 'xcloner_system_settings_group', 'xcloner_split_backup_limit', array(
604
+		register_setting('xcloner_system_settings_group', 'xcloner_split_backup_limit', array(
605 605
 			$this->xcloner_sanitization,
606 606
 			"sanitize_input_as_int"
607
-		) );
607
+		));
608 608
 		add_settings_field(
609 609
 			'xcloner_split_backup_limit',
610
-			__( 'Split Backup Archive Limit (MB)', 'xcloner-backup-and-restore' ),
611
-			array( $this, 'do_form_number_field' ),
610
+			__('Split Backup Archive Limit (MB)', 'xcloner-backup-and-restore'),
611
+			array($this, 'do_form_number_field'),
612 612
 			'xcloner_system_settings_page',
613 613
 			'xcloner_system_settings_group',
614 614
 			array(
615 615
 				'xcloner_split_backup_limit',
616
-				__( 'Use this option to automatically split the backup archive into smaller parts. Range  0-10000 MB', 'xcloner-backup-and-restore' ),
616
+				__('Use this option to automatically split the backup archive into smaller parts. Range  0-10000 MB', 'xcloner-backup-and-restore'),
617 617
 			)
618 618
 		);
619 619
 
620
-		register_setting( 'xcloner_system_settings_group', 'xcloner_force_tmp_path_site_root' );
620
+		register_setting('xcloner_system_settings_group', 'xcloner_force_tmp_path_site_root');
621 621
 		add_settings_field(
622 622
 			'xcloner_force_tmp_path_site_root',
623
-			__( 'Force Temporary Path Within XCloner Storage', 'xcloner-backup-and-restore' ),
624
-			array( $this, 'do_form_switch_field' ),
623
+			__('Force Temporary Path Within XCloner Storage', 'xcloner-backup-and-restore'),
624
+			array($this, 'do_form_switch_field'),
625 625
 			'xcloner_system_settings_page',
626 626
 			'xcloner_system_settings_group',
627 627
 			array(
628 628
 				'xcloner_force_tmp_path_site_root',
629
-				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() )
629
+				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())
630 630
 			)
631 631
 		);
632 632
 
633
-		register_setting( 'xcloner_system_settings_group', 'xcloner_disable_email_notification' );
633
+		register_setting('xcloner_system_settings_group', 'xcloner_disable_email_notification');
634 634
 		add_settings_field(
635 635
 			'xcloner_disable_email_notification',
636
-			__( 'Disable Email Notifications', 'xcloner-backup-and-restore' ),
637
-			array( $this, 'do_form_switch_field' ),
636
+			__('Disable Email Notifications', 'xcloner-backup-and-restore'),
637
+			array($this, 'do_form_switch_field'),
638 638
 			'xcloner_system_settings_page',
639 639
 			'xcloner_system_settings_group',
640 640
 			array(
641 641
 				'xcloner_disable_email_notification',
642
-				sprintf( __( 'Enable this option if you want the XCloner to NOT send email notifications on successful backups', 'xcloner-backup-and-restore' ), $this->get_table_prefix() )
642
+				sprintf(__('Enable this option if you want the XCloner to NOT send email notifications on successful backups', 'xcloner-backup-and-restore'), $this->get_table_prefix())
643 643
 			)
644 644
 		);
645 645
 
646 646
 		//REGISTERING THE 'CLEANUP SECTION' FIELDS
647
-		register_setting( 'xcloner_cleanup_settings_group', 'xcloner_cleanup_retention_limit_days', array(
647
+		register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_retention_limit_days', array(
648 648
 			$this->xcloner_sanitization,
649 649
 			"sanitize_input_as_int"
650
-		) );
650
+		));
651 651
 		add_settings_field(
652 652
 			'xcloner_cleanup_retention_limit_days',
653
-			__( 'Cleanup by Date(days)', 'xcloner-backup-and-restore' ),
654
-			array( $this, 'do_form_number_field' ),
653
+			__('Cleanup by Date(days)', 'xcloner-backup-and-restore'),
654
+			array($this, 'do_form_number_field'),
655 655
 			'xcloner_cleanup_settings_page',
656 656
 			'xcloner_cleanup_settings_group',
657 657
 			array(
658 658
 				'xcloner_cleanup_retention_limit_days',
659
-				__( 'Specify the maximum number of days a backup archive can be kept on the server. 0 disables this option', 'xcloner-backup-and-restore' )
659
+				__('Specify the maximum number of days a backup archive can be kept on the server. 0 disables this option', 'xcloner-backup-and-restore')
660 660
 			)
661 661
 		);
662 662
 
663
-		register_setting( 'xcloner_cleanup_settings_group', 'xcloner_cleanup_retention_limit_archives', array(
663
+		register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_retention_limit_archives', array(
664 664
 			$this->xcloner_sanitization,
665 665
 			"sanitize_input_as_int"
666
-		) );
666
+		));
667 667
 		add_settings_field(
668 668
 			'xcloner_cleanup_retention_limit_archives',
669
-			__( 'Cleanup by Quantity', 'xcloner-backup-and-restore' ),
670
-			array( $this, 'do_form_number_field' ),
669
+			__('Cleanup by Quantity', 'xcloner-backup-and-restore'),
670
+			array($this, 'do_form_number_field'),
671 671
 			'xcloner_cleanup_settings_page',
672 672
 			'xcloner_cleanup_settings_group',
673 673
 			array(
674 674
 				'xcloner_cleanup_retention_limit_archives',
675
-				__( 'Specify the maximum number of backup archives to keep on the server. 0 disables this option', 'xcloner-backup-and-restore' )
675
+				__('Specify the maximum number of backup archives to keep on the server. 0 disables this option', 'xcloner-backup-and-restore')
676 676
 			)
677 677
 		);
678 678
 
679
-		register_setting( 'xcloner_cleanup_settings_group', 'xcloner_cleanup_capacity_limit', array(
679
+		register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_capacity_limit', array(
680 680
 			$this->xcloner_sanitization,
681 681
 			"sanitize_input_as_int"
682
-		) );
682
+		));
683 683
 		add_settings_field(
684 684
 			'xcloner_cleanup_capacity_limit',
685
-			__( 'Cleanup by Capacity(MB)', 'xcloner-backup-and-restore' ),
686
-			array( $this, 'do_form_number_field' ),
685
+			__('Cleanup by Capacity(MB)', 'xcloner-backup-and-restore'),
686
+			array($this, 'do_form_number_field'),
687 687
 			'xcloner_cleanup_settings_page',
688 688
 			'xcloner_cleanup_settings_group',
689 689
 			array(
690 690
 				'xcloner_cleanup_capacity_limit',
691
-				__( 'Remove oldest backups if all created backups exceed the configured limit in Megabytes. 0 disables this option', 'xcloner-backup-and-restore' )
691
+				__('Remove oldest backups if all created backups exceed the configured limit in Megabytes. 0 disables this option', 'xcloner-backup-and-restore')
692 692
 			)
693 693
 		);
694 694
 
695
-		register_setting( 'xcloner_cleanup_settings_group', 'xcloner_cleanup_delete_after_remote_transfer', array(
695
+		register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_delete_after_remote_transfer', array(
696 696
 			$this->xcloner_sanitization,
697 697
 			"sanitize_input_as_int"
698
-		) );
698
+		));
699 699
 		add_settings_field(
700 700
 			'xcloner_cleanup_delete_after_remote_transfer',
701
-			__( 'Delete Backup After Remote Storage Transfer', 'xcloner-backup-and-restore' ),
702
-			array( $this, 'do_form_switch_field' ),
701
+			__('Delete Backup After Remote Storage Transfer', 'xcloner-backup-and-restore'),
702
+			array($this, 'do_form_switch_field'),
703 703
 			'xcloner_cleanup_settings_page',
704 704
 			'xcloner_cleanup_settings_group',
705 705
 			array(
706 706
 				'xcloner_cleanup_delete_after_remote_transfer',
707
-				__( 'Remove backup created automatically from local storage after sending the backup to Remote Storage', 'xcloner-backup-and-restore' )
707
+				__('Remove backup created automatically from local storage after sending the backup to Remote Storage', 'xcloner-backup-and-restore')
708 708
 			)
709 709
 		);
710 710
 
711 711
 		//REGISTERING THE 'CRON SECTION' FIELDS
712
-		register_setting( 'xcloner_cron_settings_group', 'xcloner_cron_frequency' );
712
+		register_setting('xcloner_cron_settings_group', 'xcloner_cron_frequency');
713 713
 		add_settings_field(
714 714
 			'xcloner_cron_frequency',
715
-			__( 'Cron frequency', 'xcloner-backup-and-restore' ),
716
-			array( $this, 'do_form_text_field' ),
715
+			__('Cron frequency', 'xcloner-backup-and-restore'),
716
+			array($this, 'do_form_text_field'),
717 717
 			'xcloner_cron_settings_page',
718 718
 			'xcloner_cron_settings_group',
719 719
 			array(
720 720
 				'xcloner_cron_frequency',
721
-				__( 'Cron frequency' )
721
+				__('Cron frequency')
722 722
 			)
723 723
 		);
724 724
 	}
Please login to merge, or discard this patch.
includes/class-xcloner-api.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		$this->xcloner_remote_storage   = $xcloner_container->get_xcloner_remote_storage();
91 91
 
92 92
 		if (isset($_POST['API_ID'])) {
93
-			$this->logger->info("Processing ajax request ID " . substr($this->xcloner_sanitization->sanitize_input_as_string($_POST['API_ID']),
93
+			$this->logger->info("Processing ajax request ID ".substr($this->xcloner_sanitization->sanitize_input_as_string($_POST['API_ID']),
94 94
 					0, 15));
95 95
 		}
96 96
 
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
 
132 132
 
133 133
 		$data['recordsPerSession'] = $this->xcloner_settings->get_xcloner_option('xcloner_database_records_per_request');
134
-		$data['TEMP_DBPROCESS_FILE'] = $this->xcloner_settings->get_xcloner_tmp_path() . DS . ".database";
135
-		$data['TEMP_DUMP_FILE'] = $this->xcloner_settings->get_xcloner_tmp_path() . DS . "database-sql.sql";
134
+		$data['TEMP_DBPROCESS_FILE'] = $this->xcloner_settings->get_xcloner_tmp_path().DS.".database";
135
+		$data['TEMP_DUMP_FILE'] = $this->xcloner_settings->get_xcloner_tmp_path().DS."database-sql.sql";
136 136
 
137 137
 		try {
138 138
 			$this->xcloner_database->init($data);
139 139
 
140
-		} catch (Exception $e) {
140
+		}catch (Exception $e) {
141 141
 
142 142
 			$this->send_response($e->getMessage());
143 143
 			$this->logger->error($e->getMessage());
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
 		} else {
224 224
 
225 225
 			$schedule['status'] = 1;
226
-			$schedule['start_at'] = strtotime($this->form_params['backup_params']['schedule_start_date'] .
227
-				" " . $this->form_params['backup_params']['schedule_start_time']);
226
+			$schedule['start_at'] = strtotime($this->form_params['backup_params']['schedule_start_date'].
227
+				" ".$this->form_params['backup_params']['schedule_start_time']);
228 228
 
229 229
 			if ($schedule['start_at'] <= time()) {
230 230
 				$schedule['start_at'] = "";
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 
250 250
 		if (!isset($_POST['id'])) {
251 251
 			$wpdb->insert(
252
-				$wpdb->prefix . 'xcloner_scheduler',
252
+				$wpdb->prefix.'xcloner_scheduler',
253 253
 				$schedule,
254 254
 				array(
255 255
 					'%s',
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			);
259 259
 		} else {
260 260
 			$wpdb->update(
261
-				$wpdb->prefix . 'xcloner_scheduler',
261
+				$wpdb->prefix.'xcloner_scheduler',
262 262
 				$schedule,
263 263
 				array('id' => $_POST['id']),
264 264
 				array(
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 		try {
313 313
 			$return = $this->archive_system->start_incremental_backup($this->form_params['backup_params'],
314 314
 				$this->form_params['extra'], $init);
315
-		} catch (Exception $e) {
315
+		}catch (Exception $e) {
316 316
 			$return = array();
317 317
 			$return['error'] = true;
318 318
 			$return['status'] = 500;
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 					$additional['lines_total'] = $return['extra']['lines_total'];
340 340
 					$this->archive_system->send_notification($to, $from, $subject, $return['extra']['backup_parent'],
341 341
 						$this->form_params, "", $additional);
342
-				} catch (Exception $e) {
342
+				}catch (Exception $e) {
343 343
 					$this->logger->error($e->getMessage());
344 344
 				}
345 345
 			}
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 		if (isset($params->backup_params)) {
438 438
 			foreach ($params->backup_params as $param) {
439 439
 				$this->form_params['backup_params'][$param->name] = $this->xcloner_sanitization->sanitize_input_as_string($param->value);
440
-				$this->logger->debug("Adding form parameter " . $param->name . "." . $param->value . "\n", array(
440
+				$this->logger->debug("Adding form parameter ".$param->name.".".$param->value."\n", array(
441 441
 					'POST',
442 442
 					'fields filter'
443 443
 				));
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 		if (isset($params->table_params)) {
450 450
 			foreach ($params->table_params as $param) {
451 451
 				$this->form_params['database'][$param->parent][] = $this->xcloner_sanitization->sanitize_input_as_raw($param->id);
452
-				$this->logger->debug("Adding database filter " . $param->parent . "." . $param->id . "\n", array(
452
+				$this->logger->debug("Adding database filter ".$param->parent.".".$param->id."\n", array(
453 453
 					'POST',
454 454
 					'database filter'
455 455
 				));
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 				if (!in_array($param->parent, $this->form_params['excluded_files'])) {
469 469
 					//$this->form_params['excluded_files'][] = $this->xcloner_sanitization->sanitize_input_as_relative_path($param->id);
470 470
 					$unique_exclude_files[] = $param->id;
471
-					$this->logger->debug("Adding file filter " . $param->id . "\n", array(
471
+					$this->logger->debug("Adding file filter ".$param->id."\n", array(
472 472
 						'POST',
473 473
 						'exclude files filter'
474 474
 					));
@@ -516,13 +516,13 @@  discard block
 block discarded – undo
516 516
 				'text' => $this->xcloner_settings->get_xcloner_start_path(),
517 517
 				//'children' => true,
518 518
 				'state' => array('selected' => false, 'opened' => true),
519
-				'icon' => plugin_dir_url(dirname(__FILE__)) . "/admin/assets/file-icon-root.png"
519
+				'icon' => plugin_dir_url(dirname(__FILE__))."/admin/assets/file-icon-root.png"
520 520
 			);
521 521
 		}
522 522
 
523 523
 		try {
524 524
 			$files = $this->xcloner_file_system->list_directory($folder);
525
-		} catch (Exception $e) {
525
+		}catch (Exception $e) {
526 526
 
527 527
 			print $e->getMessage();
528 528
 			$this->logger->error($e->getMessage());
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 			if ($file['type'] == "dir") {
544 544
 				$children = true;
545 545
 			} else {
546
-				$text .= " (" . $this->xcloner_requirements->file_format_size($file['size']) . ")";
546
+				$text .= " (".$this->xcloner_requirements->file_format_size($file['size']).")";
547 547
 			}
548 548
 
549 549
 			if ($this->xcloner_file_system->is_excluded($file)) {
@@ -559,8 +559,8 @@  discard block
 block discarded – undo
559 559
 				//'title' => "test",
560 560
 				'children' => $children,
561 561
 				'state' => array('selected' => $selected, 'opened' => false, "checkbox_disabled" => $selected),
562
-				'icon' => plugin_dir_url(dirname(__FILE__)) . "/admin/assets/file-icon-" . strtolower(substr($file['type'],
563
-						0, 1)) . ".png"
562
+				'icon' => plugin_dir_url(dirname(__FILE__))."/admin/assets/file-icon-".strtolower(substr($file['type'],
563
+						0, 1)).".png"
564 564
 			);
565 565
 		}
566 566
 
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 		if ($database == "#") {
587 587
 			try {
588 588
 				$return = $this->xcloner_database->get_all_databases();
589
-			} catch (Exception $e) {
589
+			}catch (Exception $e) {
590 590
 				$this->logger->error($e->getMessage());
591 591
 			}
592 592
 
@@ -607,10 +607,10 @@  discard block
 block discarded – undo
607 607
 				$data[] = array(
608 608
 					'id' => $database['name'],
609 609
 					'parent' => '#',
610
-					'text' => $database['name'] . " (" . (int)$database['num_tables'] . ")",
610
+					'text' => $database['name']." (".(int)$database['num_tables'].")",
611 611
 					'children' => true,
612 612
 					'state' => $state,
613
-					'icon' => plugin_dir_url(dirname(__FILE__)) . "/admin/assets/database-icon.png"
613
+					'icon' => plugin_dir_url(dirname(__FILE__))."/admin/assets/database-icon.png"
614 614
 				);
615 615
 			}
616 616
 
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 
619 619
 			try {
620 620
 				$return = $this->xcloner_database->list_tables($database, "", 1);
621
-			} catch (Exception $e) {
621
+			}catch (Exception $e) {
622 622
 				$this->logger->error($e->getMessage());
623 623
 			}
624 624
 
@@ -635,12 +635,12 @@  discard block
 block discarded – undo
635 635
 				}
636 636
 
637 637
 				$data[] = array(
638
-					'id' => $database . "." . $table['name'],
638
+					'id' => $database.".".$table['name'],
639 639
 					'parent' => $database,
640
-					'text' => $table['name'] . " (" . (int)$table['records'] . ")",
640
+					'text' => $table['name']." (".(int)$table['records'].")",
641 641
 					'children' => false,
642 642
 					'state' => $state,
643
-					'icon' => plugin_dir_url(dirname(__FILE__)) . "/admin/assets/table-icon.png"
643
+					'icon' => plugin_dir_url(dirname(__FILE__))."/admin/assets/table-icon.png"
644 644
 				);
645 645
 			}
646 646
 		}
@@ -686,17 +686,17 @@  discard block
 block discarded – undo
686 686
 		$return['data'] = array();
687 687
 
688 688
 		foreach ($data as $res) {
689
-			$action = "<a href=\"#" . $res->id . "\" class=\"edit\" title='Edit'> <i class=\"material-icons \">edit</i></a>
690
-					<a href=\"#" . $res->id . "\" class=\"delete\" title='Delete'><i class=\"material-icons  \">delete</i></a>";
689
+			$action = "<a href=\"#".$res->id."\" class=\"edit\" title='Edit'> <i class=\"material-icons \">edit</i></a>
690
+					<a href=\"#" . $res->id."\" class=\"delete\" title='Delete'><i class=\"material-icons  \">delete</i></a>";
691 691
 			if ($res->status) {
692 692
 				$status = '<i class="material-icons active status">timer</i>';
693 693
 			} else {
694 694
 				$status = '<i class="material-icons status inactive">timer_off</i>';
695 695
 			}
696 696
 
697
-			$next_run_time = wp_next_scheduled('xcloner_scheduler_' . $res->id, array($res->id));
697
+			$next_run_time = wp_next_scheduled('xcloner_scheduler_'.$res->id, array($res->id));
698 698
 
699
-			$next_run = date(get_option('date_format') . " " . get_option('time_format'), $next_run_time);
699
+			$next_run = date(get_option('date_format')." ".get_option('time_format'), $next_run_time);
700 700
 
701 701
 			$remote_storage = $res->remote_storage;
702 702
 
@@ -705,16 +705,16 @@  discard block
 block discarded – undo
705 705
 			}
706 706
 
707 707
 			if (trim($next_run)) {
708
-				$date_text = date(get_option('date_format') . " " . get_option('time_format'),
708
+				$date_text = date(get_option('date_format')." ".get_option('time_format'),
709 709
 					$next_run_time + (get_option('gmt_offset') * HOUR_IN_SECONDS));
710 710
 
711 711
 				if ($next_run_time >= time()) {
712
-					$next_run = "in " . human_time_diff($next_run_time, time());
712
+					$next_run = "in ".human_time_diff($next_run_time, time());
713 713
 				} else {
714 714
 					$next_run = __("executed", 'xcloner-backup-and-restore');
715 715
 				}
716 716
 
717
-				$next_run = "<a href='#' title='" . $date_text . "'>" . $next_run . "</a>";
717
+				$next_run = "<a href='#' title='".$date_text."'>".$next_run."</a>";
718 718
 				//$next_run .=" ($date_text)";
719 719
 			}
720 720
 
@@ -726,11 +726,11 @@  discard block
 block discarded – undo
726 726
 				if ($this->xcloner_file_system->get_storage_filesystem()->has($res->last_backup)) {
727 727
 					$metadata = $this->xcloner_file_system->get_storage_filesystem()->getMetadata($res->last_backup);
728 728
 					$backup_size = size_format($this->xcloner_file_system->get_backup_size($res->last_backup));
729
-					$backup_time = date(get_option('date_format') . " " . get_option('time_format'),
729
+					$backup_time = date(get_option('date_format')." ".get_option('time_format'),
730 730
 						$metadata['timestamp'] + (get_option('gmt_offset') * HOUR_IN_SECONDS));
731 731
 				}
732 732
 
733
-				$backup_text = "<span title='" . $backup_time . "' class='shorten_string'>" . $res->last_backup . " (" . $backup_size . ")</span>";
733
+				$backup_text = "<span title='".$backup_time."' class='shorten_string'>".$res->last_backup." (".$backup_size.")</span>";
734 734
 			}
735 735
 
736 736
 			$schedules = wp_get_schedules();
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 			$return['data'][] = array(
743 743
 				$res->id,
744 744
 				$res->name,
745
-				$res->recurrence,/*$res->start_at,*/
745
+				$res->recurrence, /*$res->start_at,*/
746 746
 				$next_run,
747 747
 				$remote_storage,
748 748
 				$backup_text,
@@ -808,25 +808,25 @@  discard block
 block discarded – undo
808 808
 			$this->process_params($params);
809 809
 			$source_backup_file = $this->xcloner_sanitization->sanitize_input_as_string($this->form_params['extra']['backup_parent']);
810 810
 
811
-			if(isset($this->form_params['extra']['start'])) {
811
+			if (isset($this->form_params['extra']['start'])) {
812 812
 				$start = $this->xcloner_sanitization->sanitize_input_as_int($this->form_params['extra']['start']);
813
-			}else{
813
+			} else {
814 814
 				$start = 0;
815 815
 			}
816 816
 
817
-			if(isset($this->form_params['extra']['iv'])) {
817
+			if (isset($this->form_params['extra']['iv'])) {
818 818
 				$iv = $this->xcloner_sanitization->sanitize_input_as_raw($this->form_params['extra']['iv']);
819
-			}else{
819
+			} else {
820 820
 				$iv = "";
821 821
 			}
822 822
 
823
-			if(isset($this->form_params['extra']['part'])) {
823
+			if (isset($this->form_params['extra']['part'])) {
824 824
 				$return['part'] = (int)$this->xcloner_sanitization->sanitize_input_as_int($this->form_params['extra']['part']);
825
-			}else{
825
+			} else {
826 826
 				$return['part'] = 0;
827 827
 			}
828 828
 
829
-		}else{
829
+		} else {
830 830
 			$source_backup_file = $this->xcloner_sanitization->sanitize_input_as_string($_POST['file']);
831 831
 			$start = $this->xcloner_sanitization->sanitize_input_as_int($_POST['start']);
832 832
 			$iv = $this->xcloner_sanitization->sanitize_input_as_raw($_POST['iv']);
@@ -841,14 +841,14 @@  discard block
 block discarded – undo
841 841
 		}
842 842
 
843 843
 		$return['processing_file'] = $backup_file;
844
-		$return['total_size'] = filesize($this->xcloner_settings->get_xcloner_store_path() . DS . $backup_file);
844
+		$return['total_size'] = filesize($this->xcloner_settings->get_xcloner_store_path().DS.$backup_file);
845 845
 
846 846
 		try {
847 847
 			$this->logger->info(json_encode($_POST));
848 848
 			$this->logger->info($iv);
849 849
 			$return = array_merge($return,
850 850
 				$this->xcloner_encryption->encrypt_file($backup_file, "", "", $start, base64_decode($iv)));
851
-		}catch(\Exception $e){
851
+		}catch (\Exception $e) {
852 852
 			$return['error'] = true;
853 853
 			$return['message'] = $e->getMessage();
854 854
 			$return['error_message'] = $e->getMessage();
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 
857 857
 		//echo strlen($return['iv']);exit;
858 858
 
859
-		if($return['finished']) {
859
+		if ($return['finished']) {
860 860
 			if ($this->xcloner_file_system->is_multipart($source_backup_file)) {
861 861
 				$return['start'] = 0;
862 862
 
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 		}
871 871
 
872 872
 		if (isset($_POST['data'])) {
873
-			$return['extra'] = array_merge($this->form_params['extra'],  $return);
873
+			$return['extra'] = array_merge($this->form_params['extra'], $return);
874 874
 		}
875 875
 
876 876
 		$this->send_response($return, 0);
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
 		$source_backup_file = $this->xcloner_sanitization->sanitize_input_as_string($_POST['file']);
890 890
 		$start = $this->xcloner_sanitization->sanitize_input_as_int($_POST['start']);
891 891
 		$iv = $this->xcloner_sanitization->sanitize_input_as_raw($_POST['iv']);
892
-		$decryption_key = $this->xcloner_sanitization->sanitize_input_as_raw($_POST['decryption_key']);;
892
+		$decryption_key = $this->xcloner_sanitization->sanitize_input_as_raw($_POST['decryption_key']); ;
893 893
 		$return['part'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['part']);
894 894
 
895 895
 		$backup_file = $source_backup_file;
@@ -900,17 +900,17 @@  discard block
 block discarded – undo
900 900
 		}
901 901
 
902 902
 		$return['processing_file'] = $backup_file;
903
-		$return['total_size'] = filesize($this->xcloner_settings->get_xcloner_store_path() . DS . $backup_file);
903
+		$return['total_size'] = filesize($this->xcloner_settings->get_xcloner_store_path().DS.$backup_file);
904 904
 
905 905
 		try {
906 906
 			$return = array_merge($return,
907 907
 				$this->xcloner_encryption->decrypt_file($backup_file, "", $decryption_key, $start, base64_decode($iv)));
908
-		}catch(\Exception $e){
908
+		}catch (\Exception $e) {
909 909
 			$return['error'] = true;
910 910
 			$return['message'] = $e->getMessage();
911 911
 		}
912 912
 
913
-		if($return['finished']) {
913
+		if ($return['finished']) {
914 914
 			if ($this->xcloner_file_system->is_multipart($source_backup_file)) {
915 915
 				$return['start'] = 0;
916 916
 
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
 		foreach ($backup_list as $file_info):?>
945 945
             <?php
946 946
 			if ($storage_selection == "gdrive") {
947
-				$file_info['path'] = $file_info['filename'] . "." . $file_info['extension'];
947
+				$file_info['path'] = $file_info['filename'].".".$file_info['extension'];
948 948
 			}
949 949
 			$file_exists_on_local_storage = true;
950 950
 
@@ -1065,10 +1065,10 @@  discard block
 block discarded – undo
1065 1065
                             <?php endif ?>
1066 1066
                             <?php
1067 1067
 							$basename = $file_info['basename'];
1068
-							if(isset($file_info['childs']) and sizeof($file_info['childs']))
1068
+							if (isset($file_info['childs']) and sizeof($file_info['childs']))
1069 1069
 								$basename = $file_info['childs'][0][0];
1070 1070
 							?>
1071
-                            <?php if($this->xcloner_encryption->is_encrypted_file($basename)) :?>
1071
+                            <?php if ($this->xcloner_encryption->is_encrypted_file($basename)) :?>
1072 1072
                                 <a href="#<?php echo $file_info['basename'] ?>" class="backup-decryption"
1073 1073
                                    title="<?php echo __('Backup Decryption', 'xcloner-backup-and-restore') ?>">
1074 1074
                                     <i class="material-icons">enhanced_encryption</i>
@@ -1126,7 +1126,7 @@  discard block
 block discarded – undo
1126 1126
 			$backup_file = $backup_parts[$return['part']];
1127 1127
 		}
1128 1128
 
1129
-		if($this->xcloner_encryption->is_encrypted_file($backup_file)) {
1129
+		if ($this->xcloner_encryption->is_encrypted_file($backup_file)) {
1130 1130
 			$return['error'] = true;
1131 1131
 			$return['message'] = __("Backup archive is encrypted, please decrypt it first before you can list it's content.", "xcloner-backup-and-restore");
1132 1132
 			$this->send_response($return, 0);
@@ -1134,10 +1134,10 @@  discard block
 block discarded – undo
1134 1134
 
1135 1135
 		try {
1136 1136
 			$tar = new Tar();
1137
-			$tar->open($this->xcloner_settings->get_xcloner_store_path() . DS . $backup_file, $start);
1137
+			$tar->open($this->xcloner_settings->get_xcloner_store_path().DS.$backup_file, $start);
1138 1138
 
1139 1139
 			$data = $tar->contents(get_option('xcloner_files_to_process_per_request'));
1140
-		} catch (Exception $e) {
1140
+		}catch (Exception $e) {
1141 1141
 			$return['error'] = true;
1142 1142
 			$return['message'] = $e->getMessage();
1143 1143
 			$this->send_response($return, 0);
@@ -1145,14 +1145,14 @@  discard block
 block discarded – undo
1145 1145
 
1146 1146
 		$return['files'] = array();
1147 1147
 		$return['finished'] = 1;
1148
-		$return['total_size'] = filesize($this->xcloner_settings->get_xcloner_store_path() . DS . $backup_file);
1148
+		$return['total_size'] = filesize($this->xcloner_settings->get_xcloner_store_path().DS.$backup_file);
1149 1149
 		$i = 0;
1150 1150
 
1151 1151
 		if (isset($data['extracted_files']) and is_array($data['extracted_files'])) {
1152 1152
 			foreach ($data['extracted_files'] as $file) {
1153 1153
 				$return['files'][$i]['path'] = $file->getPath();
1154 1154
 				$return['files'][$i]['size'] = $file->getSize();
1155
-				$return['files'][$i]['mtime'] = date(get_option('date_format') . " " . get_option('time_format'),
1155
+				$return['files'][$i]['mtime'] = date(get_option('date_format')." ".get_option('time_format'),
1156 1156
 					$file->getMtime());
1157 1157
 
1158 1158
 				$i++;
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
 					"copy_backup_remote_to_local"
1201 1201
 				), array($backup_file, $storage_type));
1202 1202
 			}
1203
-		} catch (Exception $e) {
1203
+		}catch (Exception $e) {
1204 1204
 
1205 1205
 			$return['error'] = 1;
1206 1206
 			$return['message'] = $e->getMessage();
@@ -1239,7 +1239,7 @@  discard block
 block discarded – undo
1239 1239
 					"upload_backup_to_storage"
1240 1240
 				), array($backup_file, $storage_type));
1241 1241
 			}
1242
-		} catch (Exception $e) {
1242
+		}catch (Exception $e) {
1243 1243
 
1244 1244
 			$return['error'] = 1;
1245 1245
 			$return['message'] = $e->getMessage();
@@ -1301,21 +1301,21 @@  discard block
 block discarded – undo
1301 1301
         $phar2->setStub($phar2->createDefaultStub('vendor/autoload.php', 'vendor/autoload.php'));
1302 1302
          * */
1303 1303
 
1304
-		$tmp_file = $this->xcloner_settings->get_xcloner_tmp_path() . DS . "xcloner-restore.tgz";
1304
+		$tmp_file = $this->xcloner_settings->get_xcloner_tmp_path().DS."xcloner-restore.tgz";
1305 1305
 
1306 1306
 		$tar = new Tar();
1307 1307
 		$tar->create($tmp_file);
1308 1308
 
1309
-		$tar->addFile(dirname(__DIR__) . "/restore/vendor.build.txt", "vendor.phar");
1309
+		$tar->addFile(dirname(__DIR__)."/restore/vendor.build.txt", "vendor.phar");
1310 1310
 		//$tar->addFile(dirname(__DIR__)."/restore/vendor.tgz", "vendor.tgz");
1311 1311
 
1312 1312
 		$files = $xcloner_plugin_filesystem->listContents("vendor/", true);
1313 1313
 		foreach ($files as $file) {
1314
-			$tar->addFile(dirname(__DIR__) . DS . $file['path'], $file['path']);
1314
+			$tar->addFile(dirname(__DIR__).DS.$file['path'], $file['path']);
1315 1315
 		}
1316 1316
 
1317
-		$content = file_get_contents(dirname(__DIR__) . "/restore/xcloner_restore.php");
1318
-		$content = str_replace("define('AUTH_KEY', '');", "define('AUTH_KEY', '" . md5(AUTH_KEY) . "');", $content);
1317
+		$content = file_get_contents(dirname(__DIR__)."/restore/xcloner_restore.php");
1318
+		$content = str_replace("define('AUTH_KEY', '');", "define('AUTH_KEY', '".md5(AUTH_KEY)."');", $content);
1319 1319
 
1320 1320
 		$tar->addData("xcloner_restore.php", $content);
1321 1321
 
@@ -1324,18 +1324,18 @@  discard block
 block discarded – undo
1324 1324
 		if (file_exists($tmp_file)) {
1325 1325
 			header('Content-Description: File Transfer');
1326 1326
 			header('Content-Type: application/octet-stream');
1327
-			header('Content-Disposition: attachment; filename="' . basename($tmp_file) . '"');
1327
+			header('Content-Disposition: attachment; filename="'.basename($tmp_file).'"');
1328 1328
 			header('Expires: 0');
1329 1329
 			header('Cache-Control: must-revalidate');
1330 1330
 			header('Pragma: public');
1331
-			header('Content-Length: ' . filesize($tmp_file));
1331
+			header('Content-Length: '.filesize($tmp_file));
1332 1332
 			readfile($tmp_file);
1333 1333
 
1334 1334
 		}
1335 1335
 
1336 1336
 		try {
1337 1337
             unlink($tmp_file);
1338
-        }catch(Exception $e) {
1338
+        }catch (Exception $e) {
1339 1339
 		    //We are not interested in the error here
1340 1340
         }
1341 1341
 
@@ -1365,9 +1365,9 @@  discard block
 block discarded – undo
1365 1365
 		header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
1366 1366
 		header('Cache-Control: private', false);
1367 1367
 		header('Content-Transfer-Encoding: binary');
1368
-		header('Content-Disposition: attachment; filename="' . $metadata['path'] . '";');
1368
+		header('Content-Disposition: attachment; filename="'.$metadata['path'].'";');
1369 1369
 		header('Content-Type: application/octet-stream');
1370
-		header('Content-Length: ' . $metadata['size']);
1370
+		header('Content-Length: '.$metadata['size']);
1371 1371
 
1372 1372
 		ob_end_clean();
1373 1373
 
@@ -1430,12 +1430,12 @@  discard block
 block discarded – undo
1430 1430
 			$xcloner_file_transfer->set_target($target_url);
1431 1431
 			$return['start'] = $xcloner_file_transfer->transfer_file($file, $start, $hash);
1432 1432
 
1433
-		} catch (Exception $e) {
1433
+		}catch (Exception $e) {
1434 1434
 
1435 1435
 			$return = array();
1436 1436
 			$return['error'] = true;
1437 1437
 			$return['status'] = 500;
1438
-			$return['message'] = "CURL communication error with the restore host. " . $e->getMessage();
1438
+			$return['message'] = "CURL communication error with the restore host. ".$e->getMessage();
1439 1439
 			$this->send_response($return, 0);
1440 1440
 
1441 1441
 		}
@@ -1459,7 +1459,7 @@  discard block
 block discarded – undo
1459 1459
 		$this->check_access();
1460 1460
 
1461 1461
 		define("XCLONER_PLUGIN_ACCESS", 1);
1462
-		include_once(dirname(__DIR__) . DS . "restore" . DS . "xcloner_restore.php");
1462
+		include_once(dirname(__DIR__).DS."restore".DS."xcloner_restore.php");
1463 1463
 
1464 1464
 		return;
1465 1465
 	}
Please login to merge, or discard this patch.
includes/class-xcloner-remote-storage.php 1 patch
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -166,26 +166,26 @@  discard block
 block discarded – undo
166 166
      * Xcloner_Remote_Storage constructor.
167 167
      * @param Xcloner $xcloner_container
168 168
      */
169
-    public function __construct( Xcloner $xcloner_container ) {
169
+    public function __construct(Xcloner $xcloner_container) {
170 170
 		$this->xcloner_sanitization = $xcloner_container->get_xcloner_sanitization();
171 171
 		$this->xcloner_file_system  = $xcloner_container->get_xcloner_filesystem();
172
-		$this->logger               = $xcloner_container->get_xcloner_logger()->withName( "xcloner_remote_storage" );
172
+		$this->logger               = $xcloner_container->get_xcloner_logger()->withName("xcloner_remote_storage");
173 173
 		$this->xcloner              = $xcloner_container;
174 174
 
175
-		foreach($this->storage_fields as $main_key=>$array){
175
+		foreach ($this->storage_fields as $main_key=>$array) {
176 176
 
177
-			if(is_array($array)) {
177
+			if (is_array($array)) {
178 178
 				foreach ($array as $key => $type) {
179 179
 
180
-					if( $type == "raw") {
181
-						add_filter("pre_update_option_" . $this->storage_fields['option_prefix'] . $key,
182
-							function ($value) {
180
+					if ($type == "raw") {
181
+						add_filter("pre_update_option_".$this->storage_fields['option_prefix'].$key,
182
+							function($value) {
183 183
 
184 184
 								return $this->simple_crypt($value, 'e');
185 185
 
186 186
 							}, 10, 1);
187 187
 
188
-						add_filter("option_" . $this->storage_fields['option_prefix'] . $key, function ($value) {
188
+						add_filter("option_".$this->storage_fields['option_prefix'].$key, function($value) {
189 189
 
190 190
 							return $this->simple_crypt($value, 'd');
191 191
 
@@ -205,22 +205,22 @@  discard block
 block discarded – undo
205 205
 	 * @param string $action
206 206
 	 * @return string
207 207
 	 */
208
-	private function simple_crypt( $string, $action = 'e' ) {
208
+	private function simple_crypt($string, $action = 'e') {
209 209
 		// you may change these values to your own
210 210
 		$secret_key = NONCE_KEY;
211 211
 		$secret_iv = NONCE_SALT;
212 212
 
213 213
 		$output = $string;
214 214
 		$encrypt_method = "AES-256-CBC";
215
-		$key = hash( 'sha256', $secret_key );
216
-		$iv = substr( hash( 'sha256', $secret_iv ), 0, 16 );
215
+		$key = hash('sha256', $secret_key);
216
+		$iv = substr(hash('sha256', $secret_iv), 0, 16);
217 217
 
218
-		if( $action == 'e' && function_exists('openssl_encrypt')) {
219
-			$output = base64_encode( openssl_encrypt( $string, $encrypt_method, $key, 0, $iv ) );
218
+		if ($action == 'e' && function_exists('openssl_encrypt')) {
219
+			$output = base64_encode(openssl_encrypt($string, $encrypt_method, $key, 0, $iv));
220 220
 		}
221
-		else if( $action == 'd' && function_exists('openssl_decrypt') && base64_decode( $string )){
222
-			$decrypt = openssl_decrypt( base64_decode( $string ), $encrypt_method, $key, 0, $iv );
223
-			if($decrypt) {
221
+		else if ($action == 'd' && function_exists('openssl_decrypt') && base64_decode($string)) {
222
+			$decrypt = openssl_decrypt(base64_decode($string), $encrypt_method, $key, 0, $iv);
223
+			if ($decrypt) {
224 224
 				//we check if decrypt was succesful
225 225
 				$output = $decrypt;
226 226
 			}
@@ -235,121 +235,121 @@  discard block
 block discarded – undo
235 235
 
236 236
 	public function get_available_storages() {
237 237
 		$return = array();
238
-		foreach ( $this->storage_fields as $storage => $data ) {
239
-			$check_field = $this->storage_fields["option_prefix"] . $storage . "_enable";
240
-			if ( get_option( $check_field ) ) {
241
-				$return[ $storage ] = $data['text'];
238
+		foreach ($this->storage_fields as $storage => $data) {
239
+			$check_field = $this->storage_fields["option_prefix"].$storage."_enable";
240
+			if (get_option($check_field)) {
241
+				$return[$storage] = $data['text'];
242 242
 			}
243 243
 		}
244 244
 
245 245
 		return $return;
246 246
 	}
247 247
 
248
-	public function save( $action = "ftp" ) {
249
-		if ( ! $action ) {
248
+	public function save($action = "ftp") {
249
+		if (!$action) {
250 250
 			return false;
251 251
 		}
252 252
 
253
-		$storage = $this->xcloner_sanitization->sanitize_input_as_string( $action );
254
-		$this->logger->debug( sprintf( "Saving the remote storage %s options", strtoupper( $action ) ) );
253
+		$storage = $this->xcloner_sanitization->sanitize_input_as_string($action);
254
+		$this->logger->debug(sprintf("Saving the remote storage %s options", strtoupper($action)));
255 255
 
256
-		if ( is_array( $this->storage_fields[ $storage ] ) ) {
257
-			foreach ( $this->storage_fields[ $storage ] as $field => $validation ) {
258
-				$check_field     = $this->storage_fields["option_prefix"] . $field;
259
-				$sanitize_method = "sanitize_input_as_" . $validation;
256
+		if (is_array($this->storage_fields[$storage])) {
257
+			foreach ($this->storage_fields[$storage] as $field => $validation) {
258
+				$check_field     = $this->storage_fields["option_prefix"].$field;
259
+				$sanitize_method = "sanitize_input_as_".$validation;
260 260
 
261
-				if ( ! isset( $_POST[ $check_field ] ) ) {
262
-					$_POST[ $check_field ] = 0;
261
+				if (!isset($_POST[$check_field])) {
262
+					$_POST[$check_field] = 0;
263 263
 				}
264 264
 
265
-				if ( ! method_exists( $this->xcloner_sanitization, $sanitize_method ) ) {
265
+				if (!method_exists($this->xcloner_sanitization, $sanitize_method)) {
266 266
 					$sanitize_method = "sanitize_input_as_string";
267 267
 				}
268 268
 
269
-				$sanitized_value = $this->xcloner_sanitization->$sanitize_method( stripslashes( $_POST[ $check_field ] ) );
270
-				update_option( $check_field, $sanitized_value );
269
+				$sanitized_value = $this->xcloner_sanitization->$sanitize_method(stripslashes($_POST[$check_field]));
270
+				update_option($check_field, $sanitized_value);
271 271
 			}
272 272
 
273
-			$this->xcloner->trigger_message( __( "%s storage settings saved.", 'xcloner-backup-and-restore' ), "success", $this->storage_fields[ $action ]['text'] );
273
+			$this->xcloner->trigger_message(__("%s storage settings saved.", 'xcloner-backup-and-restore'), "success", $this->storage_fields[$action]['text']);
274 274
 		}
275 275
 
276 276
 	}
277 277
 
278
-	public function check( $action = "ftp" ) {
278
+	public function check($action = "ftp") {
279 279
 		try {
280
-			$this->verify_filesystem( $action );
281
-			$this->xcloner->trigger_message( __( "%s connection is valid.", 'xcloner-backup-and-restore' ), "success", $this->storage_fields[ $action ]['text'] );
282
-			$this->logger->debug( sprintf( "Connection to remote storage %s is valid", strtoupper( $action ) ) );
283
-		} catch ( Exception $e ) {
284
-			$this->xcloner->trigger_message( "%s connection error: " . $e->getMessage(), "error", $this->storage_fields[ $action ]['text'] );
280
+			$this->verify_filesystem($action);
281
+			$this->xcloner->trigger_message(__("%s connection is valid.", 'xcloner-backup-and-restore'), "success", $this->storage_fields[$action]['text']);
282
+			$this->logger->debug(sprintf("Connection to remote storage %s is valid", strtoupper($action)));
283
+		}catch (Exception $e) {
284
+			$this->xcloner->trigger_message("%s connection error: ".$e->getMessage(), "error", $this->storage_fields[$action]['text']);
285 285
 		}
286 286
 	}
287 287
 
288 288
 	/**
289 289
 	 * @param string $storage_type
290 290
 	 */
291
-	public function verify_filesystem( $storage_type ) {
292
-		$method = "get_" . $storage_type . "_filesystem";
291
+	public function verify_filesystem($storage_type) {
292
+		$method = "get_".$storage_type."_filesystem";
293 293
 
294
-		$this->logger->info( sprintf( "Checking validity of the remote storage %s filesystem", strtoupper( $storage_type ) ) );
294
+		$this->logger->info(sprintf("Checking validity of the remote storage %s filesystem", strtoupper($storage_type)));
295 295
 
296
-		if ( ! method_exists( $this, $method ) ) {
296
+		if (!method_exists($this, $method)) {
297 297
 			return false;
298 298
 		}
299 299
 
300
-		list( $adapter, $filesystem ) = $this->$method();
300
+		list($adapter, $filesystem) = $this->$method();
301 301
 
302
-		$test_file = substr( ".xcloner_" . md5( time() ), 0, 15 );
302
+		$test_file = substr(".xcloner_".md5(time()), 0, 15);
303 303
 
304
-		if ( $storage_type == "gdrive" ) {
305
-			if ( ! is_array( $filesystem->listContents() ) ) {
306
-				throw new Exception( __( "Could not read data", 'xcloner-backup-and-restore' ) );
304
+		if ($storage_type == "gdrive") {
305
+			if (!is_array($filesystem->listContents())) {
306
+				throw new Exception(__("Could not read data", 'xcloner-backup-and-restore'));
307 307
 			}
308
-			$this->logger->debug( sprintf( "I can list data from remote storage %s", strtoupper( $storage_type ) ) );
308
+			$this->logger->debug(sprintf("I can list data from remote storage %s", strtoupper($storage_type)));
309 309
 
310 310
 			return true;
311 311
 		}
312 312
 
313 313
 		//testing write access
314
-		if ( ! $filesystem->write( $test_file, "data" ) ) {
315
-			throw new Exception( __( "Could not write data", 'xcloner-backup-and-restore' ) );
314
+		if (!$filesystem->write($test_file, "data")) {
315
+			throw new Exception(__("Could not write data", 'xcloner-backup-and-restore'));
316 316
 		}
317
-		$this->logger->debug( sprintf( "I can write data to remote storage %s", strtoupper( $storage_type ) ) );
317
+		$this->logger->debug(sprintf("I can write data to remote storage %s", strtoupper($storage_type)));
318 318
 
319 319
 		//testing read access
320
-		if ( ! $filesystem->has( $test_file ) ) {
321
-			throw new Exception( __( "Could not read data", 'xcloner-backup-and-restore' ) );
320
+		if (!$filesystem->has($test_file)) {
321
+			throw new Exception(__("Could not read data", 'xcloner-backup-and-restore'));
322 322
 		}
323
-		$this->logger->debug( sprintf( "I can read data to remote storage %s", strtoupper( $storage_type ) ) );
323
+		$this->logger->debug(sprintf("I can read data to remote storage %s", strtoupper($storage_type)));
324 324
 
325 325
 		//delete test file
326
-		if ( ! $filesystem->delete( $test_file ) ) {
327
-			throw new Exception( __( "Could not delete data", 'xcloner-backup-and-restore' ) );
326
+		if (!$filesystem->delete($test_file)) {
327
+			throw new Exception(__("Could not delete data", 'xcloner-backup-and-restore'));
328 328
 		}
329
-		$this->logger->debug( sprintf( "I can delete data to remote storage %s", strtoupper( $storage_type ) ) );
329
+		$this->logger->debug(sprintf("I can delete data to remote storage %s", strtoupper($storage_type)));
330 330
 
331 331
 		return true;
332 332
 	}
333 333
 
334
-	public function upload_backup_to_storage( $file, $storage ) {
335
-		if ( ! $this->xcloner_file_system->get_storage_filesystem()->has( $file ) ) {
336
-			$this->logger->info( sprintf( "File not found %s in local storage", $file ) );
334
+	public function upload_backup_to_storage($file, $storage) {
335
+		if (!$this->xcloner_file_system->get_storage_filesystem()->has($file)) {
336
+			$this->logger->info(sprintf("File not found %s in local storage", $file));
337 337
 
338 338
 			return false;
339 339
 		}
340 340
 
341
-		$method = "get_" . $storage . "_filesystem";
341
+		$method = "get_".$storage."_filesystem";
342 342
 
343
-		if ( ! method_exists( $this, $method ) ) {
343
+		if (!method_exists($this, $method)) {
344 344
 			return false;
345 345
 		}
346 346
 
347
-		list( $remote_storage_adapter, $remote_storage_filesystem ) = $this->$method();
347
+		list($remote_storage_adapter, $remote_storage_filesystem) = $this->$method();
348 348
 
349 349
 		//doing remote storage cleaning here
350
-		$this->clean_remote_storage( $storage, $remote_storage_filesystem );
350
+		$this->clean_remote_storage($storage, $remote_storage_filesystem);
351 351
 
352
-		$this->logger->info( sprintf( "Transferring backup %s to remote storage %s", $file, strtoupper( $storage ) ), array( "" ) );
352
+		$this->logger->info(sprintf("Transferring backup %s to remote storage %s", $file, strtoupper($storage)), array(""));
353 353
 
354 354
 		/*if(!$this->xcloner_file_system->get_storage_filesystem()->has($file))
355 355
 		{
Please login to merge, or discard this patch.
includes/class-xcloner-encryption.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 	 */
63 63
 	public function is_encrypted_file($filename) {
64 64
 		$fp = fopen($this->get_xcloner_path().$filename, 'r');
65
-		if($fp) {
65
+		if ($fp) {
66 66
             $encryption_length = fread($fp, 16);
67 67
             fclose($fp);
68 68
             if (is_numeric($encryption_length)) {
Please login to merge, or discard this patch.