settings = $settings; $this->llms = $llms; $this->scanner = $scanner; $this->forms = $forms; $this->tools = $tools; $this->accessibility = $accessibility; $this->layout = $layout; $this->woocommerce = $woocommerce; $this->integrations = $integrations; } /** * Register admin hooks. * * @return void */ public function init() { add_action( 'admin_init', array( $this->settings, 'register' ) ); add_action( 'admin_menu', array( $this, 'add_menu' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) ); add_action( 'admin_post_agizoai_agentic_clear_cache', array( $this, 'handle_clear_cache' ) ); add_action( 'admin_post_agizoai_agentic_export_report', array( $this, 'handle_export_report' ) ); add_filter( 'plugin_action_links_' . plugin_basename( AGIZOAI_AGENTIC_FILE ), array( $this, 'plugin_action_links' ) ); } /** * Add plugin menu. * * @return void */ public function add_menu() { add_menu_page( __( 'AgizoAI Agentic', 'agizoai-agentic-browsing-optimizer' ), __( 'AgizoAI Agentic', 'agizoai-agentic-browsing-optimizer' ), 'manage_options', 'agizoai-agentic', array( $this, 'render_page' ), 'dashicons-superhero-alt', 59 ); // Backward/forward compatibility: keep the WordPress.org slug URL valid too. add_submenu_page( null, __( 'AgizoAI Agentic', 'agizoai-agentic-browsing-optimizer' ), __( 'AgizoAI Agentic', 'agizoai-agentic-browsing-optimizer' ), 'manage_options', 'agizoai-agentic-browsing-optimizer', array( $this, 'render_page' ) ); } /** * Add settings link to plugin row. * * @param array $links Links. * @return array */ public function plugin_action_links( $links ) { $url = admin_url( 'admin.php?page=agizoai-agentic' ); array_unshift( $links, '' . esc_html__( 'Dashboard', 'agizoai-agentic-browsing-optimizer' ) . '' ); return $links; } /** * Enqueue admin assets. * * @param string $hook Hook suffix. * @return void */ public function enqueue_assets( $hook ) { $allowed_hooks = array( 'toplevel_page_agizoai-agentic', 'admin_page_agizoai-agentic-browsing-optimizer', ); if ( ! in_array( $hook, $allowed_hooks, true ) ) { return; } wp_enqueue_style( 'agizoai-agentic-admin', AGIZOAI_AGENTIC_URL . 'admin/css/admin.css', array(), AGIZOAI_AGENTIC_VERSION ); wp_enqueue_script( 'agizoai-agentic-admin', AGIZOAI_AGENTIC_URL . 'admin/js/admin.js', array(), AGIZOAI_AGENTIC_VERSION, true ); } /** * Handle cache clear/regenerate. * * @return void */ public function handle_clear_cache() { if ( ! current_user_can( 'manage_options' ) ) { wp_die( esc_html__( 'You do not have permission to do this.', 'agizoai-agentic-browsing-optimizer' ) ); } check_admin_referer( 'agizoai_agentic_clear_cache' ); $this->llms->clear_cache(); $redirect = add_query_arg( array( 'page' => 'agizoai-agentic', 'tab' => 'llms', 'updated' => 'cache-cleared', ), admin_url( 'admin.php' ) ); wp_safe_redirect( $redirect ); exit; } /** * Export a report as HTML, Markdown or JSON. * * @return void */ public function handle_export_report() { if ( ! current_user_can( 'manage_options' ) ) { wp_die( esc_html__( 'You do not have permission to do this.', 'agizoai-agentic-browsing-optimizer' ) ); } check_admin_referer( 'agizoai_agentic_export_report' ); $format = isset( $_GET['format'] ) ? sanitize_key( wp_unslash( $_GET['format'] ) ) : 'html'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended $scan = $this->scanner->scan(); $this->scanner->persist_last_scan( $scan ); $filename_base = 'agizoai-agentic-report-' . gmdate( 'Y-m-d' ); if ( 'markdown' === $format || 'md' === $format ) { $content = $this->format_report_markdown( $scan ); $filename = $filename_base . '.md'; header( 'Content-Type: text/markdown; charset=utf-8' ); } elseif ( 'json' === $format ) { $content = wp_json_encode( $this->format_report_array( $scan ), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ); $filename = $filename_base . '.json'; header( 'Content-Type: application/json; charset=utf-8' ); } else { $content = $this->format_report_html( $scan ); $filename = $filename_base . '.html'; header( 'Content-Type: text/html; charset=utf-8' ); } header( 'Content-Disposition: attachment; filename="' . sanitize_file_name( $filename ) . '"' ); header( 'X-Content-Type-Options: nosniff' ); echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- generated report has escaped values. exit; } /** * Render main plugin page. * * @return void */ public function render_page() { if ( ! current_user_can( 'manage_options' ) ) { return; } $options = $this->settings->get_options(); $tab = isset( $_GET['tab'] ) ? sanitize_key( wp_unslash( $_GET['tab'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended $tab_groups = array( 'overview' => array( 'label' => __( 'Overview', 'agizoai-agentic-browsing-optimizer' ), 'tabs' => array( 'dashboard' => __( 'Dashboard', 'agizoai-agentic-browsing-optimizer' ), 'setup' => __( 'Setup Wizard', 'agizoai-agentic-browsing-optimizer' ), ), ), 'discovery' => array( 'label' => __( 'Discovery', 'agizoai-agentic-browsing-optimizer' ), 'tabs' => array( 'llms' => __( 'llms.txt', 'agizoai-agentic-browsing-optimizer' ), 'tools' => __( 'Agent Tools', 'agizoai-agentic-browsing-optimizer' ), 'integrations' => __( 'Integrations', 'agizoai-agentic-browsing-optimizer' ), ), ), 'optimise' => array( 'label' => __( 'Optimise', 'agizoai-agentic-browsing-optimizer' ), 'tabs' => array( 'forms' => __( 'Forms & WebMCP', 'agizoai-agentic-browsing-optimizer' ), 'accessibility' => __( 'Accessibility', 'agizoai-agentic-browsing-optimizer' ), 'layout' => __( 'Layout Stability', 'agizoai-agentic-browsing-optimizer' ), ), ), 'commerce' => array( 'label' => __( 'Commerce', 'agizoai-agentic-browsing-optimizer' ), 'tabs' => array( 'ecommerce' => __( 'WooCommerce', 'agizoai-agentic-browsing-optimizer' ), ), ), 'admin' => array( 'label' => __( 'Admin', 'agizoai-agentic-browsing-optimizer' ), 'tabs' => array( 'reports' => __( 'Reports', 'agizoai-agentic-browsing-optimizer' ), 'settings' => __( 'Settings', 'agizoai-agentic-browsing-optimizer' ), ), ), ); $tabs = array(); $current_group_label = __( 'Overview', 'agizoai-agentic-browsing-optimizer' ); foreach ( $tab_groups as $group ) { $tabs = array_merge( $tabs, $group['tabs'] ); } $tab_icons = array( 'dashboard' => '↗', 'setup' => '✓', 'llms' => 'L', 'tools' => '⚙', 'integrations' => 'S', 'forms' => 'F', 'accessibility' => 'A', 'layout' => 'C', 'ecommerce' => 'W', 'reports' => 'R', 'settings' => '⚙', ); if ( '' === $tab ) { $tab = empty( $options['wizard_completed'] ) ? 'setup' : 'dashboard'; } if ( ! isset( $tabs[ $tab ] ) ) { $tab = 'dashboard'; } foreach ( $tab_groups as $group ) { if ( isset( $group['tabs'][ $tab ] ) ) { $current_group_label = $group['label']; break; } } ?>

render_notices(); ?>
·
render_setup_tab(); break; case 'llms': $this->render_llms_tab(); break; case 'forms': $this->render_forms_tab(); break; case 'tools': $this->render_tools_tab(); break; case 'accessibility': $this->render_accessibility_tab(); break; case 'layout': $this->render_layout_tab(); break; case 'ecommerce': $this->render_ecommerce_tab(); break; case 'integrations': $this->render_integrations_tab(); break; case 'reports': $this->render_reports_tab(); break; case 'settings': $this->render_settings_tab(); break; case 'dashboard': default: $this->render_dashboard_tab(); } ?>
render_notice( __( 'Agentic files regenerated successfully.', 'agizoai-agentic-browsing-optimizer' ), 'success' ); } if ( isset( $_GET['settings-updated'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended $this->llms->clear_cache(); $this->render_notice( __( 'Settings saved. Agentic files cache has been refreshed.', 'agizoai-agentic-browsing-optimizer' ), 'success' ); } } /** * Render a custom visible notice. * * @param string $message Notice text. * @param string $type Notice type. * @return void */ private function render_notice( $message, $type = 'success' ) { $type_class = 'success' === $type ? 'agizoai-notice-success' : 'agizoai-notice-info'; ?>
scanner->scan(); $this->scanner->persist_last_scan( $scan ); ?>
/100

score_message( $scan['score'] ) ); ?>

settings->get( 'site_type', 'business' ) ) : ?>

