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 '
'; self::render_header( $step ); switch ( $step ) { case 2: self::render_step2(); break; case 3: self::render_step3(); break; default: self::render_step1(); break; } echo '
'; } // ── Header with step dots ───────────────────────────────────────────────── private static function render_header( int $step ): void { $steps = [ 1 => __( 'Welcome', 'admore-widgets-suite' ), 2 => __( 'Configure', 'admore-widgets-suite' ), 3 => __( 'Done', 'admore-widgets-suite' ), ]; ?>
$label ) : ?>
', [ 'svg' => [ 'width' => true, 'height' => true, 'viewBox' => true, 'fill' => true, 'stroke' => true, 'stroke-width' => true, 'stroke-linecap' => true, 'stroke-linejoin' => true ], 'path' => [ 'd' => true ] ] ); } else { echo esc_html( $num ); } ?>
→

$name ) { $meta = $all_widgets_meta[ $slug ] ?? [ 'icon' => 'dashicons-admin-generic', 'desc' => '' ]; $widgets[ $slug ] = [ 'label' => $name, 'icon' => $meta['icon'], 'desc' => $meta['desc'], ]; } $extensions = [ 'sticky' => [ 'icon' => 'dashicons-sticky', 'label' => 'Sticky', 'desc' => 'Make any element sticky on scroll' ], 'custom_css' => [ 'icon' => 'dashicons-admin-appearance', 'label' => 'Custom Styles', 'desc' => 'Per-element colors, spacing & border' ], 'conditions' => [ 'icon' => 'dashicons-visibility', 'label' => 'Conditional Display', 'desc' => 'Show/hide elements by rules' ], 'dynamic_tags' => [ 'icon' => 'dashicons-tag', 'label' => 'Dynamic Tags', 'desc' => 'Link fields to post data / ACF' ], ]; ?>

( total)

$info ) : $enabled = ! in_array( $slug, (array) $s['disabled_widgets'], true ); ?>

( total)

$info ) : $enabled = ! in_array( $slug, (array) ( $s['disabled_extensions'] ?? [] ), true ); ?>