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