@@ -42,10 +42,11 @@ discard block |
||
42 | 42 | { |
43 | 43 | $new_list= array(); |
44 | 44 | |
45 | - foreach($list as $res) |
|
46 | - if($res->status) |
|
45 | + foreach($list as $res) { |
|
46 | + if($res->status) |
|
47 | 47 | { |
48 | 48 | $res->next_run_time = wp_next_scheduled('xcloner_scheduler_'.$res->id, array($res->id))+(get_option( 'gmt_offset' ) * HOUR_IN_SECONDS); |
49 | + } |
|
49 | 50 | $new_list[] = $res; |
50 | 51 | } |
51 | 52 | $list = $new_list; |
@@ -71,8 +72,9 @@ discard block |
||
71 | 72 | { |
72 | 73 | $data = $this->db->get_row("SELECT * FROM ".$this->scheduler_table." WHERE id=".$id, ARRAY_A); |
73 | 74 | |
74 | - if(!$data) |
|
75 | - return false; |
|
75 | + if(!$data) { |
|
76 | + return false; |
|
77 | + } |
|
76 | 78 | |
77 | 79 | $params = json_decode($data['params']); |
78 | 80 | |
@@ -122,12 +124,13 @@ discard block |
||
122 | 124 | |
123 | 125 | if ( ! wp_next_scheduled( $hook, array($schedule->id) ) and $schedule->status) { |
124 | 126 | |
125 | - if($schedule->recurrence == "single") |
|
126 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
127 | - else |
|
128 | - wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
127 | + if($schedule->recurrence == "single") { |
|
128 | + wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
129 | + } else { |
|
130 | + wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
131 | + } |
|
129 | 132 | |
130 | - }elseif(!$schedule->status) |
|
133 | + } elseif(!$schedule->status) |
|
131 | 134 | { |
132 | 135 | $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
133 | 136 | wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
@@ -146,9 +149,9 @@ discard block |
||
146 | 149 | |
147 | 150 | if ($schedule->status) { |
148 | 151 | |
149 | - if($schedule->recurrence == "single") |
|
150 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
151 | - else{ |
|
152 | + if($schedule->recurrence == "single") { |
|
153 | + wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
154 | + } else{ |
|
152 | 155 | wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
153 | 156 | } |
154 | 157 | |
@@ -274,8 +277,9 @@ discard block |
||
274 | 277 | |
275 | 278 | //getting the last backup archive file |
276 | 279 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_with_extension(); |
277 | - if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
278 | - $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
|
280 | + if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) { |
|
281 | + $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
|
282 | + } |
|
279 | 283 | |
280 | 284 | $this->update_last_backup($schedule['id'], $return['extra']['backup_parent']); |
281 | 285 | |
@@ -285,8 +289,9 @@ discard block |
||
285 | 289 | |
286 | 290 | $this->logger->info(sprintf("Transferring backup to remote storage %s", strtoupper($schedule['remote_storage'])), array("CRON")); |
287 | 291 | |
288 | - if(method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) |
|
289 | - call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage'])); |
|
292 | + if(method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) { |
|
293 | + call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage'])); |
|
294 | + } |
|
290 | 295 | } |
291 | 296 | |
292 | 297 | |
@@ -296,7 +301,7 @@ discard block |
||
296 | 301 | $from = "XCloner Schedule - ".$schedule['name']; |
297 | 302 | $additional['lines_total'] = $return['extra']['lines_total']; |
298 | 303 | $this->archive_system->send_notification($to, $from, "", $return['extra']['backup_parent'], $schedule, "", $additional); |
299 | - }catch(Exception $e) |
|
304 | + } catch(Exception $e) |
|
300 | 305 | { |
301 | 306 | $this->logger->error($e->getMessage()); |
302 | 307 | } |
@@ -315,11 +320,12 @@ discard block |
||
315 | 320 | |
316 | 321 | $this->__xcloner_scheduler_callback($id, $schedule); |
317 | 322 | |
318 | - }catch(Exception $e){ |
|
323 | + } catch(Exception $e){ |
|
319 | 324 | |
320 | 325 | //send email to site admin if email notification is not set in the scheduler |
321 | - if(!isset($schedule['backup_params']->email_notification)) |
|
322 | - $schedule['backup_params']->email_notification = get_option('admin_email'); |
|
326 | + if(!isset($schedule['backup_params']->email_notification)) { |
|
327 | + $schedule['backup_params']->email_notification = get_option('admin_email'); |
|
328 | + } |
|
323 | 329 | |
324 | 330 | if(isset($schedule['backup_params']->email_notification) and $to=$schedule['backup_params']->email_notification) |
325 | 331 | { |
@@ -28,8 +28,9 @@ discard block |
||
28 | 28 | global $wpdb; |
29 | 29 | |
30 | 30 | error_reporting(0); |
31 | - if( ob_get_length() ) |
|
32 | - ob_end_clean(); |
|
31 | + if( ob_get_length() ) { |
|
32 | + ob_end_clean(); |
|
33 | + } |
|
33 | 34 | ob_start(); |
34 | 35 | |
35 | 36 | $wpdb->show_errors = false; |
@@ -83,7 +84,7 @@ discard block |
||
83 | 84 | { |
84 | 85 | $this->xcloner_database->init($data); |
85 | 86 | |
86 | - }catch(Exception $e){ |
|
87 | + } catch(Exception $e){ |
|
87 | 88 | |
88 | 89 | $this->send_response($e->getMessage()); |
89 | 90 | $this->logger->error($e->getMessage()); |
@@ -110,8 +111,9 @@ discard block |
||
110 | 111 | $schedule = array(); |
111 | 112 | $response = array(); |
112 | 113 | |
113 | - if(isset($_POST['data'])) |
|
114 | - $params = json_decode(stripslashes($_POST['data'])); |
|
114 | + if(isset($_POST['data'])) { |
|
115 | + $params = json_decode(stripslashes($_POST['data'])); |
|
116 | + } |
|
115 | 117 | |
116 | 118 | $this->process_params($params); |
117 | 119 | |
@@ -134,8 +136,9 @@ discard block |
||
134 | 136 | { |
135 | 137 | $table = str_replace("\r","", $table); |
136 | 138 | $data = explode(".", $table); |
137 | - if(isset($data[1])) |
|
138 | - $return[$data[0]][] = $data[1]; |
|
139 | + if(isset($data[1])) { |
|
140 | + $return[$data[0]][] = $data[1]; |
|
141 | + } |
|
139 | 142 | } |
140 | 143 | |
141 | 144 | $this->form_params['database'] = ($return); |
@@ -146,19 +149,21 @@ discard block |
||
146 | 149 | foreach($excluded_files as $file) |
147 | 150 | { |
148 | 151 | $file = str_replace("\r","", $file); |
149 | - if($file) |
|
150 | - $return[] = $file; |
|
152 | + if($file) { |
|
153 | + $return[] = $file; |
|
154 | + } |
|
151 | 155 | } |
152 | 156 | |
153 | 157 | $this->form_params['excluded_files'] = ($return); |
154 | 158 | |
155 | 159 | $schedule['start_at'] = $this->form_params['backup_params']['start_at']; |
156 | 160 | |
157 | - if(!isset($_POST['status'])) |
|
158 | - $schedule['status'] = 0; |
|
159 | - else |
|
160 | - $schedule['status'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['status']); |
|
161 | - }else{ |
|
161 | + if(!isset($_POST['status'])) { |
|
162 | + $schedule['status'] = 0; |
|
163 | + } else { |
|
164 | + $schedule['status'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['status']); |
|
165 | + } |
|
166 | + } else{ |
|
162 | 167 | |
163 | 168 | $schedule['status'] = 1; |
164 | 169 | $schedule['start_at'] = strtotime($this->form_params['backup_params']['schedule_start_date'] . |
@@ -168,7 +173,7 @@ discard block |
||
168 | 173 | if(!$schedule['start_at']) |
169 | 174 | { |
170 | 175 | $schedule['start_at'] = date('Y-m-d H:i:s', time()); |
171 | - }else{ |
|
176 | + } else{ |
|
172 | 177 | $schedule['start_at'] = date('Y-m-d H:i:s', $schedule['start_at'] - (get_option( 'gmt_offset' ) * HOUR_IN_SECONDS) ); |
173 | 178 | } |
174 | 179 | |
@@ -188,7 +193,7 @@ discard block |
||
188 | 193 | '%s' |
189 | 194 | ) |
190 | 195 | ); |
191 | - }else { |
|
196 | + } else { |
|
192 | 197 | $wpdb->update( |
193 | 198 | $wpdb->prefix.'xcloner_scheduler', |
194 | 199 | $schedule, |
@@ -199,8 +204,9 @@ discard block |
||
199 | 204 | ) |
200 | 205 | ); |
201 | 206 | } |
202 | - if(isset($_POST['id'])) |
|
203 | - $scheduler->update_cron_hook($_POST['id']); |
|
207 | + if(isset($_POST['id'])) { |
|
208 | + $scheduler->update_cron_hook($_POST['id']); |
|
209 | + } |
|
204 | 210 | |
205 | 211 | if( $wpdb->last_error ) { |
206 | 212 | $response['error'] = 1; |
@@ -227,8 +233,9 @@ discard block |
||
227 | 233 | |
228 | 234 | $init = (int)$_POST['init']; |
229 | 235 | |
230 | - if($params === NULL) |
|
231 | - die( '{"status":false,"msg":"The post_data parameter must be valid JSON"}' ); |
|
236 | + if($params === NULL) { |
|
237 | + die( '{"status":false,"msg":"The post_data parameter must be valid JSON"}' ); |
|
238 | + } |
|
232 | 239 | |
233 | 240 | $this->process_params($params); |
234 | 241 | |
@@ -237,7 +244,7 @@ discard block |
||
237 | 244 | //$return = $this->archive_system->start_incremental_backup($this->form_params['backup_params'], $this->form_params['extra'], $init); |
238 | 245 | try{ |
239 | 246 | $return = $this->archive_system->start_incremental_backup($this->form_params['backup_params'], $this->form_params['extra'], $init); |
240 | - }catch(Exception $e) |
|
247 | + } catch(Exception $e) |
|
241 | 248 | { |
242 | 249 | $return = array(); |
243 | 250 | $return['error'] = true; |
@@ -249,8 +256,9 @@ discard block |
||
249 | 256 | if($return['finished']) |
250 | 257 | { |
251 | 258 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_with_extension(); |
252 | - if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
253 | - $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
|
259 | + if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) { |
|
260 | + $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
|
261 | + } |
|
254 | 262 | } |
255 | 263 | |
256 | 264 | $data = $return; |
@@ -265,7 +273,7 @@ discard block |
||
265 | 273 | $subject = ""; |
266 | 274 | $additional['lines_total'] = $return['extra']['lines_total']; |
267 | 275 | $this->archive_system->send_notification($to, $from, $subject, $return['extra']['backup_parent'], $this->form_params,"", $additional); |
268 | - }catch(Exception $e) |
|
276 | + } catch(Exception $e) |
|
269 | 277 | { |
270 | 278 | $this->logger->error($e->getMessage()); |
271 | 279 | } |
@@ -289,18 +297,20 @@ discard block |
||
289 | 297 | |
290 | 298 | $init = (int)$_POST['init']; |
291 | 299 | |
292 | - if($params === NULL) |
|
293 | - die( '{"status":false,"msg":"The post_data parameter must be valid JSON"}' ); |
|
300 | + if($params === NULL) { |
|
301 | + die( '{"status":false,"msg":"The post_data parameter must be valid JSON"}' ); |
|
302 | + } |
|
294 | 303 | |
295 | 304 | $this->process_params($params); |
296 | 305 | |
297 | 306 | //$xcloner_database = $this->init_db(); |
298 | 307 | $return = $this->xcloner_database->start_database_recursion($this->form_params['database'], $this->form_params['extra'], $init); |
299 | 308 | |
300 | - if(isset($return['error']) and $return['error']) |
|
301 | - $data['finished'] = 1; |
|
302 | - else |
|
303 | - $data['finished'] = $return['finished']; |
|
309 | + if(isset($return['error']) and $return['error']) { |
|
310 | + $data['finished'] = 1; |
|
311 | + } else { |
|
312 | + $data['finished'] = $return['finished']; |
|
313 | + } |
|
304 | 314 | |
305 | 315 | $data['extra'] = $return; |
306 | 316 | |
@@ -319,8 +329,9 @@ discard block |
||
319 | 329 | $params = json_decode(stripslashes($_POST['data'])); |
320 | 330 | $init = (int)$_POST['init']; |
321 | 331 | |
322 | - if($params === NULL) |
|
323 | - die( '{"status":false,"msg":"The post_data parameter must be valid JSON"}' ); |
|
332 | + if($params === NULL) { |
|
333 | + die( '{"status":false,"msg":"The post_data parameter must be valid JSON"}' ); |
|
334 | + } |
|
324 | 335 | |
325 | 336 | $hash = $this->process_params($params); |
326 | 337 | |
@@ -343,8 +354,9 @@ discard block |
||
343 | 354 | */ |
344 | 355 | private function process_params($params) |
345 | 356 | { |
346 | - if(isset($params->hash)) |
|
347 | - $this->xcloner_settings->set_hash($params->hash); |
|
357 | + if(isset($params->hash)) { |
|
358 | + $this->xcloner_settings->set_hash($params->hash); |
|
359 | + } |
|
348 | 360 | |
349 | 361 | $this->form_params['extra'] = array(); |
350 | 362 | $this->form_params['backup_params'] = array(); |
@@ -397,8 +409,9 @@ discard block |
||
397 | 409 | |
398 | 410 | if(isset($params->extra)) |
399 | 411 | { |
400 | - foreach($params->extra as $key=>$value) |
|
401 | - $this->form_params['extra'][$key] = $this->xcloner_sanitization->sanitize_input_as_raw($value); |
|
412 | + foreach($params->extra as $key=>$value) { |
|
413 | + $this->form_params['extra'][$key] = $this->xcloner_sanitization->sanitize_input_as_raw($value); |
|
414 | + } |
|
402 | 415 | } |
403 | 416 | |
404 | 417 | return $this->xcloner_settings->get_hash(); |
@@ -432,7 +445,7 @@ discard block |
||
432 | 445 | |
433 | 446 | try{ |
434 | 447 | $files = $this->xcloner_file_system->list_directory($folder); |
435 | - }catch(Exception $e){ |
|
448 | + } catch(Exception $e){ |
|
436 | 449 | |
437 | 450 | print $e->getMessage(); |
438 | 451 | $this->logger->error($e->getMessage()); |
@@ -452,15 +465,17 @@ discard block |
||
452 | 465 | $children = false; |
453 | 466 | $text = $file['basename']; |
454 | 467 | |
455 | - if($file['type'] == "dir") |
|
456 | - $children = true; |
|
457 | - else |
|
458 | - $text .= " (". $this->xcloner_requirements->file_format_size($file['size']).")"; |
|
468 | + if($file['type'] == "dir") { |
|
469 | + $children = true; |
|
470 | + } else { |
|
471 | + $text .= " (". $this->xcloner_requirements->file_format_size($file['size']).")"; |
|
472 | + } |
|
459 | 473 | |
460 | - if($this->xcloner_file_system->is_excluded($file)) |
|
461 | - $selected = true; |
|
462 | - else |
|
463 | - $selected = false; |
|
474 | + if($this->xcloner_file_system->is_excluded($file)) { |
|
475 | + $selected = true; |
|
476 | + } else { |
|
477 | + $selected = false; |
|
478 | + } |
|
464 | 479 | |
465 | 480 | $data[] = array( |
466 | 481 | 'id' => $file['path'], |
@@ -496,22 +511,24 @@ discard block |
||
496 | 511 | { |
497 | 512 | try{ |
498 | 513 | $return = $this->xcloner_database->get_all_databases(); |
499 | - }catch(Exception $e){ |
|
514 | + } catch(Exception $e){ |
|
500 | 515 | $this->logger->error($e->getMessage()); |
501 | 516 | } |
502 | 517 | |
503 | 518 | foreach($return as $database) |
504 | 519 | { |
505 | - if($xcloner_backup_only_wp_tables and $database['name'] != $this->xcloner_settings->get_db_database()) |
|
506 | - continue; |
|
520 | + if($xcloner_backup_only_wp_tables and $database['name'] != $this->xcloner_settings->get_db_database()) { |
|
521 | + continue; |
|
522 | + } |
|
507 | 523 | |
508 | 524 | $state = array(); |
509 | 525 | |
510 | 526 | if($database['name'] == $this->xcloner_settings->get_db_database()) |
511 | 527 | { |
512 | 528 | $state['selected'] = true; |
513 | - if($database['num_tables'] < 25) |
|
514 | - $state['opened'] = false; |
|
529 | + if($database['num_tables'] < 25) { |
|
530 | + $state['opened'] = false; |
|
531 | + } |
|
515 | 532 | } |
516 | 533 | |
517 | 534 | $data[] = array( |
@@ -524,13 +541,11 @@ discard block |
||
524 | 541 | ); |
525 | 542 | } |
526 | 543 | |
527 | - } |
|
528 | - |
|
529 | - else{ |
|
544 | + } else{ |
|
530 | 545 | |
531 | 546 | try{ |
532 | 547 | $return = $this->xcloner_database->list_tables($database, "", 1); |
533 | - }catch(Exception $e){ |
|
548 | + } catch(Exception $e){ |
|
534 | 549 | $this->logger->error($e->getMessage()); |
535 | 550 | } |
536 | 551 | |
@@ -538,11 +553,13 @@ discard block |
||
538 | 553 | { |
539 | 554 | $state = array(); |
540 | 555 | |
541 | - if($xcloner_backup_only_wp_tables and !stristr($table['name'], $this->xcloner_settings->get_table_prefix())) |
|
542 | - continue; |
|
556 | + if($xcloner_backup_only_wp_tables and !stristr($table['name'], $this->xcloner_settings->get_table_prefix())) { |
|
557 | + continue; |
|
558 | + } |
|
543 | 559 | |
544 | - if(isset($database['name']) and $database['name'] == $this->xcloner_settings->get_db_database()) |
|
545 | - $state = array('selected' => true); |
|
560 | + if(isset($database['name']) and $database['name'] == $this->xcloner_settings->get_db_database()) { |
|
561 | + $state = array('selected' => true); |
|
562 | + } |
|
546 | 563 | |
547 | 564 | $data[] = array( |
548 | 565 | 'id' => $table['name'], |
@@ -593,10 +610,11 @@ discard block |
||
593 | 610 | { |
594 | 611 | $action = "<a href=\"#".$res->id."\" class=\"edit\" title='Edit'> <i class=\"material-icons \">edit</i></a> |
595 | 612 | <a href=\"#".$res->id."\" class=\"delete\" title='Delete'><i class=\"material-icons \">delete</i></a>"; |
596 | - if($res->status) |
|
597 | - $status = '<i class="material-icons active status">timer</i>'; |
|
598 | - else |
|
599 | - $status = '<i class="material-icons status inactive">timer_off</i>'; |
|
613 | + if($res->status) { |
|
614 | + $status = '<i class="material-icons active status">timer</i>'; |
|
615 | + } else { |
|
616 | + $status = '<i class="material-icons status inactive">timer_off</i>'; |
|
617 | + } |
|
600 | 618 | |
601 | 619 | $next_run_time = wp_next_scheduled('xcloner_scheduler_'.$res->id, array($res->id)); |
602 | 620 | |
@@ -604,17 +622,19 @@ discard block |
||
604 | 622 | |
605 | 623 | $remote_storage = $res->remote_storage; |
606 | 624 | |
607 | - if(!$next_run_time >= time()) |
|
608 | - $next_run = " "; |
|
625 | + if(!$next_run_time >= time()) { |
|
626 | + $next_run = " "; |
|
627 | + } |
|
609 | 628 | |
610 | 629 | if(trim($next_run)) |
611 | 630 | { |
612 | 631 | $date_text = date(get_option('date_format')." ".get_option('time_format'), $next_run_time + (get_option( 'gmt_offset' ) * HOUR_IN_SECONDS)); |
613 | 632 | |
614 | - if($next_run_time >= time()) |
|
615 | - $next_run = "in ".human_time_diff($next_run_time, time()); |
|
616 | - else |
|
617 | - $next_run = __("executed", 'xcloner-backup-and-restore'); |
|
633 | + if($next_run_time >= time()) { |
|
634 | + $next_run = "in ".human_time_diff($next_run_time, time()); |
|
635 | + } else { |
|
636 | + $next_run = __("executed", 'xcloner-backup-and-restore'); |
|
637 | + } |
|
618 | 638 | |
619 | 639 | $next_run = "<a href='#' title='".$date_text."'>".$next_run."</a>"; |
620 | 640 | //$next_run .=" ($date_text)"; |
@@ -698,7 +718,7 @@ discard block |
||
698 | 718 | $tar->open($this->xcloner_settings->get_xcloner_store_path().DS.$backup_file, $start); |
699 | 719 | |
700 | 720 | $data = $tar->contents(get_option('xcloner_files_to_process_per_request')); |
701 | - }catch(Exception $e) |
|
721 | + } catch(Exception $e) |
|
702 | 722 | { |
703 | 723 | $return['error'] = true; |
704 | 724 | $return['message'] = $e->getMessage(); |
@@ -726,15 +746,16 @@ discard block |
||
726 | 746 | { |
727 | 747 | $return['start'] = $data['start']; |
728 | 748 | $return['finished'] = 0; |
729 | - }else{ |
|
749 | + } else{ |
|
730 | 750 | if($this->xcloner_file_system->is_multipart($source_backup_file)) |
731 | 751 | { |
732 | 752 | $return['start'] = 0; |
733 | 753 | |
734 | 754 | ++$return['part']; |
735 | 755 | |
736 | - if($return['part'] < sizeof($backup_parts)) |
|
737 | - $return['finished'] = 0; |
|
756 | + if($return['part'] < sizeof($backup_parts)) { |
|
757 | + $return['finished'] = 0; |
|
758 | + } |
|
738 | 759 | |
739 | 760 | } |
740 | 761 | } |
@@ -760,7 +781,7 @@ discard block |
||
760 | 781 | { |
761 | 782 | $return = call_user_func_array(array($xcloner_remote_storage, "copy_backup_remote_to_local"), array($backup_file, $storage_type)); |
762 | 783 | } |
763 | - }catch(Exception $e){ |
|
784 | + } catch(Exception $e){ |
|
764 | 785 | |
765 | 786 | $return['error'] = 1; |
766 | 787 | $return['message'] = $e->getMessage(); |
@@ -799,7 +820,7 @@ discard block |
||
799 | 820 | { |
800 | 821 | $return = call_user_func_array(array($xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $storage_type)); |
801 | 822 | } |
802 | - }catch(Exception $e){ |
|
823 | + } catch(Exception $e){ |
|
803 | 824 | |
804 | 825 | $return['error'] = 1; |
805 | 826 | $return['message'] = $e->getMessage(); |
@@ -950,11 +971,13 @@ discard block |
||
950 | 971 | $file = $this->xcloner_sanitization->sanitize_input_as_string($_POST['file']); |
951 | 972 | $hash = $this->xcloner_sanitization->sanitize_input_as_string($_POST['hash']); |
952 | 973 | |
953 | - if(isset($_POST['part'])) |
|
954 | - $return['part'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['part']); |
|
974 | + if(isset($_POST['part'])) { |
|
975 | + $return['part'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['part']); |
|
976 | + } |
|
955 | 977 | |
956 | - if(isset($_POST['uploaded_size'])) |
|
957 | - $return['uploaded_size'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['uploaded_size']); |
|
978 | + if(isset($_POST['uploaded_size'])) { |
|
979 | + $return['uploaded_size'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['uploaded_size']); |
|
980 | + } |
|
958 | 981 | |
959 | 982 | $start = $this->xcloner_sanitization->sanitize_input_as_string($_POST['start']); |
960 | 983 | $target_url = $this->xcloner_sanitization->sanitize_input_as_string($_POST['target_url']); |
@@ -981,7 +1004,7 @@ discard block |
||
981 | 1004 | $xcloner_file_transfer->set_target($target_url); |
982 | 1005 | $return['start'] = $xcloner_file_transfer->transfer_file($file, $start, $hash); |
983 | 1006 | |
984 | - }catch(Exception $e){ |
|
1007 | + } catch(Exception $e){ |
|
985 | 1008 | |
986 | 1009 | $return = array(); |
987 | 1010 | $return['error'] = true; |
@@ -1015,8 +1038,9 @@ discard block |
||
1015 | 1038 | $data['hash'] = $this->xcloner_settings->get_hash(); |
1016 | 1039 | } |
1017 | 1040 | |
1018 | - if( ob_get_length() ) |
|
1019 | - ob_clean(); |
|
1041 | + if( ob_get_length() ) { |
|
1042 | + ob_clean(); |
|
1043 | + } |
|
1020 | 1044 | wp_send_json($data); |
1021 | 1045 | |
1022 | 1046 | die(); |