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.
Completed
Push — master ( e65d67...dc9fa8 )
by Liuta
03:08
created
uninstall.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,6 +26,6 @@
 block discarded – undo
26 26
  */
27 27
 
28 28
 // If uninstall not called from WordPress, then exit.
29
-if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
29
+if (!defined('WP_UNINSTALL_PLUGIN')) {
30 30
 	exit;
31 31
 }
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
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 		load_plugin_textdomain(
38 38
 			'xcloner-backup-and-restore',
39 39
 			false,
40
-			dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
40
+			dirname(dirname(plugin_basename(__FILE__))).'/languages/'
41 41
 		);
42 42
 
43 43
 	}
Please login to merge, or discard this patch.
admin/partials/xcloner_console_page.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-$xcloner_settings 	= $this->get_xcloner_container()->get_xcloner_settings();
4
-$logger				= $this->get_xcloner_container()->get_xcloner_logger();
5
-$logger_content 	= $logger->getLastDebugLines();
3
+$xcloner_settings = $this->get_xcloner_container()->get_xcloner_settings();
4
+$logger = $this->get_xcloner_container()->get_xcloner_logger();
5
+$logger_content = $logger->getLastDebugLines();
6 6
 ?>
7 7
 <div class="col s12 ">
8 8
 	<div>
@@ -10,12 +10,12 @@  discard block
 block discarded – undo
10 10
 				<?php echo __('XCloner Debugger Dashboard', 'xcloner-backup-and-restore') ?>
11 11
 		</h5>
12 12
 		
13
-		<?php if($xcloner_settings->get_xcloner_option('xcloner_enable_log')) :?>
13
+		<?php if ($xcloner_settings->get_xcloner_option('xcloner_enable_log')) :?>
14 14
 		<ul class="collapsible xcloner-debugger" data-collapsible="accordion">
15 15
 			<li class="active">
16 16
 				<div class="collapsible-header active"><i class="material-icons">bug_report</i>XCloner Debugger</div>
17 17
 				<div class="collapsible-body">
18
-					<div class="console" id="xcloner-console"><?php if(isset($logger_content)) echo implode("<br />\n", $logger_content); ?></div>
18
+					<div class="console" id="xcloner-console"><?php if (isset($logger_content)) echo implode("<br />\n", $logger_content); ?></div>
19 19
 				</div>
20 20
 			</li>
21 21
 		</ul>
@@ -28,6 +28,6 @@  discard block
 block discarded – undo
28 28
 				}, 2000);*/
29 29
 			})
30 30
 		</script>
31
-		<?php endif;?>
31
+		<?php endif; ?>
32 32
 	</div>
33 33
 </div>
Please login to merge, or discard this patch.
includes/class-xcloner-remote-storage.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 use Sabre\DAV\Client as SabreClient;
22 22
 use League\Flysystem\WebDAV\WebDAVAdapter;
23 23
 
