@@ -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 | |
@@ -393,15 +393,15 @@ discard block |
||
393 | 393 | } |
394 | 394 | |
395 | 395 | function friendly_error_type($type) { |
396 | - static $levels=null; |
|
397 | - if ($levels===null) { |
|
398 | - $levels=[]; |
|
399 | - foreach (get_defined_constants() as $key=>$value) { |
|
400 | - if (strpos($key,'E_')!==0) {continue;} |
|
396 | + static $levels=null; |
|
397 | + if ($levels===null) { |
|
398 | + $levels=[]; |
|
399 | + foreach (get_defined_constants() as $key=>$value) { |
|
400 | + if (strpos($key,'E_')!==0) {continue;} |
|
401 | 401 | $levels[$value]= $key; //substr($key,2); |
402 | - } |
|
403 | - } |
|
404 | - return (isset($levels[$type]) ? $levels[$type] : "Error #{$type}"); |
|
402 | + } |
|
403 | + } |
|
404 | + return (isset($levels[$type]) ? $levels[$type] : "Error #{$type}"); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | private function define_ajax_hooks() |
@@ -437,19 +437,19 @@ discard block |
||
437 | 437 | add_action( 'wp_ajax_copy_backup_remote_to_local', array($xcloner_api,'copy_backup_remote_to_local') ); |
438 | 438 | add_action( 'admin_notices', array($this, 'xcloner_error_admin_notices' )); |
439 | 439 | |
440 | - } |
|
440 | + } |
|
441 | 441 | |
442 | 442 | } |
443 | 443 | |
444 | 444 | function add_plugin_action_links($links, $file) { |
445 | - if ($file == plugin_basename(dirname(dirname(__FILE__)) . '/xcloner.php')) |
|
445 | + if ($file == plugin_basename(dirname(dirname(__FILE__)) . '/xcloner.php')) |
|
446 | 446 | { |
447 | 447 | $links[] = '<a href="admin.php?page=xcloner_settings_page">'.__('Settings', 'xcloner-backup-and-restore').'</a>'; |
448 | 448 | $links[] = '<a href="admin.php?page=xcloner_generate_backups_page">'.__('Generate Backup', 'xcloner-backup-and-restore').'</a>'; |
449 | 449 | } |
450 | 450 | |
451 | - return $links; |
|
452 | - } |
|
451 | + return $links; |
|
452 | + } |
|
453 | 453 | |
454 | 454 | public function xcloner_error_admin_notices() { |
455 | 455 | settings_errors( 'xcloner_error_message' ); |
@@ -526,9 +526,9 @@ discard block |
||
526 | 526 | function xcloner_display() |
527 | 527 | { |
528 | 528 | // check user capabilities |
529 | - if (!current_user_can('manage_options')) { |
|
530 | - return; |
|
531 | - } |
|
529 | + if (!current_user_can('manage_options')) { |
|
530 | + return; |
|
531 | + } |
|
532 | 532 | |
533 | 533 | $page = sanitize_key($_GET['page']); |
534 | 534 |
@@ -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 | } |
@@ -373,10 +373,10 @@ discard block |
||
373 | 373 | */ |
374 | 374 | private function define_public_hooks() { |
375 | 375 | |
376 | - $plugin_public = new Xcloner_Public( $this ); |
|
376 | + $plugin_public = new Xcloner_Public($this); |
|
377 | 377 | |
378 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
379 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
378 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
379 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
380 | 380 | |
381 | 381 | } |
382 | 382 | |
@@ -385,20 +385,20 @@ discard block |
||
385 | 385 | $logger = new XCloner_Logger($this, "php_system"); |
386 | 386 | $error = error_get_last(); |
387 | 387 | |
388 | - if($error['type'] and $logger) |
|
388 | + if ($error['type'] and $logger) |
|
389 | 389 | { |
390 | - $logger->info($this->friendly_error_type ($error['type']).": ".var_export($error, true)); |
|
390 | + $logger->info($this->friendly_error_type($error['type']).": ".var_export($error, true)); |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | } |
394 | 394 | |
395 | 395 | function friendly_error_type($type) { |
396 | - static $levels=null; |
|
397 | - if ($levels===null) { |
|
398 | - $levels=[]; |
|
396 | + static $levels = null; |
|
397 | + if ($levels === null) { |
|
398 | + $levels = []; |
|
399 | 399 | foreach (get_defined_constants() as $key=>$value) { |
400 | - if (strpos($key,'E_')!==0) {continue;} |
|
401 | - $levels[$value]= $key; //substr($key,2); |
|
400 | + if (strpos($key, 'E_') !== 0) {continue; } |
|
401 | + $levels[$value] = $key; //substr($key,2); |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 | return (isset($levels[$type]) ? $levels[$type] : "Error #{$type}"); |
@@ -406,43 +406,43 @@ discard block |
||
406 | 406 | |
407 | 407 | private function define_ajax_hooks() |
408 | 408 | { |
409 | - if(is_admin() || defined('DOING_CRON')) |
|
409 | + if (is_admin() || defined('DOING_CRON')) |
|
410 | 410 | { |
411 | 411 | $this->xcloner_logger = new XCloner_Logger($this, "xcloner_api"); |
412 | - $this->xcloner_filesystem = new Xcloner_File_System($this); |
|
412 | + $this->xcloner_filesystem = new Xcloner_File_System($this); |
|
413 | 413 | $this->archive_system = new Xcloner_Archive($this); |
414 | - $this->xcloner_database = new Xcloner_Database($this); |
|
415 | - $this->xcloner_scheduler = new Xcloner_Scheduler($this); |
|
416 | - $this->xcloner_remote_storage = new Xcloner_Remote_Storage($this); |
|
417 | - $this->xcloner_file_transfer = new Xcloner_File_Transfer($this); |
|
414 | + $this->xcloner_database = new Xcloner_Database($this); |
|
415 | + $this->xcloner_scheduler = new Xcloner_Scheduler($this); |
|
416 | + $this->xcloner_remote_storage = new Xcloner_Remote_Storage($this); |
|
417 | + $this->xcloner_file_transfer = new Xcloner_File_Transfer($this); |
|
418 | 418 | |
419 | - $xcloner_api = new Xcloner_Api($this); |
|
419 | + $xcloner_api = new Xcloner_Api($this); |
|
420 | 420 | |
421 | - add_action( 'wp_ajax_get_database_tables_action', array($xcloner_api,'get_database_tables_action') ); |
|
422 | - add_action( 'wp_ajax_get_file_system_action', array($xcloner_api,'get_file_system_action') ); |
|
423 | - add_action( 'wp_ajax_scan_filesystem', array($xcloner_api,'scan_filesystem') ); |
|
424 | - add_action( 'wp_ajax_backup_database', array($xcloner_api,'backup_database') ); |
|
425 | - add_action( 'wp_ajax_backup_files' , array($xcloner_api,'backup_files') ); |
|
426 | - add_action( 'wp_ajax_save_schedule' , array($xcloner_api,'save_schedule') ); |
|
427 | - add_action( 'wp_ajax_get_schedule_by_id', array($xcloner_api,'get_schedule_by_id') ); |
|
428 | - add_action( 'wp_ajax_get_scheduler_list', array($xcloner_api,'get_scheduler_list') ); |
|
429 | - add_action( 'wp_ajax_delete_schedule_by_id' , array($xcloner_api,'delete_schedule_by_id') ); |
|
430 | - add_action( 'wp_ajax_delete_backup_by_name' , array($xcloner_api,'delete_backup_by_name') ); |
|
431 | - add_action( 'wp_ajax_download_backup_by_name', array($xcloner_api,'download_backup_by_name') ); |
|
432 | - add_action( 'wp_ajax_remote_storage_save_status', array($xcloner_api,'remote_storage_save_status') ); |
|
433 | - add_action( 'wp_ajax_upload_backup_to_remote', array($xcloner_api,'upload_backup_to_remote') ); |
|
434 | - add_action( 'wp_ajax_list_backup_files' , array($xcloner_api,'list_backup_files') ); |
|
435 | - add_action( 'wp_ajax_restore_upload_backup' , array($xcloner_api,'restore_upload_backup') ); |
|
436 | - add_action( 'wp_ajax_download_restore_script', array($xcloner_api,'download_restore_script') ); |
|
437 | - add_action( 'wp_ajax_copy_backup_remote_to_local', array($xcloner_api,'copy_backup_remote_to_local') ); |
|
438 | - add_action( 'admin_notices', array($this, 'xcloner_error_admin_notices' )); |
|
421 | + add_action('wp_ajax_get_database_tables_action', array($xcloner_api, 'get_database_tables_action')); |
|
422 | + add_action('wp_ajax_get_file_system_action', array($xcloner_api, 'get_file_system_action')); |
|
423 | + add_action('wp_ajax_scan_filesystem', array($xcloner_api, 'scan_filesystem')); |
|
424 | + add_action('wp_ajax_backup_database', array($xcloner_api, 'backup_database')); |
|
425 | + add_action('wp_ajax_backup_files', array($xcloner_api, 'backup_files')); |
|
426 | + add_action('wp_ajax_save_schedule', array($xcloner_api, 'save_schedule')); |
|
427 | + add_action('wp_ajax_get_schedule_by_id', array($xcloner_api, 'get_schedule_by_id')); |
|
428 | + add_action('wp_ajax_get_scheduler_list', array($xcloner_api, 'get_scheduler_list')); |
|
429 | + add_action('wp_ajax_delete_schedule_by_id', array($xcloner_api, 'delete_schedule_by_id')); |
|
430 | + add_action('wp_ajax_delete_backup_by_name', array($xcloner_api, 'delete_backup_by_name')); |
|
431 | + add_action('wp_ajax_download_backup_by_name', array($xcloner_api, 'download_backup_by_name')); |
|
432 | + add_action('wp_ajax_remote_storage_save_status', array($xcloner_api, 'remote_storage_save_status')); |
|
433 | + add_action('wp_ajax_upload_backup_to_remote', array($xcloner_api, 'upload_backup_to_remote')); |
|
434 | + add_action('wp_ajax_list_backup_files', array($xcloner_api, 'list_backup_files')); |
|
435 | + add_action('wp_ajax_restore_upload_backup', array($xcloner_api, 'restore_upload_backup')); |
|
436 | + add_action('wp_ajax_download_restore_script', array($xcloner_api, 'download_restore_script')); |
|
437 | + add_action('wp_ajax_copy_backup_remote_to_local', array($xcloner_api, 'copy_backup_remote_to_local')); |
|
438 | + add_action('admin_notices', array($this, 'xcloner_error_admin_notices')); |
|
439 | 439 | |
440 | 440 | } |
441 | 441 | |
442 | 442 | } |
443 | 443 | |
444 | 444 | function add_plugin_action_links($links, $file) { |
445 | - if ($file == plugin_basename(dirname(dirname(__FILE__)) . '/xcloner.php')) |
|
445 | + if ($file == plugin_basename(dirname(dirname(__FILE__)).'/xcloner.php')) |
|
446 | 446 | { |
447 | 447 | $links[] = '<a href="admin.php?page=xcloner_settings_page">'.__('Settings', 'xcloner-backup-and-restore').'</a>'; |
448 | 448 | $links[] = '<a href="admin.php?page=xcloner_generate_backups_page">'.__('Generate Backup', 'xcloner-backup-and-restore').'</a>'; |
@@ -452,13 +452,13 @@ discard block |
||
452 | 452 | } |
453 | 453 | |
454 | 454 | public function xcloner_error_admin_notices() { |
455 | - settings_errors( 'xcloner_error_message' ); |
|
455 | + settings_errors('xcloner_error_message'); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | public function define_cron_hooks() |
459 | 459 | { |
460 | 460 | //registering new schedule intervals |
461 | - add_filter( 'cron_schedules', array($this, 'add_new_intervals')); |
|
461 | + add_filter('cron_schedules', array($this, 'add_new_intervals')); |
|
462 | 462 | |
463 | 463 | |
464 | 464 | $xcloner_scheduler = $this->get_xcloner_scheduler(); |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | |
533 | 533 | $page = sanitize_key($_GET['page']); |
534 | 534 | |
535 | - if($page) |
|
535 | + if ($page) |
|
536 | 536 | { |
537 | 537 | $this->display($page); |
538 | 538 | } |
@@ -350,7 +350,7 @@ |
||
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 | } |
@@ -58,19 +58,19 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -58,8 +58,9 @@ |
||
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 | |
64 | 65 | if ( function_exists('add_submenu_page') ) |
65 | 66 | { |
@@ -33,7 +33,7 @@ |
||
33 | 33 | |
34 | 34 | global $xcloner_plugin; |
35 | 35 | |
36 | - if(is_a($xcloner_plugin, 'Xcloner')) |
|
36 | + if (is_a($xcloner_plugin, 'Xcloner')) |
|
37 | 37 | { |
38 | 38 | $xcloner_scheduler = $xcloner_plugin->get_xcloner_scheduler(); |
39 | 39 | $xcloner_scheduler->deactivate_wp_cron_hooks(); |
@@ -4,44 +4,44 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 = ''; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 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 | |
@@ -83,8 +83,9 @@ discard block |
||
83 | 83 | { |
84 | 84 | $lines = array(); |
85 | 85 | |
86 | - if(!file_exists($this->main_logger_url) or !is_readable($this->main_logger_url)) |
|
87 | - return false; |
|
86 | + if(!file_exists($this->main_logger_url) or !is_readable($this->main_logger_url)) { |
|
87 | + return false; |
|
88 | + } |
|
88 | 89 | |
89 | 90 | $fp = fopen($this->main_logger_url, 'r'); |
90 | 91 | fseek($fp, -1, SEEK_END); |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | <h1><?= esc_html(get_admin_page_title()); ?></h1> |
11 | 11 | |
12 | 12 | <ul class="nav-tab-wrapper content row"> |
13 | - <li><a href="#backup_options" class="nav-tab col s12 m3 l2 nav-tab-active"><?php echo $tab.". ".__('Backup Options','xcloner-backup-and-restore')?></a></li> |
|
14 | - <?php if($xcloner_settings->get_enable_mysql_backup()):?> |
|
15 | - <li><a href="#database_options" class="nav-tab col s12 m3 l2 "><?php echo ++$tab.". ".__('Database Options','xcloner-backup-and-restore')?></a></li> |
|
13 | + <li><a href="#backup_options" class="nav-tab col s12 m3 l2 nav-tab-active"><?php echo $tab.". ".__('Backup Options', 'xcloner-backup-and-restore')?></a></li> |
|
14 | + <?php if ($xcloner_settings->get_enable_mysql_backup()):?> |
|
15 | + <li><a href="#database_options" class="nav-tab col s12 m3 l2 "><?php echo ++$tab.". ".__('Database Options', 'xcloner-backup-and-restore')?></a></li> |
|
16 | 16 | <?php endif?> |
17 | - <li><a href="#files_options" class="nav-tab col s12 m3 l2 "><?php echo ++$tab.". ".__('Files Options','xcloner-backup-and-restore')?></a></li> |
|
18 | - <li><a href="#generate_backup" class="nav-tab col s12 m3 l2 "><?php echo ++$tab.". ".__('Generate Backup','xcloner-backup-and-restore')?></a></li> |
|
19 | - <li><a href="#schedule_backup" class="nav-tab col s12 m3 l2 "><?php echo ++$tab.". ".__('Schedule Backup','xcloner-backup-and-restore')?></a></li> |
|
17 | + <li><a href="#files_options" class="nav-tab col s12 m3 l2 "><?php echo ++$tab.". ".__('Files Options', 'xcloner-backup-and-restore')?></a></li> |
|
18 | + <li><a href="#generate_backup" class="nav-tab col s12 m3 l2 "><?php echo ++$tab.". ".__('Generate Backup', 'xcloner-backup-and-restore')?></a></li> |
|
19 | + <li><a href="#schedule_backup" class="nav-tab col s12 m3 l2 "><?php echo ++$tab.". ".__('Schedule Backup', 'xcloner-backup-and-restore')?></a></li> |
|
20 | 20 | </ul> |
21 | 21 | |
22 | 22 | <form action="" method="POST" id="generate_backup_form"> |
@@ -27,21 +27,21 @@ discard block |
||
27 | 27 | <div class="input-field inline col s12 m10 l6"> |
28 | 28 | <i class="material-icons prefix">input</i> |
29 | 29 | <input name="backup_name" id="backup_name" type="text" value=<?php echo $xcloner_settings->get_default_backup_name() ?> > |
30 | - <label for="backup_name"><?php echo __('Backup Name','xcloner-backup-and-restore')?></label> |
|
30 | + <label for="backup_name"><?php echo __('Backup Name', 'xcloner-backup-and-restore')?></label> |
|
31 | 31 | </div> |
32 | 32 | <div class="hide-on-small-only m2"> |
33 | - <a class="btn-floating tooltipped btn-small" data-position="right" data-delay="50" data-tooltip="<?php echo __('The default backup name, supported tags [time], [hostname], [domain]','xcloner-backup-and-restore')?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
|
33 | + <a class="btn-floating tooltipped btn-small" data-position="right" data-delay="50" data-tooltip="<?php echo __('The default backup name, supported tags [time], [hostname], [domain]', 'xcloner-backup-and-restore')?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
|
34 | 34 | </div> |
35 | 35 | </div> |
36 | 36 | |
37 | 37 | <div class="row"> |
38 | 38 | <div class="input-field inline col s12 m10 l6"> |
39 | 39 | <i class="material-icons prefix">input</i> |
40 | - <input name="email_notification" id="email_notification" type="text" value="<?php echo get_option('admin_email');?>" > |
|
41 | - <label for="email_notification"><?php echo __('Send Email Notification To','xcloner-backup-and-restore')?></label> |
|
40 | + <input name="email_notification" id="email_notification" type="text" value="<?php echo get_option('admin_email'); ?>" > |
|
41 | + <label for="email_notification"><?php echo __('Send Email Notification To', 'xcloner-backup-and-restore')?></label> |
|
42 | 42 | </div> |
43 | 43 | <div class="hide-on-small-only m2"> |
44 | - <a class="btn-floating tooltipped btn-small" data-position="right" data-delay="50" data-tooltip="<?php echo __('If left blank, no notification will be sent','xcloner-backup-and-restore')?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
|
44 | + <a class="btn-floating tooltipped btn-small" data-position="right" data-delay="50" data-tooltip="<?php echo __('If left blank, no notification will be sent', 'xcloner-backup-and-restore')?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
|
45 | 45 | </div> |
46 | 46 | </div> |
47 | 47 | |
@@ -49,10 +49,10 @@ discard block |
||
49 | 49 | <div class="input-field col s12 m10 l6"> |
50 | 50 | <i class="material-icons prefix">input</i> |
51 | 51 | <textarea name="backup_comments" id="backup_comments" class="materialize-textarea"></textarea> |
52 | - <label for="backup_comments"><?php echo __('Backup Comments','xcloner-backup-and-restore')?></label> |
|
52 | + <label for="backup_comments"><?php echo __('Backup Comments', 'xcloner-backup-and-restore')?></label> |
|
53 | 53 | </div> |
54 | 54 | <div class="hide-on-small-only m2"> |
55 | - <a class="btn-floating tooltipped btn-small" data-position="right" data-delay="50" data-tooltip="<?php echo __('Some default backup comments that will be stored inside the backup archive','xcloner-backup-and-restore')?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
|
55 | + <a class="btn-floating tooltipped btn-small" data-position="right" data-delay="50" data-tooltip="<?php echo __('Some default backup comments that will be stored inside the backup archive', 'xcloner-backup-and-restore')?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
|
56 | 56 | </div> |
57 | 57 | </div> |
58 | 58 | |
@@ -63,10 +63,10 @@ discard block |
||
63 | 63 | </div> |
64 | 64 | </div> |
65 | 65 | |
66 | - <?php if($xcloner_settings->get_enable_mysql_backup()):?> |
|
66 | + <?php if ($xcloner_settings->get_enable_mysql_backup()):?> |
|
67 | 67 | <div id="database_options" class="tab-content"> |
68 | 68 | <h2><?php echo __('Select database data to include in the backup', 'xcloner-backup-and-restore')?>: |
69 | - <a class="btn-floating tooltipped btn-small" data-position="right" data-delay="50" data-tooltip="<?php echo __('Enable the \'Backup only WP tables\' setting if you don\'t want to show all other databases and tables not related to this Wordpress install','xcloner-backup-and-restore');?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
|
69 | + <a class="btn-floating tooltipped btn-small" data-position="right" data-delay="50" data-tooltip="<?php echo __('Enable the \'Backup only WP tables\' setting if you don\'t want to show all other databases and tables not related to this Wordpress install', 'xcloner-backup-and-restore'); ?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
|
70 | 70 | </h2> |
71 | 71 | |
72 | 72 | <!-- database/tables tree --> |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | <?php endif ?> |
87 | 87 | |
88 | 88 | <div id="files_options" class="tab-content"> |
89 | - <h2><?php echo __('Select from below the files/folders you want to exclude from your Backup Archive','xcloner-backup-and-restore')?>: |
|
90 | - <a class="btn-floating tooltipped btn-small" data-position="bottom" data-delay="50" data-html="true" data-tooltip="<?php echo __('You can navigate below through all your site structure(Backup Start Location) to exclude any file/folder you need by clicking the checkbox near it. <br />If the checkobx is disabled, then it matches a Regex Exclude File option and it can\'t be unchecked','xcloner-backup-and-restore');?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
|
89 | + <h2><?php echo __('Select from below the files/folders you want to exclude from your Backup Archive', 'xcloner-backup-and-restore')?>: |
|
90 | + <a class="btn-floating tooltipped btn-small" data-position="bottom" data-delay="50" data-html="true" data-tooltip="<?php echo __('You can navigate below through all your site structure(Backup Start Location) to exclude any file/folder you need by clicking the checkbox near it. <br />If the checkobx is disabled, then it matches a Regex Exclude File option and it can\'t be unchecked', 'xcloner-backup-and-restore'); ?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
|
91 | 91 | </h2> |
92 | 92 | |
93 | 93 | <!-- Files System Container --> |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | <ul class="backup-status collapsible" data-collapsible="accordion"> |
116 | 116 | <li class="file-system"> |
117 | 117 | <div class="collapsible-header"> |
118 | - <i class="material-icons">folder</i><?php echo __('Scanning The File System...','xcloner-backup-and-restore')?> |
|
118 | + <i class="material-icons">folder</i><?php echo __('Scanning The File System...', 'xcloner-backup-and-restore')?> |
|
119 | 119 | |
120 | 120 | <p class="right"><?php echo sprintf(__('Found %s files (%s)', 'xcloner-backup-and-restore'), '<span class="file-counter">0</span>', '<span class="file-size-total">0</span>MB')?></p> |
121 | 121 | |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | </div> |
130 | 130 | <div class="collapsible-body status-body"></div> |
131 | 131 | </li> |
132 | - <?php if($xcloner_settings->get_enable_mysql_backup()):?> |
|
132 | + <?php if ($xcloner_settings->get_enable_mysql_backup()):?> |
|
133 | 133 | <li class="database-backup"> |
134 | 134 | <div class="collapsible-header"> |
135 | - <i class="material-icons">storage</i><?php echo __('Generating the Mysql Backup...','xcloner-backup-and-restore')?> |
|
135 | + <i class="material-icons">storage</i><?php echo __('Generating the Mysql Backup...', 'xcloner-backup-and-restore')?> |
|
136 | 136 | |
137 | - <p class="right"><?php echo sprintf(__('Found %s tables in %s databases (%s)', 'xcloner-backup-and-restore'), '<span class="table-counter">0</span>', '<span class="database-counter">0</span>', '<span data-processed="0" class="total-records">0</span> records','xcloner-backup-and-restore')?></p> |
|
137 | + <p class="right"><?php echo sprintf(__('Found %s tables in %s databases (%s)', 'xcloner-backup-and-restore'), '<span class="table-counter">0</span>', '<span class="database-counter">0</span>', '<span data-processed="0" class="total-records">0</span> records', 'xcloner-backup-and-restore')?></p> |
|
138 | 138 | |
139 | 139 | <div> |
140 | 140 | <p class="right"><span class="last-logged-table"></span></p> |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | <?php endif?> |
159 | 159 | <li class="files-backup"> |
160 | 160 | <div class="collapsible-header"> |
161 | - <i class="material-icons">archive</i><?php echo __('Adding Files to Archive...','xcloner-backup-and-restore')?> |
|
161 | + <i class="material-icons">archive</i><?php echo __('Adding Files to Archive...', 'xcloner-backup-and-restore')?> |
|
162 | 162 | |
163 | - <p class="right"><?php echo sprintf(__('Adding %s files (%s)','xcloner-backup-and-restore'), '<span class="file-counter">0</span>', '<span data-processed="0" class="file-size-total">0</span>MB')?></p> |
|
163 | + <p class="right"><?php echo sprintf(__('Adding %s files (%s)', 'xcloner-backup-and-restore'), '<span class="file-counter">0</span>', '<span data-processed="0" class="file-size-total">0</span>MB')?></p> |
|
164 | 164 | |
165 | 165 | <div> |
166 | 166 | <p class="right"><span class="last-logged-file"></span></p> |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | <div class="collapsible-body status-body"> |
174 | 174 | <div class="row"> |
175 | 175 | <div class="col l3 s12"> |
176 | - <h2><?php echo __("Backup Parts",'xcloner-backup-and-restore')?>: </h2> |
|
176 | + <h2><?php echo __("Backup Parts", 'xcloner-backup-and-restore')?>: </h2> |
|
177 | 177 | </div> |
178 | 178 | <div class="col l9 s12"> |
179 | 179 | <ul class="backup-name"></ul> |
@@ -183,14 +183,14 @@ discard block |
||
183 | 183 | </li> |
184 | 184 | <li class="backup-done"> |
185 | 185 | <div class="collapsible-header"> |
186 | - <i class="material-icons">done</i><?php echo __('Backup Done','xcloner-backup-and-restore')?> |
|
186 | + <i class="material-icons">done</i><?php echo __('Backup Done', 'xcloner-backup-and-restore')?> |
|
187 | 187 | |
188 | 188 | <p class="right"> |
189 | - <?php if(sizeof($available_storages)):?> |
|
190 | - <a href="#" class="cloud-upload" title="<?php echo __("Send Backup To Remote Storage",'xcloner-backup-and-restore')?>"><i class="material-icons">cloud_upload</i></a> |
|
189 | + <?php if (sizeof($available_storages)):?> |
|
190 | + <a href="#" class="cloud-upload" title="<?php echo __("Send Backup To Remote Storage", 'xcloner-backup-and-restore')?>"><i class="material-icons">cloud_upload</i></a> |
|
191 | 191 | <?php endif?> |
192 | - <a href="#" class="download" title="<?php echo __("Download Backup",'xcloner-backup-and-restore')?>"><i class="material-icons">file_download</i></a> |
|
193 | - <a href="#" class="list-backup-content" title="<?php echo __("List Backup Content",'xcloner-backup-and-restore')?>"><i class="material-icons">folder_open</i></a> |
|
192 | + <a href="#" class="download" title="<?php echo __("Download Backup", 'xcloner-backup-and-restore')?>"><i class="material-icons">file_download</i></a> |
|
193 | + <a href="#" class="list-backup-content" title="<?php echo __("List Backup Content", 'xcloner-backup-and-restore')?>"><i class="material-icons">folder_open</i></a> |
|
194 | 194 | </p> |
195 | 195 | |
196 | 196 | <div class="progress"> |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | </div> |
201 | 201 | <div class="collapsible-body center-align"> |
202 | 202 | <div class="row"> |
203 | - <h5><?php echo __("Thank you for using XCloner.",'xcloner-backup-and-restore')?></h5> |
|
204 | - <h6><?php echo sprintf(__("We would love to hear about your experience in the %s.", 'xcloner-backup-and-restore'),'<a href="https://wordpress.org/support/plugin/xcloner-backup-and-restore/reviews/" target="_blank">Wordpress XCloner Reviews Section</a>') ?></h6> |
|
203 | + <h5><?php echo __("Thank you for using XCloner.", 'xcloner-backup-and-restore')?></h5> |
|
204 | + <h6><?php echo sprintf(__("We would love to hear about your experience in the %s.", 'xcloner-backup-and-restore'), '<a href="https://wordpress.org/support/plugin/xcloner-backup-and-restore/reviews/" target="_blank">Wordpress XCloner Reviews Section</a>') ?></h6> |
|
205 | 205 | <a class="twitter-follow-button" href="https://twitter.com/thinkovi" data-show-count="false">Follow @thinkovi</a> |
206 | 206 | <script src="//platform.twitter.com/widgets.js" async="" charset="utf-8"></script> |
207 | 207 | </div> |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | <div class="row"> |
219 | 219 | <div id="schedule_backup_success" class="col s12 l6 updated settings-error notice is-dismissible"> |
220 | 220 | <p><strong><?php echo __('Schedule Saved', 'xcloner-backup-and-restore')?></strong></p> |
221 | - <button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php echo __('(Dismiss this notice.','xcloner-backup-and-restore')?></span></button> |
|
221 | + <button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php echo __('(Dismiss this notice.', 'xcloner-backup-and-restore')?></span></button> |
|
222 | 222 | </div> |
223 | 223 | </div> |
224 | 224 | |
@@ -238,11 +238,11 @@ discard block |
||
238 | 238 | <div class="row"> |
239 | 239 | <div class="input-field inline col s12 m8 l4"> |
240 | 240 | <input type="datetime-local" id="datepicker" class="datepicker" name="schedule_start_date" > |
241 | - <label for="datepicker"><?php echo __('Schedule Backup To Start On:','xcloner-backup-and-restore')?></label> |
|
241 | + <label for="datepicker"><?php echo __('Schedule Backup To Start On:', 'xcloner-backup-and-restore')?></label> |
|
242 | 242 | </div> |
243 | 243 | <div class="input-field inline col s12 m4 l3"> |
244 | 244 | <input id="timepicker_ampm_dark" class="timepicker" type="time" name="schedule_start_time"> |
245 | - <label for="timepicker_ampm_dark"><?php echo __('At:','xcloner-backup-and-restore')?></label> |
|
245 | + <label for="timepicker_ampm_dark"><?php echo __('At:', 'xcloner-backup-and-restore')?></label> |
|
246 | 246 | </div> |
247 | 247 | </div> |
248 | 248 | |
@@ -250,22 +250,22 @@ discard block |
||
250 | 250 | <div class="input-field col s12 l7"> |
251 | 251 | <select name="schedule_frequency" id="schedule_frequency" class="validate" required> |
252 | 252 | <option value="" disabled selected><?php echo __('please select', 'xcloner-backup-and-restore') ?></option> |
253 | - <option value="single"><?php echo __("Don't Repeat",'xcloner-backup-and-restore')?></option> |
|
254 | - <option value="hourly"><?php echo __("Hourly",'xcloner-backup-and-restore')?></option> |
|
255 | - <option value="daily"><?php echo __("Daily",'xcloner-backup-and-restore')?></option> |
|
256 | - <option value="weekly"><?php echo __("Weekly",'xcloner-backup-and-restore')?></option> |
|
257 | - <option value="monthly"><?php echo __("Monthly",'xcloner-backup-and-restore')?></option> |
|
253 | + <option value="single"><?php echo __("Don't Repeat", 'xcloner-backup-and-restore')?></option> |
|
254 | + <option value="hourly"><?php echo __("Hourly", 'xcloner-backup-and-restore')?></option> |
|
255 | + <option value="daily"><?php echo __("Daily", 'xcloner-backup-and-restore')?></option> |
|
256 | + <option value="weekly"><?php echo __("Weekly", 'xcloner-backup-and-restore')?></option> |
|
257 | + <option value="monthly"><?php echo __("Monthly", 'xcloner-backup-and-restore')?></option> |
|
258 | 258 | </select> |
259 | 259 | <label><?php echo __('Please Select Frequency to run', 'xcloner-backup-and-restore') ?></label> |
260 | 260 | </div> |
261 | 261 | </div> |
262 | 262 | |
263 | - <?php if(sizeof($available_storages)):?> |
|
263 | + <?php if (sizeof($available_storages)):?> |
|
264 | 264 | <div class="row"> |
265 | 265 | <div class="input-field col s12 m12 l7"> |
266 | 266 | <select name="schedule_storage" id="schedule_storage" class="validate"> |
267 | 267 | <option value="" selected><?php echo __('none', 'xcloner-backup-and-restore') ?></option> |
268 | - <?php foreach($available_storages as $storage=>$text):?> |
|
268 | + <?php foreach ($available_storages as $storage=>$text):?> |
|
269 | 269 | <option value="<?php echo $storage?>"><?php echo $text?></option> |
270 | 270 | <?php endforeach?> |
271 | 271 | </select> |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | <?php endif?> |
276 | 276 | <div class="row"> |
277 | 277 | <div class="col s12 l7"> |
278 | - <button class="right btn waves-effect waves-light submit_schedule" type="submit" name="action"><?php echo __("Submit" ,'xcloner-backup-and-restore')?> |
|
278 | + <button class="right btn waves-effect waves-light submit_schedule" type="submit" name="action"><?php echo __("Submit", 'xcloner-backup-and-restore')?> |
|
279 | 279 | <i class="material-icons right">send</i> |
280 | 280 | </button> |
281 | 281 | </div> |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | <textarea class="body" rows="5"></textarea> |
295 | 295 | </div> |
296 | 296 | <div class="modal-footer"> |
297 | - <a class=" modal-action modal-close waves-effect waves-green btn-flat red darken-2"><?php echo __('Close','xcloner-backup-and-restore')?></a> |
|
297 | + <a class=" modal-action modal-close waves-effect waves-green btn-flat red darken-2"><?php echo __('Close', 'xcloner-backup-and-restore')?></a> |
|
298 | 298 | </div> |
299 | 299 | </div> |
300 | 300 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | |
303 | 303 | <div id="backup_cotent_modal" class="modal"> |
304 | 304 | <div class="modal-content"> |
305 | - <h4><?php echo sprintf(__("Listing Backup Content ",'xcloner-backup-and-restore'), "")?></h4> |
|
305 | + <h4><?php echo sprintf(__("Listing Backup Content ", 'xcloner-backup-and-restore'), "")?></h4> |
|
306 | 306 | <h5 class="backup-name"></h5> |
307 | 307 | |
308 | 308 | <div class="progress"> |
@@ -317,9 +317,9 @@ discard block |
||
317 | 317 | <form method="POST" class="remote-storage-form"> |
318 | 318 | <input type="hidden" name="file" class="backup_name"> |
319 | 319 | <div class="modal-content"> |
320 | - <h4><?php echo __("Remote Storage Transfer",'xcloner-backup-and-restore')?></h4> |
|
320 | + <h4><?php echo __("Remote Storage Transfer", 'xcloner-backup-and-restore')?></h4> |
|
321 | 321 | <p> |
322 | - <?php if(sizeof($available_storages)):?> |
|
322 | + <?php if (sizeof($available_storages)):?> |
|
323 | 323 | <div class="row"> |
324 | 324 | <div class="col s12 label"> |
325 | 325 | <label><?php echo __(sprintf('Send %s to remote storage', "<span class='backup_name'></span>"), 'xcloner-backup-and-restore') ?></label> |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | <div class="input-field col s8 m10"> |
328 | 328 | <select name="transfer_storage" id="transfer_storage" class="validate" required > |
329 | 329 | <option value="" selected><?php echo __('please select...', 'xcloner-backup-and-restore') ?></option> |
330 | - <?php foreach($available_storages as $storage=>$text):?> |
|
330 | + <?php foreach ($available_storages as $storage=>$text):?> |
|
331 | 331 | <option value="<?php echo $storage?>"><?php echo $text?></option> |
332 | 332 | <?php endforeach?> |
333 | 333 | </select> |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | </div> |
339 | 339 | </div> |
340 | 340 | <div class="row status"> |
341 | - <?php echo __("Uploading backup to the selected remote storage...",'xcloner-backup-and-restore')?> <span class="status-text"></span> |
|
341 | + <?php echo __("Uploading backup to the selected remote storage...", 'xcloner-backup-and-restore')?> <span class="status-text"></span> |
|
342 | 342 | <div class="progress"> |
343 | 343 | <div class="indeterminate"></div> |
344 | 344 | </div> |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | } |
412 | 412 | }); |
413 | 413 | |
414 | - <?php if($xcloner_settings->get_enable_mysql_backup()):?> |
|
414 | + <?php if ($xcloner_settings->get_enable_mysql_backup()):?> |
|
415 | 415 | jQuery('#jstree_database_container').jstree({ |
416 | 416 | 'core' : { |
417 | 417 | 'check_callback' : true, |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | $xcloner_remote_storage = $this->get_xcloner_container()->get_xcloner_remote_storage(); |
5 | 5 | $available_storages = $xcloner_remote_storage->get_available_storages(); |
6 | 6 | ?> |
7 | -<?php if(!defined("DISABLE_WP_CRON") || !DISABLE_WP_CRON): ?> |
|
7 | +<?php if (!defined("DISABLE_WP_CRON") || !DISABLE_WP_CRON): ?> |
|
8 | 8 | <div id="setting-error-" class="error settings-error notice is-dismissible"> |
9 | 9 | <p><strong> |
10 | 10 | <?php echo sprintf(__('We have noticed that DISABLE_WP_CRON is disabled, we recommend enabling that and setting up wp-cron.php to run manually through your hosting account scheduler as explained <a href="%s" target="_blank">here</a>', 'xcloner-backup-and-restore'), "http://www.inmotionhosting.com/support/website/wordpress/disabling-the-wp-cronphp-in-wordpress") ?> |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | <div class="row"> |
50 | 50 | <div class="col s12 m6 offset-m6 teal lighten-1" id="server_time"> |
51 | - <h2><?php echo __('Current Server Time', 'xcloner-backup-and-restore')?>: <span class="right"><?php echo current_time('mysql');?></span></h2> |
|
51 | + <h2><?php echo __('Current Server Time', 'xcloner-backup-and-restore')?>: <span class="right"><?php echo current_time('mysql'); ?></span></h2> |
|
52 | 52 | </div> |
53 | 53 | </div> |
54 | 54 | |
@@ -103,21 +103,21 @@ discard block |
||
103 | 103 | <div class="input-field col s12 l6"> |
104 | 104 | <select name="schedule_frequency" id="schedule_frequency" class="validate" required> |
105 | 105 | <option value="" disabled selected><?php echo __('Schedule Recurrence', 'xcloner-backup-and-restore') ?></option> |
106 | - <option value="single"><?php echo __("Don't Repeat",'xcloner-backup-and-restore')?></option> |
|
107 | - <option value="hourly"><?php echo __("Hourly",'xcloner-backup-and-restore')?></option> |
|
108 | - <option value="daily"><?php echo __("Daily",'xcloner-backup-and-restore')?></option> |
|
109 | - <option value="weekly"><?php echo __("Weekly",'xcloner-backup-and-restore')?></option> |
|
110 | - <option value="monthly"><?php echo __("Monthly",'xcloner-backup-and-restore')?></option> |
|
106 | + <option value="single"><?php echo __("Don't Repeat", 'xcloner-backup-and-restore')?></option> |
|
107 | + <option value="hourly"><?php echo __("Hourly", 'xcloner-backup-and-restore')?></option> |
|
108 | + <option value="daily"><?php echo __("Daily", 'xcloner-backup-and-restore')?></option> |
|
109 | + <option value="weekly"><?php echo __("Weekly", 'xcloner-backup-and-restore')?></option> |
|
110 | + <option value="monthly"><?php echo __("Monthly", 'xcloner-backup-and-restore')?></option> |
|
111 | 111 | </select> |
112 | 112 | </div> |
113 | 113 | </div> |
114 | 114 | |
115 | - <?php if(sizeof($available_storages)):?> |
|
115 | + <?php if (sizeof($available_storages)):?> |
|
116 | 116 | <div class="row"> |
117 | 117 | <div class="input-field col s12 l12"> |
118 | 118 | <select name="schedule_storage" id="schedule_storage" class="validate" > |
119 | 119 | <option value="" selected><?php echo __('none', 'xcloner-backup-and-restore') ?></option> |
120 | - <?php foreach($available_storages as $storage=>$text):?> |
|
120 | + <?php foreach ($available_storages as $storage=>$text):?> |
|
121 | 121 | <option value="<?php echo $storage?>"><?php echo $text?></option> |
122 | 122 | <?php endforeach?> |
123 | 123 | </select> |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class Xcloner_Scheduler{ |
|
3 | +class Xcloner_Scheduler { |
|
4 | 4 | |
5 | 5 | private $db; |
6 | 6 | private $scheduler_table = "xcloner_scheduler"; |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | { |
21 | 21 | global $wpdb; |
22 | 22 | |
23 | - $this->db = $wpdb; |
|
24 | - $wpdb->show_errors = false; |
|
23 | + $this->db = $wpdb; |
|
24 | + $wpdb->show_errors = false; |
|
25 | 25 | |
26 | 26 | $this->xcloner_container = $xcloner_container; |
27 | 27 | $this->xcloner_settings = $xcloner_container->get_xcloner_settings(); |
@@ -34,18 +34,18 @@ discard block |
||
34 | 34 | return $this->xcloner_container; |
35 | 35 | } |
36 | 36 | |
37 | - public function get_scheduler_list($return_only_enabled = 0 ) |
|
37 | + public function get_scheduler_list($return_only_enabled = 0) |
|
38 | 38 | { |
39 | 39 | $list = $this->db->get_results("SELECT * FROM ".$this->scheduler_table); |
40 | 40 | |
41 | - if($return_only_enabled) |
|
41 | + if ($return_only_enabled) |
|
42 | 42 | { |
43 | - $new_list= array(); |
|
43 | + $new_list = array(); |
|
44 | 44 | |
45 | - foreach($list as $res) |
|
46 | - if($res->status) |
|
45 | + foreach ($list as $res) |
|
46 | + if ($res->status) |
|
47 | 47 | { |
48 | - $res->next_run_time = wp_next_scheduled('xcloner_scheduler_'.$res->id, array($res->id))+(get_option( 'gmt_offset' ) * HOUR_IN_SECONDS); |
|
48 | + $res->next_run_time = wp_next_scheduled('xcloner_scheduler_'.$res->id, array($res->id)) + (get_option('gmt_offset') * HOUR_IN_SECONDS); |
|
49 | 49 | $new_list[] = $res; |
50 | 50 | } |
51 | 51 | $list = $new_list; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | { |
72 | 72 | $data = $this->db->get_row("SELECT * FROM ".$this->scheduler_table." WHERE id=".$id, ARRAY_A); |
73 | 73 | |
74 | - if(!$data) |
|
74 | + if (!$data) |
|
75 | 75 | return false; |
76 | 76 | |
77 | 77 | $params = json_decode($data['params']); |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | |
89 | 89 | public function delete_schedule_by_id($id) |
90 | 90 | { |
91 | - $hook = 'xcloner_scheduler_'.$id; |
|
92 | - wp_clear_scheduled_hook( $hook, array($id) ); |
|
91 | + $hook = 'xcloner_scheduler_'.$id; |
|
92 | + wp_clear_scheduled_hook($hook, array($id)); |
|
93 | 93 | |
94 | - $data = $this->db->delete( $this->scheduler_table , array( 'id' => $id ) ); |
|
94 | + $data = $this->db->delete($this->scheduler_table, array('id' => $id)); |
|
95 | 95 | |
96 | 96 | return $data; |
97 | 97 | } |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | { |
101 | 101 | $list = $this->get_scheduler_list(); |
102 | 102 | |
103 | - foreach($list as $schedule) |
|
103 | + foreach ($list as $schedule) |
|
104 | 104 | { |
105 | - $hook = 'xcloner_scheduler_'.$schedule->id; |
|
105 | + $hook = 'xcloner_scheduler_'.$schedule->id; |
|
106 | 106 | |
107 | - $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
|
108 | - wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
|
107 | + $timestamp = wp_next_scheduled($hook, array($schedule->id)); |
|
108 | + wp_unschedule_event($timestamp, $hook, array($schedule->id)); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
@@ -113,24 +113,24 @@ discard block |
||
113 | 113 | { |
114 | 114 | $list = $this->get_scheduler_list(); |
115 | 115 | |
116 | - foreach($list as $schedule) |
|
116 | + foreach ($list as $schedule) |
|
117 | 117 | { |
118 | - $hook = 'xcloner_scheduler_'.$schedule->id; |
|
118 | + $hook = 'xcloner_scheduler_'.$schedule->id; |
|
119 | 119 | |
120 | 120 | //adding the xcloner_scheduler hook with xcloner_scheduler_callback callback |
121 | - add_action( $hook, array($this, 'xcloner_scheduler_callback'), 10, 1 ); |
|
121 | + add_action($hook, array($this, 'xcloner_scheduler_callback'), 10, 1); |
|
122 | 122 | |
123 | - if ( ! wp_next_scheduled( $hook, array($schedule->id) ) and $schedule->status) { |
|
123 | + if (!wp_next_scheduled($hook, array($schedule->id)) and $schedule->status) { |
|
124 | 124 | |
125 | - if($schedule->recurrence == "single") |
|
126 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
125 | + if ($schedule->recurrence == "single") |
|
126 | + wp_schedule_single_event(strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
127 | 127 | else |
128 | - wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
128 | + wp_schedule_event(strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id)); |
|
129 | 129 | |
130 | - }elseif(!$schedule->status) |
|
130 | + }elseif (!$schedule->status) |
|
131 | 131 | { |
132 | - $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
|
133 | - wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
|
132 | + $timestamp = wp_next_scheduled($hook, array($schedule->id)); |
|
133 | + wp_unschedule_event($timestamp, $hook, array($schedule->id)); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
@@ -139,17 +139,17 @@ discard block |
||
139 | 139 | public function update_cron_hook($id) |
140 | 140 | { |
141 | 141 | $schedule = $this->get_schedule_by_id_object($id); |
142 | - $hook = 'xcloner_scheduler_'.$schedule->id; |
|
142 | + $hook = 'xcloner_scheduler_'.$schedule->id; |
|
143 | 143 | |
144 | - $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
|
145 | - wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
|
144 | + $timestamp = wp_next_scheduled($hook, array($schedule->id)); |
|
145 | + wp_unschedule_event($timestamp, $hook, array($schedule->id)); |
|
146 | 146 | |
147 | 147 | if ($schedule->status) { |
148 | 148 | |
149 | - if($schedule->recurrence == "single") |
|
150 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
151 | - else{ |
|
152 | - wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
149 | + if ($schedule->recurrence == "single") |
|
150 | + wp_schedule_single_event(strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
151 | + else { |
|
152 | + wp_schedule_event(strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id)); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | } |
@@ -157,16 +157,16 @@ discard block |
||
157 | 157 | |
158 | 158 | public function disable_single_cron($schedule_id) |
159 | 159 | { |
160 | - $hook = 'xcloner_scheduler_'.$schedule_id; |
|
161 | - $timestamp = wp_next_scheduled( $hook , array($schedule_id) ); |
|
162 | - wp_unschedule_event( $timestamp, $hook, array($schedule_id) ); |
|
160 | + $hook = 'xcloner_scheduler_'.$schedule_id; |
|
161 | + $timestamp = wp_next_scheduled($hook, array($schedule_id)); |
|
162 | + wp_unschedule_event($timestamp, $hook, array($schedule_id)); |
|
163 | 163 | |
164 | 164 | $schedule['status'] = 0; |
165 | 165 | |
166 | 166 | $update = $this->db->update( |
167 | 167 | $this->scheduler_table, |
168 | 168 | $schedule, |
169 | - array( 'id' => $schedule_id ), |
|
169 | + array('id' => $schedule_id), |
|
170 | 170 | array( |
171 | 171 | '%s', |
172 | 172 | '%s' |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $update = $this->db->update( |
183 | 183 | $this->scheduler_table, |
184 | 184 | $schedule, |
185 | - array( 'id' => $schedule_id ), |
|
185 | + array('id' => $schedule_id), |
|
186 | 186 | array( |
187 | 187 | '%s', |
188 | 188 | '%s' |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $update = $this->db->update( |
199 | 199 | $this->scheduler_table, |
200 | 200 | $schedule, |
201 | - array( 'id' => $schedule_id ), |
|
201 | + array('id' => $schedule_id), |
|
202 | 202 | array( |
203 | 203 | '%s', |
204 | 204 | '%s' |
@@ -211,18 +211,18 @@ discard block |
||
211 | 211 | { |
212 | 212 | set_time_limit(0); |
213 | 213 | |
214 | - $this->xcloner_file_system = $this->get_xcloner_container()->get_xcloner_filesystem(); |
|
215 | - $this->xcloner_database = $this->get_xcloner_container()->get_xcloner_database(); |
|
216 | - $this->archive_system = $this->get_xcloner_container()->get_archive_system(); |
|
217 | - $this->logger = $this->get_xcloner_container()->get_xcloner_logger()->withName("xcloner_scheduler"); |
|
218 | - $this->xcloner_remote_storage = $this->get_xcloner_container()->get_xcloner_remote_storage(); |
|
214 | + $this->xcloner_file_system = $this->get_xcloner_container()->get_xcloner_filesystem(); |
|
215 | + $this->xcloner_database = $this->get_xcloner_container()->get_xcloner_database(); |
|
216 | + $this->archive_system = $this->get_xcloner_container()->get_archive_system(); |
|
217 | + $this->logger = $this->get_xcloner_container()->get_xcloner_logger()->withName("xcloner_scheduler"); |
|
218 | + $this->xcloner_remote_storage = $this->get_xcloner_container()->get_xcloner_remote_storage(); |
|
219 | 219 | |
220 | - if($schedule['recurrence'] == "single") |
|
220 | + if ($schedule['recurrence'] == "single") |
|
221 | 221 | { |
222 | 222 | $this->disable_single_cron($schedule['id']); |
223 | 223 | } |
224 | 224 | |
225 | - if(!$schedule) |
|
225 | + if (!$schedule) |
|
226 | 226 | { |
227 | 227 | $this->logger->info(sprintf("Could not load schedule with id'%s'", $id), array("CRON")); |
228 | 228 | return; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $init = 1; |
238 | 238 | $continue = 1; |
239 | 239 | |
240 | - while($continue) |
|
240 | + while ($continue) |
|
241 | 241 | { |
242 | 242 | $continue = $this->xcloner_file_system->start_file_recursion($init); |
243 | 243 | |
@@ -251,9 +251,9 @@ discard block |
||
251 | 251 | $init = 1; |
252 | 252 | $return['finished'] = 0; |
253 | 253 | |
254 | - while(!$return['finished']) |
|
254 | + while (!$return['finished']) |
|
255 | 255 | { |
256 | - $return = $this->xcloner_database->start_database_recursion((array)json_decode($schedule['table_params']), $return, $init); |
|
256 | + $return = $this->xcloner_database->start_database_recursion((array)json_decode($schedule['table_params']), $return, $init); |
|
257 | 257 | $init = 0; |
258 | 258 | } |
259 | 259 | |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $return['finished'] = 0; |
266 | 266 | $return['extra'] = array(); |
267 | 267 | |
268 | - while(!$return['finished']) |
|
268 | + while (!$return['finished']) |
|
269 | 269 | { |
270 | 270 | $return = $this->archive_system->start_incremental_backup((array)$schedule['backup_params'], $return['extra'], $init); |
271 | 271 | $init = 0; |
@@ -274,29 +274,29 @@ discard block |
||
274 | 274 | |
275 | 275 | //getting the last backup archive file |
276 | 276 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_with_extension(); |
277 | - if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
277 | + if ($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
278 | 278 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
279 | 279 | |
280 | 280 | $this->update_last_backup($schedule['id'], $return['extra']['backup_parent']); |
281 | 281 | |
282 | - if($schedule['remote_storage'] and array_key_exists($schedule['remote_storage'], $this->xcloner_remote_storage->get_available_storages())) |
|
282 | + if ($schedule['remote_storage'] and array_key_exists($schedule['remote_storage'], $this->xcloner_remote_storage->get_available_storages())) |
|
283 | 283 | { |
284 | 284 | $backup_file = $return['extra']['backup_parent']; |
285 | 285 | |
286 | 286 | $this->logger->info(sprintf("Transferring backup to remote storage %s", strtoupper($schedule['remote_storage'])), array("CRON")); |
287 | 287 | |
288 | - if(method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) |
|
288 | + if (method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) |
|
289 | 289 | call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage'])); |
290 | 290 | } |
291 | 291 | |
292 | 292 | |
293 | - if(isset($schedule['backup_params']->email_notification) and $to=$schedule['backup_params']->email_notification) |
|
293 | + if (isset($schedule['backup_params']->email_notification) and $to = $schedule['backup_params']->email_notification) |
|
294 | 294 | { |
295 | - try{ |
|
295 | + try { |
|
296 | 296 | $from = "XCloner Schedule - ".$schedule['name']; |
297 | 297 | $additional['lines_total'] = $return['extra']['lines_total']; |
298 | 298 | $this->archive_system->send_notification($to, $from, "", $return['extra']['backup_parent'], $schedule, "", $additional); |
299 | - }catch(Exception $e) |
|
299 | + }catch (Exception $e) |
|
300 | 300 | { |
301 | 301 | $this->logger->error($e->getMessage()); |
302 | 302 | } |
@@ -311,22 +311,22 @@ discard block |
||
311 | 311 | { |
312 | 312 | $schedule = $this->get_schedule_by_id($id); |
313 | 313 | |
314 | - try{ |
|
314 | + try { |
|
315 | 315 | |
316 | 316 | $this->__xcloner_scheduler_callback($id, $schedule); |
317 | 317 | |
318 | - }catch(Exception $e){ |
|
318 | + }catch (Exception $e) { |
|
319 | 319 | |
320 | 320 | //send email to site admin if email notification is not set in the scheduler |
321 | - if(!isset($schedule['backup_params']->email_notification) || !$schedule['backup_params']->email_notification) |
|
321 | + if (!isset($schedule['backup_params']->email_notification) || !$schedule['backup_params']->email_notification) |
|
322 | 322 | { |
323 | 323 | $schedule['backup_params']->email_notification = get_option('admin_email'); |
324 | 324 | } |
325 | 325 | |
326 | - if(isset($schedule['backup_params']->email_notification) && $to=$schedule['backup_params']->email_notification) |
|
326 | + if (isset($schedule['backup_params']->email_notification) && $to = $schedule['backup_params']->email_notification) |
|
327 | 327 | { |
328 | 328 | $from = "XCloner Schedule - ".$schedule['name']; |
329 | - $this->archive_system->send_notification($to, $from, "Scheduled backup error","", "", $e->getMessage()); |
|
329 | + $this->archive_system->send_notification($to, $from, "Scheduled backup error", "", "", $e->getMessage()); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | } |
@@ -42,10 +42,11 @@ discard block |
||
42 | 42 | { |
43 | 43 | $new_list= array(); |
44 | 44 | |
45 | - foreach($list as $res) |
|
46 | - if($res->status) |
|
45 | + foreach($list as $res) { |
|
46 | + if($res->status) |
|
47 | 47 | { |
48 | 48 | $res->next_run_time = wp_next_scheduled('xcloner_scheduler_'.$res->id, array($res->id))+(get_option( 'gmt_offset' ) * HOUR_IN_SECONDS); |
49 | + } |
|
49 | 50 | $new_list[] = $res; |
50 | 51 | } |
51 | 52 | $list = $new_list; |
@@ -71,8 +72,9 @@ discard block |
||
71 | 72 | { |
72 | 73 | $data = $this->db->get_row("SELECT * FROM ".$this->scheduler_table." WHERE id=".$id, ARRAY_A); |
73 | 74 | |
74 | - if(!$data) |
|
75 | - return false; |
|
75 | + if(!$data) { |
|
76 | + return false; |
|
77 | + } |
|
76 | 78 | |
77 | 79 | $params = json_decode($data['params']); |
78 | 80 | |
@@ -122,12 +124,13 @@ discard block |
||
122 | 124 | |
123 | 125 | if ( ! wp_next_scheduled( $hook, array($schedule->id) ) and $schedule->status) { |
124 | 126 | |
125 | - if($schedule->recurrence == "single") |
|
126 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
127 | - else |
|
128 | - wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
127 | + if($schedule->recurrence == "single") { |
|
128 | + wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
129 | + } else { |
|
130 | + wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
131 | + } |
|
129 | 132 | |
130 | - }elseif(!$schedule->status) |
|
133 | + } elseif(!$schedule->status) |
|
131 | 134 | { |
132 | 135 | $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
133 | 136 | wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
@@ -146,9 +149,9 @@ discard block |
||
146 | 149 | |
147 | 150 | if ($schedule->status) { |
148 | 151 | |
149 | - if($schedule->recurrence == "single") |
|
150 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
151 | - else{ |
|
152 | + if($schedule->recurrence == "single") { |
|
153 | + wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
154 | + } else{ |
|
152 | 155 | wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
153 | 156 | } |
154 | 157 | |
@@ -274,8 +277,9 @@ discard block |
||
274 | 277 | |
275 | 278 | //getting the last backup archive file |
276 | 279 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_with_extension(); |
277 | - if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
278 | - $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
|
280 | + if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) { |
|
281 | + $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
|
282 | + } |
|
279 | 283 | |
280 | 284 | $this->update_last_backup($schedule['id'], $return['extra']['backup_parent']); |
281 | 285 | |
@@ -285,8 +289,9 @@ discard block |
||
285 | 289 | |
286 | 290 | $this->logger->info(sprintf("Transferring backup to remote storage %s", strtoupper($schedule['remote_storage'])), array("CRON")); |
287 | 291 | |
288 | - if(method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) |
|
289 | - call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage'])); |
|
292 | + if(method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) { |
|
293 | + call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage'])); |
|
294 | + } |
|
290 | 295 | } |
291 | 296 | |
292 | 297 | |
@@ -296,7 +301,7 @@ discard block |
||
296 | 301 | $from = "XCloner Schedule - ".$schedule['name']; |
297 | 302 | $additional['lines_total'] = $return['extra']['lines_total']; |
298 | 303 | $this->archive_system->send_notification($to, $from, "", $return['extra']['backup_parent'], $schedule, "", $additional); |
299 | - }catch(Exception $e) |
|
304 | + } catch(Exception $e) |
|
300 | 305 | { |
301 | 306 | $this->logger->error($e->getMessage()); |
302 | 307 | } |
@@ -315,7 +320,7 @@ discard block |
||
315 | 320 | |
316 | 321 | $this->__xcloner_scheduler_callback($id, $schedule); |
317 | 322 | |
318 | - }catch(Exception $e){ |
|
323 | + } catch(Exception $e){ |
|
319 | 324 | |
320 | 325 | //send email to site admin if email notification is not set in the scheduler |
321 | 326 | if(!isset($schedule['backup_params']->email_notification) || !$schedule['backup_params']->email_notification) |