'true', ), menu_page_url( 'ai-editor-post-switcher', false ) ); wp_safe_redirect( $redirect_url ); exit; } /** * Process navigation options form */ public function process_navigation_options_form() { // Check page parameter first // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Checking page context before nonce verification if ( ! isset( $_GET['page'] ) || 'ai-editor-post-switcher' !== $_GET['page'] ) { return; } // Check if form was submitted // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce is verified in the next condition if ( ! isset( $_POST['ai_editor_navigation_options_submit'] ) ) { return; } // Verify user capability if ( ! current_user_can( 'manage_options' ) ) { return; } // Verify nonce if ( ! AI_Editor_Nonce_Manager::verify_request( AI_Editor_Nonce_Manager::SETTINGS_NONCE, AI_Editor_Nonce_Manager::SETTINGS_ACTION, 'POST' ) ) { return; } // Get current settings $settings = AI_Editor_Admin_Helpers::get_plugin_settings(); // Update only the navigation option // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce already verified above $settings['enable_first_last'] = ! empty( $_POST['ai_editor_post_switcher_settings']['enable_first_last'] ) ? 1 : 0; // Save settings update_option( 'ai_editor_post_switcher_settings', $settings ); // Add success parameter to the redirect URL $redirect_url = add_query_arg( array( 'form-updated' => 'true', ), menu_page_url( 'ai-editor-post-switcher', false ) ); wp_safe_redirect( $redirect_url ); exit; } /** * Process uninstall settings form */ public function process_uninstall_settings_form() { // Check page parameter first // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Checking page context before nonce verification if ( ! isset( $_GET['page'] ) || 'ai-editor-post-switcher' !== $_GET['page'] ) { return; } // Check if form was submitted // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce is verified in the next condition if ( ! isset( $_POST['ai_editor_uninstall_settings_submit'] ) ) { return; } // Verify user capability if ( ! current_user_can( 'manage_options' ) ) { return; } // Verify nonce if ( ! AI_Editor_Nonce_Manager::verify_request( 'ai_editor_uninstall_nonce', AI_Editor_Nonce_Manager::UNINSTALL_ACTION, 'POST' ) ) { return; } // Get current settings $settings = AI_Editor_Admin_Helpers::get_plugin_settings(); // Update only the uninstall option // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce already verified above $settings['delete_on_uninstall'] = ! empty( $_POST['ai_editor_post_switcher_settings']['delete_on_uninstall'] ) ? 1 : 0; // Save settings update_option( 'ai_editor_post_switcher_settings', $settings ); // Add success parameter to the redirect URL $redirect_url = add_query_arg( array( 'form-updated' => 'true', ), menu_page_url( 'ai-editor-post-switcher', false ) ); wp_safe_redirect( $redirect_url ); exit; } /** * Render settings tab content */ public function render() { // Get selected post types $selected_post_types = get_option( 'ai_editor_post_types', array( 'post', 'page' ) ); // Get all available post types $post_types = AI_Editor_Admin_Helpers::get_compatible_post_types(); // Get plugin settings with defaults $settings = AI_Editor_Admin_Helpers::get_plugin_settings(); $first_last_enabled = $settings['enable_first_last']; $delete_on_uninstall = $settings['delete_on_uninstall']; ?>

name ); ?>
name, $selected_post_types, true ) ); ?> />

/> labels->singular_name ) : __( 'post', 'ai-editor-post-switcher' ); ?>

/>