get_settings(); // $_GET['tab'] selects which settings tab to display — read-only, no state // change. Saving settings POSTs to BoxCart_Admin_Settings with its own nonce. $current_tab = isset( $_GET['tab'] ) ? sanitize_key( $_GET['tab'] ) : 'general'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only tab selector; capability-gated above. // Define tabs. $boxcart_tabs = array( 'general' => __( 'General', 'boxcart' ), 'collection' => __( 'Collection', 'boxcart' ), 'orders' => __( 'Orders', 'boxcart' ), 'customer' => __( 'Accounts', 'boxcart' ), 'emails' => __( 'Emails', 'boxcart' ), 'styling' => __( 'Styling', 'boxcart' ), 'sidecart' => __( 'Sidecart', 'boxcart' ), 'shortcodes' => __( 'Shortcodes', 'boxcart' ), 'misc' => __( 'Misc', 'boxcart' ), ); // Insert Payments tab only when pricing is enabled. if ( BoxCart_Helpers::prices_enabled() ) { // Insert after 'orders' to maintain original tab order. $position = array_search( 'orders', array_keys( $boxcart_tabs ), true ); $boxcart_tabs = array_slice( $boxcart_tabs, 0, $position + 1, true ) + array( 'payments' => __( 'Payments', 'boxcart' ) ) + array_slice( $boxcart_tabs, $position + 1, null, true ); } // Check for notices (informational flag set by the save handler on redirect). $saved = isset( $_GET['saved'] ) ? true : false; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only success-notice flag; capability-gated above. // Get pages for dropdown. $boxcart_pages = $settings_handler->get_pages_dropdown(); // Check if current tab has a form (shortcodes doesn't). $has_form = 'shortcodes' !== $current_tab; // Check if the auto-save notice has been dismissed by this user. $show_autosave_notice = ! get_user_meta( get_current_user_id(), 'boxcart_dismissed_autosave_notice', true ); ?>