%

render_checks_list( $scan['failed'], true ); ?>

settings->get_options(); $post_types = $this->settings->get_public_post_type_names(); $taxonomies = $this->settings->get_public_taxonomy_names(); $site_types = $this->settings->get_site_types(); ?>
render_preserve_hidden_fields( $options, array( 'site_type', 'site_purpose', 'custom_intro', 'include_post_types', 'include_taxonomies', 'wizard_completed', 'enabled', 'full_enabled', 'safe_mode', 'respect_noindex', 'add_robots_reference' ) ); ?>

1

$label ) : ?>
2

3

4

render_checkbox( 'enabled', __( 'Enable /llms.txt', 'agizoai-agentic-browsing-optimizer' ), $options['enabled'] ); ?> render_checkbox( 'full_enabled', __( 'Enable /llms-full.txt', 'agizoai-agentic-browsing-optimizer' ), $options['full_enabled'] ); ?> render_checkbox( 'safe_mode', __( 'Safe read-only mode', 'agizoai-agentic-browsing-optimizer' ), $options['safe_mode'] ); ?> render_checkbox( 'respect_noindex', __( 'Respect noindex metadata where detected', 'agizoai-agentic-browsing-optimizer' ), $options['respect_noindex'] ); ?> render_checkbox( 'add_robots_reference', __( 'Add llms.txt reference to robots.txt', 'agizoai-agentic-browsing-optimizer' ), $options['add_robots_reference'] ); ?> render_checkbox( 'webmcp_enabled', __( 'Enable WebMCP form metadata foundation', 'agizoai-agentic-browsing-optimizer' ), $options['webmcp_enabled'] ); ?> render_checkbox( 'webmcp_form_metadata_enabled', __( 'Add declarative metadata to supported public forms', 'agizoai-agentic-browsing-optimizer' ), $options['webmcp_form_metadata_enabled'] ); ?>

