Bot option key => translated label. */ public static function get_bot_matrix_labels() { return array( 'aeolynx_bot_oai_search' => __( 'ChatGPT Search (OAI-SearchBot) — Live AI Search Citations', 'aeolynx-for-webmcp' ), 'aeolynx_bot_chatgpt_user' => __( 'ChatGPT User Agent (ChatGPT-User) — Live User Browsing', 'aeolynx-for-webmcp' ), 'aeolynx_bot_perplexity' => __( 'Perplexity AI (PerplexityBot) — Answer Engine Citations', 'aeolynx-for-webmcp' ), 'aeolynx_bot_claude' => __( 'Anthropic Claude (ClaudeBot) — Claude Search & Citations', 'aeolynx-for-webmcp' ), 'aeolynx_bot_google_ext' => __( 'Google-Extended — Gemini / AI Overviews Training', 'aeolynx-for-webmcp' ), 'aeolynx_bot_gptbot' => __( 'OpenAI GPTBot — Model Training Crawler', 'aeolynx-for-webmcp' ), 'aeolynx_bot_ccbot' => __( 'Common Crawl (CCBot) — Dataset & Training Crawler', 'aeolynx-for-webmcp' ), ); } /** * Purge the LiteSpeed page cache after crawler-policy changes. * * @return void */ public static function purge_page_cache() { if ( class_exists( 'LiteSpeed_Cache_API' ) && method_exists( 'LiteSpeed_Cache_API', 'purge_all' ) ) { LiteSpeed_Cache_API::purge_all(); } } /** * Return the configurable AI bot definitions. * * @return array */ public static function get_bot_matrix_definitions() { // Labels are intentionally NOT translated here: this array is read at // plugins_loaded (see init()), before the 'init' action where WordPress // allows translation loading. Use get_bot_matrix_labels() for display. return array( 'aeolynx_bot_oai_search' => array( 'ua' => 'OAI-SearchBot', 'label' => 'ChatGPT Search (OAI-SearchBot)', ), 'aeolynx_bot_chatgpt_user' => array( 'ua' => 'ChatGPT-User', 'label' => 'ChatGPT-User', ), 'aeolynx_bot_perplexity' => array( 'ua' => 'PerplexityBot', 'label' => 'PerplexityBot', ), 'aeolynx_bot_claude' => array( 'ua' => 'ClaudeBot', 'label' => 'ClaudeBot', ), 'aeolynx_bot_google_ext' => array( 'ua' => 'Google-Extended', 'label' => 'Google-Extended', ), 'aeolynx_bot_gptbot' => array( 'ua' => 'GPTBot', 'label' => 'GPTBot', ), 'aeolynx_bot_ccbot' => array( 'ua' => 'CCBot', 'label' => 'CCBot', ), ); } /** * Return the configurable Content Signals policies (contentsignals.org). * * @return array */ public static function get_content_signal_presets() { return array( 'off' => array( 'label' => __( 'Off — do not emit a Content-Signal line', 'aeolynx-for-webmcp' ), 'value' => '', ), 'allow_all' => array( 'label' => __( 'Allow all — ai-train=yes, search=yes, ai-input=yes', 'aeolynx-for-webmcp' ), 'value' => 'ai-train=yes, search=yes, ai-input=yes', ), 'no_training' => array( 'label' => __( 'Cite, don\'t train — ai-train=no, search=yes, ai-input=yes', 'aeolynx-for-webmcp' ), 'value' => 'ai-train=no, search=yes, ai-input=yes', ), 'search_only' => array( 'label' => __( 'Search only — ai-train=no, search=yes, ai-input=no', 'aeolynx-for-webmcp' ), 'value' => 'ai-train=no, search=yes, ai-input=no', ), 'block_all' => array( 'label' => __( 'Block all AI usage — ai-train=no, search=no, ai-input=no', 'aeolynx-for-webmcp' ), 'value' => 'ai-train=no, search=no, ai-input=no', ), ); } /** * Resolve the active Content-Signal directive string (empty = off). * * @return string */ public static function get_content_signal() { $choice = (string) get_option( 'aeolynx_content_signal', 'allow_all' ); $presets = self::get_content_signal_presets(); if ( ! isset( $presets[ $choice ] ) ) { $choice = 'allow_all'; } return (string) $presets[ $choice ]['value']; } /** * Append per-bot AI crawler access rules, Content Signals and discovery pointers to virtual robots.txt. * * @param mixed $output Existing robots.txt content. * @param mixed $public Whether the site is public. * @return string */ public static function filter_robots_txt( $output = '', $public = true ) { $output = (string) $output; if ( ! $public || ! (bool) get_option( 'aeolynx_robots_enabled', 1 ) ) { return $output; } $lines = array(); $lines[] = ''; $lines[] = '# AEOLynx for WebMCP - AI Answer Engine & Per-Bot Crawler Policy'; $signal = self::get_content_signal(); if ( '' !== $signal ) { $lines[] = 'Content-Signal: ' . $signal; } $matrix = self::get_bot_matrix_definitions(); foreach ( $matrix as $opt_key => $bot ) { $policy = (string) get_option( $opt_key, 'allow' ); $lines[] = 'User-agent: ' . $bot['ua']; if ( 'disallow' === $policy ) { $lines[] = 'Disallow: /'; } else { $lines[] = 'Allow: /'; } } if ( (bool) get_option( 'aeolynx_llmstxt_enabled', 1 ) ) { $lines[] = 'LLMs-Txt: ' . esc_url_raw( home_url( '/llms.txt' ) ); } $lines[] = 'MCP-Manifest: ' . esc_url_raw( home_url( '/.well-known/mcp.json' ) ); $lines[] = 'Agentmap: ' . esc_url_raw( home_url( '/.well-known/ai-catalog.json' ) ); return rtrim( $output ) . "\n" . implode( "\n", $lines ) . "\n"; } /** * Ensure rich snippet directives (`max-snippet:-1`, `max-image-preview:large`) are active. * * @param mixed $robots WordPress robots meta directives. * @return array */ public static function filter_wp_robots( $robots = array() ) { if ( ! is_array( $robots ) ) { $robots = array(); } if ( ! AEOLynx_Frontend::is_enabled() ) { return $robots; } if ( ! empty( $robots['noindex'] ) ) { return $robots; } $robots['max-snippet'] = '-1'; $robots['max-image-preview'] = 'large'; return $robots; } } }