input( 'enable_audit_log', 'post', false ); $settings['auto_prune_days'] = absint( $request->input( 'auto_prune_days', 'post', 0 ) ); update_option( SettingsController::OPTION_KEY, $settings ); // Schedule or clear the prune cron based on the saved value. if ( $settings['auto_prune_days'] > 0 ) { if ( ! wp_next_scheduled( 'adfuz_prune_audit_logs' ) ) { wp_schedule_event( time(), 'daily', 'adfuz_prune_audit_logs' ); } } else { $timestamp = wp_next_scheduled( 'adfuz_prune_audit_logs' ); if ( $timestamp ) { wp_unschedule_event( $timestamp, 'adfuz_prune_audit_logs' ); } } wp_send_json_success( array( 'message' => __( 'Settings saved.', 'ad-fuz' ) ) ); } public static function generalTabData( array $tabData ): array { $settings = get_option( SettingsController::OPTION_KEY, array() ); $tabData['enable_audit_log'] = ! empty( $settings['enable_audit_log'] ); $tabData['auto_prune_days'] = absint( $settings['auto_prune_days'] ?? 0 ); return $tabData; } protected static function getModel(): string { return ''; } }