llms->generate(); $full_preview = $this->llms->generate_full(); ?>

render_clear_cache_button(); ?>

settings->get_options(); $forms = $this->forms->detect_forms( 60 ); $summary = $this->forms->summarize_detected_forms( $forms ); ?>

render_preserve_hidden_fields( $options, array( 'webmcp_enabled', 'webmcp_form_metadata_enabled', 'webmcp_search_form_enabled', 'webmcp_content_forms_enabled', 'webmcp_confirmation_required', 'webmcp_tool_prefix', 'webmcp_default_form_description' ) ); ?>

render_checkbox( 'webmcp_enabled', __( 'Enable WebMCP support', 'agizoai-agentic-browsing-optimizer' ), $options['webmcp_enabled'] ); ?> render_checkbox( 'webmcp_form_metadata_enabled', __( 'Enable declarative form metadata', 'agizoai-agentic-browsing-optimizer' ), $options['webmcp_form_metadata_enabled'] ); ?> render_checkbox( 'webmcp_search_form_enabled', __( 'Enhance native WordPress search form', 'agizoai-agentic-browsing-optimizer' ), $options['webmcp_search_form_enabled'] ); ?> render_checkbox( 'webmcp_content_forms_enabled', __( 'Enhance forms rendered inside public content', 'agizoai-agentic-browsing-optimizer' ), $options['webmcp_content_forms_enabled'] ); ?> render_checkbox( 'webmcp_confirmation_required', __( 'Mark form submission as requiring user confirmation', 'agizoai-agentic-browsing-optimizer' ), $options['webmcp_confirmation_required'] ); ?>

·

: : :

  • —

