pending_bubble(), 'manage_options', self::SLUG, array( $this, 'render' ), 'dashicons-shield', 81 ); } /** * The approval-queue bubble appended to the menu label. * * Deliberately the markup core uses for comments awaiting moderation, so * it inherits the admin colour scheme and reads as the signal admins * already know. Empty queue, empty string: absence is the all-clear, and * a "(0)" would only be noise to dismiss. */ private function pending_bubble(): string { $count = null === $this->pending_count ? 0 : ( $this->pending_count )(); if ( $count < 1 ) { return ''; } $display = $count > self::COUNT_DISPLAY_CAP ? sprintf( /* translators: %s: capped number of queued actions, e.g. "99". */ __( '%s+', 'agentic-daisy-ai-agent-firewall' ), number_format_i18n( self::COUNT_DISPLAY_CAP ) ) : number_format_i18n( $count ); // The digit is decoration for assistive tech; this sentence carries // the meaning, and the real number even when the badge is capped. $label = sprintf( /* translators: %s: number of agent actions waiting for approval. */ _n( '%s action awaiting approval', '%s actions awaiting approval', $count, 'agentic-daisy-ai-agent-firewall' ), number_format_i18n( $count ) ); return sprintf( ' ' . '' . '%3$s', $count, esc_html( $display ), esc_html( $label ) ); } /** * Enqueue the built SPA bundle; only on our own screen. * * @param string $hook_suffix Current admin screen hook. */ public function enqueue_assets( string $hook_suffix ): void { if ( self::SCREEN_HOOK !== $hook_suffix ) { return; } $asset_file = ADAF_PLUGIN_PATH . 'build/index.asset.php'; if ( ! file_exists( $asset_file ) ) { return; } $asset = require $asset_file; if ( ! is_array( $asset ) ) { return; } wp_enqueue_script( 'agentic-daisy-ai-agent-firewall-admin', ADAF_PLUGIN_URL . 'build/index.js', isset( $asset['dependencies'] ) && is_array( $asset['dependencies'] ) ? $asset['dependencies'] : array(), isset( $asset['version'] ) && is_string( $asset['version'] ) ? $asset['version'] : ADAF_VERSION, true ); // Only enqueue the stylesheet the build actually produced; a missing // file would otherwise be requested on every admin page load. if ( file_exists( ADAF_PLUGIN_PATH . 'build/style-index.css' ) ) { wp_enqueue_style( 'agentic-daisy-ai-agent-firewall-admin', ADAF_PLUGIN_URL . 'build/style-index.css', array(), isset( $asset['version'] ) && is_string( $asset['version'] ) ? $asset['version'] : ADAF_VERSION ); } } /** * Render the SPA mount point. */ public function render(): void { echo '