Conditions | 5 |
Paths | 16 |
Total Lines | 493 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
229 | public function settings_init() { |
||
230 | global $wpdb; |
||
231 | $this->xcloner_sanitization = $this->get_xcloner_container()->get_xcloner_sanitization(); |
||
232 | |||
233 | //ADDING MISSING OPTIONS |
||
234 | if ( false == get_option( 'xcloner_mysql_settings_page' ) ) { |
||
235 | add_option( 'xcloner_mysql_settings_page' ); |
||
236 | } // end if |
||
237 | |||
238 | if ( false == get_option( 'xcloner_cron_settings_page' ) ) { |
||
239 | add_option( 'xcloner_cron_settings_page' ); |
||
240 | } // end if |
||
241 | |||
242 | if ( false == get_option( 'xcloner_system_settings_page' ) ) { |
||
243 | add_option( 'xcloner_system_settings_page' ); |
||
244 | } // end if |
||
245 | |||
246 | if ( false == get_option( 'xcloner_cleanup_settings_page' ) ) { |
||
247 | add_option( 'xcloner_cleanup_settings_page' ); |
||
248 | } // end if |
||
249 | |||
250 | |||
251 | //ADDING SETTING SECTIONS |
||
252 | //GENERAL section |
||
253 | add_settings_section( |
||
254 | 'xcloner_general_settings_group', |
||
255 | __( ' ' ), |
||
256 | array( $this, 'xcloner_settings_section_cb' ), |
||
257 | 'xcloner_settings_page' |
||
258 | ); |
||
259 | //MYSQL section |
||
260 | add_settings_section( |
||
261 | 'xcloner_mysql_settings_group', |
||
262 | __( ' ' ), |
||
263 | array( $this, 'xcloner_settings_section_cb' ), |
||
264 | 'xcloner_mysql_settings_page' |
||
265 | ); |
||
266 | |||
267 | //SYSTEM section |
||
268 | add_settings_section( |
||
269 | 'xcloner_system_settings_group', |
||
270 | __( 'These are advanced options recommended for developers!', 'xcloner-backup-and-restore' ), |
||
271 | array( $this, 'xcloner_settings_section_cb' ), |
||
272 | 'xcloner_system_settings_page' |
||
273 | ); |
||
274 | |||
275 | //CLEANUP section |
||
276 | add_settings_section( |
||
277 | 'xcloner_cleanup_settings_group', |
||
278 | __( ' ' ), |
||
279 | array( $this, 'xcloner_settings_section_cb' ), |
||
280 | 'xcloner_cleanup_settings_page' |
||
281 | ); |
||
282 | |||
283 | |||
284 | //CRON section |
||
285 | add_settings_section( |
||
286 | 'xcloner_cron_settings_group', |
||
287 | __( ' ' ), |
||
288 | array( $this, 'xcloner_settings_section_cb' ), |
||
289 | 'xcloner_cron_settings_page' |
||
290 | ); |
||
291 | |||
292 | |||
293 | //REGISTERING THE 'GENERAL SECTION' FIELDS |
||
294 | register_setting( 'xcloner_general_settings_group', 'xcloner_backup_compression_level', array( |
||
295 | $this->xcloner_sanitization, |
||
296 | "sanitize_input_as_int" |
||
297 | ) ); |
||
298 | add_settings_field( |
||
299 | 'xcloner_backup_compression_level', |
||
300 | __( 'Backup Compression Level', 'xcloner-backup-and-restore' ), |
||
301 | array( $this, 'do_form_range_field' ), |
||
302 | 'xcloner_settings_page', |
||
303 | 'xcloner_general_settings_group', |
||
304 | array( |
||
305 | 'xcloner_backup_compression_level', |
||
306 | __( 'Options between [0-9]. Value 0 means no compression, while 9 is maximum compression affecting cpu load', 'xcloner-backup-and-restore' ), |
||
307 | 0, |
||
308 | 9 |
||
309 | ) |
||
310 | ); |
||
311 | |||
312 | register_setting( 'xcloner_general_settings_group', 'xcloner_start_path', array( |
||
313 | $this->xcloner_sanitization, |
||
314 | "sanitize_input_as_absolute_path" |
||
315 | ) ); |
||
316 | add_settings_field( |
||
317 | 'xcloner_start_path', |
||
318 | __( 'Backup Start Location', 'xcloner-backup-and-restore' ), |
||
319 | array( $this, 'do_form_text_field' ), |
||
320 | 'xcloner_settings_page', |
||
321 | 'xcloner_general_settings_group', |
||
322 | array( |
||
323 | 'xcloner_start_path', |
||
324 | __( 'Base path location from where XCloner can start the Backup.', 'xcloner-backup-and-restore' ), |
||
325 | $this->get_xcloner_start_path(), |
||
326 | //'disabled' |
||
327 | ) |
||
328 | ); |
||
329 | |||
330 | register_setting( 'xcloner_general_settings_group', 'xcloner_store_path', array( |
||
331 | $this->xcloner_sanitization, |
||
332 | "sanitize_input_as_absolute_path" |
||
333 | ) ); |
||
334 | add_settings_field( |
||
335 | 'xcloner_store_path', |
||
336 | __( 'Backup Storage Location', 'xcloner-backup-and-restore' ), |
||
337 | array( $this, 'do_form_text_field' ), |
||
338 | 'xcloner_settings_page', |
||
339 | 'xcloner_general_settings_group', |
||
340 | array( |
||
341 | 'xcloner_store_path', |
||
342 | __( 'Location where XCloner will store the Backup archives.', 'xcloner-backup-and-restore' ), |
||
343 | $this->get_xcloner_store_path(), |
||
344 | //'disabled' |
||
345 | ) |
||
346 | ); |
||
347 | |||
348 | register_setting( 'xcloner_general_settings_group', 'xcloner_encryption_key', array( |
||
349 | $this->xcloner_sanitization, |
||
350 | "sanitize_input_as_string" |
||
351 | ) ); |
||
352 | add_settings_field( |
||
353 | 'xcloner_encryption_key', |
||
354 | __( 'Backup Encryption Key', 'xcloner-backup-and-restore' ), |
||
355 | array( $this, 'do_form_text_field' ), |
||
356 | 'xcloner_settings_page', |
||
357 | 'xcloner_general_settings_group', |
||
358 | array( |
||
359 | 'xcloner_encryption_key', |
||
360 | __( 'Backup Encryption Key used to Encrypt/Decrypt backups, you might want to save this somewhere else as well.', 'xcloner-backup-and-restore' ), |
||
361 | $this->get_xcloner_encryption_key(), |
||
362 | //'disabled' |
||
363 | ) |
||
364 | ); |
||
365 | |||
366 | register_setting( 'xcloner_general_settings_group', 'xcloner_enable_log', array( |
||
367 | $this->xcloner_sanitization, |
||
368 | "sanitize_input_as_int" |
||
369 | ) ); |
||
370 | add_settings_field( |
||
371 | 'xcloner_enable_log', |
||
372 | __( 'Enable XCloner Backup Log', 'xcloner-backup-and-restore' ), |
||
373 | array( $this, 'do_form_switch_field' ), |
||
374 | 'xcloner_settings_page', |
||
375 | 'xcloner_general_settings_group', |
||
376 | array( |
||
377 | 'xcloner_enable_log', |
||
378 | sprintf( __( 'Enable the XCloner Backup log. You will find it stored unde the Backup Storage Location, file %s', 'xcloner-backup-and-restore' ), $this->get_logger_filename() ) |
||
379 | ) |
||
380 | ); |
||
381 | |||
382 | register_setting( 'xcloner_general_settings_group', 'xcloner_enable_pre_update_backup', array( |
||
383 | $this->xcloner_sanitization, |
||
384 | "sanitize_input_as_int" |
||
385 | ) ); |
||
386 | add_settings_field( |
||
387 | 'xcloner_enable_pre_update_backup', |
||
388 | __( 'Generate Backups before Automatic WP Upgrades', 'xcloner-backup-and-restore' ), |
||
389 | array( $this, 'do_form_switch_field' ), |
||
390 | 'xcloner_settings_page', |
||
391 | 'xcloner_general_settings_group', |
||
392 | array( |
||
393 | 'xcloner_enable_pre_update_backup', |
||
394 | sprintf( __( 'Attempt to generate a core, plugins, themes or languages files backup before the automatic update of Wordpress core, plugins, themes or languages files.', 'xcloner-backup-and-restore' ), $this->get_logger_filename() ) |
||
395 | ) |
||
396 | ); |
||
397 | |||
398 | register_setting( 'xcloner_general_settings_group', 'xcloner_regex_exclude', array( |
||
399 | $this->xcloner_sanitization, |
||
400 | "sanitize_input_as_raw" |
||
401 | ) ); |
||
402 | add_settings_field( |
||
403 | 'xcloner_regex_exclude', |
||
404 | __( 'Regex Exclude Files', 'xcloner-backup-and-restore' ), |
||
405 | array( $this, 'do_form_textarea_field' ), |
||
406 | 'xcloner_settings_page', |
||
407 | 'xcloner_general_settings_group', |
||
408 | array( |
||
409 | 'xcloner_regex_exclude', |
||
410 | __( 'Regular expression match to exclude files and folders, example patterns provided below, one pattern per line', 'xcloner-backup-and-restore' ), |
||
411 | //$this->get_xcloner_store_path(), |
||
412 | //'disabled' |
||
413 | ) |
||
414 | ); |
||
415 | |||
416 | //REGISTERING THE 'MYSQL SECTION' FIELDS |
||
417 | register_setting( 'xcloner_mysql_settings_group', 'xcloner_enable_mysql_backup', array( |
||
418 | $this->xcloner_sanitization, |
||
419 | "sanitize_input_as_int" |
||
420 | ) ); |
||
421 | add_settings_field( |
||
422 | 'xcloner_enable_mysql_backup', |
||
423 | __( 'Enable Mysql Backup', 'xcloner-backup-and-restore' ), |
||
424 | array( $this, 'do_form_switch_field' ), |
||
425 | 'xcloner_mysql_settings_page', |
||
426 | 'xcloner_mysql_settings_group', |
||
427 | array( |
||
428 | 'xcloner_enable_mysql_backup', |
||
429 | __( 'Enable Mysql Backup Option. If you don\'t want to backup the database, you can disable this.', 'xcloner-backup-and-restore' ) |
||
430 | ) |
||
431 | ); |
||
432 | |||
433 | register_setting( 'xcloner_mysql_settings_group', 'xcloner_backup_only_wp_tables' ); |
||
434 | add_settings_field( |
||
435 | 'xcloner_backup_only_wp_tables', |
||
436 | __( 'Backup only WP tables', 'xcloner-backup-and-restore' ), |
||
437 | array( $this, 'do_form_switch_field' ), |
||
438 | 'xcloner_mysql_settings_page', |
||
439 | 'xcloner_mysql_settings_group', |
||
440 | array( |
||
441 | 'xcloner_backup_only_wp_tables', |
||
442 | sprintf( __( 'Enable this if you only want to Backup only tables starting with \'%s\' prefix', 'xcloner-backup-and-restore' ), $this->get_table_prefix() ) |
||
443 | ) |
||
444 | ); |
||
445 | |||
446 | register_setting( 'xcloner_mysql_settings_group', 'xcloner_mysql_hostname', array( |
||
447 | $this->xcloner_sanitization, |
||
448 | "sanitize_input_as_raw" |
||
449 | ) ); |
||
450 | add_settings_field( |
||
451 | 'xcloner_mysql_hostname', |
||
452 | __( 'Mysql Hostname', 'xcloner-backup-and-restore' ), |
||
453 | array( $this, 'do_form_text_field' ), |
||
454 | 'xcloner_mysql_settings_page', |
||
455 | 'xcloner_mysql_settings_group', |
||
456 | array( |
||
457 | 'xcloner_mysql_hostname', |
||
458 | __( 'Wordpress mysql hostname', 'xcloner-backup-and-restore' ), |
||
459 | $this->get_db_hostname(), |
||
460 | 'disabled' |
||
461 | ) |
||
462 | ); |
||
463 | |||
464 | register_setting( 'xcloner_mysql_settings_group', 'xcloner_mysql_username', array( |
||
465 | $this->xcloner_sanitization, |
||
466 | "sanitize_input_as_raw" |
||
467 | ) ); |
||
468 | add_settings_field( |
||
469 | 'xcloner_mysql_username', |
||
470 | __( 'Mysql Username', 'xcloner-backup-and-restore' ), |
||
471 | array( $this, 'do_form_text_field' ), |
||
472 | 'xcloner_mysql_settings_page', |
||
473 | 'xcloner_mysql_settings_group', |
||
474 | array( |
||
475 | 'xcloner_mysql_username', |
||
476 | __( 'Wordpress mysql username', 'xcloner-backup-and-restore' ), |
||
477 | $this->get_db_username(), |
||
478 | 'disabled' |
||
479 | ) |
||
480 | ); |
||
481 | |||
482 | register_setting( 'xcloner_mysql_settings_group', 'xcloner_mysql_database', array( |
||
483 | $this->xcloner_sanitization, |
||
484 | "sanitize_input_as_raw" |
||
485 | ) ); |
||
486 | add_settings_field( |
||
487 | 'xcloner_mysql_database', |
||
488 | __( 'Mysql Database', 'xcloner-backup-and-restore' ), |
||
489 | array( $this, 'do_form_text_field' ), |
||
490 | 'xcloner_mysql_settings_page', |
||
491 | 'xcloner_mysql_settings_group', |
||
492 | array( |
||
493 | 'xcloner_mysql_database', |
||
494 | __( 'Wordpress mysql database', 'xcloner-backup-and-restore' ), |
||
495 | $this->get_db_database(), |
||
496 | 'disabled' |
||
497 | ) |
||
498 | ); |
||
499 | |||
500 | //REGISTERING THE 'SYSTEM SECTION' FIELDS |
||
501 | register_setting( 'xcloner_system_settings_group', 'xcloner_size_limit_per_request', array( |
||
502 | $this->xcloner_sanitization, |
||
503 | "sanitize_input_as_int" |
||
504 | ) ); |
||
505 | add_settings_field( |
||
506 | 'xcloner_size_limit_per_request', |
||
507 | __( 'Data Size Limit Per Request', 'xcloner-backup-and-restore' ), |
||
508 | array( $this, 'do_form_range_field' ), |
||
509 | 'xcloner_system_settings_page', |
||
510 | 'xcloner_system_settings_group', |
||
511 | array( |
||
512 | 'xcloner_size_limit_per_request', |
||
513 | __( 'Use this option to set how much file data can XCloner backup in one AJAX request. Range 0-1024 MB', 'xcloner-backup-and-restore' ), |
||
514 | 0, |
||
515 | 1024 |
||
516 | ) |
||
517 | ); |
||
518 | |||
519 | register_setting( 'xcloner_system_settings_group', 'xcloner_files_to_process_per_request', array( |
||
520 | $this->xcloner_sanitization, |
||
521 | "sanitize_input_as_int" |
||
522 | ) ); |
||
523 | add_settings_field( |
||
524 | 'xcloner_files_to_process_per_request', |
||
525 | __( 'Files To Process Per Request', 'xcloner-backup-and-restore' ), |
||
526 | array( $this, 'do_form_range_field' ), |
||
527 | 'xcloner_system_settings_page', |
||
528 | 'xcloner_system_settings_group', |
||
529 | array( |
||
530 | 'xcloner_files_to_process_per_request', |
||
531 | __( 'Use this option to set how many files XCloner should process at one time before doing another AJAX call', 'xcloner-backup-and-restore' ), |
||
532 | 0, |
||
533 | 1000 |
||
534 | ) |
||
535 | ); |
||
536 | |||
537 | register_setting( 'xcloner_system_settings_group', 'xcloner_directories_to_scan_per_request', array( |
||
538 | $this->xcloner_sanitization, |
||
539 | "sanitize_input_as_int" |
||
540 | ) ); |
||
541 | add_settings_field( |
||
542 | 'xcloner_directories_to_scan_per_request', |
||
543 | __( 'Directories To Scan Per Request', 'xcloner-backup-and-restore' ), |
||
544 | array( $this, 'do_form_range_field' ), |
||
545 | 'xcloner_system_settings_page', |
||
546 | 'xcloner_system_settings_group', |
||
547 | array( |
||
548 | 'xcloner_directories_to_scan_per_request', |
||
549 | __( 'Use this option to set how many directories XCloner should scan at one time before doing another AJAX call', 'xcloner-backup-and-restore' ), |
||
550 | 0, |
||
551 | 1000 |
||
552 | ) |
||
553 | ); |
||
554 | |||
555 | register_setting( 'xcloner_system_settings_group', 'xcloner_database_records_per_request', array( |
||
556 | $this->xcloner_sanitization, |
||
557 | "sanitize_input_as_int" |
||
558 | ) ); |
||
559 | add_settings_field( |
||
560 | 'xcloner_database_records_per_request', |
||
561 | __( 'Database Records Per Request', 'xcloner-backup-and-restore' ), |
||
562 | array( $this, 'do_form_range_field' ), |
||
563 | 'xcloner_system_settings_page', |
||
564 | 'xcloner_system_settings_group', |
||
565 | array( |
||
566 | 'xcloner_database_records_per_request', |
||
567 | __( 'Use this option to set how many database table records should be fetched per AJAX request, or set to 0 to fetch all. Range 0-100000 records', 'xcloner-backup-and-restore' ), |
||
568 | 0, |
||
569 | 100000 |
||
570 | ) |
||
571 | ); |
||
572 | |||
573 | /*register_setting('xcloner_system_settings_group', 'xcloner_diff_backup_recreate_period', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
||
574 | add_settings_field( |
||
575 | 'xcloner_diff_backup_recreate_period', |
||
576 | __('Differetial Backups Max Days','xcloner-backup-and-restore'), |
||
577 | array($this, 'do_form_number_field'), |
||
578 | 'xcloner_system_settings_page', |
||
579 | 'xcloner_system_settings_group', |
||
580 | array('xcloner_diff_backup_recreate_period', |
||
581 | __('Use this option to set when a full backup should be recreated if the scheduled backup type is set to \'Full Backup+Differential Backups\' ','xcloner-backup-and-restore'), |
||
582 | ) |
||
583 | );*/ |
||
584 | |||
585 | register_setting( 'xcloner_system_settings_group', 'xcloner_exclude_files_larger_than_mb', array( |
||
586 | $this->xcloner_sanitization, |
||
587 | "sanitize_input_as_int" |
||
588 | ) ); |
||
589 | add_settings_field( |
||
590 | 'xcloner_exclude_files_larger_than_mb', |
||
591 | __( 'Exclude files larger than (MB)', 'xcloner-backup-and-restore' ), |
||
592 | array( $this, 'do_form_number_field' ), |
||
593 | 'xcloner_system_settings_page', |
||
594 | 'xcloner_system_settings_group', |
||
595 | array( |
||
596 | 'xcloner_exclude_files_larger_than_mb', |
||
597 | __( 'Use this option to automatically exclude files larger than a certain size in MB, or set to 0 to include all. Range 0-1000 MB', 'xcloner-backup-and-restore' ), |
||
598 | ) |
||
599 | ); |
||
600 | |||
601 | register_setting( 'xcloner_system_settings_group', 'xcloner_split_backup_limit', array( |
||
602 | $this->xcloner_sanitization, |
||
603 | "sanitize_input_as_int" |
||
604 | ) ); |
||
605 | add_settings_field( |
||
606 | 'xcloner_split_backup_limit', |
||
607 | __( 'Split Backup Archive Limit (MB)', 'xcloner-backup-and-restore' ), |
||
608 | array( $this, 'do_form_number_field' ), |
||
609 | 'xcloner_system_settings_page', |
||
610 | 'xcloner_system_settings_group', |
||
611 | array( |
||
612 | 'xcloner_split_backup_limit', |
||
613 | __( 'Use this option to automatically split the backup archive into smaller parts. Range 0-10000 MB', 'xcloner-backup-and-restore' ), |
||
614 | ) |
||
615 | ); |
||
616 | |||
617 | register_setting( 'xcloner_system_settings_group', 'xcloner_force_tmp_path_site_root' ); |
||
618 | add_settings_field( |
||
619 | 'xcloner_force_tmp_path_site_root', |
||
620 | __( 'Force Temporary Path Within XCloner Storage', 'xcloner-backup-and-restore' ), |
||
621 | array( $this, 'do_form_switch_field' ), |
||
622 | 'xcloner_system_settings_page', |
||
623 | 'xcloner_system_settings_group', |
||
624 | array( |
||
625 | 'xcloner_force_tmp_path_site_root', |
||
626 | sprintf( __( 'Enable this option if you want the XCloner Temporary Path to be within your XCloner Storage Location', 'xcloner-backup-and-restore' ), $this->get_table_prefix() ) |
||
627 | ) |
||
628 | ); |
||
629 | |||
630 | register_setting( 'xcloner_system_settings_group', 'xcloner_disable_email_notification' ); |
||
631 | add_settings_field( |
||
632 | 'xcloner_disable_email_notification', |
||
633 | __( 'Disable Email Notifications', 'xcloner-backup-and-restore' ), |
||
634 | array( $this, 'do_form_switch_field' ), |
||
635 | 'xcloner_system_settings_page', |
||
636 | 'xcloner_system_settings_group', |
||
637 | array( |
||
638 | 'xcloner_disable_email_notification', |
||
639 | sprintf( __( 'Enable this option if you want the XCloner to NOT send email notifications on successful backups', 'xcloner-backup-and-restore' ), $this->get_table_prefix() ) |
||
640 | ) |
||
641 | ); |
||
642 | |||
643 | //REGISTERING THE 'CLEANUP SECTION' FIELDS |
||
644 | register_setting( 'xcloner_cleanup_settings_group', 'xcloner_cleanup_retention_limit_days', array( |
||
645 | $this->xcloner_sanitization, |
||
646 | "sanitize_input_as_int" |
||
647 | ) ); |
||
648 | add_settings_field( |
||
649 | 'xcloner_cleanup_retention_limit_days', |
||
650 | __( 'Cleanup by Date(days)', 'xcloner-backup-and-restore' ), |
||
651 | array( $this, 'do_form_number_field' ), |
||
652 | 'xcloner_cleanup_settings_page', |
||
653 | 'xcloner_cleanup_settings_group', |
||
654 | array( |
||
655 | 'xcloner_cleanup_retention_limit_days', |
||
656 | __( 'Specify the maximum number of days a backup archive can be kept on the server. 0 disables this option', 'xcloner-backup-and-restore' ) |
||
657 | ) |
||
658 | ); |
||
659 | |||
660 | register_setting( 'xcloner_cleanup_settings_group', 'xcloner_cleanup_retention_limit_archives', array( |
||
661 | $this->xcloner_sanitization, |
||
662 | "sanitize_input_as_int" |
||
663 | ) ); |
||
664 | add_settings_field( |
||
665 | 'xcloner_cleanup_retention_limit_archives', |
||
666 | __( 'Cleanup by Quantity', 'xcloner-backup-and-restore' ), |
||
667 | array( $this, 'do_form_number_field' ), |
||
668 | 'xcloner_cleanup_settings_page', |
||
669 | 'xcloner_cleanup_settings_group', |
||
670 | array( |
||
671 | 'xcloner_cleanup_retention_limit_archives', |
||
672 | __( 'Specify the maximum number of backup archives to keep on the server. 0 disables this option', 'xcloner-backup-and-restore' ) |
||
673 | ) |
||
674 | ); |
||
675 | |||
676 | register_setting( 'xcloner_cleanup_settings_group', 'xcloner_cleanup_capacity_limit', array( |
||
677 | $this->xcloner_sanitization, |
||
678 | "sanitize_input_as_int" |
||
679 | ) ); |
||
680 | add_settings_field( |
||
681 | 'xcloner_cleanup_capacity_limit', |
||
682 | __( 'Cleanup by Capacity(MB)', 'xcloner-backup-and-restore' ), |
||
683 | array( $this, 'do_form_number_field' ), |
||
684 | 'xcloner_cleanup_settings_page', |
||
685 | 'xcloner_cleanup_settings_group', |
||
686 | array( |
||
687 | 'xcloner_cleanup_capacity_limit', |
||
688 | __( 'Remove oldest backups if all created backups exceed the configured limit in Megabytes. 0 disables this option', 'xcloner-backup-and-restore' ) |
||
689 | ) |
||
690 | ); |
||
691 | |||
692 | register_setting( 'xcloner_cleanup_settings_group', 'xcloner_cleanup_delete_after_remote_transfer', array( |
||
693 | $this->xcloner_sanitization, |
||
694 | "sanitize_input_as_int" |
||
695 | ) ); |
||
696 | add_settings_field( |
||
697 | 'xcloner_cleanup_delete_after_remote_transfer', |
||
698 | __( 'Delete Backup After Remote Storage Transfer', 'xcloner-backup-and-restore' ), |
||
699 | array( $this, 'do_form_switch_field' ), |
||
700 | 'xcloner_cleanup_settings_page', |
||
701 | 'xcloner_cleanup_settings_group', |
||
702 | array( |
||
703 | 'xcloner_cleanup_delete_after_remote_transfer', |
||
704 | __( 'Remove backup created automatically from local storage after sending the backup to Remote Storage', 'xcloner-backup-and-restore' ) |
||
705 | ) |
||
706 | ); |
||
707 | |||
708 | //REGISTERING THE 'CRON SECTION' FIELDS |
||
709 | register_setting( 'xcloner_cron_settings_group', 'xcloner_cron_frequency' ); |
||
710 | add_settings_field( |
||
711 | 'xcloner_cron_frequency', |
||
712 | __( 'Cron frequency', 'xcloner-backup-and-restore' ), |
||
713 | array( $this, 'do_form_text_field' ), |
||
714 | 'xcloner_cron_settings_page', |
||
715 | 'xcloner_cron_settings_group', |
||
716 | array( |
||
717 | 'xcloner_cron_frequency', |
||
718 | __( 'Cron frequency' ) |
||
719 | ) |
||
720 | ); |
||
721 | } |
||
722 | |||
926 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.