settings->get_options(); $summary = $this->tools->summarize_tools(); $registry_json = wp_json_encode( array( 'enabled' => (bool) $summary['enabled'], 'mode' => 'public_read_only', 'tool_registry' => $summary['registry_url'], 'base_url' => $summary['base_url'], 'security_notes' => array( __( 'Only public read-only tools are exposed.', 'agizoai-agentic-browsing-optimizer' ), __( 'No private, draft, password-protected or admin-only data is intentionally exposed.', 'agizoai-agentic-browsing-optimizer' ), __( 'No endpoint changes site state, submits forms, creates content, changes settings or processes payments.', 'agizoai-agentic-browsing-optimizer' ), ), 'tools' => $summary['tools'], ), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ); ?>

render_preserve_hidden_fields( $options, array( 'agent_tools_enabled', 'agent_tools_rest_enabled', 'agent_tools_search_enabled', 'agent_tools_content_enabled', 'agent_tools_recent_enabled', 'agent_tools_menus_enabled', 'agent_tools_taxonomies_enabled', 'abilities_enabled', 'abilities_public_enabled', 'ai_profile_enabled', 'site_health_enabled' ) ); ?>

render_checkbox( 'agent_tools_enabled', __( 'Enable public read-only agent tools', 'agizoai-agentic-browsing-optimizer' ), $options['agent_tools_enabled'] ); ?> render_checkbox( 'agent_tools_rest_enabled', __( 'Expose REST tool registry', 'agizoai-agentic-browsing-optimizer' ), $options['agent_tools_rest_enabled'] ); ?>

render_checkbox( 'agent_tools_search_enabled', __( 'Search public content', 'agizoai-agentic-browsing-optimizer' ), $options['agent_tools_search_enabled'] ); ?> render_checkbox( 'agent_tools_content_enabled', __( 'Get public content summary', 'agizoai-agentic-browsing-optimizer' ), $options['agent_tools_content_enabled'] ); ?> render_checkbox( 'agent_tools_recent_enabled', __( 'Get recent public content', 'agizoai-agentic-browsing-optimizer' ), $options['agent_tools_recent_enabled'] ); ?> render_checkbox( 'agent_tools_menus_enabled', __( 'Get public navigation menus', 'agizoai-agentic-browsing-optimizer' ), $options['agent_tools_menus_enabled'] ); ?> render_checkbox( 'agent_tools_taxonomies_enabled', __( 'Get public sections and taxonomies', 'agizoai-agentic-browsing-optimizer' ), $options['agent_tools_taxonomies_enabled'] ); ?>

render_checkbox( 'abilities_enabled', __( 'Register native WordPress abilities (WordPress 6.9+)', 'agizoai-agentic-browsing-optimizer' ), $options['abilities_enabled'] ); ?> render_checkbox( 'abilities_public_enabled', __( 'Expose eligible abilities to REST/MCP clients', 'agizoai-agentic-browsing-optimizer' ), $options['abilities_public_enabled'] ); ?> render_checkbox( 'ai_profile_enabled', __( 'Publish machine-readable /ai.json site profile', 'agizoai-agentic-browsing-optimizer' ), $options['ai_profile_enabled'] ); ?> render_checkbox( 'site_health_enabled', __( 'Add AgizoAI checks to Tools > Site Health', 'agizoai-agentic-browsing-optimizer' ), $options['site_health_enabled'] ); ?>

·

: : :
settings->get_options(); $scan = $this->accessibility->scan( $options['accessibility_scan_limit'] ); $metrics = isset( $scan['metrics'] ) && is_array( $scan['metrics'] ) ? $scan['metrics'] : array(); ?>

/100

render_preserve_hidden_fields( $options, array( 'accessibility_scanner_enabled', 'accessibility_scan_limit' ) ); ?> render_checkbox( 'accessibility_scanner_enabled', __( 'Enable accessibility-for-agents scanner', 'agizoai-agentic-browsing-optimizer' ), $options['accessibility_scanner_enabled'] ); ?>

: :
settings->get_options(); $scan = $this->layout->scan( $options['layout_scan_limit'] ); $metrics = isset( $scan['metrics'] ) && is_array( $scan['metrics'] ) ? $scan['metrics'] : array(); $css = $this->layout->get_helper_css( $options ); ?>

/100

render_preserve_hidden_fields( $options, array( 'layout_scanner_enabled', 'layout_scan_limit', 'layout_helper_css_enabled', 'layout_reserve_ad_slots', 'layout_top_ad_min_height', 'layout_inline_ad_min_height', 'layout_sidebar_ad_min_height', 'layout_mobile_ad_min_height', 'layout_sticky_header_offset' ) ); ?> render_checkbox( 'layout_scanner_enabled', __( 'Enable layout stability scanner', 'agizoai-agentic-browsing-optimizer' ), $options['layout_scanner_enabled'] ); ?> render_checkbox( 'layout_helper_css_enabled', __( 'Enable frontend helper CSS', 'agizoai-agentic-browsing-optimizer' ), $options['layout_helper_css_enabled'] ); ?> render_checkbox( 'layout_reserve_ad_slots', __( 'Reserve common ad-slot space', 'agizoai-agentic-browsing-optimizer' ), $options['layout_reserve_ad_slots'] ); ?>

: :
settings->get_options(); $scan = $this->woocommerce->scan( $options['ecommerce_scan_limit'] ); ?>

/100

render_preserve_hidden_fields( $options, array( 'ecommerce_scanner_enabled', 'ecommerce_scan_limit', 'ecommerce_product_tools_enabled', 'ecommerce_product_search_enabled', 'ecommerce_product_details_enabled', 'ecommerce_product_categories_enabled', 'ecommerce_include_out_of_stock' ) ); ?> render_checkbox( 'ecommerce_scanner_enabled', __( 'Enable WooCommerce readiness scanner', 'agizoai-agentic-browsing-optimizer' ), $options['ecommerce_scanner_enabled'] ); ?> render_checkbox( 'ecommerce_product_tools_enabled', __( 'Enable public read-only product tools', 'agizoai-agentic-browsing-optimizer' ), $options['ecommerce_product_tools_enabled'] ); ?> render_checkbox( 'ecommerce_product_search_enabled', __( 'Product search endpoint', 'agizoai-agentic-browsing-optimizer' ), $options['ecommerce_product_search_enabled'] ); ?> render_checkbox( 'ecommerce_product_details_enabled', __( 'Single product detail endpoint', 'agizoai-agentic-browsing-optimizer' ), $options['ecommerce_product_details_enabled'] ); ?> render_checkbox( 'ecommerce_product_categories_enabled', __( 'Product categories endpoint', 'agizoai-agentic-browsing-optimizer' ), $options['ecommerce_product_categories_enabled'] ); ?> render_checkbox( 'ecommerce_include_out_of_stock', __( 'Include out-of-stock status in public summaries', 'agizoai-agentic-browsing-optimizer' ), $options['ecommerce_include_out_of_stock'] ); ?>

✓

✓

✓

settings->get_options(); $scan = $this->integrations->scan( $options['integration_scan_limit'] ); $sources = isset( $scan['sources'] ) ? (array) $scan['sources'] : array(); ?>

/100

render_preserve_hidden_fields( $options, array( 'integrations_enabled', 'integration_real_seo_master_enabled', 'integration_yoast_enabled', 'integration_rankmath_enabled', 'integration_aioseo_enabled', 'integration_seopress_enabled', 'integration_wordpress_core_enabled', 'integration_primary_source', 'integration_use_seo_descriptions_in_llms', 'integration_expose_seo_metadata_in_tools', 'integration_add_seo_notes_to_llms', 'integration_scan_limit' ) ); ?>

render_checkbox( 'integrations_enabled', __( 'Enable SEO metadata integrations', 'agizoai-agentic-browsing-optimizer' ), $options['integrations_enabled'] ); ?> render_checkbox( 'integration_use_seo_descriptions_in_llms', __( 'Use SEO descriptions in llms.txt summaries', 'agizoai-agentic-browsing-optimizer' ), $options['integration_use_seo_descriptions_in_llms'] ); ?> render_checkbox( 'integration_expose_seo_metadata_in_tools', __( 'Expose SEO metadata in public read-only content tools', 'agizoai-agentic-browsing-optimizer' ), $options['integration_expose_seo_metadata_in_tools'] ); ?> render_checkbox( 'integration_add_seo_notes_to_llms', __( 'Add SEO metadata notes to llms.txt', 'agizoai-agentic-browsing-optimizer' ), $options['integration_add_seo_notes_to_llms'] ); ?>

$source ) : ?>

: :
render_checkbox( $source['option'], sprintf( __( 'Enable %s', 'agizoai-agentic-browsing-optimizer' ), $source['label'] ), $options[ $source['option'] ] ); ?>

: :

scanner->scan(); $this->scanner->persist_last_scan( $scan ); ?>

/100

render_checks_list( $scan['failed'], false ); ?>
settings->get_options(); $post_types = $this->settings->get_public_post_type_names(); $taxonomies = $this->settings->get_public_taxonomy_names(); $site_types = $this->settings->get_site_types(); ?>

render_checkbox( 'enabled', __( 'Enable /llms.txt', 'agizoai-agentic-browsing-optimizer' ), $options['enabled'] ); ?> render_checkbox( 'full_enabled', __( 'Enable /llms-full.txt', 'agizoai-agentic-browsing-optimizer' ), $options['full_enabled'] ); ?> render_checkbox( 'safe_mode', __( 'Safe read-only mode', 'agizoai-agentic-browsing-optimizer' ), $options['safe_mode'] ); ?> render_checkbox( 'add_robots_reference', __( 'Add llms.txt reference to robots.txt', 'agizoai-agentic-browsing-optimizer' ), $options['add_robots_reference'] ); ?> render_checkbox( 'webmcp_enabled', __( 'Enable WebMCP support', 'agizoai-agentic-browsing-optimizer' ), $options['webmcp_enabled'] ); ?>

render_checkbox( 'respect_noindex', __( 'Respect noindex metadata where detected', 'agizoai-agentic-browsing-optimizer' ), $options['respect_noindex'] ); ?> render_checkbox( 'include_private', __( 'Include private content', 'agizoai-agentic-browsing-optimizer' ), $options['include_private'] ); ?> render_checkbox( 'include_attachments', __( 'Include media attachments', 'agizoai-agentic-browsing-optimizer' ), $options['include_attachments'] ); ?>

render_checkbox( 'report_branding', __( 'Include AgizoAI branding in exported reports', 'agizoai-agentic-browsing-optimizer' ), $options['report_branding'] ); ?>