24
-class Xcloner_Remote_Storage{
24
+class Xcloner_Remote_Storage {
25 25
 	
26
-	private $gdrive_app_name 		= "XCloner Backup and Restore";
26
+	private $gdrive_app_name = "XCloner Backup and Restore";
27 27
 	
28 28
 	private $storage_fields = array(
29 29
 					"option_prefix" => "xcloner_",
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 	{
134 134
 		$this->xcloner_sanitization 	= $xcloner_container->get_xcloner_sanitization();
135 135
 		$this->xcloner_file_system 		= $xcloner_container->get_xcloner_filesystem();
136
-		$this->logger 					= $xcloner_container->get_xcloner_logger()->withName("xcloner_remote_storage");
137
-		$this->xcloner 					= $xcloner_container;
136
+		$this->logger = $xcloner_container->get_xcloner_logger()->withName("xcloner_remote_storage");
137
+		$this->xcloner = $xcloner_container;
138 138
 	}
139 139
 	
140 140
 	private function get_xcloner_container()
@@ -145,10 +145,10 @@  discard block
 block discarded – undo
145 145
 	public function get_available_storages()
146 146
 	{
147 147
 		$return = array();
148
-		foreach($this->storage_fields as $storage=>$data)
148
+		foreach ($this->storage_fields as $storage=>$data)
149 149
 		{
150 150
 			$check_field = $this->storage_fields["option_prefix"].$storage."_enable";
151
-			if(get_option($check_field))
151
+			if (get_option($check_field))
152 152
 				$return[$storage] = $data['text'];
153 153
 		}
154 154
 		
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	
158 158
 	public function save($action = "ftp")
159 159
 	{
160
-		if(!$action)
160
+		if (!$action)
161 161
 		{
162 162
 			return false;
163 163
 		}
@@ -165,17 +165,17 @@  discard block
 block discarded – undo
165 165
 		$storage = $this->xcloner_sanitization->sanitize_input_as_string($action);
166 166
 		$this->logger->debug(sprintf("Saving the remote storage %s options", strtoupper($action)));	
167 167
 		
168
-		if(is_array($this->storage_fields[$storage]))
168
+		if (is_array($this->storage_fields[$storage]))
169 169
 		{
170
-			foreach($this->storage_fields[$storage] as $field=>$validation)
170
+			foreach ($this->storage_fields[$storage] as $field=>$validation)
171 171
 			{
172 172
 				$check_field = $this->storage_fields["option_prefix"].$field;
173 173
 				$sanitize_method = "sanitize_input_as_".$validation;
174 174
 				
175
-				if(!isset($_POST[$check_field]))
175
+				if (!isset($_POST[$check_field]))
176 176
 					$_POST[$check_field] = 0;
177 177
 				
178
-				if(!method_exists($this->xcloner_sanitization, $sanitize_method))
178
+				if (!method_exists($this->xcloner_sanitization, $sanitize_method))
179 179
 					$sanitize_method = "sanitize_input_as_string";
180 180
 					
181 181
 				$sanitized_value = $this->xcloner_sanitization->$sanitize_method($_POST[$check_field]);
@@ -189,11 +189,11 @@  discard block
 block discarded – undo
189 189
 	
190 190
 	public function check($action = "ftp")
191 191
 	{
192
-		try{
192
+		try {
193 193
 			$this->verify_filesystem($action);
194 194
 			$this->xcloner->trigger_message(__("%s connection is valid.", 'xcloner-backup-and-restore'), "success", ucfirst($action));
195 195
 			$this->logger->debug(sprintf("Connection to remote storage %s is valid", strtoupper($action)));	
196
-		}catch(Exception $e){
196
+		}catch (Exception $e) {
197 197
 			$this->xcloner->trigger_message("%s connection error: ".$e->getMessage(), "error", ucfirst($action));
198 198
 		}
199 199
 	}
@@ -204,35 +204,35 @@  discard block
 block discarded – undo
204 204
 		
205 205
 		$this->logger->info(sprintf("Checking validity of the remote storage %s filesystem", strtoupper($storage_type)));	
206 206
 		
207
-		if(!method_exists($this, $method))
207
+		if (!method_exists($this, $method))
208 208
 			return false;
209 209
 		
210 210
 		list($adapter, $filesystem) = $this->$method();
211 211
 		
212 212
 		$test_file = substr(".xcloner_".md5(time()), 0, 15);
213 213
 		
214
-		if($storage_type == "gdrive")
214
+		if ($storage_type == "gdrive")
215 215
 		{
216
-			if(!is_array($filesystem->listContents()))
217
-				throw new Exception(__("Could not read data",'xcloner-backup-and-restore'));
216
+			if (!is_array($filesystem->listContents()))
217
+				throw new Exception(__("Could not read data", 'xcloner-backup-and-restore'));
218 218
 			$this->logger->debug(sprintf("I can list data from remote storage %s", strtoupper($storage_type)));	
219 219
 			
220 220
 			return true;
221 221
 		}
222 222
 			
223 223
 		//testing write access
224
-		if(!$filesystem->write($test_file, "data"))
225
-			throw new Exception(__("Could not write data",'xcloner-backup-and-restore'));
224
+		if (!$filesystem->write($test_file, "data"))
225
+			throw new Exception(__("Could not write data", 'xcloner-backup-and-restore'));
226 226
 		$this->logger->debug(sprintf("I can write data to remote storage %s", strtoupper($storage_type)));	
227 227
 		
228 228
 		//testing read access
229
-		if(!$filesystem->read($test_file))
230
-			throw new Exception(__("Could not read data",'xcloner-backup-and-restore'));
229
+		if (!$filesystem->read($test_file))
230
+			throw new Exception(__("Could not read data", 'xcloner-backup-and-restore'));
231 231
 		$this->logger->debug(sprintf("I can read data to remote storage %s", strtoupper($storage_type)));		
232 232
 		
233 233
 		//delete test file
234
-		if(!$filesystem->delete($test_file))
235
-			throw new Exception(__("Could not delete data",'xcloner-backup-and-restore'));
234
+		if (!$filesystem->delete($test_file))
235
+			throw new Exception(__("Could not delete data", 'xcloner-backup-and-restore'));
236 236
 		$this->logger->debug(sprintf("I can delete data to remote storage %s", strtoupper($storage_type)));		
237 237
 		
238 238
 		return true;
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	
241 241
 	public function upload_backup_to_storage($file, $storage)
242 242
 	{
243
-		if(!$this->xcloner_file_system->get_storage_filesystem()->has($file))
243
+		if (!$this->xcloner_file_system->get_storage_filesystem()->has($file))
244 244
 		{
245 245
 			$this->logger->info(sprintf("File not found %s in local storage", $file));
246 246
 			return false;
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 			
249 249
 		$method = "get_".$storage."_filesystem";	
250 250
 		
251
-		if(!method_exists($this, $method))
251
+		if (!method_exists($this, $method))
252 252
 			return false;
253 253
 			
254 254
 		list($remote_storage_adapter, $remote_storage_filesystem) = $this->$method();
@@ -266,22 +266,22 @@  discard block
 block discarded – undo
266 266
 		
267 267
 		$backup_file_stream = $this->xcloner_file_system->get_storage_filesystem()->readStream($file);
268 268
 
269
-		if(!$remote_storage_filesystem->writeStream($file, $backup_file_stream))
269
+		if (!$remote_storage_filesystem->writeStream($file, $backup_file_stream))
270 270
 		{
271 271
 			$this->logger->info(sprintf("Could not transfer file %s", $file));
272 272
 			return false;
273 273
 		}
274 274
 		
275
-		if($this->xcloner_file_system->is_multipart($file))
275
+		if ($this->xcloner_file_system->is_multipart($file))
276 276
 		{
277 277
 			$parts = $this->xcloner_file_system->get_multipart_files($file);
278
-			if(is_array($parts))
279
-				foreach($parts as $part_file)
278
+			if (is_array($parts))
279
+				foreach ($parts as $part_file)
280 280
 				{
281 281
 					$this->logger->info(sprintf("Transferring backup %s to remote storage %s", $part_file, strtoupper($storage)), array(""));
282 282
 					
283 283
 					$backup_file_stream = $this->xcloner_file_system->get_storage_filesystem()->readStream($part_file);
284
-					if(!$remote_storage_filesystem->writeStream($part_file, $backup_file_stream))
284
+					if (!$remote_storage_filesystem->writeStream($part_file, $backup_file_stream))
285 285
 						return false;
286 286
 				}
287 287
 		}
@@ -298,18 +298,18 @@  discard block
 block discarded – undo
298 298
 		
299 299
 		$target_filename = $file;
300 300
 		
301
-		if(!method_exists($this, $method))
301
+		if (!method_exists($this, $method))
302 302
 			return false;
303 303
 			
304 304
 		list($remote_storage_adapter, $remote_storage_filesystem) = $this->$method();
305 305
 		
306
-		if(!$remote_storage_filesystem->has($file))
306
+		if (!$remote_storage_filesystem->has($file))
307 307
 		{
308 308
 			$this->logger->info(sprintf("File not found %s in remote storage %s", $file, strtoupper($storage)));
309 309
 			return false;
310 310
 		}
311 311
 		
312
-		if($storage == "gdrive")
312
+		if ($storage == "gdrive")
313 313
 		{
314 314
 			$metadata = $remote_storage_filesystem->getMetadata($file);
315 315
 			$target_filename = $metadata['filename'].".".$metadata['extension'];
@@ -319,22 +319,22 @@  discard block
 block discarded – undo
319 319
 		
320 320
 		$backup_file_stream = $remote_storage_filesystem->readStream($file);
321 321
 
322
-		if(!$this->xcloner_file_system->get_storage_filesystem()->writeStream($target_filename, $backup_file_stream))
322
+		if (!$this->xcloner_file_system->get_storage_filesystem()->writeStream($target_filename, $backup_file_stream))
323 323
 		{
324 324
 			$this->logger->info(sprintf("Could not transfer file %s", $file));
325 325
 			return false;
326 326
 		}
327 327
 		
328
-		if($this->xcloner_file_system->is_multipart($target_filename))
328
+		if ($this->xcloner_file_system->is_multipart($target_filename))
329 329
 		{
330 330
 			$parts = $this->xcloner_file_system->get_multipart_files($file, $storage);
331
-			if(is_array($parts))
332
-				foreach($parts as $part_file)
331
+			if (is_array($parts))
332
+				foreach ($parts as $part_file)
333 333
 				{
334 334
 					$this->logger->info(sprintf("Transferring backup %s to local storage from %s storage", $part_file, strtoupper($storage)), array(""));
335 335
 					
336 336
 					$backup_file_stream = $remote_storage_filesystem->readStream($part_file);
337
-					if(!$this->xcloner_file_system->get_storage_filesystem()->writeStream($part_file, $backup_file_stream))
337
+					if (!$this->xcloner_file_system->get_storage_filesystem()->writeStream($part_file, $backup_file_stream))
338 338
 						return false;
339 339
 				}
340 340
 		}
@@ -348,19 +348,19 @@  discard block
 block discarded – undo
348 348
 	public function clean_remote_storage($storage, $remote_storage_filesystem)
349 349
 	{
350 350
 		$check_field = $this->storage_fields["option_prefix"].$storage."_cleanup_days";
351
-		if($expire_days = get_option($check_field))
351
+		if ($expire_days = get_option($check_field))
352 352
 		{
353 353
 			$this->logger->info(sprintf("Doing %s remote storage cleanup for %s days limit", strtoupper($storage), $expire_days));
354 354
 			$files = $remote_storage_filesystem->listContents();
355 355
 			
356 356
 			$current_timestamp = strtotime("-".$expire_days." days");
357 357
 			
358
-			if(is_array($files))
359
-			foreach($files as $file)
358
+			if (is_array($files))
359
+			foreach ($files as $file)
360 360
 			{
361 361
 				$file['timestamp'] = $remote_storage_filesystem->getTimestamp($file['path']);
362 362
 				
363
-				if($current_timestamp >= $file['timestamp'])
363
+				if ($current_timestamp >= $file['timestamp'])
364 364
 				{
365 365
 					$remote_storage_filesystem->delete($file['path']);
366 366
 					$this->logger->info("Deleting remote file ".$file['path']." matching rule", array("RETENTION LIMIT TIMESTAMP", $file['timestamp']." =< ".$expire_days));
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 	{
499 499
 
500 500
 		//if((function_exists("is_plugin_active") && !is_plugin_active("xcloner-google-drive/xcloner-google-drive.php")) || !file_exists(__DIR__ . "/../../xcloner-google-drive/vendor/autoload.php"))
501
-		if(!class_exists('Google_Client'))
501
+		if (!class_exists('Google_Client'))
502 502
 		{
503 503
 			return false;
504 504
 		}
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 	{
525 525
 		$client = $this->gdrive_construct();
526 526
 		
527
-		if(!$client)
527
+		if (!$client)
528 528
 			return false;
529 529
 			
530 530
 		return $authUrl = $client->createAuthUrl();
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 	{
535 535
 		$client = $this->gdrive_construct();
536 536
 		
537
-		if(!$client)
537
+		if (!$client)
538 538
 		{
539 539
 			$error_msg = "Could not initialize the Google Drive Class, please check that the xcloner-google-drive plugin is enabled...";
540 540
 			$this->logger->error($error_msg);
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 		update_option("xcloner_gdrive_access_token", $token['access_token']);
548 548
 		update_option("xcloner_gdrive_refresh_token", $token['refresh_token']);
549 549
 		
550
-		$redirect_url = ('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']."?page=xcloner_remote_storage_page#gdrive");
550
+		$redirect_url = ('http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."?page=xcloner_remote_storage_page#gdrive");
551 551
 		
552 552
 		?>
553 553
 		<script>
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 		
573 573
 		$client = $this->gdrive_construct();
574 574
 		
575
-		if(!$client)
575
+		if (!$client)
576 576
 		{
577 577
 			$error_msg = "Could not initialize the Google Drive Class, please check that the xcloner-google-drive plugin is enabled...";
578 578
 			$this->logger->error($error_msg);
@@ -584,18 +584,18 @@  discard block
 block discarded – undo
584 584
 		$service = new \Google_Service_Drive($client);
585 585
 		
586 586
 		$parent = 'root';
587
-		$dir = basename( get_option("xcloner_gdrive_target_folder"));
587
+		$dir = basename(get_option("xcloner_gdrive_target_folder"));
588 588
 		
589 589
 		$folderID = get_option("xcloner_gdrive_target_folder");
590 590
 		
591 591
 		$tmp = parse_url($folderID);
592 592
 		
593
-		if(isset($tmp['query']))
593
+		if (isset($tmp['query']))
594 594
 		{
595 595
 			$folderID = str_replace("id=", "", $tmp['query']);
596 596
 		}
597 597
 		
598
-		if(stristr($folderID, "/"))
598
+		if (stristr($folderID, "/"))
599 599
 		{
600 600
 			$query = sprintf('mimeType = \'application/vnd.google-apps.folder\' and \'%s\' in parents and name contains \'%s\'', $parent, $dir);
601 601
 			$response = $service->files->listFiles([
@@ -603,12 +603,12 @@  discard block
 block discarded – undo
603 603
 	                'q' => $query
604 604
 	            ]);
605 605
 			
606
-			if(sizeof($response))
606
+			if (sizeof($response))
607 607
 			{
608 608
 				foreach ($response as $obj) {
609
-					$folderID =  $obj->getId();
609
+					$folderID = $obj->getId();
610 610
 				}
611
-			}else{
611
+			} else {
612 612
 				$this->xcloner->trigger_message(sprintf(__("Could not find folder ID by name %s", 'xcloner-backup-and-restore'), $folderID), "error");
613 613
 			}
614 614
 		}
Please login to merge, or discard this patch.
includes/class-xcloner-loader.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -58,19 +58,19 @@  discard block
 block discarded – undo
58 58
 	
59 59
 	public function xcloner_backup_add_admin_menu()
60 60
 	{
61
-		if ( function_exists('add_menu_page') )
62
-			add_menu_page( __('Site Backup','xcloner-backup-and-restore'), __('Site Backup','xcloner-backup-and-restore'), 'manage_options', 'xcloner_init_page', array($this->xcloner_container, 'xcloner_display'), 'dashicons-backup');
61
+		if (function_exists('add_menu_page'))
62
+			add_menu_page(__('Site Backup', 'xcloner-backup-and-restore'), __('Site Backup', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_init_page', array($this->xcloner_container, 'xcloner_display'), 'dashicons-backup');
63 63
 
64
-		if ( function_exists('add_submenu_page') )
64
+		if (function_exists('add_submenu_page'))
65 65
 		{
66 66
 			
67
-			add_submenu_page( 'xcloner_init_page', __('XCloner Dashboard','xcloner-backup-and-restore'), __('Dashboard','xcloner-backup-and-restore'), 'manage_options', 'xcloner_init_page', array($this->xcloner_container, 'xcloner_display'));
68
-			add_submenu_page( 'xcloner_init_page', __('XCloner Backup Settings','xcloner-backup-and-restore'), __('Settings','xcloner-backup-and-restore'), 'manage_options', 'xcloner_settings_page', array($this->xcloner_container, 'xcloner_display'));
69
-			add_submenu_page( 'xcloner_init_page', __('Remote Storage Settings','xcloner-backup-and-restore'), __('Remote Storage','xcloner-backup-and-restore'), 'manage_options', 'xcloner_remote_storage_page', array($this->xcloner_container, 'xcloner_display'));
70
-			add_submenu_page( 'xcloner_init_page', __('Manage Backups','xcloner-backup-and-restore'), __('Manage Backups','xcloner-backup-and-restore'), 'manage_options', 'xcloner_manage_backups_page', array($this->xcloner_container, 'xcloner_display'));
71
-			add_submenu_page( 'xcloner_init_page', __('Scheduled Backups','xcloner-backup-and-restore'), __('Scheduled Backups','xcloner-backup-and-restore'), 'manage_options', 'xcloner_scheduled_backups_page', array($this->xcloner_container, 'xcloner_display'));
72
-			add_submenu_page( 'xcloner_init_page', __('Generate Backups','xcloner-backup-and-restore'), __('Generate Backups','xcloner-backup-and-restore'), 'manage_options', 'xcloner_generate_backups_page', array($this->xcloner_container, 'xcloner_display'));
73
-			add_submenu_page( 'xcloner_init_page', __('Restore Backups','xcloner-backup-and-restore'), __('Restore Backups','xcloner-backup-and-restore'), 'manage_options', 'xcloner_restore_page', array($this->xcloner_container, 'xcloner_display'));
67
+			add_submenu_page('xcloner_init_page', __('XCloner Dashboard', 'xcloner-backup-and-restore'), __('Dashboard', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_init_page', array($this->xcloner_container, 'xcloner_display'));
68
+			add_submenu_page('xcloner_init_page', __('XCloner Backup Settings', 'xcloner-backup-and-restore'), __('Settings', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_settings_page', array($this->xcloner_container, 'xcloner_display'));
69
+			add_submenu_page('xcloner_init_page', __('Remote Storage Settings', 'xcloner-backup-and-restore'), __('Remote Storage', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_remote_storage_page', array($this->xcloner_container, 'xcloner_display'));
70
+			add_submenu_page('xcloner_init_page', __('Manage Backups', 'xcloner-backup-and-restore'), __('Manage Backups', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_manage_backups_page', array($this->xcloner_container, 'xcloner_display'));
71
+			add_submenu_page('xcloner_init_page', __('Scheduled Backups', 'xcloner-backup-and-restore'), __('Scheduled Backups', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_scheduled_backups_page', array($this->xcloner_container, 'xcloner_display'));
72
+			add_submenu_page('xcloner_init_page', __('Generate Backups', 'xcloner-backup-and-restore'), __('Generate Backups', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_generate_backups_page', array($this->xcloner_container, 'xcloner_display'));
73
+			add_submenu_page('xcloner_init_page', __('Restore Backups', 'xcloner-backup-and-restore'), __('Restore Backups', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_restore_page', array($this->xcloner_container, 'xcloner_display'));
74 74
 		}
75 75
 	
76 76
 	}
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 	 * @param    int                  $priority         Optional. he priority at which the function should be fired. Default is 10.
87 87
 	 * @param    int                  $accepted_args    Optional. The number of arguments that should be passed to the $callback. Default is 1.
88 88
 	 */
89
-	public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
90
-		$this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
89
+	public function add_action($hook, $component, $callback, $priority = 10, $accepted_args = 1) {
90
+		$this->actions = $this->add($this->actions, $hook, $component, $callback, $priority, $accepted_args);
91 91
 	}
92 92
 
93 93
 	/**
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 	 * @param    int                  $priority         Optional. he priority at which the function should be fired. Default is 10.
101 101
 	 * @param    int                  $accepted_args    Optional. The number of arguments that should be passed to the $callback. Default is 1
102 102
 	 */
103
-	public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
104
-		$this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
103
+	public function add_filter($hook, $component, $callback, $priority = 10, $accepted_args = 1) {
104
+		$this->filters = $this->add($this->filters, $hook, $component, $callback, $priority, $accepted_args);
105 105
 	}
106 106
 
107 107
 	/**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 * @param    int                  $accepted_args    The number of arguments that should be passed to the $callback.
119 119
 	 * @return   array                                  The collection of actions and filters registered with WordPress.
120 120
 	 */
121
-	private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
121
+	private function add($hooks, $hook, $component, $callback, $priority, $accepted_args) {
122 122
 
123 123
 		$hooks[] = array(
124 124
 			'hook'          => $hook,
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	public function run() {
141 141
 
142
-		foreach ( $this->filters as $hook ) {
143
-			add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
142
+		foreach ($this->filters as $hook) {
143
+			add_filter($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']);
144 144
 		}
145 145
 
146
-		foreach ( $this->actions as $hook ) {
147
-			add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
146
+		foreach ($this->actions as $hook) {
147
+			add_action($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']);
148 148
 		}
149 149
 
150 150
 	}
Please login to merge, or discard this patch.
includes/class-xcloner-logger.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -4,44 +4,44 @@  discard block
 block discarded – undo
4 4
 use Monolog\Handler\StreamHandler;
5 5
 use Monolog\Handler\RotatingFileHandler;
6 6
 
7
-class Xcloner_Logger extends Logger{
7
+class Xcloner_Logger extends Logger {
8 8
 	
9
-	private $logger_path ;
9
+	private $logger_path;
10 10
 	private $max_logger_files = 7;
11 11
 	private $main_logger_url;
12 12
 	
13 13
 	public function __construct(Xcloner $xcloner_container, $logger_name = "xcloner_logger")
14 14
 	{
15
-		if(!$xcloner_container->get_xcloner_settings())
15
+		if (!$xcloner_container->get_xcloner_settings())
16 16
 		{
17 17
 			$xcloner_settings 	= new Xcloner_Settings($xcloner_container);
18
-		}else{
18
+		} else {
19 19
 			$xcloner_settings 	= $xcloner_container->get_xcloner_settings();
20 20
 		}
21 21
 		
22 22
 		$hash = $xcloner_settings->get_hash();
23
-		if($hash == "-".$xcloner_settings->get_server_unique_hash(5))
23
+		if ($hash == "-".$xcloner_settings->get_server_unique_hash(5))
24 24
 		{
25 25
 			$hash = "";
26 26
 		}
27 27
 		
28
-		$logger_path 		= $xcloner_settings->get_xcloner_store_path().DS.$xcloner_settings->get_logger_filename();
29
-		$logger_path_tmp 	= "";
28
+		$logger_path = $xcloner_settings->get_xcloner_store_path().DS.$xcloner_settings->get_logger_filename();
29
+		$logger_path_tmp = "";
30 30
 		
31
-		if($hash)
31
+		if ($hash)
32 32
 		{
33 33
 			$logger_path_tmp = $xcloner_settings->get_xcloner_tmp_path().DS.$xcloner_settings->get_logger_filename(1);
34 34
 		}
35 35
 		
36 36
 		$this->logger_path = $logger_path;
37 37
 		
38
-		if(!is_dir($xcloner_settings->get_xcloner_store_path()) or !is_writable($xcloner_settings->get_xcloner_store_path()))
38
+		if (!is_dir($xcloner_settings->get_xcloner_store_path()) or !is_writable($xcloner_settings->get_xcloner_store_path()))
39 39
 		{
40 40
 			$logger_path = "php://stderr";
41 41
 			$logger_path_tmp = "";
42 42
 		}
43 43
 		
44
-		if(!$xcloner_settings->get_xcloner_option('xcloner_enable_log'))
44
+		if (!$xcloner_settings->get_xcloner_option('xcloner_enable_log'))
45 45
 		{
46 46
 			$logger_path = "php://stderr";
47 47
 			$logger_path_tmp = "";
@@ -52,21 +52,21 @@  discard block
 block discarded – undo
52 52
 		
53 53
 		$debug_level = Logger::INFO;
54 54
 		
55
-		if(WP_DEBUG)
55
+		if (WP_DEBUG)
56 56
 		{
57 57
 			$debug_level = Logger::DEBUG;
58 58
 		}
59 59
 
60 60
 	
61
-		if($logger_path)
61
+		if ($logger_path)
62 62
 		{
63 63
 			$stream = new RotatingFileHandler($logger_path, $this->max_logger_files, $debug_level);
64 64
 			$this->pushHandler($stream);
65 65
 			
66
-			$this->main_logger_url =  $stream->getUrl();
66
+			$this->main_logger_url = $stream->getUrl();
67 67
 		}
68 68
 			
69
-		if($hash and $logger_path_tmp)
69
+		if ($hash and $logger_path_tmp)
70 70
 		{
71 71
 			$this->pushHandler(new StreamHandler($logger_path_tmp, $debug_level));
72 72
 		}
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	{
84 84
 		$lines = array();
85 85
 		
86
-		if(!file_exists($this->main_logger_url) or !is_readable($this->main_logger_url))
86
+		if (!file_exists($this->main_logger_url) or !is_readable($this->main_logger_url))
87 87
 			return false;
88 88
 		
89 89
 		$fp = fopen($this->main_logger_url, 'r');
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
 		$lastLine = "";
93 93
 		
94 94
 		// Loop backword until we have our lines or we reach the start
95
-		while($pos > 0 && count($lines) < $totalLines) {
95
+		while ($pos > 0 && count($lines) < $totalLines) {
96 96
 		
97 97
 		$C = fgetc($fp);
98
-		if($C == "\n") {
98
+		if ($C == "\n") {
99 99
 		  // skip empty lines
100
-		  if(trim($lastLine) != "") {
100
+		  if (trim($lastLine) != "") {
101 101
 			$lines[] = $lastLine;
102 102
 		  }
103 103
 		  $lastLine = '';
Please login to merge, or discard this patch.
includes/class-xcloner-sanitization.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 
4 4
 class Xcloner_Sanitization {
5 5
 	
6
-	public function __construct(){}
6
+	public function __construct() {}
7 7
 	
8 8
 	public function sanitize_input_as_int($option)
9 9
 	{
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
 	{
25 25
 		$path = filter_var($option, FILTER_SANITIZE_URL);
26 26
 		
27
-		try{
27
+		try {
28 28
 			$option = Util::normalizePath($path);
29
-		}catch(Exception $e){
29
+		}catch (Exception $e) {
30 30
 			add_settings_error('xcloner_error_message', '', __($e->getMessage()), 'error');
31 31
 		}
32 32
 		
33
-		if($path and !is_dir($path)){
34
-			add_settings_error('xcloner_error_message', '', __(sprintf('Invalid Server Path %s',$option)), 'error');
33
+		if ($path and !is_dir($path)) {
34
+			add_settings_error('xcloner_error_message', '', __(sprintf('Invalid Server Path %s', $option)), 'error');
35 35
 			return false;
36 36
 		}
37 37
 		
Please login to merge, or discard this patch.
includes/class-xcloner-requirements.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 class Xcloner_Requirements
4 4
 {
5 5
 	
6
-	var $min_php_version 	= "5.4.0";
7
-	var $safe_mode			= "Off";
6
+	var $min_php_version = "5.4.0";
7
+	var $safe_mode = "Off";
8 8
 	
9 9
 	private $xcloner_settings;
10 10
 	private $xcloner_container;
@@ -22,19 +22,19 @@  discard block
 block discarded – undo
22 22
 	
23 23
 	public function check_backup_ready_status()
24 24
 	{
25
-		if(!$this->check_min_php_version(1))
25
+		if (!$this->check_min_php_version(1))
26 26
 			return false;
27 27
 		
28
-		if(!$this->check_safe_mode(1))
28
+		if (!$this->check_safe_mode(1))
29 29
 			return false;
30 30
 		
31
-		if(!$this->check_xcloner_start_path(1))
31
+		if (!$this->check_xcloner_start_path(1))
32 32
 			return false;
33 33
 		
34
-		if(!$this->check_xcloner_store_path(1))
34
+		if (!$this->check_xcloner_store_path(1))
35 35
 			return false;
36 36
 		
37
-		if(!$this->check_xcloner_tmp_path(1))
37
+		if (!$this->check_xcloner_tmp_path(1))
38 38
 			return false;
39 39
 			
40 40
 		return true;	
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 	public function check_min_php_version($return_bool = 0)
49 49
 	{
50 50
 		
51
-		if($return_bool == 1)
51
+		if ($return_bool == 1)
52 52
 		{
53
-			if(version_compare(phpversion(), $this->min_php_version, '<'))
53
+			if (version_compare(phpversion(), $this->min_php_version, '<'))
54 54
 				return false;
55 55
 			else
56 56
 				return true;
@@ -59,31 +59,31 @@  discard block
 block discarded – undo
59 59
 		return phpversion();
60 60
 	}
61 61
 	
62
-	public function check_safe_mode($return_bool=0)
62
+	public function check_safe_mode($return_bool = 0)
63 63
 	{
64 64
 		$safe_mode = "Off";
65 65
 		
66
-		if($return_bool)
66
+		if ($return_bool)
67 67
 		{
68
-			if( ini_get('safe_mode') )
68
+			if (ini_get('safe_mode'))
69 69
 				return false;
70 70
 			else
71 71
 				return true;
72 72
 		}
73 73
 		
74
-		if( ini_get('safe_mode') )
74
+		if (ini_get('safe_mode'))
75 75
 			$safe_mode = "On";
76 76
 			
77 77
 		return $safe_mode;
78 78
 	}
79 79
 	
80
-	public function check_xcloner_start_path($return_bool=0)
80
+	public function check_xcloner_start_path($return_bool = 0)
81 81
 	{
82 82
 		$path = $this->xcloner_settings->get_xcloner_start_path();
83 83
 		
84
-		if($return_bool)
84
+		if ($return_bool)
85 85
 		{
86
-			if(!file_exists($path))
86
+			if (!file_exists($path))
87 87
 				return false;
88 88
 				
89 89
 			return is_readable($path);
@@ -92,16 +92,16 @@  discard block
 block discarded – undo
92 92
 		return $path;
93 93
 	}
94 94
 	
95
-	public function check_xcloner_tmp_path($return_bool=0)
95
+	public function check_xcloner_tmp_path($return_bool = 0)
96 96
 	{
97 97
 		$path = $this->xcloner_settings->get_xcloner_tmp_path();
98 98
 		
99
-		if($return_bool)
99
+		if ($return_bool)
100 100
 		{
101
-			if(!file_exists($path))
101
+			if (!file_exists($path))
102 102
 				return false;
103 103
 			
104
-			if(!is_writeable($path))	
104
+			if (!is_writeable($path))	
105 105
 				@chmod($path, 0777);
106 106
 					
107 107
 			return is_writeable($path);
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
 		return $path;
111 111
 	}
112 112
 	
113
-	public function check_xcloner_store_path($return_bool=0)
113
+	public function check_xcloner_store_path($return_bool = 0)
114 114
 	{
115 115
 		$path = $this->xcloner_settings->get_xcloner_store_path();
116 116
 		
117
-		if($return_bool)
117
+		if ($return_bool)
118 118
 		{
119
-			if(!file_exists($path))
119
+			if (!file_exists($path))
120 120
 				return false;
121 121
 			
122
-			if(!is_writeable($path))	
122
+			if (!is_writeable($path))	
123 123
 				@chmod($path, 0777);
124 124
 				
125 125
 			return is_writeable($path);
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
 	
141 141
 	public function get_open_basedir()
142 142
 	{
143
-		$open_basedir =  ini_get('open_basedir');
143
+		$open_basedir = ini_get('open_basedir');
144 144
 		
145
-		if(!$open_basedir)
145
+		if (!$open_basedir)
146 146
 			$open_basedir = "none";
147 147
 		return $open_basedir;	
148 148
 	}
@@ -156,14 +156,14 @@  discard block
 block discarded – undo
156 156
 	  $unit_list = array('B', 'KB', 'MB', 'GB', 'PB');
157 157
 	
158 158
 	  if ($bytes == 0) {
159
-	    return $bytes . ' ' . $unit_list[0];
159
+	    return $bytes.' '.$unit_list[0];
160 160
 	  }
161 161
 	
162 162
 	  $unit_count = count($unit_list);
163 163
 	  for ($i = $unit_count - 1; $i >= 0; $i--) {
164 164
 	    $power = $i * 10;
165 165
 	    if (($bytes >> $power) >= 1)
166
-	      return round($bytes / (1 << $power), $decimals) . ' ' . $unit_list[$i];
166
+	      return round($bytes / (1 << $power), $decimals).' '.$unit_list[$i];
167 167
 	  }
168 168
 	}
169 169
 }
Please login to merge, or discard this patch.
public/class-xcloner-public.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
 	 * @param      string    $plugin_name       The name of the plugin.
48 48
 	 * @param      string    $version    The version of this plugin.
49 49
 	 */
50
-	public function __construct( Xcloner $xcloner_container ) {
50
+	public function __construct(Xcloner $xcloner_container) {
51 51
 
52
-		$this->plugin_name 			= $xcloner_container->get_plugin_name();
53
-		$this->version				= $xcloner_container->get_version();
52
+		$this->plugin_name = $xcloner_container->get_plugin_name();
53
+		$this->version = $xcloner_container->get_version();
54 54
 
55 55
 	}
56 56
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 		 * class.
74 74
 		 */
75 75
 
76
-		wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/xcloner-public.css', array(), $this->version, 'all' );
76
+		wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/xcloner-public.css', array(), $this->version, 'all');
77 77
 
78 78
 	}
79 79
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		 * class.
97 97
 		 */
98 98
 
99
-		wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/xcloner-public.js', array( 'jquery' ), $this->version, false );
99
+		wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__).'js/xcloner-public.js', array('jquery'), $this->version, false);
100 100
 
101 101
 	}
102 102
 
Please login to merge, or discard this patch.