@@ -26,6 +26,6 @@ |
||
26 | 26 | */ |
27 | 27 | |
28 | 28 | // If uninstall not called from WordPress, then exit. |
29 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
29 | +if (!defined('WP_UNINSTALL_PLUGIN')) { |
|
30 | 30 | exit; |
31 | 31 | } |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | */ |
22 | 22 | |
23 | 23 | |
24 | -class Xcloner_Database extends wpdb{ |
|
24 | +class Xcloner_Database extends wpdb { |
|
25 | 25 | |
26 | 26 | |
27 | - public $debug = 0; |
|
28 | - public $recordsPerSession = 10000; |
|
29 | - public $dbCompatibility = ""; |
|
27 | + public $debug = 0; |
|
28 | + public $recordsPerSession = 10000; |
|
29 | + public $dbCompatibility = ""; |
|
30 | 30 | public $dbDropSyntax = 1; |
31 | 31 | public $countRecords = 0; |
32 | 32 | |
@@ -38,24 +38,24 @@ discard block |
||
38 | 38 | private $TEMP_DBPROCESS_FILE = ".database"; |
39 | 39 | private $TEMP_DUMP_FILE = "database-backup.sql"; |
40 | 40 | |
41 | - public function __construct(Xcloner $xcloner_container, $wp_user="", $wp_pass="", $wp_db="", $wp_host="") |
|
41 | + public function __construct(Xcloner $xcloner_container, $wp_user = "", $wp_pass = "", $wp_db = "", $wp_host = "") |
|
42 | 42 | { |
43 | - $this->logger = $xcloner_container->get_xcloner_logger()->withName("xcloner_database"); |
|
44 | - $this->xcloner_settings = $xcloner_container->get_xcloner_settings(); |
|
45 | - $this->fs = $xcloner_container->get_xcloner_filesystem(); |
|
43 | + $this->logger = $xcloner_container->get_xcloner_logger()->withName("xcloner_database"); |
|
44 | + $this->xcloner_settings = $xcloner_container->get_xcloner_settings(); |
|
45 | + $this->fs = $xcloner_container->get_xcloner_filesystem(); |
|
46 | 46 | |
47 | - if($this->xcloner_settings->get_xcloner_option('xcloner_database_records_per_request')) |
|
48 | - $this->recordsPerSession = $this->xcloner_settings->get_xcloner_option('xcloner_database_records_per_request'); |
|
47 | + if ($this->xcloner_settings->get_xcloner_option('xcloner_database_records_per_request')) |
|
48 | + $this->recordsPerSession = $this->xcloner_settings->get_xcloner_option('xcloner_database_records_per_request'); |
|
49 | 49 | |
50 | - if(!$this->recordsPerSession) |
|
50 | + if (!$this->recordsPerSession) |
|
51 | 51 | $this->recordsPerSession = 100; |
52 | 52 | |
53 | - if(!$wp_user && !$wp_pass && !$wp_host && !$wp_db ) |
|
53 | + if (!$wp_user && !$wp_pass && !$wp_host && !$wp_db) |
|
54 | 54 | { |
55 | 55 | $wp_host = $this->xcloner_settings->get_db_hostname(); |
56 | 56 | $wp_user = $this->xcloner_settings->get_db_username(); |
57 | 57 | $wp_pass = $this->xcloner_settings->get_db_password(); |
58 | - $wp_db = $this->xcloner_settings->get_db_database(); |
|
58 | + $wp_db = $this->xcloner_settings->get_db_database(); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | parent::__construct($wp_user, $wp_pass, $wp_db, $wp_host); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function init($data, $start = 0) |
73 | 73 | { |
74 | - if($start and $this->fs->get_tmp_filesystem()->has($this->TEMP_DBPROCESS_FILE)){ |
|
74 | + if ($start and $this->fs->get_tmp_filesystem()->has($this->TEMP_DBPROCESS_FILE)) { |
|
75 | 75 | $this->fs->get_tmp_filesystem()->delete($this->TEMP_DBPROCESS_FILE); |
76 | 76 | } |
77 | 77 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | "database_count"=>0, |
91 | 91 | ); |
92 | 92 | |
93 | - if(!$this->xcloner_settings->get_enable_mysql_backup()) |
|
93 | + if (!$this->xcloner_settings->get_enable_mysql_backup()) |
|
94 | 94 | { |
95 | 95 | $return['finished'] = 1; |
96 | 96 | return $return; |
@@ -100,44 +100,44 @@ discard block |
||
100 | 100 | |
101 | 101 | $this->init($params, $init); |
102 | 102 | |
103 | - if($init) |
|
103 | + if ($init) |
|
104 | 104 | { |
105 | 105 | $db_count = 0; |
106 | 106 | |
107 | - if(isset($params['#'])) |
|
107 | + if (isset($params['#'])) |
|
108 | 108 | { |
109 | - foreach($params['#'] as $database) |
|
109 | + foreach ($params['#'] as $database) |
|
110 | 110 | { |
111 | - if(!isset($params[$database]) or !is_array($params[$database])) |
|
111 | + if (!isset($params[$database]) or !is_array($params[$database])) |
|
112 | 112 | $params[$database] = array(); |
113 | 113 | } |
114 | 114 | $db_count = -1; |
115 | 115 | } |
116 | 116 | |
117 | - if(isset($params) and is_array($params)) |
|
118 | - foreach($params as $database=>$tables) |
|
117 | + if (isset($params) and is_array($params)) |
|
118 | + foreach ($params as $database=>$tables) |
|
119 | 119 | { |
120 | - if($database != "#") |
|
120 | + if ($database != "#") |
|
121 | 121 | { |
122 | 122 | $stats = $this->write_backup_process_list($database, $tables); |
123 | - $return['stats']['tables_count'] += $stats['tables_count']; |
|
124 | - $return['stats']['total_records'] += $stats['total_records']; |
|
123 | + $return['stats']['tables_count'] += $stats['tables_count']; |
|
124 | + $return['stats']['total_records'] += $stats['total_records']; |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
128 | - if(sizeof($params)) |
|
129 | - $return['stats']['database_count'] = sizeof($params)+$db_count; |
|
128 | + if (sizeof($params)) |
|
129 | + $return['stats']['database_count'] = sizeof($params) + $db_count; |
|
130 | 130 | else |
131 | 131 | $return['stats']['database_count'] = 0; |
132 | 132 | |
133 | 133 | return $return; |
134 | 134 | } |
135 | 135 | |
136 | - if(!isset($extra_params['startAtLine'])) |
|
136 | + if (!isset($extra_params['startAtLine'])) |
|
137 | 137 | $extra_params['startAtLine'] = 0; |
138 | - if(!isset($extra_params['startAtRecord'])) |
|
138 | + if (!isset($extra_params['startAtRecord'])) |
|
139 | 139 | $extra_params['startAtRecord'] = 0; |
140 | - if(!isset($extra_params['dumpfile'])) |
|
140 | + if (!isset($extra_params['dumpfile'])) |
|
141 | 141 | $extra_params['dumpfile'] = ""; |
142 | 142 | |
143 | 143 | $return = $this->process_incremental($extra_params['startAtLine'], $extra_params['startAtRecord'], $extra_params['dumpfile']); |
@@ -148,13 +148,13 @@ discard block |
||
148 | 148 | public function log($message = "") |
149 | 149 | { |
150 | 150 | |
151 | - if($message){ |
|
152 | - $this->logger->info( $message, array("")); |
|
153 | - }else{ |
|
154 | - if($this->last_query) |
|
155 | - $this->logger->debug( $this->last_query, array("")); |
|
156 | - if($this->last_error) |
|
157 | - $this->logger->error( $this->last_error, array("")); |
|
151 | + if ($message) { |
|
152 | + $this->logger->info($message, array("")); |
|
153 | + } else { |
|
154 | + if ($this->last_query) |
|
155 | + $this->logger->debug($this->last_query, array("")); |
|
156 | + if ($this->last_error) |
|
157 | + $this->logger->error($this->last_error, array("")); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | return; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function error($message) |
171 | 171 | { |
172 | - $this->logger->error( $message, array("")); |
|
172 | + $this->logger->error($message, array("")); |
|
173 | 173 | |
174 | 174 | return; |
175 | 175 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | $query = "show tables in `".$database."`"; |
204 | 204 | |
205 | - $res = $this->get_results($query); |
|
205 | + $res = $this->get_results($query); |
|
206 | 206 | $this->log(); |
207 | 207 | |
208 | 208 | return count($res); |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | $databases_list[$i]['num_tables'] = $this->get_database_num_tables($this->dbname); |
226 | 226 | $i++; |
227 | 227 | |
228 | - if(is_array($databases)) |
|
229 | - foreach( $databases as $db){ |
|
230 | - if($db->Database != $this->dbname) |
|
228 | + if (is_array($databases)) |
|
229 | + foreach ($databases as $db) { |
|
230 | + if ($db->Database != $this->dbname) |
|
231 | 231 | { |
232 | 232 | $databases_list[$i]['name'] = $db->Database; |
233 | 233 | $databases_list[$i]['num_tables'] = $this->get_database_num_tables($db->Database); |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $tablesList[0] = array( ); |
253 | 253 | $inc = 0; |
254 | 254 | |
255 | - if(!$database) |
|
255 | + if (!$database) |
|
256 | 256 | $database = $this->dbname; |
257 | 257 | |
258 | 258 | $this->logger->debug(sprintf(("Listing tables in %s database"), $database)); |
@@ -260,14 +260,14 @@ discard block |
||
260 | 260 | $tables = $this->get_results("SHOW TABLES in `".$database."`"); |
261 | 261 | $this->log(); |
262 | 262 | |
263 | - foreach ($tables as $table){ |
|
263 | + foreach ($tables as $table) { |
|
264 | 264 | |
265 | 265 | $table = array_values((array)$table)[0]; |
266 | 266 | |
267 | 267 | $tablesList[$inc]['name'] = $table; |
268 | 268 | $tablesList[$inc]['database'] = $database; |
269 | 269 | |
270 | - if($get_num_records) |
|
270 | + if ($get_num_records) |
|
271 | 271 | { |
272 | 272 | $records_num_result = $this->get_var("SELECT count(*) FROM `".$database."`.`".$table."`"); |
273 | 273 | $this->log(); |
@@ -277,8 +277,8 @@ discard block |
||
277 | 277 | |
278 | 278 | $tablesList[$inc]['excluded'] = 0; |
279 | 279 | |
280 | - if(sizeof($included) and is_array($included)) |
|
281 | - if(!in_array($table, $included) ) |
|
280 | + if (sizeof($included) and is_array($included)) |
|
281 | + if (!in_array($table, $included)) |
|
282 | 282 | { |
283 | 283 | $tablesList[$inc]['excluded'] = 1; |
284 | 284 | $this->log(sprintf(__("Excluding table %s.%s from backup"), $table, $database)); |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | |
300 | 300 | $tables = $this->list_tables($dbname, $incl_tables, 1); |
301 | 301 | |
302 | - if($this->dbname != $dbname) |
|
302 | + if ($this->dbname != $dbname) |
|
303 | 303 | $dumpfile = $dbname."-backup.sql"; |
304 | 304 | else |
305 | 305 | $dumpfile = $this->TEMP_DUMP_FILE; |
@@ -308,8 +308,8 @@ discard block |
||
308 | 308 | $this->fs->get_tmp_filesystem_append()->write($this->TEMP_DBPROCESS_FILE, $line); |
309 | 309 | |
310 | 310 | // write this to the class and write to $TEMP_DBPROCESS_FILE file as database.table records |
311 | - foreach($tables as $key=>$table) |
|
312 | - if($table!= "" and !$tables[$key]['excluded']){ |
|
311 | + foreach ($tables as $key=>$table) |
|
312 | + if ($table != "" and !$tables[$key]['excluded']) { |
|
313 | 313 | |
314 | 314 | $line = sprintf("`%s`.`%s`\t%s\t%s\n", $dbname, $tables[$key]['name'], $tables[$key]['records'], $tables[$key]['excluded']); |
315 | 315 | $this->fs->get_tmp_filesystem_append()->write($this->TEMP_DBPROCESS_FILE, $line); |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | |
338 | 338 | $result = $this->get_var("SELECT count(*) FROM $table;"); |
339 | 339 | |
340 | - return intval($result) ;// not max limit on 32 bit systems 2147483647; on 64 bit 999999999999 |
|
340 | + return intval($result); // not max limit on 32 bit systems 2147483647; on 64 bit 999999999999 |
|
341 | 341 | |
342 | 342 | } |
343 | 343 | |
@@ -353,25 +353,25 @@ discard block |
||
353 | 353 | * int $dbDropSyntax - check if the DROP TABLE syntax should be added |
354 | 354 | * @return array $return |
355 | 355 | */ |
356 | - public function process_incremental($startAtLine= 0, $startAtRecord = 0, $dumpfile = "", $dbCompatibility= ""){ |
|
356 | + public function process_incremental($startAtLine = 0, $startAtRecord = 0, $dumpfile = "", $dbCompatibility = "") { |
|
357 | 357 | |
358 | 358 | $count = 0; |
359 | 359 | $return['finished'] = 0; |
360 | 360 | $lines = array(); |
361 | 361 | |
362 | - if($this->fs->get_tmp_filesystem()->has($this->TEMP_DBPROCESS_FILE)) |
|
363 | - $lines = array_filter(explode("\n",$this->fs->get_tmp_filesystem()->read($this->TEMP_DBPROCESS_FILE))); |
|
362 | + if ($this->fs->get_tmp_filesystem()->has($this->TEMP_DBPROCESS_FILE)) |
|
363 | + $lines = array_filter(explode("\n", $this->fs->get_tmp_filesystem()->read($this->TEMP_DBPROCESS_FILE))); |
|
364 | 364 | |
365 | - foreach ($lines as $buffer){ |
|
365 | + foreach ($lines as $buffer) { |
|
366 | 366 | |
367 | - if($count == $startAtLine) |
|
367 | + if ($count == $startAtLine) |
|
368 | 368 | { |
369 | 369 | |
370 | - $tableInfo =explode("\t", $buffer); |
|
370 | + $tableInfo = explode("\t", $buffer); |
|
371 | 371 | |
372 | - if($tableInfo[0] == "###newdump###"){ |
|
372 | + if ($tableInfo[0] == "###newdump###") { |
|
373 | 373 | // we create a new mysql dump file |
374 | - if($dumpfile != ""){ |
|
374 | + if ($dumpfile != "") { |
|
375 | 375 | // we finished a previous one and write the footers |
376 | 376 | $return['dumpsize'] = $this->data_footers($dumpfile); |
377 | 377 | } |
@@ -385,13 +385,13 @@ discard block |
||
385 | 385 | $startAtLine++; |
386 | 386 | $return['new_dump'] = 1; |
387 | 387 | //break; |
388 | - }else{ |
|
388 | + } else { |
|
389 | 389 | //we export the table |
390 | - if($tableInfo[0] == "###enddump###") |
|
390 | + if ($tableInfo[0] == "###enddump###") |
|
391 | 391 | $return['endDump'] = 1; |
392 | 392 | |
393 | 393 | //table is excluded |
394 | - if($tableInfo[2]) |
|
394 | + if ($tableInfo[2]) |
|
395 | 395 | continue; |
396 | 396 | |
397 | 397 | $next = $startAtRecord + $this->recordsPerSession; |
@@ -403,28 +403,28 @@ discard block |
||
403 | 403 | |
404 | 404 | //return something to the browser |
405 | 405 | $return['databaseName'] = $databaseName; |
406 | - $return['tableName'] = $tableName; |
|
406 | + $return['tableName'] = $tableName; |
|
407 | 407 | $return['totalRecords'] = $tableInfo[1]; |
408 | 408 | |
409 | 409 | $processed_records = 0; |
410 | 410 | |
411 | - if(trim($tableName) !="" and !$tableInfo[2]) |
|
411 | + if (trim($tableName) != "" and !$tableInfo[2]) |
|
412 | 412 | $processed_records = $this->export_table($databaseName, $tableName, $startAtRecord, $this->recordsPerSession, $dumpfile); |
413 | 413 | |
414 | - $return['processedRecords'] = $startAtRecord+$processed_records; |
|
414 | + $return['processedRecords'] = $startAtRecord + $processed_records; |
|
415 | 415 | |
416 | - if($next >= $tableInfo[1]) //we finished loading the records for next sessions, will go to the new record |
|
416 | + if ($next >= $tableInfo[1]) //we finished loading the records for next sessions, will go to the new record |
|
417 | 417 | { |
418 | - $startAtLine ++; |
|
418 | + $startAtLine++; |
|
419 | 419 | $startAtRecord = 0; |
420 | - }else{ |
|
420 | + } else { |
|
421 | 421 | $startAtRecord = $startAtRecord + $this->recordsPerSession; |
422 | 422 | } |
423 | 423 | |
424 | 424 | //$return['dbCompatibility'] = self::$dbCompatibility; |
425 | 425 | |
426 | - $return['startAtLine'] = $startAtLine; |
|
427 | - $return['startAtRecord'] = $startAtRecord; |
|
426 | + $return['startAtLine'] = $startAtLine; |
|
427 | + $return['startAtRecord'] = $startAtRecord; |
|
428 | 428 | $return['dumpfile'] = $dumpfile; |
429 | 429 | $return['dumpsize'] = $this->fs->get_tmp_filesystem_append()->getSize($dumpfile); |
430 | 430 | |
@@ -442,15 +442,15 @@ discard block |
||
442 | 442 | } |
443 | 443 | |
444 | 444 | //while is finished, lets go home... |
445 | - if($dumpfile != ""){ |
|
445 | + if ($dumpfile != "") { |
|
446 | 446 | // we finished a previous one and write the footers |
447 | 447 | $return['dumpsize'] = $this->data_footers($dumpfile); |
448 | 448 | $return['dumpfile'] = ($dumpfile); |
449 | 449 | } |
450 | 450 | $return['finished'] = 1; |
451 | - $return['startAtLine'] = $startAtLine; |
|
451 | + $return['startAtLine'] = $startAtLine; |
|
452 | 452 | |
453 | - if($this->fs->get_tmp_filesystem()->has($this->TEMP_DBPROCESS_FILE)) |
|
453 | + if ($this->fs->get_tmp_filesystem()->has($this->TEMP_DBPROCESS_FILE)) |
|
454 | 454 | $this->fs->get_tmp_filesystem()->delete($this->TEMP_DBPROCESS_FILE); |
455 | 455 | |
456 | 456 | $this->logger->debug(sprintf(("Database backup finished!"))); |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | |
480 | 480 | $records = 0; |
481 | 481 | |
482 | - if($start == 0) |
|
482 | + if ($start == 0) |
|
483 | 483 | $this->dump_structure($databaseName, $tableName, $dumpfile); |
484 | 484 | |
485 | 485 | $start = intval($start); |
@@ -487,20 +487,20 @@ discard block |
||
487 | 487 | //exporting the table content now |
488 | 488 | |
489 | 489 | $query = "SELECT * from `$databaseName`.`$tableName` Limit $start, $limit ;"; |
490 | - if($this->use_mysqli) |
|
490 | + if ($this->use_mysqli) |
|
491 | 491 | { |
492 | 492 | $result = mysqli_query($this->dbh, $query); |
493 | 493 | $mysql_fetch_function = "mysqli_fetch_array"; |
494 | 494 | |
495 | - }else{ |
|
495 | + } else { |
|
496 | 496 | $result = mysql_query($query, $this->dbh); |
497 | 497 | $mysql_fetch_function = "mysqli_fetch_array"; |
498 | 498 | } |
499 | 499 | //$result = $this->get_results($query, ARRAY_N); |
500 | 500 | //print_r($result); exit; |
501 | 501 | |
502 | - if($result){ |
|
503 | - while($row = $mysql_fetch_function($result, MYSQLI_ASSOC)){ |
|
502 | + if ($result) { |
|
503 | + while ($row = $mysql_fetch_function($result, MYSQLI_ASSOC)) { |
|
504 | 504 | |
505 | 505 | $this->fs->get_tmp_filesystem_append()->write($dumpfile, "INSERT INTO `$tableName` VALUES ("); |
506 | 506 | $arr = $row; |
@@ -510,13 +510,13 @@ discard block |
||
510 | 510 | foreach ($arr as $key => $value) { |
511 | 511 | $value = $this->_real_escape($value); |
512 | 512 | |
513 | - if(method_exists($this, 'remove_placeholder_escape')){ |
|
513 | + if (method_exists($this, 'remove_placeholder_escape')) { |
|
514 | 514 | $value = $this->remove_placeholder_escape($value); |
515 | 515 | } |
516 | 516 | |
517 | 517 | $buffer .= "'".$value."', "; |
518 | 518 | } |
519 | - $buffer = rtrim($buffer, ', ') . ");\n"; |
|
519 | + $buffer = rtrim($buffer, ', ').");\n"; |
|
520 | 520 | $this->fs->get_tmp_filesystem_append()->write($dumpfile, $buffer); |
521 | 521 | unset($buffer); |
522 | 522 | |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | |
532 | 532 | } |
533 | 533 | |
534 | - public function dump_structure($databaseName, $tableName ,$dumpfile) |
|
534 | + public function dump_structure($databaseName, $tableName, $dumpfile) |
|
535 | 535 | { |
536 | 536 | $this->log(sprintf(__("Dumping the structure for %s.%s table"), $databaseName, $tableName)); |
537 | 537 | |
@@ -546,14 +546,14 @@ discard block |
||
546 | 546 | |
547 | 547 | //$result = mysqli_query($this->dbh,"SHOW CREATE table `$databaseName`.`$tableName`;"); |
548 | 548 | $result = $this->get_row("SHOW CREATE table `$databaseName`.`$tableName`;", ARRAY_N); |
549 | - if($result){ |
|
549 | + if ($result) { |
|
550 | 550 | //$row = mysqli_fetch_row( $result); |
551 | 551 | $line = ($result[1].";\n"); |
552 | 552 | $this->fs->get_tmp_filesystem_append()->write($dumpfile, $line); |
553 | 553 | } |
554 | 554 | |
555 | - $line = ( "\n#\n# End Structure for table `$tableName`\n#\n\n"); |
|
556 | - $line .=("#\n# Dumping data for table `$tableName`\n#\n\n"); |
|
555 | + $line = ("\n#\n# End Structure for table `$tableName`\n#\n\n"); |
|
556 | + $line .= ("#\n# Dumping data for table `$tableName`\n#\n\n"); |
|
557 | 557 | $this->fs->get_tmp_filesystem_append()->write($dumpfile, $line); |
558 | 558 | |
559 | 559 | return; |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | |
577 | 577 | } |
578 | 578 | |
579 | - public function resetcountRecords(){ |
|
579 | + public function resetcountRecords() { |
|
580 | 580 | |
581 | 581 | $this->countRecords = 0; |
582 | 582 | |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | |
585 | 585 | } |
586 | 586 | |
587 | - public function getcountRecords(){ |
|
587 | + public function getcountRecords() { |
|
588 | 588 | |
589 | 589 | return $this->countRecords; |
590 | 590 | |
@@ -601,14 +601,14 @@ discard block |
||
601 | 601 | $return .= "# Powered by XCloner Site Backup\n"; |
602 | 602 | $return .= "# http://www.xcloner.com\n"; |
603 | 603 | $return .= "#\n"; |
604 | - $return .= "# Host: " . get_site_url() . "\n"; |
|
605 | - $return .= "# Generation Time: " . date("M j, Y \a\\t H:i") . "\n"; |
|
606 | - $return .= "# PHP Version: " . phpversion() . "\n"; |
|
607 | - $return .= "# Database Charset: ". $this->charset . "\n"; |
|
604 | + $return .= "# Host: ".get_site_url()."\n"; |
|
605 | + $return .= "# Generation Time: ".date("M j, Y \a\\t H:i")."\n"; |
|
606 | + $return .= "# PHP Version: ".phpversion()."\n"; |
|
607 | + $return .= "# Database Charset: ".$this->charset."\n"; |
|
608 | 608 | |
609 | 609 | $results = $this->get_results("SHOW VARIABLES LIKE \"%version%\";", ARRAY_N); |
610 | - if(isset($results)){ |
|
611 | - foreach($results as $result){ |
|
610 | + if (isset($results)) { |
|
611 | + foreach ($results as $result) { |
|
612 | 612 | |
613 | 613 | $return .= "# MYSQL ".$result[0].": ".$result[1]."\n"; |
614 | 614 | |
@@ -618,13 +618,13 @@ discard block |
||
618 | 618 | $results = $this->get_results("SELECT DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME |
619 | 619 | FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '".$database."';"); |
620 | 620 | |
621 | - if(isset($results[0])){ |
|
621 | + if (isset($results[0])) { |
|
622 | 622 | |
623 | 623 | $return .= "# MYSQL DEFAULT_CHARACTER_SET_NAME: ".$results[0]->DEFAULT_CHARACTER_SET_NAME."\n"; |
624 | 624 | $return .= "# MYSQL SCHEMA_NAME: ".$results[0]->DEFAULT_COLLATION_NAME."\n"; |
625 | 625 | } |
626 | 626 | |
627 | - $return .= "#\n# Database : `" . $database . "`\n# --------------------------------------------------------\n\n"; |
|
627 | + $return .= "#\n# Database : `".$database."`\n# --------------------------------------------------------\n\n"; |
|
628 | 628 | |
629 | 629 | $this->log(sprintf(__("Writing %s database dump headers"), $database)); |
630 | 630 |
@@ -11,10 +11,10 @@ discard block |
||
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | -<h1><?= esc_html( get_admin_page_title() ); ?></h1> |
|
14 | +<h1><?= esc_html(get_admin_page_title()); ?></h1> |
|
15 | 15 | |
16 | 16 | <script> |
17 | - var xcloner_auth_key = '<?php echo md5( AUTH_KEY )?>'; |
|
17 | + var xcloner_auth_key = '<?php echo md5(AUTH_KEY)?>'; |
|
18 | 18 | </script> |
19 | 19 | |
20 | 20 | <div class="row xcloner-restore"> |
@@ -22,36 +22,36 @@ discard block |
||
22 | 22 | <ul class="collapsible xcloner-restore " data-collapsible="accordion"> |
23 | 23 | <li data-step="1" class="restore-script-upload-step steps active show"> |
24 | 24 | <div class="collapsible-header active"><i |
25 | - class="material-icons">settings_remote</i><?php echo __( "Restore Script Upload", 'xcloner-backup-and-restore' ) ?> |
|
25 | + class="material-icons">settings_remote</i><?php echo __("Restore Script Upload", 'xcloner-backup-and-restore') ?> |
|
26 | 26 | </div> |
27 | 27 | <div class="collapsible-body row"> |
28 | 28 | |
29 | 29 | <ul class="text-steps"> |
30 | - <li><?php echo __( "If you want to do a <strong>Local Target System Restore</strong>, leave Url field below empty and click 'Check Connection', you can skip the next steps.", 'xcloner-backup-and-restore' ) ?> |
|
30 | + <li><?php echo __("If you want to do a <strong>Local Target System Restore</strong>, leave Url field below empty and click 'Check Connection', you can skip the next steps.", 'xcloner-backup-and-restore') ?> |
|
31 | 31 | </li> |
32 | - <li><?php echo __( "If you want to do a <strong>Remote Target System Restore</strong>, please download the restore script from", 'xcloner-backup-and-restore' ) ?> |
|
32 | + <li><?php echo __("If you want to do a <strong>Remote Target System Restore</strong>, please download the restore script from", 'xcloner-backup-and-restore') ?> |
|
33 | 33 | <a href='#' |
34 | - onclick="window.location=ajaxurl+'?action=download_restore_script&phar=true'"><strong><?php echo __( "here", 'xcloner-backup-and-restore' ) ?></strong></a> |
|
34 | + onclick="window.location=ajaxurl+'?action=download_restore_script&phar=true'"><strong><?php echo __("here", 'xcloner-backup-and-restore') ?></strong></a> |
|
35 | 35 | </li> |
36 | 36 | <li> |
37 | - <?php echo __( "Extract the restore script archive files on your new host", 'xcloner-backup-and-restore' ) ?> |
|
37 | + <?php echo __("Extract the restore script archive files on your new host", 'xcloner-backup-and-restore') ?> |
|
38 | 38 | </li> |
39 | 39 | <li> |
40 | - <?php echo __( "Provide url below to the <u>xcloner_restore.php</u> restore script, like http://my_restore_site.com/xcloner_restore.php", 'xcloner-backup-and-restore' ) ?> |
|
40 | + <?php echo __("Provide url below to the <u>xcloner_restore.php</u> restore script, like http://my_restore_site.com/xcloner_restore.php", 'xcloner-backup-and-restore') ?> |
|
41 | 41 | </li> |
42 | 42 | <li> |
43 | - <?php echo __( "If your server is not web accessible, like a localhost computer, you can use a DynDNS service or install a blank copy of Wordpress with XCloner in the same environment and start the restore from there.", 'xcloner-backup-and-restore' ) ?> |
|
43 | + <?php echo __("If your server is not web accessible, like a localhost computer, you can use a DynDNS service or install a blank copy of Wordpress with XCloner in the same environment and start the restore from there.", 'xcloner-backup-and-restore') ?> |
|
44 | 44 | </li> |
45 | - <?php if ( is_ssl() ): ?> |
|
45 | + <?php if (is_ssl()): ?> |
|
46 | 46 | <li class="warning"> |
47 | - <?php echo __( "We have detected your connection to the site as being secure, so your restore script address must start with https://." ) ?> |
|
47 | + <?php echo __("We have detected your connection to the site as being secure, so your restore script address must start with https://.") ?> |
|
48 | 48 | </li> |
49 | 49 | <?php endif ?> |
50 | 50 | |
51 | 51 | </ul> |
52 | 52 | |
53 | 53 | <div class="input-field col l9 s12"> |
54 | - <input value="<?php echo ( is_ssl() ) ? "https://" : "" ?>" id="restore_script_url" type="text" |
|
54 | + <input value="<?php echo (is_ssl()) ? "https://" : "" ?>" id="restore_script_url" type="text" |
|
55 | 55 | class="validate" |
56 | 56 | placeholder="Url to XCloner Restore Script, example http://myddns.com/xcloner/xcloner_restore.php"> |
57 | 57 | <label for="restore_script_url"></label> |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | </div> |
60 | 60 | <div class="col l3 s12 right-align"> |
61 | 61 | <button class="btn waves-effect waves-light" type="submit" id="validate_url" |
62 | - name="action"><?php echo __( "Check Connection", 'xcloner-backup-and-restore' ) ?> |
|
62 | + name="action"><?php echo __("Check Connection", 'xcloner-backup-and-restore') ?> |
|
63 | 63 | <i class="material-icons right">send</i> |
64 | 64 | </button> |
65 | 65 | </div> |
@@ -68,18 +68,18 @@ discard block |
||
68 | 68 | |
69 | 69 | <li data-step="2" class="backup-upload-step steps"> |
70 | 70 | <div class="collapsible-header active"><i |
71 | - class="material-icons">file_upload</i><?php echo __( "Upload Local Backup Archive To Target Host", 'xcloner-backup-and-restore' ) ?> |
|
71 | + class="material-icons">file_upload</i><?php echo __("Upload Local Backup Archive To Target Host", 'xcloner-backup-and-restore') ?> |
|
72 | 72 | </div> |
73 | 73 | <div class="collapsible-body row"> |
74 | - <p><?php echo __( "You can skip this step if you want to transfer the archive in some other way, make sure you upload it in the same directory as the restore script from the previous step.", 'xcloner-backup-and-restore' ) ?></p> |
|
74 | + <p><?php echo __("You can skip this step if you want to transfer the archive in some other way, make sure you upload it in the same directory as the restore script from the previous step.", 'xcloner-backup-and-restore') ?></p> |
|
75 | 75 | <div class="input-field col s12 l7"> |
76 | 76 | <select id="backup_file" name="backup_file" class="browser-default"> |
77 | 77 | <option value="" disabled |
78 | - selected><?php echo __( "Please select a local backup archive to upload to target host", 'xcloner-backup-and-restore' ) ?></option> |
|
79 | - <?php if ( is_array( $backup_list ) ): ?> |
|
80 | - <?php foreach ( $backup_list as $file ): ?> |
|
78 | + selected><?php echo __("Please select a local backup archive to upload to target host", 'xcloner-backup-and-restore') ?></option> |
|
79 | + <?php if (is_array($backup_list)): ?> |
|
80 | + <?php foreach ($backup_list as $file): ?> |
|
81 | 81 | <option value="<?php echo $file['basename'] ?>"> |
82 | - <?php echo $file['basename'] ?> (<?php echo size_format( $file['size'] ) ?>) |
|
82 | + <?php echo $file['basename'] ?> (<?php echo size_format($file['size']) ?>) |
|
83 | 83 | </option> |
84 | 84 | <?php endforeach ?> |
85 | 85 | <?php endif ?> |
@@ -94,18 +94,18 @@ discard block |
||
94 | 94 | <div class="col s12 l5 right-align"> |
95 | 95 | <div class="toggler"> |
96 | 96 | <button class="btn waves-effect waves-light upload-backup normal" type="submit" id="" |
97 | - name="action"><?php echo __( "Upload", 'xcloner-backup-and-restore' ) ?> |
|
97 | + name="action"><?php echo __("Upload", 'xcloner-backup-and-restore') ?> |
|
98 | 98 | <i class="material-icons left">navigate_before</i> |
99 | 99 | </button> |
100 | 100 | <button class="btn waves-effect waves-light red upload-backup cancel" type="submit" id="" |
101 | - name="action"><?php echo __( "Cancel", 'xcloner-backup-and-restore' ) ?> |
|
101 | + name="action"><?php echo __("Cancel", 'xcloner-backup-and-restore') ?> |
|
102 | 102 | <i class="material-icons right">close</i> |
103 | 103 | </button> |
104 | 104 | </div> |
105 | 105 | <button class="btn waves-effect waves-light grey" type="submit" |
106 | - title="<?php echo __( "Skip Next", 'xcloner-backup-and-restore' ) ?>" |
|
106 | + title="<?php echo __("Skip Next", 'xcloner-backup-and-restore') ?>" |
|
107 | 107 | id="skip_upload_backup" |
108 | - name="action"><?php echo __( "Skip Next", 'xcloner-backup-and-restore' ) ?> |
|
108 | + name="action"><?php echo __("Skip Next", 'xcloner-backup-and-restore') ?> |
|
109 | 109 | <i class="material-icons right">navigate_next</i> |
110 | 110 | </button> |
111 | 111 | </div> |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | |
115 | 115 | <li data-step="3" class="restore-remote-backup-step steps active"> |
116 | 116 | <div class="collapsible-header"><i |
117 | - class="material-icons">folder_open</i><?php echo __( "Restore Files Backup Available On Target Location", 'xcloner-backup-and-restore' ) ?> |
|
117 | + class="material-icons">folder_open</i><?php echo __("Restore Files Backup Available On Target Location", 'xcloner-backup-and-restore') ?> |
|
118 | 118 | <i class="material-icons right" title="Refresh Target Backup Files List" |
119 | 119 | id="refresh_remote_backup_file">cached</i> |
120 | 120 | |
121 | 121 | <div class="switch right"> |
122 | 122 | <label> |
123 | - <?php echo __( 'Verbose Output', 'xcloner-backup-and-restore' ) ?> |
|
123 | + <?php echo __('Verbose Output', 'xcloner-backup-and-restore') ?> |
|
124 | 124 | <input type="checkbox" id="toggle_file_restore_display" name="toggle_file_restore_display" |
125 | 125 | class="" checked value="1"> |
126 | 126 | <span class="lever"></span> |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | <div class="col s12"> |
136 | 136 | <a class="btn-floating tooltipped btn-small right" data-html="true" data-position="left" |
137 | 137 | data-delay="50" |
138 | - data-tooltip="<?php echo __( "This is the directory where you would like to restore the backup archive files.<br /> |
|
139 | - Please use this with caution when restoring to a live site.", 'xcloner-backup-and-restore' ) ?>"><i |
|
138 | + data-tooltip="<?php echo __("This is the directory where you would like to restore the backup archive files.<br /> |
|
139 | + Please use this with caution when restoring to a live site.", 'xcloner-backup-and-restore') ?>"><i |
|
140 | 140 | class="material-icons">help_outline</i> |
141 | 141 | </a> |
142 | - <h5><?php echo __( "Restore Target Path:", 'xcloner-backup-and-restore' ) ?></h5> |
|
142 | + <h5><?php echo __("Restore Target Path:", 'xcloner-backup-and-restore') ?></h5> |
|
143 | 143 | <input type="text" name="remote_restore_path" id="remote_restore_path" class="validate" |
144 | 144 | placeholder="Restore Target Path"> |
145 | 145 | <label></label> |
@@ -151,13 +151,13 @@ discard block |
||
151 | 151 | <div class="col s12"> |
152 | 152 | <a href="#backup_localhost-2017-04-03_10-58-sql-diff2017-03-22_00-00-5b6c4.tgz" |
153 | 153 | class="list-backup-content btn-floating tooltipped btn-small right" |
154 | - data-tooltip="<?php echo __( 'Click To List The Selected Backup Content', 'xcloner-backup-and-restore' ) ?>"> |
|
154 | + data-tooltip="<?php echo __('Click To List The Selected Backup Content', 'xcloner-backup-and-restore') ?>"> |
|
155 | 155 | <i class="material-icons">folder_open</i> |
156 | 156 | </a> |
157 | - <h5><?php echo __( "Restore Backup Archive:", 'xcloner-backup-and-restore' ) ?></h5> |
|
157 | + <h5><?php echo __("Restore Backup Archive:", 'xcloner-backup-and-restore') ?></h5> |
|
158 | 158 | <select id="remote_backup_file" name="remote_backup_file" class="browser-default"> |
159 | 159 | <option value="" disabled |
160 | - selected><?php echo __( "Please select the target backup file to restore", 'xcloner-backup-and-restore' ) ?></option> |
|
160 | + selected><?php echo __("Please select the target backup file to restore", 'xcloner-backup-and-restore') ?></option> |
|
161 | 161 | </select> |
162 | 162 | <label></label> |
163 | 163 | </div> |
@@ -166,41 +166,41 @@ discard block |
||
166 | 166 | <input class="with-gap" name="filter_files" type="radio" id="filter_files_all" checked |
167 | 167 | value="" disabled/> |
168 | 168 | <label for="filter_files_all" class="tooltipped" data-position="right" |
169 | - data-tooltip="<?php echo __( "Restore all backup files. Available only when doing a Remote Target System Restore", 'xcloner-backup-and-restore' ) ?>"><?php echo __( "Restore All Files", "xcloner-backup-and-restore" ) ?></label> |
|
169 | + data-tooltip="<?php echo __("Restore all backup files. Available only when doing a Remote Target System Restore", 'xcloner-backup-and-restore') ?>"><?php echo __("Restore All Files", "xcloner-backup-and-restore") ?></label> |
|
170 | 170 | |
171 | 171 | <input class="with-gap" name="filter_files" type="radio" id="filter_files_wp_content" |
172 | 172 | value="/^wp-content\/(.*)/"/> |
173 | 173 | <label for="filter_files_wp_content" class="tooltipped" |
174 | - data-tooltip="<?php echo __( 'Restore the files only of the wp-content/ folder', 'xcloner-backup-and-restore' ) ?>"> |
|
175 | - <?php echo __( "Only wp-content", "xcloner-backup-and-restore" ) ?> |
|
174 | + data-tooltip="<?php echo __('Restore the files only of the wp-content/ folder', 'xcloner-backup-and-restore') ?>"> |
|
175 | + <?php echo __("Only wp-content", "xcloner-backup-and-restore") ?> |
|
176 | 176 | </label> |
177 | 177 | |
178 | 178 | <input class="with-gap" name="filter_files" type="radio" id="filter_files_plugins" |
179 | 179 | value="/^wp-content\/plugins(.*)/"/> |
180 | 180 | <label for="filter_files_plugins" class="tooltipped" |
181 | - data-tooltip="<?php echo __( 'Restore the files only of the wp-content/plugins/ folder', 'xcloner-backup-and-restore' ) ?>"> |
|
182 | - <?php echo __( "Only Plugins", "xcloner-backup-and-restore" ) ?> |
|
181 | + data-tooltip="<?php echo __('Restore the files only of the wp-content/plugins/ folder', 'xcloner-backup-and-restore') ?>"> |
|
182 | + <?php echo __("Only Plugins", "xcloner-backup-and-restore") ?> |
|
183 | 183 | </label> |
184 | 184 | |
185 | 185 | <input class="with-gap" name="filter_files" type="radio" id="filter_files_uploads" |
186 | 186 | value="/^wp-content\/uploads(.*)/"/> |
187 | 187 | <label for="filter_files_uploads" class="tooltipped" |
188 | - data-tooltip="<?php echo __( 'Restore the files only of the wp-content/uploads/ folder only', 'xcloner-backup-and-restore' ) ?>"> |
|
189 | - <?php echo __( "Only Uploads", "xcloner-backup-and-restore" ) ?> |
|
188 | + data-tooltip="<?php echo __('Restore the files only of the wp-content/uploads/ folder only', 'xcloner-backup-and-restore') ?>"> |
|
189 | + <?php echo __("Only Uploads", "xcloner-backup-and-restore") ?> |
|
190 | 190 | </label> |
191 | 191 | |
192 | 192 | <input class="with-gap" name="filter_files" type="radio" id="filter_files_themes" |
193 | 193 | value="/^wp-content\/themes(.*)/"/> |
194 | 194 | <label for="filter_files_themes" class="tooltipped" |
195 | - data-tooltip="<?php echo __( 'Restore the files only of the wp-content/themes/ folder', 'xcloner-backup-and-restore' ) ?>"> |
|
196 | - <?php echo __( "Only Themes", "xcloner-backup-and-restore" ) ?> |
|
195 | + data-tooltip="<?php echo __('Restore the files only of the wp-content/themes/ folder', 'xcloner-backup-and-restore') ?>"> |
|
196 | + <?php echo __("Only Themes", "xcloner-backup-and-restore") ?> |
|
197 | 197 | </label> |
198 | 198 | |
199 | 199 | <input class="with-gap" name="filter_files" type="radio" id="filter_files_database" |
200 | 200 | value="/^xcloner-(.*)\/(.*)\.sql/"/> |
201 | 201 | <label for="filter_files_database" class="tooltipped" |
202 | - data-tooltip="<?php echo __( 'Restore the database-sql.sql mysql backup from the xcloner-xxxxx/ folder', 'xcloner-backup-and-restore' ) ?>"> |
|
203 | - <?php echo __( "Only Database Backup", "xcloner-backup-and-restore" ) ?> |
|
202 | + data-tooltip="<?php echo __('Restore the database-sql.sql mysql backup from the xcloner-xxxxx/ folder', 'xcloner-backup-and-restore') ?>"> |
|
203 | + <?php echo __("Only Database Backup", "xcloner-backup-and-restore") ?> |
|
204 | 204 | </label> |
205 | 205 | </div> |
206 | 206 | </div> |
@@ -216,18 +216,18 @@ discard block |
||
216 | 216 | <div class="col s12 l5 right-align"> |
217 | 217 | <div class="toggler"> |
218 | 218 | <button class="btn waves-effect waves-light restore_remote_backup normal " type="submit" |
219 | - id="" name="action"><?php echo __( "Restore", 'xcloner-backup-and-restore' ) ?> |
|
219 | + id="" name="action"><?php echo __("Restore", 'xcloner-backup-and-restore') ?> |
|
220 | 220 | <i class="material-icons left">navigate_before</i> |
221 | 221 | </button> |
222 | 222 | <button class="btn waves-effect waves-light red restore_remote_backup cancel" type="submit" |
223 | - id="" name="action"><?php echo __( "Cancel", 'xcloner-backup-and-restore' ) ?> |
|
223 | + id="" name="action"><?php echo __("Cancel", 'xcloner-backup-and-restore') ?> |
|
224 | 224 | <i class="material-icons right">close</i> |
225 | 225 | </button> |
226 | 226 | </div> |
227 | 227 | <button class="btn waves-effect waves-light grey" type="submit" |
228 | - title="<?php echo __( "Skip Next", 'xcloner-backup-and-restore' ) ?>" |
|
228 | + title="<?php echo __("Skip Next", 'xcloner-backup-and-restore') ?>" |
|
229 | 229 | id="skip_remote_backup_step" |
230 | - name="action"><?php echo __( "Skip Next", 'xcloner-backup-and-restore' ) ?> |
|
230 | + name="action"><?php echo __("Skip Next", 'xcloner-backup-and-restore') ?> |
|
231 | 231 | <i class="material-icons right">navigate_next</i> |
232 | 232 | </button> |
233 | 233 | </div> |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | <li data-step="4" class="restore-remote-database-step steps active"> |
238 | 238 | <div class="collapsible-header"><i |
239 | - class="material-icons">list</i><?php echo __( "Restore Target Database - Search and Replace", 'xcloner-backup-and-restore' ) ?> |
|
239 | + class="material-icons">list</i><?php echo __("Restore Target Database - Search and Replace", 'xcloner-backup-and-restore') ?> |
|
240 | 240 | <i class="material-icons right" title="Refresh Database Backup Files List" |
241 | 241 | id="refresh_database_file">cached</i> |
242 | 242 | </div> |
@@ -246,68 +246,68 @@ discard block |
||
246 | 246 | <div class="col s12"> |
247 | 247 | <a class="btn-floating tooltipped btn-small right" data-position="left" data-delay="50" |
248 | 248 | data-html="true" |
249 | - data-tooltip="<?php echo __( 'Please provide below the mysql connection details for the target host database.<br />For live sites we recommend using a new separate database.', 'xcloner-backup-and-restore' ) ?>" |
|
249 | + data-tooltip="<?php echo __('Please provide below the mysql connection details for the target host database.<br />For live sites we recommend using a new separate database.', 'xcloner-backup-and-restore') ?>" |
|
250 | 250 | data-tooltip-id="92c95730-94e9-7b59-bd52-14adc30d5e3e"><i class="material-icons">help_outline</i></a> |
251 | - <h5><?php echo __( 'Target Mysql Details', 'xcloner-backup-and-restore' ) ?></h5> |
|
251 | + <h5><?php echo __('Target Mysql Details', 'xcloner-backup-and-restore') ?></h5> |
|
252 | 252 | </div> |
253 | 253 | <div class=" col s12"> |
254 | 254 | <div class="input-field col s12 m6"> |
255 | 255 | <input type="text" name="remote_mysql_host" id="remote_mysql_host" class="validate" |
256 | 256 | placeholder="Target Mysql Hostname"> |
257 | - <label><?php echo __( "Target Mysql Hostname", 'xcloner-backup-and-restore' ) ?></label> |
|
257 | + <label><?php echo __("Target Mysql Hostname", 'xcloner-backup-and-restore') ?></label> |
|
258 | 258 | </div> |
259 | 259 | |
260 | 260 | <div class="input-field col s12 m6"> |
261 | 261 | <input type="text" name="remote_mysql_db" id="remote_mysql_db" class="validate" |
262 | 262 | placeholder="Target Mysql Database"> |
263 | - <label><?php echo __( "Target Mysql Database", 'xcloner-backup-and-restore' ) ?></label> |
|
263 | + <label><?php echo __("Target Mysql Database", 'xcloner-backup-and-restore') ?></label> |
|
264 | 264 | </div> |
265 | 265 | |
266 | 266 | <div class="input-field col s12 m6"> |
267 | 267 | <input type="text" name="remote_mysql_user" id="remote_mysql_user" class="validate" |
268 | 268 | placeholder="Target Mysql Username"> |
269 | - <label><?php echo __( "Target Mysql Username", 'xcloner-backup-and-restore' ) ?></label> |
|
269 | + <label><?php echo __("Target Mysql Username", 'xcloner-backup-and-restore') ?></label> |
|
270 | 270 | </div> |
271 | 271 | |
272 | 272 | |
273 | 273 | <div class="input-field col s12 m6"> |
274 | 274 | <input type="text" name="remote_mysql_pass" id="remote_mysql_pass" class="validate" |
275 | 275 | placeholder="Target Mysql Password"> |
276 | - <label><?php echo __( "Target Mysql Password", 'xcloner-backup-and-restore' ) ?></label> |
|
276 | + <label><?php echo __("Target Mysql Password", 'xcloner-backup-and-restore') ?></label> |
|
277 | 277 | </div> |
278 | 278 | |
279 | 279 | </div> |
280 | 280 | <div class="col s12"> |
281 | 281 | <a class="btn-floating tooltipped btn-small right" data-position="left" data-delay="50" |
282 | 282 | data-html="true" |
283 | - data-tooltip="<?php echo __( 'I will attempt to replace all mysql backup records matching the provided Source Url with the provided Target Url. <br />Leave blank the Target Url if you would like to skip this option. <br />As a bonus, I will also replace all matching serialized data and fix it\'s parsing.', 'xcloner-backup-and-restore' ) ?>" |
|
283 | + data-tooltip="<?php echo __('I will attempt to replace all mysql backup records matching the provided Source Url with the provided Target Url. <br />Leave blank the Target Url if you would like to skip this option. <br />As a bonus, I will also replace all matching serialized data and fix it\'s parsing.', 'xcloner-backup-and-restore') ?>" |
|
284 | 284 | data-tooltip-id="92c95730-94e9-7b59-bd52-14adc30d5e3e"><i class="material-icons">help_outline</i></a> |
285 | - <h5><?php echo __( 'Target Mysql Search and Replace', 'xcloner-backup-and-restore' ) ?></h5> |
|
285 | + <h5><?php echo __('Target Mysql Search and Replace', 'xcloner-backup-and-restore') ?></h5> |
|
286 | 286 | </div> |
287 | 287 | <div class="col s12"> |
288 | 288 | <div class="input-field col s12 m6 "> |
289 | 289 | <input type="text" name="wp_home_url" id="wp_home_url" class="validate" |
290 | 290 | placeholder="WP Home Url" value="<?php echo home_url(); ?>"> |
291 | - <label><?php echo __( "Source Home Url", 'xcloner-backup-and-restore' ) ?></label> |
|
291 | + <label><?php echo __("Source Home Url", 'xcloner-backup-and-restore') ?></label> |
|
292 | 292 | </div> |
293 | 293 | |
294 | 294 | <div class="input-field col s12 m6 "> |
295 | 295 | <input type="text" name="remote_restore_url" id="remote_restore_url" class="validate" |
296 | 296 | placeholder="Restore Target Url"> |
297 | - <label><?php echo __( "With Target Home Url", 'xcloner-backup-and-restore' ) ?></label> |
|
297 | + <label><?php echo __("With Target Home Url", 'xcloner-backup-and-restore') ?></label> |
|
298 | 298 | </div> |
299 | 299 | |
300 | - <?php if ( site_url() != home_url() ) : ?> |
|
300 | + <?php if (site_url() != home_url()) : ?> |
|
301 | 301 | <div class="input-field col s12 m6 "> |
302 | 302 | <input type="text" name="wp_site_url" id="wp_site_url" class="validate" |
303 | 303 | placeholder="WP Site Url" value="<?php echo site_url(); ?>"> |
304 | - <label><?php echo __( "Source Site Url", 'xcloner-backup-and-restore' ) ?></label> |
|
304 | + <label><?php echo __("Source Site Url", 'xcloner-backup-and-restore') ?></label> |
|
305 | 305 | </div> |
306 | 306 | |
307 | 307 | <div class="input-field col s12 m6 "> |
308 | 308 | <input type="text" name="remote_restore_site_url" id="remote_restore_site_url" |
309 | 309 | class="validate" placeholder="Restore Target Url"> |
310 | - <label><?php echo __( "With Target Site Url", 'xcloner-backup-and-restore' ) ?></label> |
|
310 | + <label><?php echo __("With Target Site Url", 'xcloner-backup-and-restore') ?></label> |
|
311 | 311 | </div> |
312 | 312 | |
313 | 313 | <?php endif; ?> |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | <div class="input-field row"> |
320 | 320 | <select id="remote_database_file" name="remote_database_file" class="browser-default"> |
321 | 321 | <option value="" disabled |
322 | - selected><?php echo __( "Please select the target database backup file to restore", 'xcloner-backup-and-restore' ) ?></option> |
|
322 | + selected><?php echo __("Please select the target database backup file to restore", 'xcloner-backup-and-restore') ?></option> |
|
323 | 323 | </select> |
324 | 324 | |
325 | 325 | <label></label> |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | |
332 | 332 | <div class="status"></div> |
333 | 333 | <div class="query-box"> |
334 | - <h6><?php echo __( 'Use the field below to fix your mysql query and Retry again the Restore, or replace with # to Skip next', 'xcloner-backup-and-restore' ) ?></h6> |
|
334 | + <h6><?php echo __('Use the field below to fix your mysql query and Retry again the Restore, or replace with # to Skip next', 'xcloner-backup-and-restore') ?></h6> |
|
335 | 335 | <textarea class="query-list" cols="5"></textarea> |
336 | 336 | </div> |
337 | 337 | </div> |
@@ -339,20 +339,20 @@ discard block |
||
339 | 339 | <div class="col s12 l5 right-align"> |
340 | 340 | <div class="toggler"> |
341 | 341 | <button class="btn waves-effect waves-light restore_remote_mysqldump normal " type="submit" |
342 | - id="" name="action"><?php echo __( "Restore", 'xcloner-backup-and-restore' ) ?> |
|
342 | + id="" name="action"><?php echo __("Restore", 'xcloner-backup-and-restore') ?> |
|
343 | 343 | <i class="material-icons left">navigate_before</i> |
344 | 344 | </button> |
345 | 345 | <button class="btn waves-effect waves-light red restore_remote_mysqldump cancel" |
346 | 346 | type="submit" id="" |
347 | - name="action"><?php echo __( "Cancel", 'xcloner-backup-and-restore' ) ?> |
|
347 | + name="action"><?php echo __("Cancel", 'xcloner-backup-and-restore') ?> |
|
348 | 348 | <i class="material-icons right">close</i> |
349 | 349 | </button> |
350 | 350 | </div> |
351 | 351 | |
352 | 352 | <button class="btn waves-effect waves-light grey" type="submit" |
353 | - title="<?php echo __( "Skip Next", 'xcloner-backup-and-restore' ) ?>" |
|
353 | + title="<?php echo __("Skip Next", 'xcloner-backup-and-restore') ?>" |
|
354 | 354 | id="skip_restore_remote_database_step" |
355 | - name="action"><?php echo __( "Skip Next", 'xcloner-backup-and-restore' ) ?> |
|
355 | + name="action"><?php echo __("Skip Next", 'xcloner-backup-and-restore') ?> |
|
356 | 356 | <i class="material-icons right">navigate_next</i> |
357 | 357 | </button> |
358 | 358 | |
@@ -363,13 +363,13 @@ discard block |
||
363 | 363 | |
364 | 364 | <li data-step="5" class="restore-finish-step steps active"> |
365 | 365 | <div class="collapsible-header"><i |
366 | - class="material-icons">folder_open</i><?php echo __( "Finishing up...", 'xcloner-backup-and-restore' ) ?> |
|
366 | + class="material-icons">folder_open</i><?php echo __("Finishing up...", 'xcloner-backup-and-restore') ?> |
|
367 | 367 | </div> |
368 | 368 | <div class="collapsible-body row"> |
369 | 369 | |
370 | 370 | <div class="row"> |
371 | 371 | <div class="col s4"> |
372 | - <label><?php echo __( "Update wp-config.php mysql details and update the Target Site Url", 'xcloner-backup-and-restore' ) ?></label> |
|
372 | + <label><?php echo __("Update wp-config.php mysql details and update the Target Site Url", 'xcloner-backup-and-restore') ?></label> |
|
373 | 373 | </div> |
374 | 374 | |
375 | 375 | <div class="col s8"> |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | |
388 | 388 | <div class="row"> |
389 | 389 | <div class="col s4"> |
390 | - <label><?php echo __( "Delete Restored Backup Temporary Folder", 'xcloner-backup-and-restore' ) ?></label> |
|
390 | + <label><?php echo __("Delete Restored Backup Temporary Folder", 'xcloner-backup-and-restore') ?></label> |
|
391 | 391 | </div> |
392 | 392 | <div class="col s8"> |
393 | 393 | <div class="switch"> |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | |
405 | 405 | <div class="row"> |
406 | 406 | <div class="col s4"> |
407 | - <label><?php echo __( "Delete Restore Script", 'xcloner-backup-and-restore' ) ?></label> |
|
407 | + <label><?php echo __("Delete Restore Script", 'xcloner-backup-and-restore') ?></label> |
|
408 | 408 | </div> |
409 | 409 | <div class="col s8"> |
410 | 410 | <div class="switch"> |
@@ -424,8 +424,8 @@ discard block |
||
424 | 424 | </div> |
425 | 425 | |
426 | 426 | <div class=" row col s12 center-align" id="xcloner_restore_finish"> |
427 | - <h5><?php echo __( "Thank you for using XCloner.", 'xcloner-backup-and-restore' ) ?></h5> |
|
428 | - <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" target="_blank">Wordpress XCloner forums</a>' ) ?></h6> |
|
427 | + <h5><?php echo __("Thank you for using XCloner.", 'xcloner-backup-and-restore') ?></h5> |
|
428 | + <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" target="_blank">Wordpress XCloner forums</a>') ?></h6> |
|
429 | 429 | <a class="twitter-follow-button" href="https://twitter.com/thinkovi" data-show-count="false">Follow |
430 | 430 | @thinkovi</a> |
431 | 431 | <script src="//platform.twitter.com/widgets.js" async="" charset="utf-8"></script> |
@@ -435,14 +435,14 @@ discard block |
||
435 | 435 | <div class="row"> |
436 | 436 | <div class="col s6 right-align"> |
437 | 437 | <button class="btn waves-effect waves-light teal" type="submit" id="restore_finish" |
438 | - name="action"><?php echo __( "Finish", 'xcloner-backup-and-restore' ) ?> |
|
438 | + name="action"><?php echo __("Finish", 'xcloner-backup-and-restore') ?> |
|
439 | 439 | <i class="material-icons right">navigate_next</i> |
440 | 440 | </button> |
441 | 441 | </div> |
442 | 442 | |
443 | 443 | <div id="open_target_site" class="col s6 left-align"> |
444 | 444 | <a disabled="disabled" href="#" class="btn waves-effect waves-light teal" type="button" |
445 | - target="_blank"><?php echo __( "Open Target Site", 'xcloner-backup-and-restore' ) ?> |
|
445 | + target="_blank"><?php echo __("Open Target Site", 'xcloner-backup-and-restore') ?> |
|
446 | 446 | <i class="material-icons right">navigate_next</i> |
447 | 447 | </a> |
448 | 448 | </div> |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | <!-- List Backup Content Modal--> |
460 | 460 | <div id="backup_cotent_modal" class="modal"> |
461 | 461 | <div class="modal-content"> |
462 | - <h4><?php echo sprintf( __( "Listing Backup Content ", 'xcloner-backup-and-restore' ), "" ) ?></h4> |
|
462 | + <h4><?php echo sprintf(__("Listing Backup Content ", 'xcloner-backup-and-restore'), "") ?></h4> |
|
463 | 463 | <h5 class="backup-name"></h5> |
464 | 464 | |
465 | 465 | <div class="progress"> |
@@ -7,17 +7,17 @@ |
||
7 | 7 | <div class="col s12 "> |
8 | 8 | <div> |
9 | 9 | <h5 class="left-align"> |
10 | - <?php echo __( 'XCloner Debugger Dashboard', 'xcloner-backup-and-restore' ) ?> |
|
10 | + <?php echo __('XCloner Debugger Dashboard', 'xcloner-backup-and-restore') ?> |
|
11 | 11 | </h5> |
12 | 12 | |
13 | - <?php if ( $xcloner_settings->get_xcloner_option( 'xcloner_enable_log' ) ) : ?> |
|
13 | + <?php if ($xcloner_settings->get_xcloner_option('xcloner_enable_log')) : ?> |
|
14 | 14 | <ul class="collapsible xcloner-debugger" data-collapsible="accordion"> |
15 | 15 | <li class="active"> |
16 | 16 | <div class="collapsible-header active"><i class="material-icons">bug_report</i>XCloner Debugger |
17 | 17 | </div> |
18 | 18 | <div class="collapsible-body"> |
19 | - <div class="console" id="xcloner-console"><?php if ( isset( $logger_content ) ) { |
|
20 | - echo implode( "<br />\n", $logger_content ); |
|
19 | + <div class="console" id="xcloner-console"><?php if (isset($logger_content)) { |
|
20 | + echo implode("<br />\n", $logger_content); |
|
21 | 21 | } ?></div> |
22 | 22 | </div> |
23 | 23 | </li> |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @param string $plugin_name The name of this plugin. |
51 | 51 | * @param string $version The version of this plugin. |
52 | 52 | */ |
53 | - public function __construct( Xcloner $xcloner_container ) { |
|
53 | + public function __construct(Xcloner $xcloner_container) { |
|
54 | 54 | |
55 | 55 | $this->plugin_name = $xcloner_container->get_plugin_name(); |
56 | 56 | $this->version = $xcloner_container->get_version(); |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @since 1.0.0 |
68 | 68 | */ |
69 | - public function enqueue_styles( $hook ) { |
|
69 | + public function enqueue_styles($hook) { |
|
70 | 70 | |
71 | - if ( ! stristr( $hook, "page_" . $this->plugin_name ) || ( isset( $_GET['option'] ) and $_GET['option'] == "com_cloner" ) ) { |
|
71 | + if (!stristr($hook, "page_".$this->plugin_name) || (isset($_GET['option']) and $_GET['option'] == "com_cloner")) { |
|
72 | 72 | return; |
73 | 73 | } |
74 | 74 | |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | * class. |
85 | 85 | */ |
86 | 86 | |
87 | - wp_enqueue_style( $this->plugin_name . "_materialize", plugin_dir_url( __FILE__ ) . 'css/materialize.min.css', array(), $this->version, 'all' ); |
|
88 | - wp_enqueue_style( $this->plugin_name . "_materialize.clockpicker", plugin_dir_url( __FILE__ ) . 'css/materialize.clockpicker.css', array(), $this->version, 'all' ); |
|
89 | - wp_enqueue_style( $this->plugin_name . "_materialize.icons", '//fonts.googleapis.com/icon?family=Material+Icons', array(), $this->version, 'all' ); |
|
90 | - wp_enqueue_style( $this->plugin_name . "_jquery.datatables", plugin_dir_url( __FILE__ ) . 'css/jquery.dataTables.min.css', array(), $this->version, 'all' ); |
|
91 | - wp_enqueue_style( $this->plugin_name . "_jquery.datatables.responsive", plugin_dir_url( __FILE__ ) . 'css/responsive.dataTables.css', array(), $this->version, 'all' ); |
|
92 | - wp_enqueue_style( $this->plugin_name . "_jstree", dirname( plugin_dir_url( __FILE__ ) ) . '/vendor/vakata/jstree/dist/themes/default/style.min.css', array(), '3.3', 'all' ); |
|
93 | - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/xcloner-admin.css', array(), $this->version, 'all' ); |
|
87 | + wp_enqueue_style($this->plugin_name."_materialize", plugin_dir_url(__FILE__).'css/materialize.min.css', array(), $this->version, 'all'); |
|
88 | + wp_enqueue_style($this->plugin_name."_materialize.clockpicker", plugin_dir_url(__FILE__).'css/materialize.clockpicker.css', array(), $this->version, 'all'); |
|
89 | + wp_enqueue_style($this->plugin_name."_materialize.icons", '//fonts.googleapis.com/icon?family=Material+Icons', array(), $this->version, 'all'); |
|
90 | + wp_enqueue_style($this->plugin_name."_jquery.datatables", plugin_dir_url(__FILE__).'css/jquery.dataTables.min.css', array(), $this->version, 'all'); |
|
91 | + wp_enqueue_style($this->plugin_name."_jquery.datatables.responsive", plugin_dir_url(__FILE__).'css/responsive.dataTables.css', array(), $this->version, 'all'); |
|
92 | + wp_enqueue_style($this->plugin_name."_jstree", dirname(plugin_dir_url(__FILE__)).'/vendor/vakata/jstree/dist/themes/default/style.min.css', array(), '3.3', 'all'); |
|
93 | + wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/xcloner-admin.css', array(), $this->version, 'all'); |
|
94 | 94 | |
95 | 95 | } |
96 | 96 | |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @since 1.0.0 |
101 | 101 | */ |
102 | - public function enqueue_scripts( $hook ) { |
|
102 | + public function enqueue_scripts($hook) { |
|
103 | 103 | |
104 | - if ( ! stristr( $hook, "page_" . $this->plugin_name ) ) { |
|
104 | + if (!stristr($hook, "page_".$this->plugin_name)) { |
|
105 | 105 | return; |
106 | 106 | } |
107 | 107 | |
@@ -118,25 +118,25 @@ discard block |
||
118 | 118 | */ |
119 | 119 | |
120 | 120 | add_thickbox(); |
121 | - wp_enqueue_script( 'plugin-install' ); |
|
122 | - wp_enqueue_script( 'updates' ); |
|
123 | - wp_enqueue_script( $this->plugin_name . "_materialize", plugin_dir_url( __FILE__ ) . 'js/materialize.min.js', array( 'jquery' ), $this->version, false ); |
|
124 | - wp_enqueue_script( $this->plugin_name . "_materialize.clockpicker", plugin_dir_url( __FILE__ ) . 'js/materialize.clockpicker.js', array( 'jquery' ), $this->version, false ); |
|
125 | - wp_enqueue_script( $this->plugin_name . "_jquery.datatables", plugin_dir_url( __FILE__ ) . 'js/jquery.dataTables.min.js', array( 'jquery' ), $this->version, false ); |
|
126 | - wp_enqueue_script( $this->plugin_name . "_jquery.datatables.respnsive", plugin_dir_url( __FILE__ ) . 'js/dataTables.responsive.js', array( 'jquery' ), $this->version, false ); |
|
127 | - wp_enqueue_script( $this->plugin_name . "_vakata", dirname( plugin_dir_url( __FILE__ ) ) . '/vendor/vakata/jstree/dist/jstree.min.js', array( 'jquery' ), '3.3', false ); |
|
128 | - wp_enqueue_script( $this->plugin_name . "_xcloner-backup-class", plugin_dir_url( __FILE__ ) . 'js/xcloner-backup-class.js', array( 'jquery' ), $this->version, false ); |
|
129 | - wp_enqueue_script( $this->plugin_name . "_xcloner-scheduler-class", plugin_dir_url( __FILE__ ) . 'js/xcloner-scheduler-class.js', array( 'jquery' ), $this->version, false ); |
|
130 | - wp_enqueue_script( $this->plugin_name . "_xcloner-restore-class", plugin_dir_url( __FILE__ ) . 'js/xcloner-restore-class.js', array( 'jquery' ), $this->version, false ); |
|
131 | - wp_enqueue_script( $this->plugin_name . "_xcloner-manage-backups-class", plugin_dir_url( __FILE__ ) . 'js/xcloner-manage-backups-class.js', array( 'jquery' ), $this->version, false ); |
|
132 | - wp_enqueue_script( $this->plugin_name . "_xcloner-remote-storage-class", plugin_dir_url( __FILE__ ) . 'js/xcloner-remote-storage-class.js', array( 'jquery' ), $this->version, false ); |
|
133 | - wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/xcloner-admin.js', array( 'jquery' ), $this->version, false ); |
|
121 | + wp_enqueue_script('plugin-install'); |
|
122 | + wp_enqueue_script('updates'); |
|
123 | + wp_enqueue_script($this->plugin_name."_materialize", plugin_dir_url(__FILE__).'js/materialize.min.js', array('jquery'), $this->version, false); |
|
124 | + wp_enqueue_script($this->plugin_name."_materialize.clockpicker", plugin_dir_url(__FILE__).'js/materialize.clockpicker.js', array('jquery'), $this->version, false); |
|
125 | + wp_enqueue_script($this->plugin_name."_jquery.datatables", plugin_dir_url(__FILE__).'js/jquery.dataTables.min.js', array('jquery'), $this->version, false); |
|
126 | + wp_enqueue_script($this->plugin_name."_jquery.datatables.respnsive", plugin_dir_url(__FILE__).'js/dataTables.responsive.js', array('jquery'), $this->version, false); |
|
127 | + wp_enqueue_script($this->plugin_name."_vakata", dirname(plugin_dir_url(__FILE__)).'/vendor/vakata/jstree/dist/jstree.min.js', array('jquery'), '3.3', false); |
|
128 | + wp_enqueue_script($this->plugin_name."_xcloner-backup-class", plugin_dir_url(__FILE__).'js/xcloner-backup-class.js', array('jquery'), $this->version, false); |
|
129 | + wp_enqueue_script($this->plugin_name."_xcloner-scheduler-class", plugin_dir_url(__FILE__).'js/xcloner-scheduler-class.js', array('jquery'), $this->version, false); |
|
130 | + wp_enqueue_script($this->plugin_name."_xcloner-restore-class", plugin_dir_url(__FILE__).'js/xcloner-restore-class.js', array('jquery'), $this->version, false); |
|
131 | + wp_enqueue_script($this->plugin_name."_xcloner-manage-backups-class", plugin_dir_url(__FILE__).'js/xcloner-manage-backups-class.js', array('jquery'), $this->version, false); |
|
132 | + wp_enqueue_script($this->plugin_name."_xcloner-remote-storage-class", plugin_dir_url(__FILE__).'js/xcloner-remote-storage-class.js', array('jquery'), $this->version, false); |
|
133 | + wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__).'js/xcloner-admin.js', array('jquery'), $this->version, false); |
|
134 | 134 | |
135 | 135 | |
136 | 136 | } |
137 | 137 | |
138 | 138 | public function xcloner_init_page() { |
139 | - require_once( "partials/xcloner_init_page.php" ); |
|
139 | + require_once("partials/xcloner_init_page.php"); |
|
140 | 140 | |
141 | 141 | } |
142 | 142 | |
@@ -145,70 +145,70 @@ discard block |
||
145 | 145 | $remote_storage = $this->get_xcloner_container()->get_xcloner_remote_storage(); |
146 | 146 | |
147 | 147 | |
148 | - if ( isset( $_POST['action'] ) ) { |
|
149 | - $_POST['action'] = $xcloner_sanitization->sanitize_input_as_string( $_POST['action'] ); |
|
150 | - $remote_storage->save( $_POST['action'] ); |
|
148 | + if (isset($_POST['action'])) { |
|
149 | + $_POST['action'] = $xcloner_sanitization->sanitize_input_as_string($_POST['action']); |
|
150 | + $remote_storage->save($_POST['action']); |
|
151 | 151 | } |
152 | 152 | |
153 | - if ( isset( $_POST['authentification_code'] ) && $_POST['authentification_code'] != "" ) { |
|
154 | - $_POST['authentification_code'] = $xcloner_sanitization->sanitize_input_as_string( $_POST['authentification_code'] ); |
|
153 | + if (isset($_POST['authentification_code']) && $_POST['authentification_code'] != "") { |
|
154 | + $_POST['authentification_code'] = $xcloner_sanitization->sanitize_input_as_string($_POST['authentification_code']); |
|
155 | 155 | |
156 | - $remote_storage->set_access_token( $_POST['authentification_code'] ); |
|
156 | + $remote_storage->set_access_token($_POST['authentification_code']); |
|
157 | 157 | } |
158 | 158 | |
159 | - if ( isset( $_POST['connection_check'] ) && $_POST['connection_check'] ) { |
|
160 | - $remote_storage->check( $_POST['action'] ); |
|
159 | + if (isset($_POST['connection_check']) && $_POST['connection_check']) { |
|
160 | + $remote_storage->check($_POST['action']); |
|
161 | 161 | } |
162 | 162 | |
163 | - require_once( "partials/xcloner_remote_storage_page.php" ); |
|
163 | + require_once("partials/xcloner_remote_storage_page.php"); |
|
164 | 164 | |
165 | 165 | } |
166 | 166 | |
167 | 167 | public function xcloner_scheduled_backups_page() { |
168 | 168 | $requirements = $this->xcloner_container->get_xcloner_requirements(); |
169 | 169 | |
170 | - if ( ! $requirements->check_backup_ready_status() ) { |
|
171 | - require_once( "partials/xcloner_init_page.php" ); |
|
170 | + if (!$requirements->check_backup_ready_status()) { |
|
171 | + require_once("partials/xcloner_init_page.php"); |
|
172 | 172 | |
173 | 173 | return false; |
174 | 174 | } |
175 | 175 | |
176 | - require_once( "partials/xcloner_scheduled_backups_page.php" ); |
|
176 | + require_once("partials/xcloner_scheduled_backups_page.php"); |
|
177 | 177 | |
178 | 178 | } |
179 | 179 | |
180 | 180 | public function xcloner_manage_backups_page() { |
181 | - require_once( "partials/xcloner_manage_backups_page.php" ); |
|
181 | + require_once("partials/xcloner_manage_backups_page.php"); |
|
182 | 182 | |
183 | 183 | } |
184 | 184 | |
185 | 185 | public function xcloner_debugger_page() { |
186 | - require_once( "partials/xcloner_console_page.php" ); |
|
186 | + require_once("partials/xcloner_console_page.php"); |
|
187 | 187 | |
188 | 188 | } |
189 | 189 | |
190 | 190 | public function xcloner_restore_page() { |
191 | - require_once( "partials/xcloner_restore_page.php" ); |
|
191 | + require_once("partials/xcloner_restore_page.php"); |
|
192 | 192 | |
193 | 193 | } |
194 | 194 | |
195 | 195 | public function xcloner_generate_backups_page() { |
196 | 196 | $requirements = $this->xcloner_container->get_xcloner_requirements(); |
197 | 197 | |
198 | - if ( ! $requirements->check_backup_ready_status() ) { |
|
199 | - require_once( "partials/xcloner_init_page.php" ); |
|
198 | + if (!$requirements->check_backup_ready_status()) { |
|
199 | + require_once("partials/xcloner_init_page.php"); |
|
200 | 200 | |
201 | 201 | return false; |
202 | 202 | } |
203 | 203 | |
204 | - require_once( "partials/xcloner_generate_backups_page.php" ); |
|
204 | + require_once("partials/xcloner_generate_backups_page.php"); |
|
205 | 205 | |
206 | 206 | return; |
207 | 207 | } |
208 | 208 | |
209 | 209 | public function xcloner_settings_page() { |
210 | 210 | // check user capabilities |
211 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
211 | + if (!current_user_can('manage_options')) { |
|
212 | 212 | return; |
213 | 213 | } |
214 | 214 | |
@@ -216,40 +216,40 @@ discard block |
||
216 | 216 | |
217 | 217 | // check if the user have submitted the settings |
218 | 218 | // wordpress will add the "settings-updated" $_GET parameter to the url |
219 | - if ( isset( $_GET['settings-updated'] ) ) { |
|
219 | + if (isset($_GET['settings-updated'])) { |
|
220 | 220 | // add settings saved message with the class of "updated" |
221 | - add_settings_error( 'wporg_messages', 'wporg_message', __( 'Settings Saved', 'wporg' ), 'updated' ); |
|
221 | + add_settings_error('wporg_messages', 'wporg_message', __('Settings Saved', 'wporg'), 'updated'); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | // show error/update messages |
225 | - settings_errors( 'wporg_messages' ); |
|
225 | + settings_errors('wporg_messages'); |
|
226 | 226 | ?> |
227 | 227 | |
228 | 228 | <?php |
229 | 229 | $xcloner_sanitization = $this->get_xcloner_container()->get_xcloner_sanitization(); |
230 | 230 | |
231 | - if ( isset( $_GET['tab'] ) ) { |
|
232 | - $active_tab = $xcloner_sanitization->sanitize_input_as_string( $_GET['tab'] ); |
|
231 | + if (isset($_GET['tab'])) { |
|
232 | + $active_tab = $xcloner_sanitization->sanitize_input_as_string($_GET['tab']); |
|
233 | 233 | } // end if |
234 | 234 | else { |
235 | 235 | $active_tab = "general_options"; |
236 | 236 | } |
237 | 237 | |
238 | 238 | ?> |
239 | - <h1><?= esc_html( get_admin_page_title() ); ?></h1> |
|
239 | + <h1><?= esc_html(get_admin_page_title()); ?></h1> |
|
240 | 240 | |
241 | 241 | <ul class="nav-tab-wrapper row"> |
242 | 242 | <li><a href="?page=xcloner_settings_page&tab=general_options" |
243 | - class="nav-tab col s12 m3 l2 <?php echo $active_tab == 'general_options' ? 'nav-tab-active' : ''; ?>"><?php echo __( 'General Options', 'xcloner-backup-and-restore' ) ?></a> |
|
243 | + class="nav-tab col s12 m3 l2 <?php echo $active_tab == 'general_options' ? 'nav-tab-active' : ''; ?>"><?php echo __('General Options', 'xcloner-backup-and-restore') ?></a> |
|
244 | 244 | </li> |
245 | 245 | <li><a href="?page=xcloner_settings_page&tab=mysql_options" |
246 | - class="nav-tab col s12 m3 l2 <?php echo $active_tab == 'mysql_options' ? 'nav-tab-active' : ''; ?>"><?php echo __( 'Mysql Options', 'xcloner-backup-and-restore' ) ?></a> |
|
246 | + class="nav-tab col s12 m3 l2 <?php echo $active_tab == 'mysql_options' ? 'nav-tab-active' : ''; ?>"><?php echo __('Mysql Options', 'xcloner-backup-and-restore') ?></a> |
|
247 | 247 | </li> |
248 | 248 | <li><a href="?page=xcloner_settings_page&tab=system_options" |
249 | - class="nav-tab col s12 m3 l2 <?php echo $active_tab == 'system_options' ? 'nav-tab-active' : ''; ?>"><?php echo __( 'System Options', 'xcloner-backup-and-restore' ) ?></a> |
|
249 | + class="nav-tab col s12 m3 l2 <?php echo $active_tab == 'system_options' ? 'nav-tab-active' : ''; ?>"><?php echo __('System Options', 'xcloner-backup-and-restore') ?></a> |
|
250 | 250 | </li> |
251 | 251 | <li><a href="?page=xcloner_settings_page&tab=cleanup_options" |
252 | - class="nav-tab col s12 m3 l2 <?php echo $active_tab == 'cleanup_options' ? 'nav-tab-active' : ''; ?>"><?php echo __( 'Cleanup Options', 'xcloner-backup-and-restore' ) ?></a> |
|
252 | + class="nav-tab col s12 m3 l2 <?php echo $active_tab == 'cleanup_options' ? 'nav-tab-active' : ''; ?>"><?php echo __('Cleanup Options', 'xcloner-backup-and-restore') ?></a> |
|
253 | 253 | </li> |
254 | 254 | </ul> |
255 | 255 | |
@@ -258,27 +258,27 @@ discard block |
||
258 | 258 | <form action="options.php" method="post"> |
259 | 259 | <?php |
260 | 260 | |
261 | - if ( $active_tab == 'general_options' ) { |
|
261 | + if ($active_tab == 'general_options') { |
|
262 | 262 | |
263 | - settings_fields( 'xcloner_general_settings_group' ); |
|
264 | - do_settings_sections( 'xcloner_settings_page' ); |
|
263 | + settings_fields('xcloner_general_settings_group'); |
|
264 | + do_settings_sections('xcloner_settings_page'); |
|
265 | 265 | |
266 | - } elseif ( $active_tab == 'mysql_options' ) { |
|
266 | + } elseif ($active_tab == 'mysql_options') { |
|
267 | 267 | |
268 | - settings_fields( 'xcloner_mysql_settings_group' ); |
|
269 | - do_settings_sections( 'xcloner_mysql_settings_page' ); |
|
270 | - } elseif ( $active_tab == 'system_options' ) { |
|
268 | + settings_fields('xcloner_mysql_settings_group'); |
|
269 | + do_settings_sections('xcloner_mysql_settings_page'); |
|
270 | + } elseif ($active_tab == 'system_options') { |
|
271 | 271 | |
272 | - settings_fields( 'xcloner_system_settings_group' ); |
|
273 | - do_settings_sections( 'xcloner_system_settings_page' ); |
|
274 | - } elseif ( $active_tab == 'cleanup_options' ) { |
|
272 | + settings_fields('xcloner_system_settings_group'); |
|
273 | + do_settings_sections('xcloner_system_settings_page'); |
|
274 | + } elseif ($active_tab == 'cleanup_options') { |
|
275 | 275 | |
276 | - settings_fields( 'xcloner_cleanup_settings_group' ); |
|
277 | - do_settings_sections( 'xcloner_cleanup_settings_page' ); |
|
276 | + settings_fields('xcloner_cleanup_settings_group'); |
|
277 | + do_settings_sections('xcloner_cleanup_settings_page'); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | // output save settings button |
281 | - submit_button( 'Save Settings' ); |
|
281 | + submit_button('Save Settings'); |
|
282 | 282 | ?> |
283 | 283 | </form> |
284 | 284 |
@@ -25,17 +25,17 @@ discard block |
||
25 | 25 | */ |
26 | 26 | |
27 | 27 | // If this file is called directly, abort. |
28 | -if ( ! defined( 'WPINC' ) ) { |
|
28 | +if (!defined('WPINC')) { |
|
29 | 29 | die; |
30 | 30 | } |
31 | 31 | |
32 | 32 | //i will not load the plugin outside admin or cron |
33 | -if ( ! is_admin() and ! defined( 'DOING_CRON' ) ) { |
|
33 | +if (!is_admin() and !defined('DOING_CRON')) { |
|
34 | 34 | return; |
35 | 35 | } |
36 | 36 | |
37 | -if ( ! defined( "DS" ) ) { |
|
38 | - define( "DS", DIRECTORY_SEPARATOR ); |
|
37 | +if (!defined("DS")) { |
|
38 | + define("DS", DIRECTORY_SEPARATOR); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * This action is documented in includes/class-xcloner-activator.php |
44 | 44 | */ |
45 | 45 | function activate_xcloner() { |
46 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-xcloner-activator.php'; |
|
46 | + require_once plugin_dir_path(__FILE__).'includes/class-xcloner-activator.php'; |
|
47 | 47 | Xcloner_Activator::activate(); |
48 | 48 | } |
49 | 49 | |
@@ -52,31 +52,31 @@ discard block |
||
52 | 52 | * This action is documented in includes/class-xcloner-deactivator.php |
53 | 53 | */ |
54 | 54 | function deactivate_xcloner() { |
55 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-xcloner-deactivator.php'; |
|
55 | + require_once plugin_dir_path(__FILE__).'includes/class-xcloner-deactivator.php'; |
|
56 | 56 | Xcloner_Deactivator::deactivate(); |
57 | 57 | } |
58 | 58 | |
59 | -register_activation_hook( __FILE__, 'activate_xcloner' ); |
|
60 | -register_deactivation_hook( __FILE__, 'deactivate_xcloner' ); |
|
59 | +register_activation_hook(__FILE__, 'activate_xcloner'); |
|
60 | +register_deactivation_hook(__FILE__, 'deactivate_xcloner'); |
|
61 | 61 | |
62 | -require_once plugin_dir_path( __FILE__ ) . 'includes/class-xcloner-activator.php'; |
|
62 | +require_once plugin_dir_path(__FILE__).'includes/class-xcloner-activator.php'; |
|
63 | 63 | |
64 | -if ( version_compare( phpversion(), Xcloner_Activator::xcloner_minimum_version, '<' ) ) { |
|
64 | +if (version_compare(phpversion(), Xcloner_Activator::xcloner_minimum_version, '<')) { |
|
65 | 65 | ?> |
66 | 66 | <div class="error notice"> |
67 | - <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> |
|
67 | + <p><?php echo sprintf(__("XCloner requires minimum PHP version %s in order to run correctly. We have detected your version as %s. Plugin is now deactivated."), Xcloner_Activator::xcloner_minimum_version, phpversion()) ?></p> |
|
68 | 68 | </div> |
69 | 69 | <?php |
70 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
71 | - deactivate_plugins( plugin_basename( __FILE__ ) ); |
|
70 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
71 | + deactivate_plugins(plugin_basename(__FILE__)); |
|
72 | 72 | |
73 | 73 | return; |
74 | 74 | } |
75 | 75 | |
76 | -$db_installed_ver = get_option( "xcloner_db_version" ); |
|
76 | +$db_installed_ver = get_option("xcloner_db_version"); |
|
77 | 77 | $xcloner_db_version = Xcloner_Activator::xcloner_db_version; |
78 | 78 | |
79 | -if ( $db_installed_ver != $xcloner_db_version ) { |
|
79 | +if ($db_installed_ver != $xcloner_db_version) { |
|
80 | 80 | Xcloner_Activator::activate(); |
81 | 81 | } |
82 | 82 | |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | */ |
88 | 88 | |
89 | 89 | function xcloner_stop_heartbeat() { |
90 | - wp_deregister_script( 'heartbeat' ); |
|
90 | + wp_deregister_script('heartbeat'); |
|
91 | 91 | } |
92 | 92 | |
93 | -if ( isset( $_GET['page'] ) and stristr( $_GET['page'], "xcloner_" ) ) { |
|
94 | - add_action( 'init', 'xcloner_stop_heartbeat', 1 ); |
|
93 | +if (isset($_GET['page']) and stristr($_GET['page'], "xcloner_")) { |
|
94 | + add_action('init', 'xcloner_stop_heartbeat', 1); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | return $plugin; |
113 | 113 | } |
114 | 114 | |
115 | -require_once( plugin_dir_path( __FILE__ ) . '/vendor/autoload.php' ); |
|
116 | -require plugin_dir_path( __FILE__ ) . 'includes/class-xcloner.php'; |
|
115 | +require_once(plugin_dir_path(__FILE__).'/vendor/autoload.php'); |
|
116 | +require plugin_dir_path(__FILE__).'includes/class-xcloner.php'; |
|
117 | 117 | |
118 | 118 | try { |
119 | 119 | $xcloner_plugin = run_xcloner(); |
120 | -} catch ( Exception $e ) { |
|
120 | +}catch (Exception $e) { |
|
121 | 121 | echo $e->getMessage(); |
122 | 122 | } |
123 | 123 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param string $plugin_name The name of the plugin. |
49 | 49 | * @param string $version The version of this plugin. |
50 | 50 | */ |
51 | - public function __construct( Xcloner $xcloner_container ) { |
|
51 | + public function __construct(Xcloner $xcloner_container) { |
|
52 | 52 | |
53 | 53 | $this->plugin_name = $xcloner_container->get_plugin_name(); |
54 | 54 | $this->version = $xcloner_container->get_version(); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * class. |
75 | 75 | */ |
76 | 76 | |
77 | - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/xcloner-public.css', array(), $this->version, 'all' ); |
|
77 | + wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/xcloner-public.css', array(), $this->version, 'all'); |
|
78 | 78 | |
79 | 79 | } |
80 | 80 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * class. |
98 | 98 | */ |
99 | 99 | |
100 | - wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/xcloner-public.js', array( 'jquery' ), $this->version, false ); |
|
100 | + wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__).'js/xcloner-public.js', array('jquery'), $this->version, false); |
|
101 | 101 | |
102 | 102 | } |
103 | 103 |
@@ -7,29 +7,29 @@ discard block |
||
7 | 7 | public function __construct() { |
8 | 8 | } |
9 | 9 | |
10 | - public function sanitize_input_as_int( $option ) { |
|
11 | - return filter_var( $option, FILTER_SANITIZE_NUMBER_INT ); |
|
10 | + public function sanitize_input_as_int($option) { |
|
11 | + return filter_var($option, FILTER_SANITIZE_NUMBER_INT); |
|
12 | 12 | } |
13 | 13 | |
14 | - public function sanitize_input_as_float( $option ) { |
|
15 | - return filter_var( $option, FILTER_VALIDATE_FLOAT ); |
|
14 | + public function sanitize_input_as_float($option) { |
|
15 | + return filter_var($option, FILTER_VALIDATE_FLOAT); |
|
16 | 16 | } |
17 | 17 | |
18 | - public function sanitize_input_as_string( $option ) { |
|
19 | - return filter_var( $option, FILTER_SANITIZE_STRING ); |
|
18 | + public function sanitize_input_as_string($option) { |
|
19 | + return filter_var($option, FILTER_SANITIZE_STRING); |
|
20 | 20 | } |
21 | 21 | |
22 | - public function sanitize_input_as_absolute_path( $option ) { |
|
23 | - $path = filter_var( $option, FILTER_SANITIZE_URL ); |
|
22 | + public function sanitize_input_as_absolute_path($option) { |
|
23 | + $path = filter_var($option, FILTER_SANITIZE_URL); |
|
24 | 24 | |
25 | 25 | try { |
26 | - $option = Util::normalizePath( $path ); |
|
27 | - } catch ( Exception $e ) { |
|
28 | - add_settings_error( 'xcloner_error_message', '', __( $e->getMessage() ), 'error' ); |
|
26 | + $option = Util::normalizePath($path); |
|
27 | + }catch (Exception $e) { |
|
28 | + add_settings_error('xcloner_error_message', '', __($e->getMessage()), 'error'); |
|
29 | 29 | } |
30 | 30 | |
31 | - if ( $path and ! is_dir( $path ) ) { |
|
32 | - add_settings_error( 'xcloner_error_message', '', __( sprintf( 'Invalid Server Path %s', $option ) ), 'error' ); |
|
31 | + if ($path and !is_dir($path)) { |
|
32 | + add_settings_error('xcloner_error_message', '', __(sprintf('Invalid Server Path %s', $option)), 'error'); |
|
33 | 33 | |
34 | 34 | return false; |
35 | 35 | } |
@@ -37,23 +37,23 @@ discard block |
||
37 | 37 | return $path; |
38 | 38 | } |
39 | 39 | |
40 | - public function sanitize_input_as_path( $option ) { |
|
41 | - return filter_var( $option, FILTER_SANITIZE_URL ); |
|
40 | + public function sanitize_input_as_path($option) { |
|
41 | + return filter_var($option, FILTER_SANITIZE_URL); |
|
42 | 42 | } |
43 | 43 | |
44 | - public function sanitize_input_as_relative_path( $option ) { |
|
45 | - $option = filter_var( $option, FILTER_SANITIZE_URL ); |
|
46 | - $option = str_replace( "..", "", $option ); |
|
44 | + public function sanitize_input_as_relative_path($option) { |
|
45 | + $option = filter_var($option, FILTER_SANITIZE_URL); |
|
46 | + $option = str_replace("..", "", $option); |
|
47 | 47 | |
48 | 48 | return $option; |
49 | 49 | } |
50 | 50 | |
51 | - public function sanitize_input_as_email( $option ) { |
|
52 | - return filter_var( $option, FILTER_SANITIZE_EMAIL ); |
|
51 | + public function sanitize_input_as_email($option) { |
|
52 | + return filter_var($option, FILTER_SANITIZE_EMAIL); |
|
53 | 53 | } |
54 | 54 | |
55 | - public function sanitize_input_as_raw( $option ) { |
|
56 | - return filter_var( $option, FILTER_UNSAFE_RAW ); |
|
55 | + public function sanitize_input_as_raw($option) { |
|
56 | + return filter_var($option, FILTER_UNSAFE_RAW); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | private $xcloner_settings; |
9 | 9 | private $xcloner_container; |
10 | 10 | |
11 | - public function __construct( Xcloner $xcloner_container ) { |
|
11 | + public function __construct(Xcloner $xcloner_container) { |
|
12 | 12 | $this->xcloner_container = $xcloner_container; |
13 | 13 | $this->xcloner_settings = $xcloner_container->get_xcloner_settings(); |
14 | 14 | } |
@@ -18,37 +18,37 @@ discard block |
||
18 | 18 | } |
19 | 19 | |
20 | 20 | public function check_backup_ready_status() { |
21 | - if ( ! $this->check_min_php_version( 1 ) ) { |
|
21 | + if (!$this->check_min_php_version(1)) { |
|
22 | 22 | return false; |
23 | 23 | } |
24 | 24 | |
25 | - if ( ! $this->check_safe_mode( 1 ) ) { |
|
25 | + if (!$this->check_safe_mode(1)) { |
|
26 | 26 | return false; |
27 | 27 | } |
28 | 28 | |
29 | - if ( ! $this->check_xcloner_start_path( 1 ) ) { |
|
29 | + if (!$this->check_xcloner_start_path(1)) { |
|
30 | 30 | return false; |
31 | 31 | } |
32 | 32 | |
33 | - if ( ! $this->check_xcloner_store_path( 1 ) ) { |
|
33 | + if (!$this->check_xcloner_store_path(1)) { |
|
34 | 34 | return false; |
35 | 35 | } |
36 | 36 | |
37 | - if ( ! $this->check_xcloner_tmp_path( 1 ) ) { |
|
37 | + if (!$this->check_xcloner_tmp_path(1)) { |
|
38 | 38 | return false; |
39 | 39 | } |
40 | 40 | |
41 | 41 | return true; |
42 | 42 | } |
43 | 43 | |
44 | - public function get_constant( $var ) { |
|
44 | + public function get_constant($var) { |
|
45 | 45 | return $this->$var; |
46 | 46 | } |
47 | 47 | |
48 | - public function check_min_php_version( $return_bool = 0 ) { |
|
48 | + public function check_min_php_version($return_bool = 0) { |
|
49 | 49 | |
50 | - if ( $return_bool == 1 ) { |
|
51 | - if ( version_compare( phpversion(), $this->min_php_version, '<' ) ) { |
|
50 | + if ($return_bool == 1) { |
|
51 | + if (version_compare(phpversion(), $this->min_php_version, '<')) { |
|
52 | 52 | return false; |
53 | 53 | } else { |
54 | 54 | return true; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | return phpversion(); |
59 | 59 | } |
60 | 60 | |
61 | - public function check_safe_mode( $return_bool = 0 ) { |
|
61 | + public function check_safe_mode($return_bool = 0) { |
|
62 | 62 | /*no longer needed for PHP 7*/ |
63 | 63 | $safe_mode = "Off"; |
64 | 64 | |
@@ -77,68 +77,68 @@ discard block |
||
77 | 77 | return $safe_mode; |
78 | 78 | } |
79 | 79 | |
80 | - public function check_xcloner_start_path( $return_bool = 0 ) { |
|
80 | + public function check_xcloner_start_path($return_bool = 0) { |
|
81 | 81 | $path = $this->xcloner_settings->get_xcloner_start_path(); |
82 | 82 | |
83 | - if ( $return_bool ) { |
|
84 | - if ( ! file_exists( $path ) ) { |
|
83 | + if ($return_bool) { |
|
84 | + if (!file_exists($path)) { |
|
85 | 85 | return false; |
86 | 86 | } |
87 | 87 | |
88 | - return is_readable( $path ); |
|
88 | + return is_readable($path); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | return $path; |
92 | 92 | } |
93 | 93 | |
94 | - public function check_xcloner_tmp_path( $return_bool = 0 ) { |
|
94 | + public function check_xcloner_tmp_path($return_bool = 0) { |
|
95 | 95 | $path = $this->xcloner_settings->get_xcloner_tmp_path(); |
96 | 96 | |
97 | - if ( $return_bool ) { |
|
98 | - if ( ! file_exists( $path ) ) { |
|
97 | + if ($return_bool) { |
|
98 | + if (!file_exists($path)) { |
|
99 | 99 | return false; |
100 | 100 | } |
101 | 101 | |
102 | - if ( ! is_writeable( $path ) ) { |
|
103 | - @chmod( $path, 0777 ); |
|
102 | + if (!is_writeable($path)) { |
|
103 | + @chmod($path, 0777); |
|
104 | 104 | } |
105 | 105 | |
106 | - return is_writeable( $path ); |
|
106 | + return is_writeable($path); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | return $path; |
110 | 110 | } |
111 | 111 | |
112 | - public function check_xcloner_store_path( $return_bool = 0 ) { |
|
112 | + public function check_xcloner_store_path($return_bool = 0) { |
|
113 | 113 | $path = $this->xcloner_settings->get_xcloner_store_path(); |
114 | 114 | |
115 | - if ( $return_bool ) { |
|
116 | - if ( ! file_exists( $path ) ) { |
|
115 | + if ($return_bool) { |
|
116 | + if (!file_exists($path)) { |
|
117 | 117 | return false; |
118 | 118 | } |
119 | 119 | |
120 | - if ( ! is_writeable( $path ) ) { |
|
121 | - @chmod( $path, 0777 ); |
|
120 | + if (!is_writeable($path)) { |
|
121 | + @chmod($path, 0777); |
|
122 | 122 | } |
123 | 123 | |
124 | - return is_writeable( $path ); |
|
124 | + return is_writeable($path); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | return $path; |
128 | 128 | } |
129 | 129 | |
130 | 130 | public function get_max_execution_time() { |
131 | - return ini_get( 'max_execution_time' ); |
|
131 | + return ini_get('max_execution_time'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | public function get_memory_limit() { |
135 | - return ini_get( 'memory_limit' ); |
|
135 | + return ini_get('memory_limit'); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | public function get_open_basedir() { |
139 | - $open_basedir = ini_get( 'open_basedir' ); |
|
139 | + $open_basedir = ini_get('open_basedir'); |
|
140 | 140 | |
141 | - if ( ! $open_basedir ) { |
|
141 | + if (!$open_basedir) { |
|
142 | 142 | $open_basedir = "none"; |
143 | 143 | } |
144 | 144 | |
@@ -146,21 +146,21 @@ discard block |
||
146 | 146 | } |
147 | 147 | |
148 | 148 | public function get_free_disk_space() { |
149 | - return $this->file_format_size( disk_free_space( $this->xcloner_settings->get_xcloner_store_path() ) ); |
|
149 | + return $this->file_format_size(disk_free_space($this->xcloner_settings->get_xcloner_store_path())); |
|
150 | 150 | } |
151 | 151 | |
152 | - public function file_format_size( $bytes, $decimals = 2 ) { |
|
153 | - $unit_list = array( 'B', 'KB', 'MB', 'GB', 'PB' ); |
|
152 | + public function file_format_size($bytes, $decimals = 2) { |
|
153 | + $unit_list = array('B', 'KB', 'MB', 'GB', 'PB'); |
|
154 | 154 | |
155 | - if ( $bytes == 0 ) { |
|
156 | - return $bytes . ' ' . $unit_list[0]; |
|
155 | + if ($bytes == 0) { |
|
156 | + return $bytes.' '.$unit_list[0]; |
|
157 | 157 | } |
158 | 158 | |
159 | - $unit_count = count( $unit_list ); |
|
160 | - for ( $i = $unit_count - 1; $i >= 0; $i -- ) { |
|
159 | + $unit_count = count($unit_list); |
|
160 | + for ($i = $unit_count - 1; $i >= 0; $i--) { |
|
161 | 161 | $power = $i * 10; |
162 | - if ( ( $bytes >> $power ) >= 1 ) { |
|
163 | - return round( $bytes / ( 1 << $power ), $decimals ) . ' ' . $unit_list[ $i ]; |
|
162 | + if (($bytes >> $power) >= 1) { |
|
163 | + return round($bytes / (1 << $power), $decimals).' '.$unit_list[$i]; |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | } |