@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
308 | 308 | |
309 | 309 | //wp_localize_script( 'ajax-script', 'my_ajax_object', |
310 | - // array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); |
|
310 | + // array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); |
|
311 | 311 | |
312 | 312 | } |
313 | 313 | |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | |
342 | 342 | private function define_plugin_settings(){ |
343 | 343 | /** |
344 | - * register wporg_settings_init to the admin_init action hook |
|
345 | - */ |
|
344 | + * register wporg_settings_init to the admin_init action hook |
|
345 | + */ |
|
346 | 346 | |
347 | 347 | $this->xcloner_settings = new XCloner_Settings($this); |
348 | 348 | |
@@ -487,15 +487,15 @@ discard block |
||
487 | 487 | } |
488 | 488 | |
489 | 489 | function friendly_error_type($type) { |
490 | - static $levels=null; |
|
491 | - if ($levels===null) { |
|
492 | - $levels=[]; |
|
493 | - foreach (get_defined_constants() as $key=>$value) { |
|
494 | - if (strpos($key,'E_')!==0) {continue;} |
|
490 | + static $levels=null; |
|
491 | + if ($levels===null) { |
|
492 | + $levels=[]; |
|
493 | + foreach (get_defined_constants() as $key=>$value) { |
|
494 | + if (strpos($key,'E_')!==0) {continue;} |
|
495 | 495 | $levels[$value]= $key; //substr($key,2); |
496 | - } |
|
497 | - } |
|
498 | - return (isset($levels[$type]) ? $levels[$type] : "Error #{$type}"); |
|
496 | + } |
|
497 | + } |
|
498 | + return (isset($levels[$type]) ? $levels[$type] : "Error #{$type}"); |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | private function define_ajax_hooks() |
@@ -537,24 +537,24 @@ discard block |
||
537 | 537 | add_action( 'wp_ajax_restore_backup', array($xcloner_api,'restore_backup') ); |
538 | 538 | add_action( 'admin_notices', array($this, 'xcloner_error_admin_notices' )); |
539 | 539 | |
540 | - } |
|
540 | + } |
|
541 | 541 | |
542 | - //Do a pre-update backup of targeted files |
|
543 | - if($this->get_xcloner_settings()->get_xcloner_option('xcloner_enable_pre_update_backup')) |
|
544 | - { |
|
542 | + //Do a pre-update backup of targeted files |
|
543 | + if($this->get_xcloner_settings()->get_xcloner_option('xcloner_enable_pre_update_backup')) |
|
544 | + { |
|
545 | 545 | add_action("pre_auto_update", array($this, "pre_auto_update"), 1, 3); |
546 | 546 | } |
547 | 547 | } |
548 | 548 | |
549 | 549 | function add_plugin_action_links($links, $file) { |
550 | - if ($file == plugin_basename(dirname(dirname(__FILE__)) . '/xcloner.php')) |
|
550 | + if ($file == plugin_basename(dirname(dirname(__FILE__)) . '/xcloner.php')) |
|
551 | 551 | { |
552 | 552 | $links[] = '<a href="admin.php?page=xcloner_settings_page">'.__('Settings', 'xcloner-backup-and-restore').'</a>'; |
553 | 553 | $links[] = '<a href="admin.php?page=xcloner_generate_backups_page">'.__('Generate Backup', 'xcloner-backup-and-restore').'</a>'; |
554 | 554 | } |
555 | 555 | |
556 | - return $links; |
|
557 | - } |
|
556 | + return $links; |
|
557 | + } |
|
558 | 558 | |
559 | 559 | public function xcloner_error_admin_notices() { |
560 | 560 | settings_errors( 'xcloner_error_message' ); |
@@ -638,9 +638,9 @@ discard block |
||
638 | 638 | function xcloner_display() |
639 | 639 | { |
640 | 640 | // check user capabilities |
641 | - if (!current_user_can('manage_options')) { |
|
642 | - return; |
|
643 | - } |
|
641 | + if (!current_user_can('manage_options')) { |
|
642 | + return; |
|
643 | + } |
|
644 | 644 | |
645 | 645 | $page = sanitize_key($_GET['page']); |
646 | 646 |
@@ -148,15 +148,15 @@ discard block |
||
148 | 148 | return $this->xcloner_file_transfer; |
149 | 149 | } |
150 | 150 | |
151 | - public function check_dependencies(){ |
|
151 | + public function check_dependencies() { |
|
152 | 152 | |
153 | 153 | $backup_storage_path = realpath(__DIR__.DS."..".DS."..".DS."..").DS."backups".DS; |
154 | 154 | |
155 | 155 | define("XCLONER_STORAGE_PATH", realpath($backup_storage_path)); |
156 | 156 | |
157 | - if(!is_dir($backup_storage_path)) |
|
157 | + if (!is_dir($backup_storage_path)) |
|
158 | 158 | { |
159 | - if(!@mkdir($backup_storage_path)) |
|
159 | + if (!@mkdir($backup_storage_path)) |
|
160 | 160 | { |
161 | 161 | $status = "error"; |
162 | 162 | $message = sprintf(__("Unable to create the Backup Storage Location Folder %s . Please fix this before starting the backup process."), $backup_storage_path); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | return; |
165 | 165 | } |
166 | 166 | } |
167 | - if(!is_writable($backup_storage_path)) |
|
167 | + if (!is_writable($backup_storage_path)) |
|
168 | 168 | { |
169 | 169 | $status = "error"; |
170 | 170 | $message = sprintf(__("Unable to write to the Backup Storage Location Folder %s . Please fix this before starting the backup process."), $backup_storage_path); |
@@ -178,15 +178,15 @@ discard block |
||
178 | 178 | public function trigger_message($message, $status = "error", $message_param1 = "", $message_param2 = "", $message_param3 = "") |
179 | 179 | { |
180 | 180 | $message = sprintf(__($message), $message_param1, $message_param2, $message_param3); |
181 | - add_action( 'xcloner_admin_notices', array($this,"trigger_message_notice"), 10, 2); |
|
182 | - do_action( 'xcloner_admin_notices', $message, $status); |
|
181 | + add_action('xcloner_admin_notices', array($this, "trigger_message_notice"), 10, 2); |
|
182 | + do_action('xcloner_admin_notices', $message, $status); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | public function trigger_message_notice($message, $status = "success") |
186 | 186 | { |
187 | 187 | ?> |
188 | 188 | <div class="notice notice-<?php echo $status?> is-dismissible"> |
189 | - <p><?php _e( $message, 'xcloner-backup-and-restore' ); ?></p> |
|
189 | + <p><?php _e($message, 'xcloner-backup-and-restore'); ?></p> |
|
190 | 190 | </div> |
191 | 191 | <?php |
192 | 192 | } |
@@ -213,79 +213,79 @@ discard block |
||
213 | 213 | * The class responsible for orchestrating the actions and filters of the |
214 | 214 | * core plugin. |
215 | 215 | */ |
216 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-loader.php'; |
|
216 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-loader.php'; |
|
217 | 217 | |
218 | 218 | /** |
219 | 219 | * The class responsible for defining internationalization functionality |
220 | 220 | * of the plugin. |
221 | 221 | */ |
222 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-i18n.php'; |
|
222 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-i18n.php'; |
|
223 | 223 | |
224 | 224 | /** |
225 | 225 | * The class responsible for defining all actions that occur in the admin area. |
226 | 226 | */ |
227 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-xcloner-admin.php'; |
|
227 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-xcloner-admin.php'; |
|
228 | 228 | |
229 | 229 | /** |
230 | 230 | * The class responsible for debugging XCloner. |
231 | 231 | */ |
232 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-logger.php'; |
|
232 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-logger.php'; |
|
233 | 233 | |
234 | 234 | /** |
235 | 235 | * The class responsible for defining the admin settings area. |
236 | 236 | */ |
237 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-settings.php'; |
|
237 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-settings.php'; |
|
238 | 238 | |
239 | 239 | /** |
240 | 240 | * The class responsible for defining the Remote Storage settings area. |
241 | 241 | */ |
242 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-remote-storage.php'; |
|
242 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-remote-storage.php'; |
|
243 | 243 | |
244 | 244 | /** |
245 | 245 | * The class responsible for implementing the database backup methods. |
246 | 246 | */ |
247 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-database.php'; |
|
247 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-database.php'; |
|
248 | 248 | |
249 | 249 | /** |
250 | 250 | * The class responsible for sanitization of users input. |
251 | 251 | */ |
252 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-sanitization.php'; |
|
252 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-sanitization.php'; |
|
253 | 253 | |
254 | 254 | /** |
255 | 255 | * The class responsible for XCloner system requirements validation. |
256 | 256 | */ |
257 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-requirements.php'; |
|
257 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-requirements.php'; |
|
258 | 258 | |
259 | 259 | /** |
260 | 260 | * The class responsible for XCloner backup archive creation. |
261 | 261 | */ |
262 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-archive.php'; |
|
262 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-archive.php'; |
|
263 | 263 | |
264 | 264 | /** |
265 | 265 | * The class responsible for XCloner API requests. |
266 | 266 | */ |
267 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-api.php'; |
|
267 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-api.php'; |
|
268 | 268 | |
269 | 269 | /** |
270 | 270 | * The class responsible for the XCloner File System methods. |
271 | 271 | */ |
272 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-file-system.php'; |
|
272 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-file-system.php'; |
|
273 | 273 | |
274 | 274 | /** |
275 | 275 | * The class responsible for the XCloner File Transfer methods. |
276 | 276 | */ |
277 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-file-transfer.php'; |
|
277 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-file-transfer.php'; |
|
278 | 278 | |
279 | 279 | /** |
280 | 280 | * The class responsible for the XCloner Scheduler methods. |
281 | 281 | */ |
282 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-scheduler.php'; |
|
282 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-scheduler.php'; |
|
283 | 283 | |
284 | 284 | /** |
285 | 285 | * The class responsible for defining all actions that occur in the public-facing |
286 | 286 | * side of the site. |
287 | 287 | */ |
288 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-xcloner-public.php'; |
|
288 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-xcloner-public.php'; |
|
289 | 289 | |
290 | 290 | $this->loader = new Xcloner_Loader($this); |
291 | 291 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | |
305 | 305 | $plugin_i18n = new Xcloner_i18n(); |
306 | 306 | |
307 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
307 | + $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
|
308 | 308 | |
309 | 309 | //wp_localize_script( 'ajax-script', 'my_ajax_object', |
310 | 310 | // array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); |
@@ -320,11 +320,11 @@ discard block |
||
320 | 320 | */ |
321 | 321 | private function define_admin_hooks() { |
322 | 322 | |
323 | - $plugin_admin = new Xcloner_Admin( $this ); |
|
323 | + $plugin_admin = new Xcloner_Admin($this); |
|
324 | 324 | $this->plugin_admin = $plugin_admin; |
325 | 325 | |
326 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
327 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
326 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
|
327 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts'); |
|
328 | 328 | |
329 | 329 | } |
330 | 330 | |
@@ -333,24 +333,24 @@ discard block |
||
333 | 333 | * |
334 | 334 | * @access private |
335 | 335 | */ |
336 | - private function define_admin_menu(){ |
|
336 | + private function define_admin_menu() { |
|
337 | 337 | |
338 | 338 | add_action('admin_menu', array($this->loader, 'xcloner_backup_add_admin_menu')); |
339 | 339 | |
340 | 340 | } |
341 | 341 | |
342 | - private function define_plugin_settings(){ |
|
342 | + private function define_plugin_settings() { |
|
343 | 343 | /** |
344 | 344 | * register wporg_settings_init to the admin_init action hook |
345 | 345 | */ |
346 | 346 | |
347 | 347 | $this->xcloner_settings = new XCloner_Settings($this); |
348 | 348 | |
349 | - if(defined('DOING_CRON') || isset($_POST['hash'])){ |
|
349 | + if (defined('DOING_CRON') || isset($_POST['hash'])) { |
|
350 | 350 | |
351 | - if(defined('DOING_CRON') || $_POST['hash'] == "generate_hash"){ |
|
351 | + if (defined('DOING_CRON') || $_POST['hash'] == "generate_hash") { |
|
352 | 352 | $this->xcloner_settings->generate_new_hash(); |
353 | - }else{ |
|
353 | + } else { |
|
354 | 354 | $this->xcloner_settings->set_hash($_POST['hash']); |
355 | 355 | } |
356 | 356 | } |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | */ |
371 | 371 | public function pre_auto_update($type, $item, $context) |
372 | 372 | { |
373 | - if(!$type) |
|
373 | + if (!$type) |
|
374 | 374 | { |
375 | 375 | return false; |
376 | 376 | } |
@@ -379,10 +379,10 @@ discard block |
||
379 | 379 | |
380 | 380 | $content_dir = str_replace(ABSPATH, "", WP_CONTENT_DIR); |
381 | 381 | $plugins_dir = str_replace(ABSPATH, "", WP_PLUGIN_DIR); |
382 | - $langs_dir = $content_dir . DS . "languages"; |
|
383 | - $themes_dir = $content_dir . DS . "themes"; |
|
382 | + $langs_dir = $content_dir.DS."languages"; |
|
383 | + $themes_dir = $content_dir.DS."themes"; |
|
384 | 384 | |
385 | - switch ( $type ) { |
|
385 | + switch ($type) { |
|
386 | 386 | case 'core': |
387 | 387 | $exclude_files = array( |
388 | 388 | "^(?!(wp-admin|wp-includes|(?!.*\/.*.php)))(.*)$", |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | |
393 | 393 | $dir_array = explode(DS, $plugins_dir); |
394 | 394 | |
395 | - foreach($dir_array as $dir) |
|
395 | + foreach ($dir_array as $dir) |
|
396 | 396 | { |
397 | 397 | $data .= "\/".$dir; |
398 | 398 | $regex .= $data."$|"; |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | |
409 | 409 | $dir_array = explode(DS, $themes_dir); |
410 | 410 | |
411 | - foreach($dir_array as $dir) |
|
411 | + foreach ($dir_array as $dir) |
|
412 | 412 | { |
413 | 413 | $data .= "\/".$dir; |
414 | 414 | $regex .= $data."$|"; |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | |
425 | 425 | $dir_array = explode(DS, $langs_dir); |
426 | 426 | |
427 | - foreach($dir_array as $dir) |
|
427 | + foreach ($dir_array as $dir) |
|
428 | 428 | { |
429 | 429 | $data .= "\/".$dir; |
430 | 430 | $regex .= $data."$|"; |
@@ -450,9 +450,9 @@ discard block |
||
450 | 450 | $schedule['backup_params']->email_notification = get_option('admin_email'); |
451 | 451 | $schedule['backup_params']->backup_name = "backup_pre_auto_update_".$type."_[domain]-[time]-sql"; |
452 | 452 | |
453 | - try{ |
|
453 | + try { |
|
454 | 454 | $this->xcloner_scheduler->xcloner_scheduler_callback(0, $schedule); |
455 | - }catch(Exception $e){ |
|
455 | + }catch (Exception $e) { |
|
456 | 456 | $this->get_xcloner_logger()->error($e->getMessage()); |
457 | 457 | } |
458 | 458 | |
@@ -467,10 +467,10 @@ discard block |
||
467 | 467 | */ |
468 | 468 | private function define_public_hooks() { |
469 | 469 | |
470 | - $plugin_public = new Xcloner_Public( $this ); |
|
470 | + $plugin_public = new Xcloner_Public($this); |
|
471 | 471 | |
472 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
473 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
472 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
473 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
474 | 474 | |
475 | 475 | } |
476 | 476 | |
@@ -479,20 +479,20 @@ discard block |
||
479 | 479 | $logger = new XCloner_Logger($this, "php_system"); |
480 | 480 | $error = error_get_last(); |
481 | 481 | |
482 | - if($error['type'] and $logger) |
|
482 | + if ($error['type'] and $logger) |
|
483 | 483 | { |
484 | - $logger->info($this->friendly_error_type ($error['type']).": ".var_export($error, true)); |
|
484 | + $logger->info($this->friendly_error_type($error['type']).": ".var_export($error, true)); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | } |
488 | 488 | |
489 | 489 | function friendly_error_type($type) { |
490 | - static $levels=null; |
|
491 | - if ($levels===null) { |
|
492 | - $levels=[]; |
|
490 | + static $levels = null; |
|
491 | + if ($levels === null) { |
|
492 | + $levels = []; |
|
493 | 493 | foreach (get_defined_constants() as $key=>$value) { |
494 | - if (strpos($key,'E_')!==0) {continue;} |
|
495 | - $levels[$value]= $key; //substr($key,2); |
|
494 | + if (strpos($key, 'E_') !== 0) {continue; } |
|
495 | + $levels[$value] = $key; //substr($key,2); |
|
496 | 496 | } |
497 | 497 | } |
498 | 498 | return (isset($levels[$type]) ? $levels[$type] : "Error #{$type}"); |
@@ -502,52 +502,52 @@ discard block |
||
502 | 502 | { |
503 | 503 | //adding the pre-update hook |
504 | 504 | |
505 | - if(is_admin() || defined('DOING_CRON')) |
|
505 | + if (is_admin() || defined('DOING_CRON')) |
|
506 | 506 | { |
507 | - $this->xcloner_logger = new XCloner_Logger($this, "xcloner_api"); |
|
508 | - $this->xcloner_filesystem = new Xcloner_File_System($this); |
|
507 | + $this->xcloner_logger = new XCloner_Logger($this, "xcloner_api"); |
|
508 | + $this->xcloner_filesystem = new Xcloner_File_System($this); |
|
509 | 509 | |
510 | 510 | //$this->xcloner_filesystem->set_diff_timestamp_start (strtotime("-15 days")); |
511 | 511 | |
512 | - $this->archive_system = new Xcloner_Archive($this); |
|
513 | - $this->xcloner_database = new Xcloner_Database($this); |
|
514 | - $this->xcloner_scheduler = new Xcloner_Scheduler($this); |
|
515 | - $this->xcloner_remote_storage = new Xcloner_Remote_Storage($this); |
|
516 | - $this->xcloner_file_transfer = new Xcloner_File_Transfer($this); |
|
512 | + $this->archive_system = new Xcloner_Archive($this); |
|
513 | + $this->xcloner_database = new Xcloner_Database($this); |
|
514 | + $this->xcloner_scheduler = new Xcloner_Scheduler($this); |
|
515 | + $this->xcloner_remote_storage = new Xcloner_Remote_Storage($this); |
|
516 | + $this->xcloner_file_transfer = new Xcloner_File_Transfer($this); |
|
517 | 517 | |
518 | - $xcloner_api = new Xcloner_Api($this); |
|
518 | + $xcloner_api = new Xcloner_Api($this); |
|
519 | 519 | |
520 | - add_action( 'wp_ajax_get_database_tables_action', array($xcloner_api,'get_database_tables_action') ); |
|
521 | - add_action( 'wp_ajax_get_file_system_action', array($xcloner_api,'get_file_system_action') ); |
|
522 | - add_action( 'wp_ajax_scan_filesystem', array($xcloner_api,'scan_filesystem') ); |
|
523 | - add_action( 'wp_ajax_backup_database', array($xcloner_api,'backup_database') ); |
|
524 | - add_action( 'wp_ajax_backup_files' , array($xcloner_api,'backup_files') ); |
|
525 | - add_action( 'wp_ajax_save_schedule' , array($xcloner_api,'save_schedule') ); |
|
526 | - add_action( 'wp_ajax_get_schedule_by_id', array($xcloner_api,'get_schedule_by_id') ); |
|
527 | - add_action( 'wp_ajax_get_scheduler_list', array($xcloner_api,'get_scheduler_list') ); |
|
528 | - add_action( 'wp_ajax_delete_schedule_by_id' , array($xcloner_api,'delete_schedule_by_id') ); |
|
529 | - add_action( 'wp_ajax_delete_backup_by_name' , array($xcloner_api,'delete_backup_by_name') ); |
|
530 | - add_action( 'wp_ajax_download_backup_by_name', array($xcloner_api,'download_backup_by_name') ); |
|
531 | - add_action( 'wp_ajax_remote_storage_save_status', array($xcloner_api,'remote_storage_save_status') ); |
|
532 | - add_action( 'wp_ajax_upload_backup_to_remote', array($xcloner_api,'upload_backup_to_remote') ); |
|
533 | - add_action( 'wp_ajax_list_backup_files' , array($xcloner_api,'list_backup_files') ); |
|
534 | - add_action( 'wp_ajax_restore_upload_backup' , array($xcloner_api,'restore_upload_backup') ); |
|
535 | - add_action( 'wp_ajax_download_restore_script', array($xcloner_api,'download_restore_script') ); |
|
536 | - add_action( 'wp_ajax_copy_backup_remote_to_local', array($xcloner_api,'copy_backup_remote_to_local') ); |
|
537 | - add_action( 'wp_ajax_restore_backup', array($xcloner_api,'restore_backup') ); |
|
538 | - add_action( 'admin_notices', array($this, 'xcloner_error_admin_notices' )); |
|
520 | + add_action('wp_ajax_get_database_tables_action', array($xcloner_api, 'get_database_tables_action')); |
|
521 | + add_action('wp_ajax_get_file_system_action', array($xcloner_api, 'get_file_system_action')); |
|
522 | + add_action('wp_ajax_scan_filesystem', array($xcloner_api, 'scan_filesystem')); |
|
523 | + add_action('wp_ajax_backup_database', array($xcloner_api, 'backup_database')); |
|
524 | + add_action('wp_ajax_backup_files', array($xcloner_api, 'backup_files')); |
|
525 | + add_action('wp_ajax_save_schedule', array($xcloner_api, 'save_schedule')); |
|
526 | + add_action('wp_ajax_get_schedule_by_id', array($xcloner_api, 'get_schedule_by_id')); |
|
527 | + add_action('wp_ajax_get_scheduler_list', array($xcloner_api, 'get_scheduler_list')); |
|
528 | + add_action('wp_ajax_delete_schedule_by_id', array($xcloner_api, 'delete_schedule_by_id')); |
|
529 | + add_action('wp_ajax_delete_backup_by_name', array($xcloner_api, 'delete_backup_by_name')); |
|
530 | + add_action('wp_ajax_download_backup_by_name', array($xcloner_api, 'download_backup_by_name')); |
|
531 | + add_action('wp_ajax_remote_storage_save_status', array($xcloner_api, 'remote_storage_save_status')); |
|
532 | + add_action('wp_ajax_upload_backup_to_remote', array($xcloner_api, 'upload_backup_to_remote')); |
|
533 | + add_action('wp_ajax_list_backup_files', array($xcloner_api, 'list_backup_files')); |
|
534 | + add_action('wp_ajax_restore_upload_backup', array($xcloner_api, 'restore_upload_backup')); |
|
535 | + add_action('wp_ajax_download_restore_script', array($xcloner_api, 'download_restore_script')); |
|
536 | + add_action('wp_ajax_copy_backup_remote_to_local', array($xcloner_api, 'copy_backup_remote_to_local')); |
|
537 | + add_action('wp_ajax_restore_backup', array($xcloner_api, 'restore_backup')); |
|
538 | + add_action('admin_notices', array($this, 'xcloner_error_admin_notices')); |
|
539 | 539 | |
540 | 540 | } |
541 | 541 | |
542 | 542 | //Do a pre-update backup of targeted files |
543 | - if($this->get_xcloner_settings()->get_xcloner_option('xcloner_enable_pre_update_backup')) |
|
543 | + if ($this->get_xcloner_settings()->get_xcloner_option('xcloner_enable_pre_update_backup')) |
|
544 | 544 | { |
545 | 545 | add_action("pre_auto_update", array($this, "pre_auto_update"), 1, 3); |
546 | 546 | } |
547 | 547 | } |
548 | 548 | |
549 | 549 | function add_plugin_action_links($links, $file) { |
550 | - if ($file == plugin_basename(dirname(dirname(__FILE__)) . '/xcloner.php')) |
|
550 | + if ($file == plugin_basename(dirname(dirname(__FILE__)).'/xcloner.php')) |
|
551 | 551 | { |
552 | 552 | $links[] = '<a href="admin.php?page=xcloner_settings_page">'.__('Settings', 'xcloner-backup-and-restore').'</a>'; |
553 | 553 | $links[] = '<a href="admin.php?page=xcloner_generate_backups_page">'.__('Generate Backup', 'xcloner-backup-and-restore').'</a>'; |
@@ -557,13 +557,13 @@ discard block |
||
557 | 557 | } |
558 | 558 | |
559 | 559 | public function xcloner_error_admin_notices() { |
560 | - settings_errors( 'xcloner_error_message' ); |
|
560 | + settings_errors('xcloner_error_message'); |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | public function define_cron_hooks() |
564 | 564 | { |
565 | 565 | //registering new schedule intervals |
566 | - add_filter( 'cron_schedules', array($this, 'add_new_intervals')); |
|
566 | + add_filter('cron_schedules', array($this, 'add_new_intervals')); |
|
567 | 567 | |
568 | 568 | |
569 | 569 | $xcloner_scheduler = $this->get_xcloner_scheduler(); |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | |
645 | 645 | $page = sanitize_key($_GET['page']); |
646 | 646 | |
647 | - if($page) |
|
647 | + if ($page) |
|
648 | 648 | { |
649 | 649 | $this->display($page); |
650 | 650 | } |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | |
351 | 351 | if(defined('DOING_CRON') || $_POST['hash'] == "generate_hash"){ |
352 | 352 | $this->xcloner_settings->generate_new_hash(); |
353 | - }else{ |
|
353 | + } else{ |
|
354 | 354 | $this->xcloner_settings->set_hash($_POST['hash']); |
355 | 355 | } |
356 | 356 | } |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | |
453 | 453 | try{ |
454 | 454 | $this->xcloner_scheduler->xcloner_scheduler_callback(0, $schedule); |
455 | - }catch(Exception $e){ |
|
455 | + } catch(Exception $e){ |
|
456 | 456 | $this->get_xcloner_logger()->error($e->getMessage()); |
457 | 457 | } |
458 | 458 |
@@ -26,15 +26,15 @@ discard block |
||
26 | 26 | */ |
27 | 27 | |
28 | 28 | // If this file is called directly, abort. |
29 | -if ( ! defined( 'WPINC' ) ) { |
|
29 | +if (!defined('WPINC')) { |
|
30 | 30 | die; |
31 | 31 | } |
32 | 32 | |
33 | 33 | //i will not load the plugin outside admin or cron |
34 | -if(!is_admin() and !defined('DOING_CRON')) |
|
34 | +if (!is_admin() and !defined('DOING_CRON')) |
|
35 | 35 | return; |
36 | 36 | |
37 | -if(!defined("DS")) |
|
37 | +if (!defined("DS")) |
|
38 | 38 | { |
39 | 39 | define("DS", DIRECTORY_SEPARATOR); |
40 | 40 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | function activate_xcloner() |
47 | 47 | { |
48 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-xcloner-activator.php'; |
|
48 | + require_once plugin_dir_path(__FILE__).'includes/class-xcloner-activator.php'; |
|
49 | 49 | Xcloner_Activator::activate(); |
50 | 50 | } |
51 | 51 | |
@@ -55,31 +55,31 @@ discard block |
||
55 | 55 | */ |
56 | 56 | function deactivate_xcloner() |
57 | 57 | { |
58 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-xcloner-deactivator.php'; |
|
58 | + require_once plugin_dir_path(__FILE__).'includes/class-xcloner-deactivator.php'; |
|
59 | 59 | Xcloner_Deactivator::deactivate(); |
60 | 60 | } |
61 | 61 | |
62 | -register_activation_hook( __FILE__, 'activate_xcloner' ); |
|
63 | -register_deactivation_hook( __FILE__, 'deactivate_xcloner' ); |
|
62 | +register_activation_hook(__FILE__, 'activate_xcloner'); |
|
63 | +register_deactivation_hook(__FILE__, 'deactivate_xcloner'); |
|
64 | 64 | |
65 | -require_once plugin_dir_path( __FILE__ ) . 'includes/class-xcloner-activator.php'; |
|
65 | +require_once plugin_dir_path(__FILE__).'includes/class-xcloner-activator.php'; |
|
66 | 66 | |
67 | -if(version_compare(phpversion(), Xcloner_Activator::xcloner_minimum_version, '<')) |
|
67 | +if (version_compare(phpversion(), Xcloner_Activator::xcloner_minimum_version, '<')) |
|
68 | 68 | { |
69 | 69 | ?> |
70 | 70 | <div class="error notice"> |
71 | - <p><?php echo sprintf(__("XCloner requires minimum PHP version %s in order to run correctly. We have detected your version as %s. Plugin is now deactivated."),Xcloner_Activator::xcloner_minimum_version, phpversion())?></p> |
|
71 | + <p><?php echo sprintf(__("XCloner requires minimum PHP version %s in order to run correctly. We have detected your version as %s. Plugin is now deactivated."), Xcloner_Activator::xcloner_minimum_version, phpversion())?></p> |
|
72 | 72 | </div> |
73 | 73 | <?php |
74 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
75 | - deactivate_plugins( plugin_basename( __FILE__ ) ); |
|
74 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
75 | + deactivate_plugins(plugin_basename(__FILE__)); |
|
76 | 76 | return; |
77 | 77 | } |
78 | 78 | |
79 | -$db_installed_ver = get_option( "xcloner_db_version" ); |
|
79 | +$db_installed_ver = get_option("xcloner_db_version"); |
|
80 | 80 | $xcloner_db_version = Xcloner_Activator::xcloner_db_version; |
81 | 81 | |
82 | -if($db_installed_ver != $xcloner_db_version) |
|
82 | +if ($db_installed_ver != $xcloner_db_version) |
|
83 | 83 | { |
84 | 84 | Xcloner_Activator::activate(); |
85 | 85 | } |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | wp_deregister_script('heartbeat'); |
95 | 95 | } |
96 | 96 | |
97 | -if(isset($_GET['page']) and stristr($_GET['page'] , "xcloner_")) |
|
97 | +if (isset($_GET['page']) and stristr($_GET['page'], "xcloner_")) |
|
98 | 98 | { |
99 | - add_action( 'init', 'xcloner_stop_heartbeat', 1 ); |
|
99 | + add_action('init', 'xcloner_stop_heartbeat', 1); |
|
100 | 100 | |
101 | 101 | } |
102 | 102 | |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | |
121 | 121 | } |
122 | 122 | |
123 | -require_once(plugin_dir_path( __FILE__ ) . '/vendor/autoload.php'); |
|
124 | -require plugin_dir_path( __FILE__ ) . 'includes/class-xcloner.php'; |
|
123 | +require_once(plugin_dir_path(__FILE__).'/vendor/autoload.php'); |
|
124 | +require plugin_dir_path(__FILE__).'includes/class-xcloner.php'; |
|
125 | 125 | |
126 | -try{ |
|
126 | +try { |
|
127 | 127 | |
128 | 128 | $xcloner_plugin = run_xcloner(); |
129 | 129 | |
130 | -}catch(Exception $e){ |
|
130 | +}catch (Exception $e) { |
|
131 | 131 | |
132 | 132 | echo $e->getMessage(); |
133 | 133 |