@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | try{ |
26 | 26 | $option = Util::normalizePath($path); |
27 | - }catch(Exception $e){ |
|
27 | + } catch(Exception $e){ |
|
28 | 28 | add_settings_error('xcloner_error_message', '', __($e->getMessage()), 'error'); |
29 | 29 | } |
30 | 30 |
@@ -69,44 +69,57 @@ |
||
69 | 69 | update_option( "xcloner_db_version", $xcloner_db_version ); |
70 | 70 | } |
71 | 71 | |
72 | - if(!get_option('xcloner_backup_compression_level')) |
|
73 | - update_option('xcloner_backup_compression_level', 0); |
|
72 | + if(!get_option('xcloner_backup_compression_level')) { |
|
73 | + update_option('xcloner_backup_compression_level', 0); |
|
74 | + } |
|
74 | 75 | |
75 | - if(!get_option('xcloner_enable_log')) |
|
76 | - update_option('xcloner_enable_log', 1); |
|
76 | + if(!get_option('xcloner_enable_log')) { |
|
77 | + update_option('xcloner_enable_log', 1); |
|
78 | + } |
|
77 | 79 | |
78 | - if(!get_option('xcloner_enable_mysql_backup')) |
|
79 | - update_option('xcloner_enable_mysql_backup', 1); |
|
80 | + if(!get_option('xcloner_enable_mysql_backup')) { |
|
81 | + update_option('xcloner_enable_mysql_backup', 1); |
|
82 | + } |
|
80 | 83 | |
81 | - if(!get_option('xcloner_system_settings_page')) |
|
82 | - update_option('xcloner_system_settings_page', 100); |
|
84 | + if(!get_option('xcloner_system_settings_page')) { |
|
85 | + update_option('xcloner_system_settings_page', 100); |
|
86 | + } |
|
83 | 87 | |
84 | - if(!get_option('xcloner_files_to_process_per_request')) |
|
85 | - update_option('xcloner_files_to_process_per_request', 250); |
|
88 | + if(!get_option('xcloner_files_to_process_per_request')) { |
|
89 | + update_option('xcloner_files_to_process_per_request', 250); |
|
90 | + } |
|
86 | 91 | |
87 | - if(!get_option('xcloner_database_records_per_request')) |
|
88 | - update_option('xcloner_database_records_per_request', 10000); |
|
92 | + if(!get_option('xcloner_database_records_per_request')) { |
|
93 | + update_option('xcloner_database_records_per_request', 10000); |
|
94 | + } |
|
89 | 95 | |
90 | - if(!get_option('xcloner_exclude_files_larger_than_mb')) |
|
91 | - update_option('xcloner_exclude_files_larger_than_mb', 0); |
|
96 | + if(!get_option('xcloner_exclude_files_larger_than_mb')) { |
|
97 | + update_option('xcloner_exclude_files_larger_than_mb', 0); |
|
98 | + } |
|
92 | 99 | |
93 | - if(!get_option('xcloner_split_backup_limit')) |
|
94 | - update_option('xcloner_split_backup_limit', 2048); |
|
100 | + if(!get_option('xcloner_split_backup_limit')) { |
|
101 | + update_option('xcloner_split_backup_limit', 2048); |
|
102 | + } |
|
95 | 103 | |
96 | - if(!get_option('xcloner_size_limit_per_request')) |
|
97 | - update_option('xcloner_size_limit_per_request', 50); |
|
104 | + if(!get_option('xcloner_size_limit_per_request')) { |
|
105 | + update_option('xcloner_size_limit_per_request', 50); |
|
106 | + } |
|
98 | 107 | |
99 | - if(!get_option('xcloner_cleanup_retention_limit_days')) |
|
100 | - update_option('xcloner_cleanup_retention_limit_days', 60); |
|
108 | + if(!get_option('xcloner_cleanup_retention_limit_days')) { |
|
109 | + update_option('xcloner_cleanup_retention_limit_days', 60); |
|
110 | + } |
|
101 | 111 | |
102 | - if(!get_option('xcloner_cleanup_retention_limit_archives')) |
|
103 | - update_option('xcloner_cleanup_retention_limit_archives', 100); |
|
112 | + if(!get_option('xcloner_cleanup_retention_limit_archives')) { |
|
113 | + update_option('xcloner_cleanup_retention_limit_archives', 100); |
|
114 | + } |
|
104 | 115 | |
105 | - if(!get_option('xcloner_directories_to_scan_per_request')) |
|
106 | - update_option('xcloner_directories_to_scan_per_request', 25); |
|
116 | + if(!get_option('xcloner_directories_to_scan_per_request')) { |
|
117 | + update_option('xcloner_directories_to_scan_per_request', 25); |
|
118 | + } |
|
107 | 119 | |
108 | - if(!get_option('xcloner_regex_exclude')) |
|
109 | - update_option('xcloner_regex_exclude', "(wp-content\/updraft|wp-content\/uploads\/wp_all_backup)(.*)$".PHP_EOL."(.*)\.(svn|git)(.*)$".PHP_EOL."wp-content\/cache(.*)$"); |
|
120 | + if(!get_option('xcloner_regex_exclude')) { |
|
121 | + update_option('xcloner_regex_exclude', "(wp-content\/updraft|wp-content\/uploads\/wp_all_backup)(.*)$".PHP_EOL."(.*)\.(svn|git)(.*)$".PHP_EOL."wp-content\/cache(.*)$"); |
|
122 | + } |
|
110 | 123 | |
111 | 124 | } |
112 | 125 |
@@ -13,20 +13,25 @@ discard block |
||
13 | 13 | |
14 | 14 | public function check_backup_ready_status() |
15 | 15 | { |
16 | - if(!$this->check_min_php_version(1)) |
|
17 | - return false; |
|
16 | + if(!$this->check_min_php_version(1)) { |
|
17 | + return false; |
|
18 | + } |
|
18 | 19 | |
19 | - if(!$this->check_safe_mode(1)) |
|
20 | - return false; |
|
20 | + if(!$this->check_safe_mode(1)) { |
|
21 | + return false; |
|
22 | + } |
|
21 | 23 | |
22 | - if(!$this->check_xcloner_start_path(1)) |
|
23 | - return false; |
|
24 | + if(!$this->check_xcloner_start_path(1)) { |
|
25 | + return false; |
|
26 | + } |
|
24 | 27 | |
25 | - if(!$this->check_xcloner_store_path(1)) |
|
26 | - return false; |
|
28 | + if(!$this->check_xcloner_store_path(1)) { |
|
29 | + return false; |
|
30 | + } |
|
27 | 31 | |
28 | - if(!$this->check_xcloner_tmp_path(1)) |
|
29 | - return false; |
|
32 | + if(!$this->check_xcloner_tmp_path(1)) { |
|
33 | + return false; |
|
34 | + } |
|
30 | 35 | |
31 | 36 | return true; |
32 | 37 | } |
@@ -41,10 +46,11 @@ discard block |
||
41 | 46 | |
42 | 47 | if($return_bool == 1) |
43 | 48 | { |
44 | - if(version_compare(phpversion(), $this->min_php_version, '<')) |
|
45 | - return false; |
|
46 | - else |
|
47 | - return true; |
|
49 | + if(version_compare(phpversion(), $this->min_php_version, '<')) { |
|
50 | + return false; |
|
51 | + } else { |
|
52 | + return true; |
|
53 | + } |
|
48 | 54 | } |
49 | 55 | |
50 | 56 | return phpversion(); |
@@ -56,14 +62,16 @@ discard block |
||
56 | 62 | |
57 | 63 | if($return_bool) |
58 | 64 | { |
59 | - if( ini_get('safe_mode') ) |
|
60 | - return false; |
|
61 | - else |
|
62 | - return true; |
|
65 | + if( ini_get('safe_mode') ) { |
|
66 | + return false; |
|
67 | + } else { |
|
68 | + return true; |
|
69 | + } |
|
63 | 70 | } |
64 | 71 | |
65 | - if( ini_get('safe_mode') ) |
|
66 | - $safe_mode = "On"; |
|
72 | + if( ini_get('safe_mode') ) { |
|
73 | + $safe_mode = "On"; |
|
74 | + } |
|
67 | 75 | |
68 | 76 | return $safe_mode; |
69 | 77 | } |
@@ -74,8 +82,9 @@ discard block |
||
74 | 82 | |
75 | 83 | if($return_bool) |
76 | 84 | { |
77 | - if(!file_exists($path)) |
|
78 | - return false; |
|
85 | + if(!file_exists($path)) { |
|
86 | + return false; |
|
87 | + } |
|
79 | 88 | |
80 | 89 | return is_readable($path); |
81 | 90 | } |
@@ -89,11 +98,13 @@ discard block |
||
89 | 98 | |
90 | 99 | if($return_bool) |
91 | 100 | { |
92 | - if(!file_exists($path)) |
|
93 | - return false; |
|
101 | + if(!file_exists($path)) { |
|
102 | + return false; |
|
103 | + } |
|
94 | 104 | |
95 | - if(!is_writeable($path)) |
|
96 | - @chmod($path, 0777); |
|
105 | + if(!is_writeable($path)) { |
|
106 | + @chmod($path, 0777); |
|
107 | + } |
|
97 | 108 | |
98 | 109 | return is_writeable($path); |
99 | 110 | } |
@@ -107,11 +118,13 @@ discard block |
||
107 | 118 | |
108 | 119 | if($return_bool) |
109 | 120 | { |
110 | - if(!file_exists($path)) |
|
111 | - return false; |
|
121 | + if(!file_exists($path)) { |
|
122 | + return false; |
|
123 | + } |
|
112 | 124 | |
113 | - if(!is_writeable($path)) |
|
114 | - @chmod($path, 0777); |
|
125 | + if(!is_writeable($path)) { |
|
126 | + @chmod($path, 0777); |
|
127 | + } |
|
115 | 128 | |
116 | 129 | return is_writeable($path); |
117 | 130 | } |
@@ -133,8 +146,9 @@ discard block |
||
133 | 146 | { |
134 | 147 | $open_basedir = ini_get('open_basedir'); |
135 | 148 | |
136 | - if(!$open_basedir) |
|
137 | - $open_basedir = "none"; |
|
149 | + if(!$open_basedir) { |
|
150 | + $open_basedir = "none"; |
|
151 | + } |
|
138 | 152 | return $open_basedir; |
139 | 153 | } |
140 | 154 | |
@@ -153,8 +167,9 @@ discard block |
||
153 | 167 | $unit_count = count($unit_list); |
154 | 168 | for ($i = $unit_count - 1; $i >= 0; $i--) { |
155 | 169 | $power = $i * 10; |
156 | - if (($bytes >> $power) >= 1) |
|
157 | - return round($bytes / (1 << $power), $decimals) . ' ' . $unit_list[$i]; |
|
170 | + if (($bytes >> $power) >= 1) { |
|
171 | + return round($bytes / (1 << $power), $decimals) . ' ' . $unit_list[$i]; |
|
172 | + } |
|
158 | 173 | } |
159 | 174 | } |
160 | 175 | } |
@@ -19,8 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | public function transfer_file($file, $start = 0, $hash = "") |
21 | 21 | { |
22 | - if(!$this->target_url) |
|
23 | - throw new Exception("Please setup a target url for upload"); |
|
22 | + if(!$this->target_url) { |
|
23 | + throw new Exception("Please setup a target url for upload"); |
|
24 | + } |
|
24 | 25 | |
25 | 26 | |
26 | 27 | $fp = $this->get_storage_filesystem()->readStream($file); |
@@ -68,8 +69,9 @@ discard block |
||
68 | 69 | |
69 | 70 | $result = json_decode($original_result); |
70 | 71 | |
71 | - if(!$result) |
|
72 | - throw new Exception("We have received no valid response from the remote host, original message: ". $original_result); |
|
72 | + if(!$result) { |
|
73 | + throw new Exception("We have received no valid response from the remote host, original message: ". $original_result); |
|
74 | + } |
|
73 | 75 | |
74 | 76 | if($result->status != 200) |
75 | 77 | { |
@@ -94,7 +96,7 @@ discard block |
||
94 | 96 | . ($postname ?: basename($filename)) |
95 | 97 | . ($mimetype ? ";type=$mimetype" : ''); |
96 | 98 | |
97 | - }else{ |
|
99 | + } else{ |
|
98 | 100 | |
99 | 101 | return curl_file_create($filename, $mimetype, $postname); |
100 | 102 |
@@ -33,7 +33,10 @@ |
||
33 | 33 | <li class="active"> |
34 | 34 | <div class="collapsible-header active"><i class="material-icons">bug_report</i>XCloner Debugger</div> |
35 | 35 | <div class="collapsible-body"> |
36 | - <div class="console" id="xcloner-console"><?php if(isset($logger_content)) echo implode("<br />\n", $logger_content); ?></div> |
|
36 | + <div class="console" id="xcloner-console"><?php if(isset($logger_content)) { |
|
37 | + echo implode("<br />\n", $logger_content); |
|
38 | +} |
|
39 | +?></div> |
|
37 | 40 | </div> |
38 | 41 | </li> |
39 | 42 | </ul> |
@@ -61,8 +61,9 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function enqueue_styles($hook) { |
63 | 63 | |
64 | - if(!stristr($hook, "page_".$this->plugin_name) || (isset($_GET['option']) and $_GET['option']=="com_cloner")) |
|
65 | - return; |
|
64 | + if(!stristr($hook, "page_".$this->plugin_name) || (isset($_GET['option']) and $_GET['option']=="com_cloner")) { |
|
65 | + return; |
|
66 | + } |
|
66 | 67 | |
67 | 68 | /** |
68 | 69 | * This function is provided for demonstration purposes only. |
@@ -93,8 +94,9 @@ discard block |
||
93 | 94 | */ |
94 | 95 | public function enqueue_scripts($hook) { |
95 | 96 | |
96 | - if(!stristr($hook, "page_".$this->plugin_name)) |
|
97 | - return; |
|
97 | + if(!stristr($hook, "page_".$this->plugin_name)) { |
|
98 | + return; |
|
99 | + } |
|
98 | 100 | |
99 | 101 | /** |
100 | 102 | * This function is provided for demonstration purposes only. |
@@ -234,15 +236,15 @@ discard block |
||
234 | 236 | settings_fields('xcloner_general_settings_group'); |
235 | 237 | do_settings_sections('xcloner_settings_page'); |
236 | 238 | |
237 | - }elseif( $active_tab == 'mysql_options' ) { |
|
239 | + } elseif( $active_tab == 'mysql_options' ) { |
|
238 | 240 | |
239 | 241 | settings_fields('xcloner_mysql_settings_group'); |
240 | 242 | do_settings_sections('xcloner_mysql_settings_page'); |
241 | - }elseif( $active_tab == 'system_options' ) { |
|
243 | + } elseif( $active_tab == 'system_options' ) { |
|
242 | 244 | |
243 | 245 | settings_fields('xcloner_system_settings_group'); |
244 | 246 | do_settings_sections('xcloner_system_settings_page'); |
245 | - }elseif( $active_tab == 'cleanup_options' ) { |
|
247 | + } elseif( $active_tab == 'cleanup_options' ) { |
|
246 | 248 | |
247 | 249 | settings_fields('xcloner_cleanup_settings_group'); |
248 | 250 | do_settings_sections('xcloner_cleanup_settings_page'); |
@@ -31,8 +31,9 @@ discard block |
||
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 | 38 | define("DS", DIRECTORY_SEPARATOR); |
38 | 39 | |
@@ -123,7 +124,7 @@ discard block |
||
123 | 124 | |
124 | 125 | $xcloner_plugin = run_xcloner(); |
125 | 126 | |
126 | -}catch(Exception $e){ |
|
127 | +} catch(Exception $e){ |
|
127 | 128 | |
128 | 129 | echo $e->getMessage(); |
129 | 130 |
@@ -3,8 +3,9 @@ discard block |
||
3 | 3 | |
4 | 4 | $gdrive_auth_url = ""; |
5 | 5 | |
6 | -if(method_exists($remote_storage, "get_gdrive_auth_url")) |
|
6 | +if(method_exists($remote_storage, "get_gdrive_auth_url")) { |
|
7 | 7 | $gdrive_auth_url = $remote_storage->get_gdrive_auth_url(); |
8 | +} |
|
8 | 9 | |
9 | 10 | $gdrive_construct = $remote_storage->gdrive_construct(); |
10 | 11 | ?> |
@@ -25,7 +26,8 @@ discard block |
||
25 | 26 | <div class="switch"> |
26 | 27 | <label> |
27 | 28 | Off |
28 | - <input type="checkbox" name="xcloner_ftp_enable" class="status" value="1" <?php if(get_option("xcloner_ftp_enable")) echo "checked"?> \> |
|
29 | + <input type="checkbox" name="xcloner_ftp_enable" class="status" value="1" <?php if(get_option("xcloner_ftp_enable")) { |
|
30 | + echo "checked"?> \> |
|
29 | 31 | <span class="lever"></span> |
30 | 32 | On |
31 | 33 | </label> |
@@ -286,6 +288,7 @@ discard block |
||
286 | 288 | <option readonly value=""><?php echo __("Please Select AWS Region")?></option> |
287 | 289 | <?php |
288 | 290 | $aws_regions = $remote_storage->get_aws_regions(); |
291 | +} |
|
289 | 292 | |
290 | 293 | foreach($aws_regions as $key=>$region){ |
291 | 294 | ?> |
@@ -339,7 +342,8 @@ discard block |
||
339 | 342 | <div class="switch"> |
340 | 343 | <label> |
341 | 344 | Off |
342 | - <input type="checkbox" name="xcloner_dropbox_enable" class="status" value="1" <?php if(get_option("xcloner_dropbox_enable")) echo "checked"?> \> |
|
345 | + <input type="checkbox" name="xcloner_dropbox_enable" class="status" value="1" <?php if(get_option("xcloner_dropbox_enable")) { |
|
346 | + echo "checked"?> \> |
|
343 | 347 | <span class="lever"></span> |
344 | 348 | On |
345 | 349 | </label> |
@@ -767,6 +771,7 @@ discard block |
||
767 | 771 | <div class="center"> |
768 | 772 | <?php |
769 | 773 | $url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=xcloner-google-drive'), 'install-plugin_xcloner-google-drive'); |
774 | +} |
|
770 | 775 | ?> |
771 | 776 | <h6><?php echo __("This storage option requires the XCloner-Google-Drive Wordpress Plugin to be installed and activated.")?></h6> |
772 | 777 | <h6><?php echo __("PHP 5.5 minimum version is required.")?></h6> |
@@ -100,7 +100,8 @@ discard block |
||
100 | 100 | echo date($date_format." ".$time_format, $latest_backup['timestamp']+(get_option( 'gmt_offset' ) * HOUR_IN_SECONDS)) |
101 | 101 | ?> |
102 | 102 | </div> |
103 | - <?php else:?> |
|
103 | + <?php else { |
|
104 | + :?> |
|
104 | 105 | <div class="item"> |
105 | 106 | <div class="title"><?php echo __("No Backup Yet", 'xcloner-backup-and-restore')?></div> |
106 | 107 | </div> |
@@ -111,7 +112,9 @@ discard block |
||
111 | 112 | <blockquote> |
112 | 113 | <div class="item"> |
113 | 114 | <div class="title"><?php echo __("Total Size", 'xcloner-backup-and-restore')?>:</div> |
114 | - <?php echo size_format($xcloner_file_system->get_storage_usage());?> |
|
115 | + <?php echo size_format($xcloner_file_system->get_storage_usage()); |
|
116 | +} |
|
117 | +?> |
|
115 | 118 | </div> |
116 | 119 | </blockquote> |
117 | 120 | <h5><?php echo __("Next Scheduled Backup", 'xcloner-backup-and-restore')?></h5> |
@@ -125,8 +128,9 @@ discard block |
||
125 | 128 | $xcloner_file_system->sort_by($list, "next_run_time","asc"); |
126 | 129 | } |
127 | 130 | |
128 | - if(isset($list[0])) |
|
129 | - $latest_schedule = $list[0]; |
|
131 | + if(isset($list[0])) { |
|
132 | + $latest_schedule = $list[0]; |
|
133 | + } |
|
130 | 134 | ?> |
131 | 135 | <?php if(isset($latest_schedule->name)):?> |
132 | 136 | <div class="title"><?php echo __("Schedule Name", 'xcloner-backup-and-restore')?>:</div> |
@@ -135,10 +139,11 @@ discard block |
||
135 | 139 | </div> |
136 | 140 | <div class="item"> |
137 | 141 | <div class="title"><?php echo __("Next Call", 'xcloner-backup-and-restore')?>:</div> |
138 | - <?php if(isset($latest_schedule->next_run_time)) |
|
142 | + <?php if(isset($latest_schedule->next_run_time)) { |
|
139 | 143 | echo date($date_format." ".$time_format, $latest_schedule->next_run_time); |
140 | - else |
|
141 | - echo __("Unscheduled",'xcloner-backup-and-restore'); |
|
144 | +} else { |
|
145 | + echo __("Unscheduled",'xcloner-backup-and-restore'); |
|
146 | + } |
|
142 | 147 | ?> |
143 | 148 | </div> |
144 | 149 | </blockquote> |
@@ -153,7 +158,10 @@ discard block |
||
153 | 158 | <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 | 159 | </div> |
155 | 160 | <div class="collapsible-body"> |
156 | - <div class="console" id="xcloner-console"><?php if($logger_content) echo implode("<br />\n", array_reverse($logger_content)); ?></div> |
|
161 | + <div class="console" id="xcloner-console"><?php if($logger_content) { |
|
162 | + echo implode("<br />\n", array_reverse($logger_content)); |
|
163 | +} |
|
164 | +?></div> |
|
157 | 165 | </div> |
158 | 166 | </li> |
159 | 167 | <script> |
@@ -214,8 +222,9 @@ discard block |
||
214 | 222 | </li> |
215 | 223 | <?php |
216 | 224 | $data = array(); |
217 | - if($requirements->check_backup_ready_status()) |
|
218 | - $data = $xcloner_file_system->estimate_read_write_time(); |
|
225 | + if($requirements->check_backup_ready_status()) { |
|
226 | + $data = $xcloner_file_system->estimate_read_write_time(); |
|
227 | + } |
|
219 | 228 | ?> |
220 | 229 | <li class="card-panel grey darken-1" > |
221 | 230 | <?php echo __('Reading Time 1MB Block','xcloner-backup-and-restore')?>: <?php echo (isset($data['reading_time'])?$data['reading_time']:__("unknown"));?> |