@@ -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 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | load_plugin_textdomain( |
38 | 38 | 'xcloner-backup-and-restore', |
39 | 39 | false, |
40 | - dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' |
|
40 | + dirname(dirname(plugin_basename(__FILE__))).'/languages/' |
|
41 | 41 | ); |
42 | 42 | |
43 | 43 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class Xcloner_File_Transfer extends Xcloner_File_System{ |
|
3 | +class Xcloner_File_Transfer extends Xcloner_File_System { |
|
4 | 4 | |
5 | 5 | private $target_url; |
6 | 6 | private $transfer_limit = 1048576; //bytes 1MB= 1048576 300KB = 358400 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | public function set_target($target_url) |
10 | 10 | { |
11 | - return $this->target_url= $target_url; |
|
11 | + return $this->target_url = $target_url; |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | public function get_target() |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | public function transfer_file($file, $start = 0, $hash = "") |
21 | 21 | { |
22 | - if(!$this->target_url) |
|
22 | + if (!$this->target_url) |
|
23 | 23 | throw new Exception("Please setup a target url for upload"); |
24 | 24 | |
25 | 25 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | fseek($fp, $start, SEEK_SET); |
29 | 29 | |
30 | - $binary_data = fread($fp, $this->transfer_limit); |
|
30 | + $binary_data = fread($fp, $this->transfer_limit); |
|
31 | 31 | |
32 | 32 | $tmp_filename = "xcloner_upload_".substr(md5(time()), 0, 5); |
33 | 33 | |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | $send_array = array(); |
39 | 39 | |
40 | 40 | $send_array['file'] = $file; |
41 | - $send_array['start'] = $start; |
|
42 | - $send_array['action'] = "write_file"; |
|
41 | + $send_array['start'] = $start; |
|
42 | + $send_array['action'] = "write_file"; |
|
43 | 43 | $send_array['hash'] = $hash; |
44 | 44 | #$send_array['blob'] = $binary_data; |
45 | - $send_array['blob'] = $this->curl_file_create($tmp_file_path,'application/x-binary',$tmp_filename); |
|
45 | + $send_array['blob'] = $this->curl_file_create($tmp_file_path, 'application/x-binary', $tmp_filename); |
|
46 | 46 | |
47 | 47 | //$data = http_build_query($send_array); |
48 | 48 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | |
52 | 52 | $ch = curl_init(); |
53 | - curl_setopt($ch, CURLOPT_URL,$this->target_url); |
|
53 | + curl_setopt($ch, CURLOPT_URL, $this->target_url); |
|
54 | 54 | |
55 | 55 | curl_setopt($ch, CURLOPT_POST, 1); |
56 | 56 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); |
@@ -59,24 +59,24 @@ discard block |
||
59 | 59 | curl_setopt($ch, CURLOPT_TIMEOUT, 1200); |
60 | 60 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
61 | 61 | |
62 | - curl_setopt($ch, CURLOPT_POSTFIELDS, $send_array ); |
|
62 | + curl_setopt($ch, CURLOPT_POSTFIELDS, $send_array); |
|
63 | 63 | curl_setopt($ch, CURLOPT_VERBOSE, true); |
64 | 64 | |
65 | - $original_result = curl_exec ($ch); |
|
65 | + $original_result = curl_exec($ch); |
|
66 | 66 | |
67 | 67 | $this->get_tmp_filesystem()->delete($tmp_filename); |
68 | 68 | |
69 | 69 | $result = json_decode($original_result); |
70 | 70 | |
71 | - if(!$result) |
|
72 | - throw new Exception("We have received no valid response from the remote host, original message: ". $original_result); |
|
71 | + if (!$result) |
|
72 | + throw new Exception("We have received no valid response from the remote host, original message: ".$original_result); |
|
73 | 73 | |
74 | - if($result->status != 200) |
|
74 | + if ($result->status != 200) |
|
75 | 75 | { |
76 | 76 | throw new Exception($result->response); |
77 | 77 | } |
78 | 78 | |
79 | - if(ftell($fp) >= $this->get_storage_filesystem()->getSize($file)) |
|
79 | + if (ftell($fp) >= $this->get_storage_filesystem()->getSize($file)) |
|
80 | 80 | { |
81 | 81 | $this->get_logger()->info(sprintf("Upload done for file %s to target url %s, transferred a total of %s bytes", $file, $this->target_url, ftell($fp))); |
82 | 82 | $this->remove_tmp_filesystem(); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | . ($postname ?: basename($filename)) |
94 | 94 | . ($mimetype ? ";type=$mimetype" : ''); |
95 | 95 | |
96 | - }else{ |
|
96 | + } else { |
|
97 | 97 | |
98 | 98 | return curl_file_create($filename, $mimetype, $postname); |
99 | 99 |
@@ -26,12 +26,12 @@ discard block |
||
26 | 26 | */ |
27 | 27 | |
28 | 28 | // If this file is called directly, abort. |
29 | -if ( ! defined( 'WPINC' ) ) { |
|
29 | +if (!defined('WPINC')) { |
|
30 | 30 | die; |
31 | 31 | } |
32 | 32 | |
33 | 33 | //i will not load the plugin outside admin or cron |
34 | -if(!is_admin() and !defined('DOING_CRON')) |
|
34 | +if (!is_admin() and !defined('DOING_CRON')) |
|
35 | 35 | return; |
36 | 36 | |
37 | 37 | define("DS", DIRECTORY_SEPARATOR); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | function activate_xcloner() |
44 | 44 | { |
45 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-xcloner-activator.php'; |
|
45 | + require_once plugin_dir_path(__FILE__).'includes/class-xcloner-activator.php'; |
|
46 | 46 | Xcloner_Activator::activate(); |
47 | 47 | } |
48 | 48 | |
@@ -52,31 +52,31 @@ discard block |
||
52 | 52 | */ |
53 | 53 | function deactivate_xcloner() |
54 | 54 | { |
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 | ?> |
67 | 67 | <div class="error notice"> |
68 | - <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 | + <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> |
|
69 | 69 | </div> |
70 | 70 | <?php |
71 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
72 | - deactivate_plugins( plugin_basename( __FILE__ ) ); |
|
71 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
72 | + deactivate_plugins(plugin_basename(__FILE__)); |
|
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 | { |
81 | 81 | Xcloner_Activator::activate(); |
82 | 82 | } |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | wp_deregister_script('heartbeat'); |
92 | 92 | } |
93 | 93 | |
94 | -if(isset($_GET['page']) and stristr($_GET['page'] , "xcloner_")) |
|
94 | +if (isset($_GET['page']) and stristr($_GET['page'], "xcloner_")) |
|
95 | 95 | { |
96 | - add_action( 'init', 'stop_heartbeat', 1 ); |
|
96 | + add_action('init', 'stop_heartbeat', 1); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -116,14 +116,14 @@ discard block |
||
116 | 116 | |
117 | 117 | } |
118 | 118 | |
119 | -require_once(plugin_dir_path( __FILE__ ) . '/vendor/autoload.php'); |
|
120 | -require plugin_dir_path( __FILE__ ) . 'includes/class-xcloner.php'; |
|
119 | +require_once(plugin_dir_path(__FILE__).'/vendor/autoload.php'); |
|
120 | +require plugin_dir_path(__FILE__).'includes/class-xcloner.php'; |
|
121 | 121 | |
122 | -try{ |
|
122 | +try { |
|
123 | 123 | |
124 | 124 | $xcloner_plugin = run_xcloner(); |
125 | 125 | |
126 | -}catch(Exception $e){ |
|
126 | +}catch (Exception $e) { |
|
127 | 127 | |
128 | 128 | echo $e->getMessage(); |
129 | 129 |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$xcloner_settings = $this->get_xcloner_container()->get_xcloner_settings(); |
|
4 | -$logger = $this->get_xcloner_container()->get_xcloner_logger(); |
|
5 | -$logger_content = $logger->getLastDebugLines(); |
|
3 | +$xcloner_settings = $this->get_xcloner_container()->get_xcloner_settings(); |
|
4 | +$logger = $this->get_xcloner_container()->get_xcloner_logger(); |
|
5 | +$logger_content = $logger->getLastDebugLines(); |
|
6 | 6 | ?> |
7 | 7 | <div class="col s12 "> |
8 | 8 | <div> |
@@ -10,12 +10,12 @@ discard block |
||
10 | 10 | <?php echo __('XCloner Debugger Dashboard', 'xcloner-backup-and-restore') ?> |
11 | 11 | </h5> |
12 | 12 | |
13 | - <?php if($xcloner_settings->get_xcloner_option('xcloner_enable_log')) :?> |
|
13 | + <?php if ($xcloner_settings->get_xcloner_option('xcloner_enable_log')) :?> |
|
14 | 14 | <ul class="collapsible xcloner-debugger" data-collapsible="accordion"> |
15 | 15 | <li class="active"> |
16 | 16 | <div class="collapsible-header active"><i class="material-icons">bug_report</i>XCloner Debugger</div> |
17 | 17 | <div class="collapsible-body"> |
18 | - <div class="console" id="xcloner-console"><?php if(isset($logger_content)) echo implode("<br />\n", $logger_content); ?></div> |
|
18 | + <div class="console" id="xcloner-console"><?php if (isset($logger_content)) echo implode("<br />\n", $logger_content); ?></div> |
|
19 | 19 | </div> |
20 | 20 | </li> |
21 | 21 | </ul> |
@@ -28,6 +28,6 @@ discard block |
||
28 | 28 | }, 2000);*/ |
29 | 29 | }) |
30 | 30 | </script> |
31 | - <?php endif;?> |
|
31 | + <?php endif; ?> |
|
32 | 32 | </div> |
33 | 33 | </div> |
@@ -12,20 +12,20 @@ discard block |
||
12 | 12 | * @subpackage Xcloner/admin/partials |
13 | 13 | */ |
14 | 14 | |
15 | -$requirements = $this->get_xcloner_container()->get_xcloner_requirements(); |
|
16 | -$xcloner_settings = $this->get_xcloner_container()->get_xcloner_settings(); |
|
17 | -$xcloner_file_system = $this->get_xcloner_container()->get_xcloner_filesystem(); |
|
18 | -$logger = $this->get_xcloner_container()->get_xcloner_logger(); |
|
19 | -$xcloner_scheduler = $this->get_xcloner_container()->get_xcloner_scheduler(); |
|
15 | +$requirements = $this->get_xcloner_container()->get_xcloner_requirements(); |
|
16 | +$xcloner_settings = $this->get_xcloner_container()->get_xcloner_settings(); |
|
17 | +$xcloner_file_system = $this->get_xcloner_container()->get_xcloner_filesystem(); |
|
18 | +$logger = $this->get_xcloner_container()->get_xcloner_logger(); |
|
19 | +$xcloner_scheduler = $this->get_xcloner_container()->get_xcloner_scheduler(); |
|
20 | 20 | |
21 | 21 | $logger_content = $logger->getLastDebugLines(); |
22 | 22 | |
23 | -$date_format = get_option( 'date_format' ); |
|
24 | -$time_format = get_option( 'time_format' ); |
|
23 | +$date_format = get_option('date_format'); |
|
24 | +$time_format = get_option('time_format'); |
|
25 | 25 | |
26 | -if($requirements->check_backup_ready_status()) |
|
26 | +if ($requirements->check_backup_ready_status()) |
|
27 | 27 | { |
28 | - $latest_backup = $xcloner_file_system->get_latest_backup(); |
|
28 | + $latest_backup = $xcloner_file_system->get_latest_backup(); |
|
29 | 29 | $xcloner_file_system->backup_storage_cleanup(); |
30 | 30 | } |
31 | 31 | ?> |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | </div> |
39 | 39 | </div> |
40 | 40 | |
41 | -<?php if(isset($latest_backup['timestamp']) and $latest_backup['timestamp'] < strtotime("-1 day")): ?> |
|
41 | +<?php if (isset($latest_backup['timestamp']) and $latest_backup['timestamp'] < strtotime("-1 day")): ?> |
|
42 | 42 | <div id="setting-error-" class="error settings-error notice is-dismissible"> |
43 | 43 | <p><strong> |
44 | 44 | <?php echo __('Your latest backup is older than 24 hours, please create a new backup to keep your site protected.', 'xcloner-backup-and-restore') ?> |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | </div> |
48 | 48 | <?php endif?> |
49 | 49 | |
50 | -<?php if(!isset($latest_backup['timestamp']) ): ?> |
|
50 | +<?php if (!isset($latest_backup['timestamp'])): ?> |
|
51 | 51 | <div id="setting-error-" class="error settings-error notice is-dismissible"> |
52 | 52 | <p><strong> |
53 | 53 | <?php echo __('You have no backup that I could find, please generate a new backup to keep your site protected.', 'xcloner-backup-and-restore') ?> |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | </div> |
57 | 57 | <?php endif?> |
58 | 58 | |
59 | -<?php if(!$requirements->check_backup_ready_status()):?> |
|
59 | +<?php if (!$requirements->check_backup_ready_status()):?> |
|
60 | 60 | <div id="setting-error-" class="error settings-error notice is-dismissible"> |
61 | 61 | <p><strong> |
62 | 62 | <?php echo __('Backup system not ready, please check and fix the issues marked in red', 'xcloner-backup-and-restore') ?> |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | <div class="row"> |
84 | 84 | <h5><?php echo __("Latest Backup", 'xcloner-backup-and-restore')?></h5> |
85 | 85 | <blockquote> |
86 | - <?php if($latest_backup):?> |
|
86 | + <?php if ($latest_backup):?> |
|
87 | 87 | <div class="item"> |
88 | 88 | <div class="title"><?php echo __("Backup Name", 'xcloner-backup-and-restore')?>:</div> |
89 | 89 | <?php echo $latest_backup['basename']?> |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | <div class="item"> |
98 | 98 | <div class="title"><?php echo __("Backup Date", 'xcloner-backup-and-restore')?>:</div> |
99 | 99 | <?php |
100 | - echo date($date_format." ".$time_format, $latest_backup['timestamp']+(get_option( 'gmt_offset' ) * HOUR_IN_SECONDS)) |
|
100 | + echo date($date_format." ".$time_format, $latest_backup['timestamp'] + (get_option('gmt_offset') * HOUR_IN_SECONDS)) |
|
101 | 101 | ?> |
102 | 102 | </div> |
103 | 103 | <?php else:?> |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | <blockquote> |
112 | 112 | <div class="item"> |
113 | 113 | <div class="title"><?php echo __("Total Size", 'xcloner-backup-and-restore')?>:</div> |
114 | - <?php echo size_format($xcloner_file_system->get_storage_usage());?> |
|
114 | + <?php echo size_format($xcloner_file_system->get_storage_usage()); ?> |
|
115 | 115 | </div> |
116 | 116 | </blockquote> |
117 | 117 | <h5><?php echo __("Next Scheduled Backup", 'xcloner-backup-and-restore')?></h5> |
@@ -120,25 +120,25 @@ discard block |
||
120 | 120 | <?php |
121 | 121 | $list = ($xcloner_scheduler->get_next_run_schedule()); |
122 | 122 | |
123 | - if(is_array($list)) |
|
123 | + if (is_array($list)) |
|
124 | 124 | { |
125 | - $xcloner_file_system->sort_by($list, "next_run_time","asc"); |
|
125 | + $xcloner_file_system->sort_by($list, "next_run_time", "asc"); |
|
126 | 126 | } |
127 | 127 | |
128 | - if(isset($list[0])) |
|
128 | + if (isset($list[0])) |
|
129 | 129 | $latest_schedule = $list[0]; |
130 | 130 | ?> |
131 | - <?php if(isset($latest_schedule->name)):?> |
|
131 | + <?php if (isset($latest_schedule->name)):?> |
|
132 | 132 | <div class="title"><?php echo __("Schedule Name", 'xcloner-backup-and-restore')?>:</div> |
133 | - <?php echo $latest_schedule->name;?> |
|
134 | - <?php endif;?> |
|
133 | + <?php echo $latest_schedule->name; ?> |
|
134 | + <?php endif; ?> |
|
135 | 135 | </div> |
136 | 136 | <div class="item"> |
137 | 137 | <div class="title"><?php echo __("Next Call", 'xcloner-backup-and-restore')?>:</div> |
138 | - <?php if(isset($latest_schedule->next_run_time)) |
|
138 | + <?php if (isset($latest_schedule->next_run_time)) |
|
139 | 139 | echo date($date_format." ".$time_format, $latest_schedule->next_run_time); |
140 | 140 | else |
141 | - echo __("Unscheduled",'xcloner-backup-and-restore'); |
|
141 | + echo __("Unscheduled", 'xcloner-backup-and-restore'); |
|
142 | 142 | ?> |
143 | 143 | </div> |
144 | 144 | </blockquote> |
@@ -146,14 +146,14 @@ discard block |
||
146 | 146 | </div> |
147 | 147 | </li> |
148 | 148 | |
149 | - <?php if($xcloner_settings->get_xcloner_option('xcloner_enable_log')) :?> |
|
149 | + <?php if ($xcloner_settings->get_xcloner_option('xcloner_enable_log')) :?> |
|
150 | 150 | <li class="active"> |
151 | 151 | <div class="collapsible-header active"> |
152 | 152 | <i class="material-icons">bug_report</i><?php echo __('XCloner Debugger', 'xcloner-backup-and-restore')?> |
153 | 153 | <span class="right"><a href="#<?php echo $logger_basename = basename($logger->get_main_logger_url())?>" class="download-logger"><?php echo $logger_basename?></a></span> |
154 | 154 | </div> |
155 | 155 | <div class="collapsible-body"> |
156 | - <div class="console" id="xcloner-console"><?php if($logger_content) echo implode("<br />\n", array_reverse($logger_content)); ?></div> |
|
156 | + <div class="console" id="xcloner-console"><?php if ($logger_content) echo implode("<br />\n", array_reverse($logger_content)); ?></div> |
|
157 | 157 | </div> |
158 | 158 | </li> |
159 | 159 | <script> |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | }, 2000);*/ |
166 | 166 | }) |
167 | 167 | </script> |
168 | - <?php endif;?> |
|
168 | + <?php endif; ?> |
|
169 | 169 | |
170 | 170 | </ul> |
171 | 171 | |
@@ -177,59 +177,59 @@ discard block |
||
177 | 177 | |
178 | 178 | <div class="card blue-grey darken-1 z-depth-4 backup-ready"> |
179 | 179 | <div class="card-content white-text"> |
180 | - <span class="card-title"><?php echo __("System Check",'xcloner-backup-and-restore')?></span> |
|
180 | + <span class="card-title"><?php echo __("System Check", 'xcloner-backup-and-restore')?></span> |
|
181 | 181 | <ul> |
182 | - <li class="card-panel <?php echo ($requirements->check_xcloner_start_path(1)?"teal":"red")?> lighten-2" > |
|
183 | - <?php echo __('Backup Start Location','xcloner-backup-and-restore')?>: <span class="shorten_string "><?php echo $requirements->check_xcloner_start_path();?></span> |
|
182 | + <li class="card-panel <?php echo ($requirements->check_xcloner_start_path(1) ? "teal" : "red")?> lighten-2" > |
|
183 | + <?php echo __('Backup Start Location', 'xcloner-backup-and-restore')?>: <span class="shorten_string "><?php echo $requirements->check_xcloner_start_path(); ?></span> |
|
184 | 184 | </li> |
185 | - <li class="card-panel <?php echo ($requirements->check_xcloner_store_path(1)?"teal":"red")?> lighten-2" > |
|
186 | - <?php echo __('Backup Storage Location','xcloner-backup-and-restore')?>: <span class="shorten_string"><?php echo $requirements->check_xcloner_store_path();?></span> |
|
185 | + <li class="card-panel <?php echo ($requirements->check_xcloner_store_path(1) ? "teal" : "red")?> lighten-2" > |
|
186 | + <?php echo __('Backup Storage Location', 'xcloner-backup-and-restore')?>: <span class="shorten_string"><?php echo $requirements->check_xcloner_store_path(); ?></span> |
|
187 | 187 | </li> |
188 | - <li class="card-panel <?php echo ($requirements->check_xcloner_tmp_path(1)?"teal":"red")?> lighten-2" > |
|
189 | - <?php echo __('Temporary Location','xcloner-backup-and-restore')?>: <span class="shorten_string"><?php echo $requirements->check_xcloner_tmp_path();?></span> |
|
188 | + <li class="card-panel <?php echo ($requirements->check_xcloner_tmp_path(1) ? "teal" : "red")?> lighten-2" > |
|
189 | + <?php echo __('Temporary Location', 'xcloner-backup-and-restore')?>: <span class="shorten_string"><?php echo $requirements->check_xcloner_tmp_path(); ?></span> |
|
190 | 190 | </li> |
191 | 191 | |
192 | - <li class="card-panel <?php echo ($requirements->check_min_php_version(1)?"teal":"red")?> lighten-2" > |
|
193 | - <?php echo __('PHP Version Check','xcloner-backup-and-restore')?>: <?php echo $requirements->check_min_php_version();?> |
|
192 | + <li class="card-panel <?php echo ($requirements->check_min_php_version(1) ? "teal" : "red")?> lighten-2" > |
|
193 | + <?php echo __('PHP Version Check', 'xcloner-backup-and-restore')?>: <?php echo $requirements->check_min_php_version(); ?> |
|
194 | 194 | ( >= <?php echo $requirements->get_constant('min_php_version')?>) |
195 | 195 | </li> |
196 | - <li class="card-panel <?php echo ($requirements->check_safe_mode(1)?"teal":"orange")?> lighten-2" > |
|
197 | - <?php echo __('PHP Safe Mode','xcloner-backup-and-restore')?>: <?php echo $requirements->check_safe_mode();?> |
|
196 | + <li class="card-panel <?php echo ($requirements->check_safe_mode(1) ? "teal" : "orange")?> lighten-2" > |
|
197 | + <?php echo __('PHP Safe Mode', 'xcloner-backup-and-restore')?>: <?php echo $requirements->check_safe_mode(); ?> |
|
198 | 198 | ( <?php echo $requirements->get_constant('safe_mode')?>) |
199 | 199 | </li> |
200 | - <li class="card-panel <?php echo ($requirements->check_backup_ready_status()?"teal":"red")?> lighten-2"> |
|
201 | - <?php echo ($requirements->check_backup_ready_status()?__('BACKUP READY','xcloner-backup-and-restore'):__('Backup not ready, please check above requirements','xcloner-backup-and-restore'))?> |
|
202 | - <i class="material-icons right tiny"><?php echo ($requirements->check_backup_ready_status()?'thumb_up':'thumb_down')?></i> |
|
200 | + <li class="card-panel <?php echo ($requirements->check_backup_ready_status() ? "teal" : "red")?> lighten-2"> |
|
201 | + <?php echo ($requirements->check_backup_ready_status() ? __('BACKUP READY', 'xcloner-backup-and-restore') : __('Backup not ready, please check above requirements', 'xcloner-backup-and-restore'))?> |
|
202 | + <i class="material-icons right tiny"><?php echo ($requirements->check_backup_ready_status() ? 'thumb_up' : 'thumb_down')?></i> |
|
203 | 203 | </li> |
204 | 204 | </ul> |
205 | 205 | <ul class="additional_system_info"> |
206 | 206 | <li class="card-panel grey darken-1" > |
207 | - <?php echo __('PHP max_execution_time','xcloner-backup-and-restore')?>: <?php echo $requirements->get_max_execution_time();?> |
|
207 | + <?php echo __('PHP max_execution_time', 'xcloner-backup-and-restore')?>: <?php echo $requirements->get_max_execution_time(); ?> |
|
208 | 208 | </li> |
209 | 209 | <li class="card-panel grey darken-1" > |
210 | - <?php echo __('PHP memory_limit','xcloner-backup-and-restore')?>: <?php echo $requirements->get_memory_limit();?> |
|
210 | + <?php echo __('PHP memory_limit', 'xcloner-backup-and-restore')?>: <?php echo $requirements->get_memory_limit(); ?> |
|
211 | 211 | </li> |
212 | 212 | <li class="card-panel grey darken-1" > |
213 | - <?php echo __('PHP open_basedir','xcloner-backup-and-restore')?>: <?php echo $requirements->get_open_basedir();?> |
|
213 | + <?php echo __('PHP open_basedir', 'xcloner-backup-and-restore')?>: <?php echo $requirements->get_open_basedir(); ?> |
|
214 | 214 | </li> |
215 | 215 | <?php |
216 | 216 | $data = array(); |
217 | - if($requirements->check_backup_ready_status()) |
|
217 | + if ($requirements->check_backup_ready_status()) |
|
218 | 218 | $data = $xcloner_file_system->estimate_read_write_time(); |
219 | 219 | ?> |
220 | 220 | <li class="card-panel grey darken-1" > |
221 | - <?php echo __('Reading Time 1MB Block','xcloner-backup-and-restore')?>: <?php echo (isset($data['reading_time'])?$data['reading_time']:__("unknown"));?> |
|
221 | + <?php echo __('Reading Time 1MB Block', 'xcloner-backup-and-restore')?>: <?php echo (isset($data['reading_time']) ? $data['reading_time'] : __("unknown")); ?> |
|
222 | 222 | </li> |
223 | 223 | <li class="card-panel grey darken-1" > |
224 | - <?php echo __('Writing Time 1MB Block','xcloner-backup-and-restore')?>: <?php echo (isset($data['writing_time'])?$data['writing_time']:__("unknown"));?> |
|
224 | + <?php echo __('Writing Time 1MB Block', 'xcloner-backup-and-restore')?>: <?php echo (isset($data['writing_time']) ? $data['writing_time'] : __("unknown")); ?> |
|
225 | 225 | </li> |
226 | 226 | <li class="card-panel grey darken-1" > |
227 | - <?php echo __('Free Disk Space','xcloner-backup-and-restore')?>: <?php echo $requirements->get_free_disk_space();;?> |
|
227 | + <?php echo __('Free Disk Space', 'xcloner-backup-and-restore')?>: <?php echo $requirements->get_free_disk_space(); ;?> |
|
228 | 228 | </li> |
229 | 229 | </ul> |
230 | 230 | </div> |
231 | 231 | <div class="card-action"> |
232 | - <a class="waves-effect waves-light btn system_info_toggle blue darken-1"><i class="material-icons left">list</i><?php echo __('Toggle Additional System Info','xcloner-backup-and-restore')?></a> |
|
232 | + <a class="waves-effect waves-light btn system_info_toggle blue darken-1"><i class="material-icons left">list</i><?php echo __('Toggle Additional System Info', 'xcloner-backup-and-restore')?></a> |
|
233 | 233 | </div> |
234 | 234 | </div> |
235 | 235 |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$xcloner_settings = $this->get_xcloner_container()->get_xcloner_settings(); |
|
4 | -$logger = $this->get_xcloner_container()->get_xcloner_logger(); |
|
5 | -$xcloner_file_system = $this->get_xcloner_container()->get_xcloner_filesystem(); |
|
6 | -$xcloner_file_transfer = $this->get_xcloner_container()->get_xcloner_file_transfer(); |
|
3 | +$xcloner_settings = $this->get_xcloner_container()->get_xcloner_settings(); |
|
4 | +$logger = $this->get_xcloner_container()->get_xcloner_logger(); |
|
5 | +$xcloner_file_system = $this->get_xcloner_container()->get_xcloner_filesystem(); |
|
6 | +$xcloner_file_transfer = $this->get_xcloner_container()->get_xcloner_file_transfer(); |
|
7 | 7 | |
8 | -$start = 0 ; |
|
8 | +$start = 0; |
|
9 | 9 | |
10 | 10 | $backup_list = $xcloner_file_system->get_latest_backups(); |
11 | 11 | |
@@ -21,22 +21,22 @@ discard block |
||
21 | 21 | <div class="col s12"> |
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 | - <div class="collapsible-header active"><i class="material-icons">settings_remote</i><?php echo __("Restore Script Upload",'xcloner-backup-and-restore')?></div> |
|
24 | + <div class="collapsible-header active"><i class="material-icons">settings_remote</i><?php echo __("Restore Script Upload", 'xcloner-backup-and-restore')?></div> |
|
25 | 25 | <div class="collapsible-body row"> |
26 | 26 | |
27 | 27 | <ul class="text-steps"> |
28 | - <li><?php echo __("Please download the restore script from",'xcloner-backup-and-restore')?> <a href='#' onclick="window.location=ajaxurl+'?action=download_restore_script&phar=true'"><strong><?php echo __("here",'xcloner-backup-and-restore')?></strong></a> |
|
28 | + <li><?php echo __("Please download the restore script from", 'xcloner-backup-and-restore')?> <a href='#' onclick="window.location=ajaxurl+'?action=download_restore_script&phar=true'"><strong><?php echo __("here", 'xcloner-backup-and-restore')?></strong></a> |
|
29 | 29 | </li> |
30 | 30 | <li> |
31 | - <?php echo __("Extract the files on your new host",'xcloner-backup-and-restore')?> |
|
31 | + <?php echo __("Extract the files on your new host", 'xcloner-backup-and-restore')?> |
|
32 | 32 | </li> |
33 | 33 | <li> |
34 | - <?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')?> |
|
34 | + <?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')?> |
|
35 | 35 | </li> |
36 | 36 | <li> |
37 | - <?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')?> |
|
37 | + <?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')?> |
|
38 | 38 | </li> |
39 | - <?php if(is_ssl()):?> |
|
39 | + <?php if (is_ssl()):?> |
|
40 | 40 | <li> |
41 | 41 | <?php echo __("We have detected your connection to the site as being secure, so your restore script address must start with https://.")?> |
42 | 42 | </li> |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | </ul> |
46 | 46 | |
47 | 47 | <div class="input-field col l9 s12"> |
48 | - <input value="<?php echo (is_ssl())?"https://":"http://"?>" id="restore_script_url" type="text" class="validate" placeholder="Url to XCloner Restore Script, example http://myddns.com/xcloner/xcloner_restore.php" > |
|
48 | + <input value="<?php echo (is_ssl()) ? "https://" : "http://"?>" id="restore_script_url" type="text" class="validate" placeholder="Url to XCloner Restore Script, example http://myddns.com/xcloner/xcloner_restore.php" > |
|
49 | 49 | <label for="restore_script_url"></label> |
50 | 50 | <div id="url_validation_status" class="status"></div> |
51 | 51 | </div> |
52 | 52 | <div class="col l3 s12 right-align"> |
53 | - <button class="btn waves-effect waves-light" type="submit" id="validate_url" name="action"><?php echo __("Check",'xcloner-backup-and-restore')?> |
|
53 | + <button class="btn waves-effect waves-light" type="submit" id="validate_url" name="action"><?php echo __("Check", 'xcloner-backup-and-restore')?> |
|
54 | 54 | <i class="material-icons right">send</i> |
55 | 55 | </button> |
56 | 56 | </div> |
@@ -58,15 +58,15 @@ discard block |
||
58 | 58 | </li> |
59 | 59 | |
60 | 60 | <li data-step="2" class="backup-upload-step steps"> |
61 | - <div class="collapsible-header active"><i class="material-icons">file_upload</i><?php echo __("Upload Local Backup Archive To Remote Host",'xcloner-backup-and-restore')?> |
|
61 | + <div class="collapsible-header active"><i class="material-icons">file_upload</i><?php echo __("Upload Local Backup Archive To Remote Host", 'xcloner-backup-and-restore')?> |
|
62 | 62 | </div> |
63 | 63 | <div class="collapsible-body row"> |
64 | - <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> |
|
64 | + <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> |
|
65 | 65 | <div class="input-field col s12 l7"> |
66 | 66 | <select id="backup_file" name="backup_file" class="browser-default"> |
67 | - <option value="" disabled selected><?php echo __("Please select a local backup archive to upload to remote host",'xcloner-backup-and-restore')?></option> |
|
68 | - <?php if(is_array($backup_list)):?> |
|
69 | - <?php foreach($backup_list as $file):?> |
|
67 | + <option value="" disabled selected><?php echo __("Please select a local backup archive to upload to remote host", 'xcloner-backup-and-restore')?></option> |
|
68 | + <?php if (is_array($backup_list)):?> |
|
69 | + <?php foreach ($backup_list as $file):?> |
|
70 | 70 | <option value="<?php echo $file['basename']?>"> |
71 | 71 | <?php echo $file['basename']?> (<?php echo size_format($file['size'])?>) |
72 | 72 | </option> |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | </div> |
83 | 83 | <div class="col s12 l5 right-align"> |
84 | 84 | <div class="toggler"> |
85 | - <button class="btn waves-effect waves-light upload-backup normal" type="submit" id="" name="action"><?php echo __("Upload",'xcloner-backup-and-restore')?> |
|
85 | + <button class="btn waves-effect waves-light upload-backup normal" type="submit" id="" name="action"><?php echo __("Upload", 'xcloner-backup-and-restore')?> |
|
86 | 86 | <i class="material-icons right">send</i> |
87 | 87 | </button> |
88 | - <button class="btn waves-effect waves-light red upload-backup cancel" type="submit" id="" name="action"><?php echo __("Cancel",'xcloner-backup-and-restore')?> |
|
88 | + <button class="btn waves-effect waves-light red upload-backup cancel" type="submit" id="" name="action"><?php echo __("Cancel", 'xcloner-backup-and-restore')?> |
|
89 | 89 | <i class="material-icons right">close</i> |
90 | 90 | </button> |
91 | 91 | </div> |
92 | - <button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next",'xcloner-backup-and-restore')?>" id="skip_upload_backup" name="action"><?php echo __("Next",'xcloner-backup-and-restore')?> |
|
92 | + <button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next", 'xcloner-backup-and-restore')?>" id="skip_upload_backup" name="action"><?php echo __("Next", 'xcloner-backup-and-restore')?> |
|
93 | 93 | <i class="material-icons right">navigate_next</i> |
94 | 94 | </button> |
95 | 95 | </div> |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | </li> |
98 | 98 | |
99 | 99 | <li data-step="3" class="restore-remote-backup-step steps active"> |
100 | - <div class="collapsible-header"><i class="material-icons">folder_open</i><?php echo __("Restore Files Backup Available On Remote Host",'xcloner-backup-and-restore')?> |
|
100 | + <div class="collapsible-header"><i class="material-icons">folder_open</i><?php echo __("Restore Files Backup Available On Remote Host", 'xcloner-backup-and-restore')?> |
|
101 | 101 | <i class="material-icons right" title="Refresh Remote Backup Files List" id="refresh_remote_backup_file">cached</i> |
102 | 102 | |
103 | 103 | <div class="switch right"> |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | <div class=" col s12 l7"> |
115 | 115 | <div class="input-field row"> |
116 | 116 | <input type="text" name="remote_restore_path" id="remote_restore_path" class="validate" placeholder="Restore Target Path"> |
117 | - <label><?php echo __("Remote Restore Target Path",'xcloner-backup-and-restore')?></label> |
|
117 | + <label><?php echo __("Remote Restore Target Path", 'xcloner-backup-and-restore')?></label> |
|
118 | 118 | </div> |
119 | 119 | |
120 | 120 | <div class="input-field row"> |
121 | 121 | <select id="remote_backup_file" name="remote_backup_file" class="browser-default"> |
122 | - <option value="" disabled selected><?php echo __("Please select the remote backup file to restore",'xcloner-backup-and-restore')?></option> |
|
122 | + <option value="" disabled selected><?php echo __("Please select the remote backup file to restore", 'xcloner-backup-and-restore')?></option> |
|
123 | 123 | </select> |
124 | 124 | <label></label> |
125 | 125 | </div> |
@@ -134,14 +134,14 @@ discard block |
||
134 | 134 | |
135 | 135 | <div class="col s12 l5 right-align"> |
136 | 136 | <div class="toggler"> |
137 | - <button class="btn waves-effect waves-light restore_remote_backup normal " type="submit" id="" name="action"><?php echo __("Restore",'xcloner-backup-and-restore')?> |
|
137 | + <button class="btn waves-effect waves-light restore_remote_backup normal " type="submit" id="" name="action"><?php echo __("Restore", 'xcloner-backup-and-restore')?> |
|
138 | 138 | <i class="material-icons right">send</i> |
139 | 139 | </button> |
140 | - <button class="btn waves-effect waves-light red restore_remote_backup cancel" type="submit" id="" name="action"><?php echo __("Cancel",'xcloner-backup-and-restore')?> |
|
140 | + <button class="btn waves-effect waves-light red restore_remote_backup cancel" type="submit" id="" name="action"><?php echo __("Cancel", 'xcloner-backup-and-restore')?> |
|
141 | 141 | <i class="material-icons right">close</i> |
142 | 142 | </button> |
143 | 143 | </div> |
144 | - <button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next",'xcloner-backup-and-restore')?>" id="skip_remote_backup_step" name="action"><?php echo __("Next",'xcloner-backup-and-restore')?> |
|
144 | + <button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next", 'xcloner-backup-and-restore')?>" id="skip_remote_backup_step" name="action"><?php echo __("Next", 'xcloner-backup-and-restore')?> |
|
145 | 145 | <i class="material-icons right">navigate_next</i> |
146 | 146 | </button> |
147 | 147 | </div> |
@@ -149,71 +149,71 @@ discard block |
||
149 | 149 | </li> |
150 | 150 | |
151 | 151 | <li data-step="4" class="restore-remote-database-step steps active"> |
152 | - <div class="collapsible-header"><i class="material-icons">list</i><?php echo __("Restore Remote Database - Search and Replace",'xcloner-backup-and-restore')?> |
|
152 | + <div class="collapsible-header"><i class="material-icons">list</i><?php echo __("Restore Remote Database - Search and Replace", 'xcloner-backup-and-restore')?> |
|
153 | 153 | <i class="material-icons right" title="Refresh Database Backup Files List" id="refresh_database_file">cached</i> |
154 | 154 | </div> |
155 | 155 | <div class="collapsible-body row"> |
156 | 156 | |
157 | 157 | <div class="col s12"> |
158 | - <a class="btn-floating tooltipped btn-small right" data-position="left" data-delay="50" data-tooltip="<?php echo __('Please provide below the mysql connection details for the remote host database.','xcloner-backup-and-restore')?>" data-tooltip-id="92c95730-94e9-7b59-bd52-14adc30d5e3e"><i class="material-icons">help_outline</i></a> |
|
159 | - <h5><?php echo __('Remote Mysql Details','xcloner-backup-and-restore')?></h5> |
|
158 | + <a class="btn-floating tooltipped btn-small right" data-position="left" data-delay="50" data-tooltip="<?php echo __('Please provide below the mysql connection details for the remote host database.', 'xcloner-backup-and-restore')?>" data-tooltip-id="92c95730-94e9-7b59-bd52-14adc30d5e3e"><i class="material-icons">help_outline</i></a> |
|
159 | + <h5><?php echo __('Remote Mysql Details', 'xcloner-backup-and-restore')?></h5> |
|
160 | 160 | </div> |
161 | 161 | <div class=" col s12"> |
162 | 162 | <div class="input-field col s12 m6"> |
163 | 163 | <input type="text" name="remote_mysql_host" id="remote_mysql_host" class="validate" placeholder="Remote Mysql Hostname" value="localhost"> |
164 | - <label><?php echo __("Remote Mysql Hostname",'xcloner-backup-and-restore')?></label> |
|
164 | + <label><?php echo __("Remote Mysql Hostname", 'xcloner-backup-and-restore')?></label> |
|
165 | 165 | </div> |
166 | 166 | |
167 | 167 | <div class="input-field col s12 m6"> |
168 | 168 | <input type="text" name="remote_mysql_db" id="remote_mysql_db" class="validate" placeholder="Remote Mysql Database"> |
169 | - <label><?php echo __("Remote Mysql Database",'xcloner-backup-and-restore')?></label> |
|
169 | + <label><?php echo __("Remote Mysql Database", 'xcloner-backup-and-restore')?></label> |
|
170 | 170 | </div> |
171 | 171 | |
172 | 172 | <div class="input-field col s12 m6"> |
173 | 173 | <input type="text" name="remote_mysql_user" id="remote_mysql_user" class="validate" placeholder="Remote Mysql Username"> |
174 | - <label><?php echo __("Remote Mysql Username",'xcloner-backup-and-restore')?></label> |
|
174 | + <label><?php echo __("Remote Mysql Username", 'xcloner-backup-and-restore')?></label> |
|
175 | 175 | </div> |
176 | 176 | |
177 | 177 | |
178 | 178 | <div class="input-field col s12 m6"> |
179 | 179 | <input type="text" name="remote_mysql_pass" id="remote_mysql_pass" class="validate" placeholder="Remote Mysql Password"> |
180 | - <label><?php echo __("Remote Mysql Password",'xcloner-backup-and-restore')?></label> |
|
180 | + <label><?php echo __("Remote Mysql Password", 'xcloner-backup-and-restore')?></label> |
|
181 | 181 | </div> |
182 | 182 | |
183 | 183 | </div> |
184 | 184 | <div class="col s12"> |
185 | - <a class="btn-floating tooltipped btn-small right" data-position="left" data-delay="50" data-html="true" 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')?>" data-tooltip-id="92c95730-94e9-7b59-bd52-14adc30d5e3e"><i class="material-icons">help_outline</i></a> |
|
186 | - <h5><?php echo __('Remote Mysql Search and Replace','xcloner-backup-and-restore')?></h5> |
|
185 | + <a class="btn-floating tooltipped btn-small right" data-position="left" data-delay="50" data-html="true" 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')?>" data-tooltip-id="92c95730-94e9-7b59-bd52-14adc30d5e3e"><i class="material-icons">help_outline</i></a> |
|
186 | + <h5><?php echo __('Remote Mysql Search and Replace', 'xcloner-backup-and-restore')?></h5> |
|
187 | 187 | </div> |
188 | 188 | <div class="col s12"> |
189 | 189 | <div class="input-field col s12 m6 "> |
190 | - <input type="text" name="wp_home_url" id="wp_home_url" class="validate" placeholder="WP Home Url" value="<?php echo home_url();?>"> |
|
191 | - <label><?php echo __("Source Home Url",'xcloner-backup-and-restore')?></label> |
|
190 | + <input type="text" name="wp_home_url" id="wp_home_url" class="validate" placeholder="WP Home Url" value="<?php echo home_url(); ?>"> |
|
191 | + <label><?php echo __("Source Home Url", 'xcloner-backup-and-restore')?></label> |
|
192 | 192 | </div> |
193 | 193 | |
194 | 194 | <div class="input-field col s12 m6 "> |
195 | 195 | <input type="text" name="remote_restore_url" id="remote_restore_url" class="validate" placeholder="Restore Target Url"> |
196 | - <label><?php echo __("With Target Home Url",'xcloner-backup-and-restore')?></label> |
|
196 | + <label><?php echo __("With Target Home Url", 'xcloner-backup-and-restore')?></label> |
|
197 | 197 | </div> |
198 | 198 | |
199 | - <?php if( site_url() != home_url()) : ?> |
|
199 | + <?php if (site_url() != home_url()) : ?> |
|
200 | 200 | <div class="input-field col s12 m6 "> |
201 | - <input type="text" name="wp_site_url" id="wp_site_url" class="validate" placeholder="WP Site Url" value="<?php echo site_url();?>"> |
|
202 | - <label><?php echo __("Source Site Url",'xcloner-backup-and-restore')?></label> |
|
201 | + <input type="text" name="wp_site_url" id="wp_site_url" class="validate" placeholder="WP Site Url" value="<?php echo site_url(); ?>"> |
|
202 | + <label><?php echo __("Source Site Url", 'xcloner-backup-and-restore')?></label> |
|
203 | 203 | </div> |
204 | 204 | |
205 | 205 | <div class="input-field col s12 m6 "> |
206 | 206 | <input type="text" name="remote_restore_site_url" id="remote_restore_site_url" class="validate" placeholder="Restore Target Url"> |
207 | - <label><?php echo __("With Target Site Url",'xcloner-backup-and-restore')?></label> |
|
207 | + <label><?php echo __("With Target Site Url", 'xcloner-backup-and-restore')?></label> |
|
208 | 208 | </div> |
209 | 209 | |
210 | - <?php endif;?> |
|
210 | + <?php endif; ?> |
|
211 | 211 | </div> |
212 | 212 | |
213 | 213 | <div class=" col s12 l7"> |
214 | 214 | <div class="input-field row"> |
215 | 215 | <select id="remote_database_file" name="remote_database_file" class="browser-default"> |
216 | - <option value="" disabled selected><?php echo __("Please select the remote database backup file to restore",'xcloner-backup-and-restore')?></option> |
|
216 | + <option value="" disabled selected><?php echo __("Please select the remote database backup file to restore", 'xcloner-backup-and-restore')?></option> |
|
217 | 217 | </select> |
218 | 218 | |
219 | 219 | <label></label> |
@@ -232,15 +232,15 @@ discard block |
||
232 | 232 | |
233 | 233 | <div class="col s12 l5 right-align"> |
234 | 234 | <div class="toggler"> |
235 | - <button class="btn waves-effect waves-light restore_remote_mysqldump normal " type="submit" id="" name="action"><?php echo __("Restore",'xcloner-backup-and-restore')?> |
|
235 | + <button class="btn waves-effect waves-light restore_remote_mysqldump normal " type="submit" id="" name="action"><?php echo __("Restore", 'xcloner-backup-and-restore')?> |
|
236 | 236 | <i class="material-icons right">send</i> |
237 | 237 | </button> |
238 | - <button class="btn waves-effect waves-light red restore_remote_mysqldump cancel" type="submit" id="" name="action"><?php echo __("Cancel",'xcloner-backup-and-restore')?> |
|
238 | + <button class="btn waves-effect waves-light red restore_remote_mysqldump cancel" type="submit" id="" name="action"><?php echo __("Cancel", 'xcloner-backup-and-restore')?> |
|
239 | 239 | <i class="material-icons right">close</i> |
240 | 240 | </button> |
241 | 241 | </div> |
242 | 242 | |
243 | - <button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next",'xcloner-backup-and-restore')?>" id="skip_restore_remote_database_step" name="action"><?php echo __("Next",'xcloner-backup-and-restore')?> |
|
243 | + <button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next", 'xcloner-backup-and-restore')?>" id="skip_restore_remote_database_step" name="action"><?php echo __("Next", 'xcloner-backup-and-restore')?> |
|
244 | 244 | <i class="material-icons right">navigate_next</i> |
245 | 245 | </button> |
246 | 246 | |
@@ -250,13 +250,13 @@ discard block |
||
250 | 250 | </li> |
251 | 251 | |
252 | 252 | <li data-step="5" class="restore-finish-step steps active"> |
253 | - <div class="collapsible-header"><i class="material-icons">folder_open</i><?php echo __("Finishing up...",'xcloner-backup-and-restore')?> |
|
253 | + <div class="collapsible-header"><i class="material-icons">folder_open</i><?php echo __("Finishing up...", 'xcloner-backup-and-restore')?> |
|
254 | 254 | </div> |
255 | 255 | <div class="collapsible-body row"> |
256 | 256 | |
257 | 257 | <div class="row"> |
258 | 258 | <div class="col s4"> |
259 | - <label><?php echo __("Update wp-config.php mysql details and update the restored site Url",'xcloner-backup-and-restore')?></label> |
|
259 | + <label><?php echo __("Update wp-config.php mysql details and update the restored site Url", 'xcloner-backup-and-restore')?></label> |
|
260 | 260 | </div> |
261 | 261 | |
262 | 262 | <div class="col s8"> |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | |
274 | 274 | <div class="row"> |
275 | 275 | <div class="col s4"> |
276 | - <label><?php echo __("Delete Restored Backup Temporary Folder",'xcloner-backup-and-restore')?></label> |
|
276 | + <label><?php echo __("Delete Restored Backup Temporary Folder", 'xcloner-backup-and-restore')?></label> |
|
277 | 277 | </div> |
278 | 278 | <div class="col s8"> |
279 | 279 | <div class="switch"> |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | |
290 | 290 | <div class="row"> |
291 | 291 | <div class="col s4"> |
292 | - <label><?php echo __("Delete Restore Script",'xcloner-backup-and-restore')?></label> |
|
292 | + <label><?php echo __("Delete Restore Script", 'xcloner-backup-and-restore')?></label> |
|
293 | 293 | </div> |
294 | 294 | <div class="col s8"> |
295 | 295 | <div class="switch"> |
@@ -308,15 +308,15 @@ discard block |
||
308 | 308 | </div> |
309 | 309 | |
310 | 310 | <div class=" row col s12 center-align" id="xcloner_restore_finish"> |
311 | - <h5><?php echo __("Thank you for using XCloner.",'xcloner-backup-and-restore')?></h5> |
|
312 | - <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> |
|
311 | + <h5><?php echo __("Thank you for using XCloner.", 'xcloner-backup-and-restore')?></h5> |
|
312 | + <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> |
|
313 | 313 | <a class="twitter-follow-button" href="https://twitter.com/thinkovi" data-show-count="false">Follow @thinkovi</a> |
314 | 314 | <script src="//platform.twitter.com/widgets.js" async="" charset="utf-8"></script> |
315 | 315 | </div> |
316 | 316 | |
317 | 317 | <div class="col s12 center-align"> |
318 | 318 | |
319 | - <button class="btn waves-effect waves-light teal" type="submit" id="restore_finish" name="action"><?php echo __("Finish",'xcloner-backup-and-restore')?> |
|
319 | + <button class="btn waves-effect waves-light teal" type="submit" id="restore_finish" name="action"><?php echo __("Finish", 'xcloner-backup-and-restore')?> |
|
320 | 320 | <i class="material-icons right">navigate_next</i> |
321 | 321 | </button> |
322 | 322 | </div> |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | * @param string $plugin_name The name of this 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 | - $this->plugin_name = $xcloner_container->get_plugin_name(); |
|
54 | - $this->version = $xcloner_container->get_version(); |
|
55 | - $this->xcloner_container = $xcloner_container; |
|
53 | + $this->plugin_name = $xcloner_container->get_plugin_name(); |
|
54 | + $this->version = $xcloner_container->get_version(); |
|
55 | + $this->xcloner_container = $xcloner_container; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | public function get_xcloner_container() |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function enqueue_styles($hook) { |
69 | 69 | |
70 | - if(!stristr($hook, "page_".$this->plugin_name) || (isset($_GET['option']) and $_GET['option']=="com_cloner")) |
|
70 | + if (!stristr($hook, "page_".$this->plugin_name) || (isset($_GET['option']) and $_GET['option'] == "com_cloner")) |
|
71 | 71 | return; |
72 | 72 | |
73 | 73 | /** |
@@ -82,13 +82,13 @@ discard block |
||
82 | 82 | * class. |
83 | 83 | */ |
84 | 84 | |
85 | - wp_enqueue_style( $this->plugin_name."_materialize", plugin_dir_url( __FILE__ ) . 'css/materialize.min.css', array(), $this->version, 'all' ); |
|
86 | - wp_enqueue_style( $this->plugin_name."_materialize.clockpicker", plugin_dir_url( __FILE__ ) . 'css/materialize.clockpicker.css', array(), $this->version, 'all' ); |
|
87 | - wp_enqueue_style( $this->plugin_name."_materialize.icons", '//fonts.googleapis.com/icon?family=Material+Icons', array(), $this->version, 'all' ); |
|
88 | - wp_enqueue_style( $this->plugin_name."_jquery.datatables", plugin_dir_url( __FILE__ ) . 'css/jquery.dataTables.min.css', array(), $this->version, 'all' ); |
|
89 | - wp_enqueue_style( $this->plugin_name."_jquery.datatables.responsive", plugin_dir_url( __FILE__ ) . 'css/responsive.dataTables.css', array(), $this->version, 'all' ); |
|
90 | - 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' ); |
|
91 | - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/xcloner-admin.css', array(), $this->version, 'all' ); |
|
85 | + wp_enqueue_style($this->plugin_name."_materialize", plugin_dir_url(__FILE__).'css/materialize.min.css', array(), $this->version, 'all'); |
|
86 | + wp_enqueue_style($this->plugin_name."_materialize.clockpicker", plugin_dir_url(__FILE__).'css/materialize.clockpicker.css', array(), $this->version, 'all'); |
|
87 | + wp_enqueue_style($this->plugin_name."_materialize.icons", '//fonts.googleapis.com/icon?family=Material+Icons', array(), $this->version, 'all'); |
|
88 | + wp_enqueue_style($this->plugin_name."_jquery.datatables", plugin_dir_url(__FILE__).'css/jquery.dataTables.min.css', array(), $this->version, 'all'); |
|
89 | + wp_enqueue_style($this->plugin_name."_jquery.datatables.responsive", plugin_dir_url(__FILE__).'css/responsive.dataTables.css', array(), $this->version, 'all'); |
|
90 | + 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'); |
|
91 | + wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/xcloner-admin.css', array(), $this->version, 'all'); |
|
92 | 92 | |
93 | 93 | } |
94 | 94 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function enqueue_scripts($hook) { |
101 | 101 | |
102 | - if(!stristr($hook, "page_".$this->plugin_name)) |
|
102 | + if (!stristr($hook, "page_".$this->plugin_name)) |
|
103 | 103 | return; |
104 | 104 | |
105 | 105 | /** |
@@ -117,17 +117,17 @@ discard block |
||
117 | 117 | add_thickbox(); |
118 | 118 | wp_enqueue_script('plugin-install'); |
119 | 119 | wp_enqueue_script('updates'); |
120 | - wp_enqueue_script( $this->plugin_name."_materialize", plugin_dir_url( __FILE__ ) . 'js/materialize.min.js', array( 'jquery' ), $this->version, false ); |
|
121 | - wp_enqueue_script( $this->plugin_name."_materialize.clockpicker", plugin_dir_url( __FILE__ ) . 'js/materialize.clockpicker.js', array( 'jquery' ), $this->version, false ); |
|
122 | - wp_enqueue_script( $this->plugin_name."_jquery.datatables", plugin_dir_url( __FILE__ ) . 'js/jquery.dataTables.min.js', array( 'jquery' ), $this->version, false ); |
|
123 | - wp_enqueue_script( $this->plugin_name."_jquery.datatables.respnsive", plugin_dir_url( __FILE__ ) . 'js/dataTables.responsive.js', array( 'jquery' ), $this->version, false ); |
|
124 | - wp_enqueue_script( $this->plugin_name."_vakata", dirname(plugin_dir_url( __FILE__ )) . '/vendor/vakata/jstree/dist/jstree.min.js', array( 'jquery' ), '3.3', false ); |
|
125 | - wp_enqueue_script( $this->plugin_name."_xcloner-backup-class", plugin_dir_url( __FILE__ ) . 'js/xcloner-backup-class.js', array( 'jquery' ), $this->version, false ); |
|
126 | - wp_enqueue_script( $this->plugin_name."_xcloner-scheduler-class", plugin_dir_url( __FILE__ ) . 'js/xcloner-scheduler-class.js', array( 'jquery' ), $this->version, false ); |
|
127 | - wp_enqueue_script( $this->plugin_name."_xcloner-restore-class", plugin_dir_url( __FILE__ ) . 'js/xcloner-restore-class.js', array( 'jquery' ), $this->version, false ); |
|
128 | - 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 ); |
|
129 | - 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 ); |
|
130 | - wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/xcloner-admin.js', array( 'jquery' ), $this->version, false ); |
|
120 | + wp_enqueue_script($this->plugin_name."_materialize", plugin_dir_url(__FILE__).'js/materialize.min.js', array('jquery'), $this->version, false); |
|
121 | + wp_enqueue_script($this->plugin_name."_materialize.clockpicker", plugin_dir_url(__FILE__).'js/materialize.clockpicker.js', array('jquery'), $this->version, false); |
|
122 | + wp_enqueue_script($this->plugin_name."_jquery.datatables", plugin_dir_url(__FILE__).'js/jquery.dataTables.min.js', array('jquery'), $this->version, false); |
|
123 | + wp_enqueue_script($this->plugin_name."_jquery.datatables.respnsive", plugin_dir_url(__FILE__).'js/dataTables.responsive.js', array('jquery'), $this->version, false); |
|
124 | + wp_enqueue_script($this->plugin_name."_vakata", dirname(plugin_dir_url(__FILE__)).'/vendor/vakata/jstree/dist/jstree.min.js', array('jquery'), '3.3', false); |
|
125 | + wp_enqueue_script($this->plugin_name."_xcloner-backup-class", plugin_dir_url(__FILE__).'js/xcloner-backup-class.js', array('jquery'), $this->version, false); |
|
126 | + wp_enqueue_script($this->plugin_name."_xcloner-scheduler-class", plugin_dir_url(__FILE__).'js/xcloner-scheduler-class.js', array('jquery'), $this->version, false); |
|
127 | + wp_enqueue_script($this->plugin_name."_xcloner-restore-class", plugin_dir_url(__FILE__).'js/xcloner-restore-class.js', array('jquery'), $this->version, false); |
|
128 | + 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); |
|
129 | + 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); |
|
130 | + wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__).'js/xcloner-admin.js', array('jquery'), $this->version, false); |
|
131 | 131 | |
132 | 132 | |
133 | 133 | } |
@@ -145,19 +145,19 @@ discard block |
||
145 | 145 | |
146 | 146 | $_POST['action'] = $xcloner_sanitization->sanitize_input_as_string($_POST['action']); |
147 | 147 | |
148 | - if(isset($_POST['action'])) |
|
148 | + if (isset($_POST['action'])) |
|
149 | 149 | { |
150 | 150 | $remote_storage->save($_POST['action']); |
151 | 151 | } |
152 | 152 | |
153 | - if(isset($_POST['authentification_code']) && $_POST['authentification_code'] != "") |
|
153 | + if (isset($_POST['authentification_code']) && $_POST['authentification_code'] != "") |
|
154 | 154 | { |
155 | 155 | $_POST['authentification_code'] = $xcloner_sanitization->sanitize_input_as_string($_POST['authentification_code']); |
156 | 156 | |
157 | 157 | $remote_storage->set_access_token($_POST['authentification_code']); |
158 | 158 | } |
159 | 159 | |
160 | - if(isset($_POST['connection_check']) && $_POST['connection_check']) |
|
160 | + if (isset($_POST['connection_check']) && $_POST['connection_check']) |
|
161 | 161 | { |
162 | 162 | $remote_storage->check($_POST['action']); |
163 | 163 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | { |
171 | 171 | $requirements = $this->xcloner_container->get_xcloner_requirements(); |
172 | 172 | |
173 | - if(!$requirements->check_backup_ready_status()) |
|
173 | + if (!$requirements->check_backup_ready_status()) |
|
174 | 174 | { |
175 | 175 | require_once("partials/xcloner_init_page.php"); |
176 | 176 | return false; |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | { |
203 | 203 | $requirements = $this->xcloner_container->get_xcloner_requirements(); |
204 | 204 | |
205 | - if(!$requirements->check_backup_ready_status()) |
|
205 | + if (!$requirements->check_backup_ready_status()) |
|
206 | 206 | { |
207 | 207 | require_once("partials/xcloner_init_page.php"); |
208 | 208 | return false; |
@@ -235,10 +235,10 @@ discard block |
||
235 | 235 | <?php |
236 | 236 | $xcloner_sanitization = $this->get_xcloner_container()->get_xcloner_sanitization(); |
237 | 237 | |
238 | - if( isset( $_GET[ 'tab' ] ) ) { |
|
239 | - $active_tab = $xcloner_sanitization->sanitize_input_as_string($_GET[ 'tab' ]); |
|
238 | + if (isset($_GET['tab'])) { |
|
239 | + $active_tab = $xcloner_sanitization->sanitize_input_as_string($_GET['tab']); |
|
240 | 240 | } // end if |
241 | - else{ |
|
241 | + else { |
|
242 | 242 | $active_tab = "general_options"; |
243 | 243 | } |
244 | 244 | |
@@ -257,20 +257,20 @@ discard block |
||
257 | 257 | <form action="options.php" method="post"> |
258 | 258 | <?php |
259 | 259 | |
260 | - if( $active_tab == 'general_options' ) { |
|
260 | + if ($active_tab == 'general_options') { |
|
261 | 261 | |
262 | 262 | settings_fields('xcloner_general_settings_group'); |
263 | 263 | do_settings_sections('xcloner_settings_page'); |
264 | 264 | |
265 | - }elseif( $active_tab == 'mysql_options' ) { |
|
265 | + }elseif ($active_tab == 'mysql_options') { |
|
266 | 266 | |
267 | 267 | settings_fields('xcloner_mysql_settings_group'); |
268 | 268 | do_settings_sections('xcloner_mysql_settings_page'); |
269 | - }elseif( $active_tab == 'system_options' ) { |
|
269 | + }elseif ($active_tab == 'system_options') { |
|
270 | 270 | |
271 | 271 | settings_fields('xcloner_system_settings_group'); |
272 | 272 | do_settings_sections('xcloner_system_settings_page'); |
273 | - }elseif( $active_tab == 'cleanup_options' ) { |
|
273 | + }elseif ($active_tab == 'cleanup_options') { |
|
274 | 274 | |
275 | 275 | settings_fields('xcloner_cleanup_settings_group'); |
276 | 276 | do_settings_sections('xcloner_cleanup_settings_page'); |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | use Sabre\DAV\Client as SabreClient; |
22 | 22 | use League\Flysystem\WebDAV\WebDAVAdapter; |
23 | 23 | |
24 | -class Xcloner_Remote_Storage{ |
|
24 | +class Xcloner_Remote_Storage { |
|
25 | 25 | |
26 | - private $gdrive_app_name = "XCloner Backup and Restore"; |
|
26 | + private $gdrive_app_name = "XCloner Backup and Restore"; |
|
27 | 27 | |
28 | 28 | private $storage_fields = array( |
29 | 29 | "option_prefix" => "xcloner_", |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | { |
134 | 134 | $this->xcloner_sanitization = $xcloner_container->get_xcloner_sanitization(); |
135 | 135 | $this->xcloner_file_system = $xcloner_container->get_xcloner_filesystem(); |
136 | - $this->logger = $xcloner_container->get_xcloner_logger()->withName("xcloner_remote_storage"); |
|
137 | - $this->xcloner = $xcloner_container; |
|
136 | + $this->logger = $xcloner_container->get_xcloner_logger()->withName("xcloner_remote_storage"); |
|
137 | + $this->xcloner = $xcloner_container; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | private function get_xcloner_container() |
@@ -145,10 +145,10 @@ discard block |
||
145 | 145 | public function get_available_storages() |
146 | 146 | { |
147 | 147 | $return = array(); |
148 | - foreach($this->storage_fields as $storage=>$data) |
|
148 | + foreach ($this->storage_fields as $storage=>$data) |
|
149 | 149 | { |
150 | 150 | $check_field = $this->storage_fields["option_prefix"].$storage."_enable"; |
151 | - if(get_option($check_field)) |
|
151 | + if (get_option($check_field)) |
|
152 | 152 | $return[$storage] = $data['text']; |
153 | 153 | } |
154 | 154 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | public function save($action = "ftp") |
159 | 159 | { |
160 | - if(!$action) |
|
160 | + if (!$action) |
|
161 | 161 | { |
162 | 162 | return false; |
163 | 163 | } |
@@ -165,17 +165,17 @@ discard block |
||
165 | 165 | $storage = $this->xcloner_sanitization->sanitize_input_as_string($action); |
166 | 166 | $this->logger->debug(sprintf("Saving the remote storage %s options", strtoupper($action))); |
167 | 167 | |
168 | - if(is_array($this->storage_fields[$storage])) |
|
168 | + if (is_array($this->storage_fields[$storage])) |
|
169 | 169 | { |
170 | - foreach($this->storage_fields[$storage] as $field=>$validation) |
|
170 | + foreach ($this->storage_fields[$storage] as $field=>$validation) |
|
171 | 171 | { |
172 | 172 | $check_field = $this->storage_fields["option_prefix"].$field; |
173 | 173 | $sanitize_method = "sanitize_input_as_".$validation; |
174 | 174 | |
175 | - if(!isset($_POST[$check_field])) |
|
175 | + if (!isset($_POST[$check_field])) |
|
176 | 176 | $_POST[$check_field] = 0; |
177 | 177 | |
178 | - if(!method_exists($this->xcloner_sanitization, $sanitize_method)) |
|
178 | + if (!method_exists($this->xcloner_sanitization, $sanitize_method)) |
|
179 | 179 | $sanitize_method = "sanitize_input_as_string"; |
180 | 180 | |
181 | 181 | $sanitized_value = $this->xcloner_sanitization->$sanitize_method($_POST[$check_field]); |
@@ -189,11 +189,11 @@ discard block |
||
189 | 189 | |
190 | 190 | public function check($action = "ftp") |
191 | 191 | { |
192 | - try{ |
|
192 | + try { |
|
193 | 193 | $this->verify_filesystem($action); |
194 | 194 | $this->xcloner->trigger_message(__("%s connection is valid.", 'xcloner-backup-and-restore'), "success", ucfirst($action)); |
195 | 195 | $this->logger->debug(sprintf("Connection to remote storage %s is valid", strtoupper($action))); |
196 | - }catch(Exception $e){ |
|
196 | + }catch (Exception $e) { |
|
197 | 197 | $this->xcloner->trigger_message("%s connection error: ".$e->getMessage(), "error", ucfirst($action)); |
198 | 198 | } |
199 | 199 | } |
@@ -204,35 +204,35 @@ discard block |
||
204 | 204 | |
205 | 205 | $this->logger->info(sprintf("Checking validity of the remote storage %s filesystem", strtoupper($storage_type))); |
206 | 206 | |
207 | - if(!method_exists($this, $method)) |
|
207 | + if (!method_exists($this, $method)) |
|
208 | 208 | return false; |
209 | 209 | |
210 | 210 | list($adapter, $filesystem) = $this->$method(); |
211 | 211 | |
212 | 212 | $test_file = substr(".xcloner_".md5(time()), 0, 15); |
213 | 213 | |
214 | - if($storage_type == "gdrive") |
|
214 | + if ($storage_type == "gdrive") |
|
215 | 215 | { |
216 | - if(!is_array($filesystem->listContents())) |
|
217 | - throw new Exception(__("Could not read data",'xcloner-backup-and-restore')); |
|
216 | + if (!is_array($filesystem->listContents())) |
|
217 | + throw new Exception(__("Could not read data", 'xcloner-backup-and-restore')); |
|
218 | 218 | $this->logger->debug(sprintf("I can list data from remote storage %s", strtoupper($storage_type))); |
219 | 219 | |
220 | 220 | return true; |
221 | 221 | } |
222 | 222 | |
223 | 223 | //testing write access |
224 | - if(!$filesystem->write($test_file, "data")) |
|
225 | - throw new Exception(__("Could not write data",'xcloner-backup-and-restore')); |
|
224 | + if (!$filesystem->write($test_file, "data")) |
|
225 | + throw new Exception(__("Could not write data", 'xcloner-backup-and-restore')); |
|
226 | 226 | $this->logger->debug(sprintf("I can write data to remote storage %s", strtoupper($storage_type))); |
227 | 227 | |
228 | 228 | //testing read access |
229 | - if(!$filesystem->read($test_file)) |
|
230 | - throw new Exception(__("Could not read data",'xcloner-backup-and-restore')); |
|
229 | + if (!$filesystem->read($test_file)) |
|
230 | + throw new Exception(__("Could not read data", 'xcloner-backup-and-restore')); |
|
231 | 231 | $this->logger->debug(sprintf("I can read data to remote storage %s", strtoupper($storage_type))); |
232 | 232 | |
233 | 233 | //delete test file |
234 | - if(!$filesystem->delete($test_file)) |
|
235 | - throw new Exception(__("Could not delete data",'xcloner-backup-and-restore')); |
|
234 | + if (!$filesystem->delete($test_file)) |
|
235 | + throw new Exception(__("Could not delete data", 'xcloner-backup-and-restore')); |
|
236 | 236 | $this->logger->debug(sprintf("I can delete data to remote storage %s", strtoupper($storage_type))); |
237 | 237 | |
238 | 238 | return true; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | public function upload_backup_to_storage($file, $storage) |
242 | 242 | { |
243 | - if(!$this->xcloner_file_system->get_storage_filesystem()->has($file)) |
|
243 | + if (!$this->xcloner_file_system->get_storage_filesystem()->has($file)) |
|
244 | 244 | { |
245 | 245 | $this->logger->info(sprintf("File not found %s in local storage", $file)); |
246 | 246 | return false; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | |
249 | 249 | $method = "get_".$storage."_filesystem"; |
250 | 250 | |
251 | - if(!method_exists($this, $method)) |
|
251 | + if (!method_exists($this, $method)) |
|
252 | 252 | return false; |
253 | 253 | |
254 | 254 | list($remote_storage_adapter, $remote_storage_filesystem) = $this->$method(); |
@@ -266,22 +266,22 @@ discard block |
||
266 | 266 | |
267 | 267 | $backup_file_stream = $this->xcloner_file_system->get_storage_filesystem()->readStream($file); |
268 | 268 | |
269 | - if(!$remote_storage_filesystem->writeStream($file, $backup_file_stream)) |
|
269 | + if (!$remote_storage_filesystem->writeStream($file, $backup_file_stream)) |
|
270 | 270 | { |
271 | 271 | $this->logger->info(sprintf("Could not transfer file %s", $file)); |
272 | 272 | return false; |
273 | 273 | } |
274 | 274 | |
275 | - if($this->xcloner_file_system->is_multipart($file)) |
|
275 | + if ($this->xcloner_file_system->is_multipart($file)) |
|
276 | 276 | { |
277 | 277 | $parts = $this->xcloner_file_system->get_multipart_files($file); |
278 | - if(is_array($parts)) |
|
279 | - foreach($parts as $part_file) |
|
278 | + if (is_array($parts)) |
|
279 | + foreach ($parts as $part_file) |
|
280 | 280 | { |
281 | 281 | $this->logger->info(sprintf("Transferring backup %s to remote storage %s", $part_file, strtoupper($storage)), array("")); |
282 | 282 | |
283 | 283 | $backup_file_stream = $this->xcloner_file_system->get_storage_filesystem()->readStream($part_file); |
284 | - if(!$remote_storage_filesystem->writeStream($part_file, $backup_file_stream)) |
|
284 | + if (!$remote_storage_filesystem->writeStream($part_file, $backup_file_stream)) |
|
285 | 285 | return false; |
286 | 286 | } |
287 | 287 | } |
@@ -298,18 +298,18 @@ discard block |
||
298 | 298 | |
299 | 299 | $target_filename = $file; |
300 | 300 | |
301 | - if(!method_exists($this, $method)) |
|
301 | + if (!method_exists($this, $method)) |
|
302 | 302 | return false; |
303 | 303 | |
304 | 304 | list($remote_storage_adapter, $remote_storage_filesystem) = $this->$method(); |
305 | 305 | |
306 | - if(!$remote_storage_filesystem->has($file)) |
|
306 | + if (!$remote_storage_filesystem->has($file)) |
|
307 | 307 | { |
308 | 308 | $this->logger->info(sprintf("File not found %s in remote storage %s", $file, strtoupper($storage))); |
309 | 309 | return false; |
310 | 310 | } |
311 | 311 | |
312 | - if($storage == "gdrive") |
|
312 | + if ($storage == "gdrive") |
|
313 | 313 | { |
314 | 314 | $metadata = $remote_storage_filesystem->getMetadata($file); |
315 | 315 | $target_filename = $metadata['filename'].".".$metadata['extension']; |
@@ -319,22 +319,22 @@ discard block |
||
319 | 319 | |
320 | 320 | $backup_file_stream = $remote_storage_filesystem->readStream($file); |
321 | 321 | |
322 | - if(!$this->xcloner_file_system->get_storage_filesystem()->writeStream($target_filename, $backup_file_stream)) |
|
322 | + if (!$this->xcloner_file_system->get_storage_filesystem()->writeStream($target_filename, $backup_file_stream)) |
|
323 | 323 | { |
324 | 324 | $this->logger->info(sprintf("Could not transfer file %s", $file)); |
325 | 325 | return false; |
326 | 326 | } |
327 | 327 | |
328 | - if($this->xcloner_file_system->is_multipart($target_filename)) |
|
328 | + if ($this->xcloner_file_system->is_multipart($target_filename)) |
|
329 | 329 | { |
330 | 330 | $parts = $this->xcloner_file_system->get_multipart_files($file, $storage); |
331 | - if(is_array($parts)) |
|
332 | - foreach($parts as $part_file) |
|
331 | + if (is_array($parts)) |
|
332 | + foreach ($parts as $part_file) |
|
333 | 333 | { |
334 | 334 | $this->logger->info(sprintf("Transferring backup %s to local storage from %s storage", $part_file, strtoupper($storage)), array("")); |
335 | 335 | |
336 | 336 | $backup_file_stream = $remote_storage_filesystem->readStream($part_file); |
337 | - if(!$this->xcloner_file_system->get_storage_filesystem()->writeStream($part_file, $backup_file_stream)) |
|
337 | + if (!$this->xcloner_file_system->get_storage_filesystem()->writeStream($part_file, $backup_file_stream)) |
|
338 | 338 | return false; |
339 | 339 | } |
340 | 340 | } |
@@ -348,19 +348,19 @@ discard block |
||
348 | 348 | public function clean_remote_storage($storage, $remote_storage_filesystem) |
349 | 349 | { |
350 | 350 | $check_field = $this->storage_fields["option_prefix"].$storage."_cleanup_days"; |
351 | - if($expire_days = get_option($check_field)) |
|
351 | + if ($expire_days = get_option($check_field)) |
|
352 | 352 | { |
353 | 353 | $this->logger->info(sprintf("Doing %s remote storage cleanup for %s days limit", strtoupper($storage), $expire_days)); |
354 | 354 | $files = $remote_storage_filesystem->listContents(); |
355 | 355 | |
356 | 356 | $current_timestamp = strtotime("-".$expire_days." days"); |
357 | 357 | |
358 | - if(is_array($files)) |
|
359 | - foreach($files as $file) |
|
358 | + if (is_array($files)) |
|
359 | + foreach ($files as $file) |
|
360 | 360 | { |
361 | 361 | $file['timestamp'] = $remote_storage_filesystem->getTimestamp($file['path']); |
362 | 362 | |
363 | - if($current_timestamp >= $file['timestamp']) |
|
363 | + if ($current_timestamp >= $file['timestamp']) |
|
364 | 364 | { |
365 | 365 | $remote_storage_filesystem->delete($file['path']); |
366 | 366 | $this->logger->info("Deleting remote file ".$file['path']." matching rule", array("RETENTION LIMIT TIMESTAMP", $file['timestamp']." =< ".$expire_days)); |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | { |
499 | 499 | |
500 | 500 | //if((function_exists("is_plugin_active") && !is_plugin_active("xcloner-google-drive/xcloner-google-drive.php")) || !file_exists(__DIR__ . "/../../xcloner-google-drive/vendor/autoload.php")) |
501 | - if(!class_exists('Google_Client')) |
|
501 | + if (!class_exists('Google_Client')) |
|
502 | 502 | { |
503 | 503 | return false; |
504 | 504 | } |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | { |
525 | 525 | $client = $this->gdrive_construct(); |
526 | 526 | |
527 | - if(!$client) |
|
527 | + if (!$client) |
|
528 | 528 | return false; |
529 | 529 | |
530 | 530 | return $authUrl = $client->createAuthUrl(); |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | { |
535 | 535 | $client = $this->gdrive_construct(); |
536 | 536 | |
537 | - if(!$client) |
|
537 | + if (!$client) |
|
538 | 538 | { |
539 | 539 | $error_msg = "Could not initialize the Google Drive Class, please check that the xcloner-google-drive plugin is enabled..."; |
540 | 540 | $this->logger->error($error_msg); |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | update_option("xcloner_gdrive_access_token", $token['access_token']); |
548 | 548 | update_option("xcloner_gdrive_refresh_token", $token['refresh_token']); |
549 | 549 | |
550 | - $redirect_url = ('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']."?page=xcloner_remote_storage_page#gdrive"); |
|
550 | + $redirect_url = ('http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."?page=xcloner_remote_storage_page#gdrive"); |
|
551 | 551 | |
552 | 552 | ?> |
553 | 553 | <script> |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | |
573 | 573 | $client = $this->gdrive_construct(); |
574 | 574 | |
575 | - if(!$client) |
|
575 | + if (!$client) |
|
576 | 576 | { |
577 | 577 | $error_msg = "Could not initialize the Google Drive Class, please check that the xcloner-google-drive plugin is enabled..."; |
578 | 578 | $this->logger->error($error_msg); |
@@ -584,18 +584,18 @@ discard block |
||
584 | 584 | $service = new \Google_Service_Drive($client); |
585 | 585 | |
586 | 586 | $parent = 'root'; |
587 | - $dir = basename( get_option("xcloner_gdrive_target_folder")); |
|
587 | + $dir = basename(get_option("xcloner_gdrive_target_folder")); |
|
588 | 588 | |
589 | 589 | $folderID = get_option("xcloner_gdrive_target_folder"); |
590 | 590 | |
591 | 591 | $tmp = parse_url($folderID); |
592 | 592 | |
593 | - if(isset($tmp['query'])) |
|
593 | + if (isset($tmp['query'])) |
|
594 | 594 | { |
595 | 595 | $folderID = str_replace("id=", "", $tmp['query']); |
596 | 596 | } |
597 | 597 | |
598 | - if(stristr($folderID, "/")) |
|
598 | + if (stristr($folderID, "/")) |
|
599 | 599 | { |
600 | 600 | $query = sprintf('mimeType = \'application/vnd.google-apps.folder\' and \'%s\' in parents and name contains \'%s\'', $parent, $dir); |
601 | 601 | $response = $service->files->listFiles([ |
@@ -603,12 +603,12 @@ discard block |
||
603 | 603 | 'q' => $query |
604 | 604 | ]); |
605 | 605 | |
606 | - if(sizeof($response)) |
|
606 | + if (sizeof($response)) |
|
607 | 607 | { |
608 | 608 | foreach ($response as $obj) { |
609 | - $folderID = $obj->getId(); |
|
609 | + $folderID = $obj->getId(); |
|
610 | 610 | } |
611 | - }else{ |
|
611 | + } else { |
|
612 | 612 | $this->xcloner->trigger_message(sprintf(__("Could not find folder ID by name %s", 'xcloner-backup-and-restore'), $folderID), "error"); |
613 | 613 | } |
614 | 614 | } |