> $checks Checks. * @param bool $show_action Whether to show action button. * @return void */ private function render_checks_list( array $checks, $show_action ) { if ( empty( $checks ) ) { ?>

$options Options. * @param array $exclude Keys not to preserve. * @return void */ private function render_preserve_hidden_fields( array $options, array $exclude ) { foreach ( $options as $key => $value ) { if ( in_array( $key, $exclude, true ) ) { continue; } if ( is_array( $value ) ) { foreach ( $value as $item ) { printf( '', esc_attr( AGIZOAI_AGENTIC_OPTION ), esc_attr( $key ), esc_attr( (string) $item ) ); } continue; } printf( '', esc_attr( AGIZOAI_AGENTIC_OPTION ), esc_attr( $key ), esc_attr( (string) $value ) ); } } /** * Render cache clear form. * * @return void */ private function render_clear_cache_button() { ?>
'agizoai_agentic_export_report', 'format' => sanitize_key( $format ), ), admin_url( 'admin-post.php' ) ), 'agizoai_agentic_export_report' ); } /** * Human score message. * * @param int $score Score. * @return string */ private function score_message( $score ) { $score = absint( $score ); if ( $score >= 90 ) { return __( 'Excellent foundation. Your public agent-discovery, accessibility, layout-stability, shop-readiness and SEO metadata layer is in strong shape for v1.0.0.', 'agizoai-agentic-browsing-optimizer' ); } if ( $score >= 75 ) { return __( 'Good start. A few settings can improve agent discoverability and safety.', 'agizoai-agentic-browsing-optimizer' ); } if ( $score >= 50 ) { return __( 'Needs work. Configure the setup wizard and add a site purpose to improve clarity.', 'agizoai-agentic-browsing-optimizer' ); } return __( 'Critical setup missing. Enable llms.txt and select public content types first.', 'agizoai-agentic-browsing-optimizer' ); } /** * Format report as array. * * @param array $scan Scan. * @return array */ private function format_report_array( array $scan ) { $options = $this->settings->get_options(); return array( 'plugin' => 'AgizoAI Agentic Browsing Optimizer', 'version' => AGIZOAI_AGENTIC_VERSION, 'site_name' => get_bloginfo( 'name' ), 'site_url' => home_url( '/' ), 'site_type' => $options['site_type'], 'score' => $scan['score'], 'status' => $scan['status_label'], 'generated_at' => $scan['generated_at'], 'endpoints' => $scan['endpoints'], 'forms' => $scan['forms'], 'tools' => $scan['tools'], 'accessibility'=> $scan['accessibility'], 'layout' => $scan['layout'], 'ecommerce' => $scan['ecommerce'], 'integrations' => $scan['integrations'], 'groups' => $scan['groups'], 'failed' => $scan['failed'], 'checks' => $scan['checks'], ); } /** * Format report as Markdown. * * @param array $scan Scan. * @return string */ private function format_report_markdown( array $scan ) { $lines = array(); $lines[] = '# AgizoAI Agentic Browsing Report'; $lines[] = ''; $lines[] = '- Site: ' . get_bloginfo( 'name' ); $lines[] = '- URL: ' . home_url( '/' ); $lines[] = '- Plugin version: ' . AGIZOAI_AGENTIC_VERSION; $lines[] = '- Generated: ' . $scan['generated_at']; $lines[] = '- Score: ' . $scan['score'] . '/100'; $lines[] = '- Status: ' . $scan['status_label']; $lines[] = ''; $lines[] = '## Endpoints'; $lines[] = '- llms.txt: ' . $scan['endpoints']['llms']; $lines[] = '- llms-full.txt: ' . $scan['endpoints']['llms_full']; $lines[] = '- Tool registry: ' . $scan['endpoints']['tools']; $lines[] = ''; $lines[] = '## Group Scores'; foreach ( $scan['groups'] as $group ) { $lines[] = '- ' . $group['label'] . ': ' . $group['score'] . '/' . $group['total'] . ' (' . $group['percent'] . '%)'; } $lines[] = ''; $lines[] = '## Forms & WebMCP'; $lines[] = '- Detected forms: ' . $scan['forms']['total']; $lines[] = '- Required fields without name attributes: ' . $scan['forms']['required_without_name']; $lines[] = ''; $lines[] = '## Read-only Agent Tools'; $lines[] = '- Active tools: ' . $scan['tools']['count']; $lines[] = '- Tool registry: ' . $scan['tools']['registry_url']; $lines[] = ''; $lines[] = '## Accessibility for Agents'; $lines[] = '- Pages scanned: ' . $scan['accessibility']['pages_scanned']; $lines[] = '- Accessibility score: ' . $scan['accessibility']['score'] . '/100'; $lines[] = '- Critical issues: ' . $scan['accessibility']['critical_count']; $lines[] = '- Total issues: ' . $scan['accessibility']['issue_count']; if ( ! empty( $scan['accessibility']['issues'] ) ) { foreach ( array_slice( $scan['accessibility']['issues'], 0, 20 ) as $issue ) { $lines[] = '### Accessibility: ' . $issue['title']; $lines[] = '- Page: ' . ( ! empty( $issue['page_title'] ) ? $issue['page_title'] : 'Site' ); $lines[] = '- Problem: ' . $issue['problem']; $lines[] = '- Fix: ' . $issue['fix']; $lines[] = ''; } } $lines[] = ''; $lines[] = '## Layout Stability'; $lines[] = '- Pages scanned: ' . $scan['layout']['pages_scanned']; $lines[] = '- Layout score: ' . $scan['layout']['score'] . '/100'; $lines[] = '- Critical issues: ' . $scan['layout']['critical_count']; $lines[] = '- Total risks: ' . $scan['layout']['issue_count']; if ( ! empty( $scan['layout']['metrics'] ) ) { $lines[] = '- Images without reserved dimensions: ' . ( isset( $scan['layout']['metrics']['images_missing_dimensions'] ) ? $scan['layout']['metrics']['images_missing_dimensions'] : 0 ); $lines[] = '- Embeds without reserved dimensions: ' . ( isset( $scan['layout']['metrics']['iframes_missing_dimensions'] ) ? $scan['layout']['metrics']['iframes_missing_dimensions'] : 0 ); $lines[] = '- Ad slots without reserved space: ' . ( isset( $scan['layout']['metrics']['ad_slots_without_reserved_space'] ) ? $scan['layout']['metrics']['ad_slots_without_reserved_space'] : 0 ); } if ( ! empty( $scan['layout']['issues'] ) ) { foreach ( array_slice( $scan['layout']['issues'], 0, 20 ) as $issue ) { $lines[] = '### Layout: ' . $issue['title']; $lines[] = '- Page: ' . ( ! empty( $issue['page_title'] ) ? $issue['page_title'] : 'Site' ); $lines[] = '- Problem: ' . $issue['problem']; $lines[] = '- Fix: ' . $issue['fix']; $lines[] = ''; } } $lines[] = ''; $lines[] = '## WooCommerce Readiness'; $lines[] = '- WooCommerce active: ' . ( ! empty( $scan['ecommerce']['active'] ) ? 'yes' : 'no' ); $lines[] = '- WooCommerce score: ' . $scan['ecommerce']['score'] . '/100'; $lines[] = '- Published products: ' . $scan['ecommerce']['published_products']; $lines[] = '- Products scanned: ' . $scan['ecommerce']['products_scanned']; $lines[] = '- Missing summaries: ' . $scan['ecommerce']['products_missing_summary']; $lines[] = '- Product image alt gaps: ' . $scan['ecommerce']['products_missing_image_alt']; $lines[] = '- Product categories: ' . $scan['ecommerce']['product_categories']; if ( ! empty( $scan['ecommerce']['issues'] ) ) { foreach ( array_slice( $scan['ecommerce']['issues'], 0, 20 ) as $issue ) { $lines[] = '### Product: ' . $issue['title']; $lines[] = '- URL: ' . $issue['url']; $lines[] = '- Problem: ' . $issue['problem']; $lines[] = '- Fix: ' . $issue['fix']; $lines[] = ''; } } $lines[] = ''; $lines[] = '## SEO Metadata Integrations'; $lines[] = '- Integration score: ' . $scan['integrations']['score'] . '/100'; $lines[] = '- Detected sources: ' . implode( ', ', (array) $scan['integrations']['detected_sources'] ); $lines[] = '- Enabled sources: ' . implode( ', ', (array) $scan['integrations']['enabled_sources'] ); $lines[] = '- Items scanned: ' . $scan['integrations']['items_scanned']; $lines[] = '- Items with descriptions: ' . $scan['integrations']['items_with_description']; $lines[] = '- Items with canonicals: ' . $scan['integrations']['items_with_canonical']; $lines[] = '- Items with OG images: ' . $scan['integrations']['items_with_og_image']; if ( ! empty( $scan['integrations']['issues'] ) ) { foreach ( array_slice( $scan['integrations']['issues'], 0, 20 ) as $issue ) { $lines[] = '### SEO Metadata: ' . $issue['title']; if ( ! empty( $issue['url'] ) ) { $lines[] = '- URL: ' . $issue['url']; } $lines[] = '- Problem: ' . $issue['problem']; $lines[] = '- Fix: ' . $issue['fix']; $lines[] = ''; } } $lines[] = ''; $lines[] = '## Open Issues'; if ( empty( $scan['failed'] ) ) { $lines[] = 'No open issues found.'; } else { foreach ( $scan['failed'] as $check ) { $lines[] = '### ' . $check['label']; $lines[] = '- Problem: ' . $check['problem']; $lines[] = '- Why it matters: ' . $check['why']; $lines[] = '- Fix: ' . $check['fix']; $lines[] = ''; } } $lines[] = ''; $lines[] = '## llms.txt Preview'; $lines[] = '```'; $lines[] = wp_trim_words( $this->llms->generate(), 260, "\n..." ); $lines[] = '```'; return implode( "\n", $lines ) . "\n"; } /** * Format report as HTML. * * @param array $scan Scan. * @return string */ private function format_report_html( array $scan ) { ob_start(); ?> <?php echo esc_html( get_bloginfo( 'name' ) ); ?> - AgizoAI Agentic Report

AgizoAI Agentic Browsing Optimizer v

- Agentic Readiness Report

/100

·

Endpoints

  • llms.txt:
  • llms-full.txt:
  • Tool registry:

Group Scores


/ · %

Forms & WebMCP

Detected forms: . Required fields without names: .

Read-only Agent Tools

Active tools: . Registry: .

Accessibility for Agents

Score
/100
Pages scanned
Critical issues
Total issues

Page:

Problem:

Fix:

Layout Stability

Score
/100
Pages scanned
Critical risks
Total risks

Page:

Problem:

Fix:

WooCommerce Readiness

WooCommerce
Score
/100
Published products
Product issues

URL:

Problem:

Fix:

SEO Metadata Integrations

Score
/100
Enabled sources
Items scanned
Descriptions

URL:

Problem:

Fix:

Open Issues

No open issues found.

Problem:

Why it matters:

Fix:

llms.txt Preview

llms->generate(), 260, "\n..." ) ); ?>