of hidden admin pages. } ); } } // ========================================================================= // Enqueue wizard-specific styles // ========================================================================= public static function enqueue( string $hook ): void { if ( 'admin_page_' . self::PAGE_SLUG !== $hook ) return; wp_add_inline_style( 'wp-admin', self::wizard_css() ); wp_register_script( 'eppro-setup-wizard', false, [], EPPRO_VERSION, true ); wp_enqueue_script( 'eppro-setup-wizard' ); wp_add_inline_script( 'eppro-setup-wizard', self::wizard_js() ); } // ========================================================================= // Handle form submission (Step 2 save) // ========================================================================= public static function handle_submission(): void { if ( ! isset( $_POST['eppro_wizard_save'] ) ) return; if ( ! current_user_can( 'manage_options' ) ) return; check_admin_referer( self::NONCE_KEY, self::NONCE_KEY ); $k = EPPRO_Admin_Settings::OPTION_KEY; $cur = EPPRO_Admin_Settings::get_settings(); // Widgets - Get all from admin settings $all_widgets = array_keys( EPPRO_Admin_Settings::get_all_widgets() ); $active_w = array_keys( (array) ( isset( $_POST['widget_active'] ) ? array_map( 'sanitize_key', wp_unslash( $_POST['widget_active'] ) ) : [] ) ); $cur['disabled_widgets'] = array_values( array_diff( $all_widgets, $active_w ) ); // Extensions $all_ext = [ 'dynamic_tags', 'sticky', 'conditions', 'custom_css' ]; $active_e = array_keys( (array) ( isset( $_POST['extension_active'] ) ? array_map( 'sanitize_key', wp_unslash( $_POST['extension_active'] ) ) : [] ) ); $cur['disabled_extensions'] = array_values( array_diff( $all_ext, $active_e ) ); // Notification email (pre-fills form email_to default) $notify_email = sanitize_email( wp_unslash( $_POST['notify_email'] ?? '' ) ); if ( $notify_email ) { $cur['wizard_notify_email'] = $notify_email; } update_option( $k, $cur ); update_option( self::FLAG_KEY, '1' ); wp_safe_redirect( admin_url( 'admin.php?page=' . self::PAGE_SLUG . '&step=3' ) ); exit; } // ========================================================================= // Render // ========================================================================= public static function render(): void { if ( ! current_user_can( 'manage_options' ) ) return; $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only wizard step. echo '