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