hook_suffix = is_string( $hook ) ? $hook : ''; } /** * Enqueue on settings page only. * * @param string $hook_suffix Hook. */ public function enqueue( string $hook_suffix ): void { if ( '' === $this->hook_suffix || $this->hook_suffix !== $hook_suffix ) { return; } wp_enqueue_style( 'brverify-admin', BRVERIFY_URL . 'assets/css/admin.css', array(), BRVERIFY_VERSION ); } /** * Handle settings save (POST + nonce + capability). */ public function handle_post(): void { if ( ! is_admin() || ! current_user_can( 'manage_brverify' ) ) { return; } // phpcs:ignore WordPress.Security.NonceVerification.Recommended $page = isset( $_REQUEST['page'] ) ? sanitize_key( wp_unslash( (string) $_REQUEST['page'] ) ) : ''; if ( self::MENU_SLUG !== $page ) { return; } if ( empty( $_POST['brverify_settings_action'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing return; } $action = sanitize_key( wp_unslash( (string) $_POST['brverify_settings_action'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing if ( 'save' === $action ) { check_admin_referer( 'brverify_save_settings' ); $interval = isset( $_POST['schedule_interval'] ) ? sanitize_key( wp_unslash( (string) $_POST['schedule_interval'] ) ) : 'daily'; $retention = isset( $_POST['retention_count'] ) ? absint( $_POST['retention_count'] ) : 3; $email = isset( $_POST['alert_email'] ) ? sanitize_email( wp_unslash( (string) $_POST['alert_email'] ) ) : ''; $delete_data = ! empty( $_POST['delete_data_on_uninstall'] ); $pre_update_on = ! empty( $_POST['pre_update_enabled'] ); $pre_update_keep = isset( $_POST['pre_update_retention_count'] ) ? absint( $_POST['pre_update_retention_count'] ) : 3; $destinations = array( 'local' ); if ( isset( $_POST['destinations'] ) && is_array( $_POST['destinations'] ) ) { $destinations = array(); foreach ( wp_unslash( $_POST['destinations'] ) as $raw_id ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized $id = sanitize_key( (string) $raw_id ); if ( '' !== $id ) { $destinations[] = $id; } } $destinations = array_values( array_unique( $destinations ) ); if ( empty( $destinations ) ) { $destinations = array( 'local' ); } } Settings::update( array( 'schedule_interval' => $interval, 'retention_count' => max( 1, min( 100, $retention ) ), 'alert_email' => $email, 'delete_data_on_uninstall' => $delete_data, 'destinations' => $destinations, 'pre_update_enabled' => $pre_update_on, 'pre_update_retention_count' => max( 1, min( 50, $pre_update_keep ) ), ) ); ( new Scheduler() )->reschedule(); wp_safe_redirect( add_query_arg( array( 'page' => self::MENU_SLUG, 'rp_notice' => 'saved', ), admin_url( 'admin.php' ) ) ); exit; } } /** * Render settings page. */ public function render(): void { if ( ! current_user_can( 'manage_brverify' ) ) { wp_die( esc_html__( 'You do not have permission to manage 007AJ Backup Restore Verifier.', '007aj-backup-restore-verifier' ) ); } $settings = Settings::all(); $scheduler = new Scheduler(); $labels = Settings::interval_labels(); $notice = isset( $_GET['rp_notice'] ) ? sanitize_key( wp_unslash( (string) $_GET['rp_notice'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended $cron_disabled = defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON; ?>

adapters()->all(); $selected = Settings::backup_destinations(); $remote_count = 0; foreach ( $adapters as $aid => $_adapter ) { if ( 'local' !== $aid ) { ++$remote_count; } } ?>

0 ) : ?>