Notifications loads admin.css like every other // workspace, so it must carry the UI system and design layer too. // Without it that screen renders the shared stylesheet with none // of the tokens those rules resolve against. 'ai-o-optimiser-notifications', ); } /** Current admin page slug. */ private static function page() { return isset( $_GET['page'] ) ? sanitize_key( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only screen state (page slug, tab, redirect result notices). Nothing is written here, so there is no form submission to carry a nonce. } /** Whether the current request is one of our admin workspaces. */ private static function is_visop_page() { return in_array( self::page(), self::pages(), true ); } /** Scope every canonical rule under one body class. */ public static function body_class( $classes ) { if ( ! self::is_visop_page() ) { return $classes; } return trim( (string) $classes . ' ai-o-optimiser-ui-system' ); } /** Load last, after historic feature styles, and only on AI-O Optimiser admin pages. */ public static function enqueue_assets() { if ( ! self::is_visop_page() ) { return; } $path = AI_O_Optimiser_PLUGIN_DIR . 'assets/admin-ui-system.css'; $ver = file_exists( $path ) ? AI_O_Optimiser_VERSION . '.' . filemtime( $path ) : AI_O_Optimiser_VERSION; wp_enqueue_style( 'ai-o-optimiser-admin-ui-system', AI_O_Optimiser_PLUGIN_URL . 'assets/admin-ui-system.css', array(), $ver ); /* * The AI-O design layer goes on last of all, declaring the sheet above * as a dependency so load order is guaranteed rather than hoped for. * It carries the brand palette, the bundled Archivo face, the flat * 1px/2px rules and the admin type scale, and is scoped to the body * class set above. * * AI-O Optimiser Free carries the same design layer. Its copy is still * written against the pre-rename `act-` selectors; this one is * canonical throughout. Keep the two in step by content, not by byte * comparison, until Free adopts the canonical names too. */ $ds_path = AI_O_Optimiser_PLUGIN_DIR . 'assets/admin-ds.css'; $ds_ver = file_exists( $ds_path ) ? AI_O_Optimiser_VERSION . '.' . filemtime( $ds_path ) : AI_O_Optimiser_VERSION; wp_enqueue_style( 'ai-o-optimiser-admin-ds', AI_O_Optimiser_PLUGIN_URL . 'assets/admin-ds.css', array( 'ai-o-optimiser-admin-ui-system' ), $ds_ver ); /* * Visibility is the one workspace whose secondary row navigates within * a long page instead of opening server-selected panels. Keep the links * as plain anchors, then add only the presentation and hash-state helper * needed to match the Settings navigation without loading either asset * on unrelated AI-O screens. */ if ( 'ai-o-optimiser-dashboard' === self::page() ) { $visibility_css_path = AI_O_Optimiser_PLUGIN_DIR . 'assets/admin-visibility-navigation.css'; $visibility_css_ver = file_exists( $visibility_css_path ) ? AI_O_Optimiser_VERSION . '.' . filemtime( $visibility_css_path ) : AI_O_Optimiser_VERSION; wp_enqueue_style( 'ai-o-optimiser-visibility-navigation', AI_O_Optimiser_PLUGIN_URL . 'assets/admin-visibility-navigation.css', array( 'ai-o-optimiser-admin-ds' ), $visibility_css_ver ); $visibility_js_path = AI_O_Optimiser_PLUGIN_DIR . 'assets/admin-visibility-navigation.js'; $visibility_js_ver = file_exists( $visibility_js_path ) ? AI_O_Optimiser_VERSION . '.' . filemtime( $visibility_js_path ) : AI_O_Optimiser_VERSION; wp_enqueue_script( 'ai-o-optimiser-visibility-navigation', AI_O_Optimiser_PLUGIN_URL . 'assets/admin-visibility-navigation.js', array(), $visibility_js_ver, true ); } } }