, and connects AI referral attribution. * Version: 1.0.0 * Requires at least: 6.0 * Requires PHP: 7.4 * Author: Verisource * Author URI: https://verisource.dev * License: GPL-2.0-or-later */ if ( ! defined( 'ABSPATH' ) ) { exit; } define( 'VERISOURCE_GEO_CONNECTOR_VERSION', '1.0.0' ); /** * Render virtual /llms.txt and /agents.md endpoints with clean HTTP 200 headers. */ function verisource_geo_serve_virtual_protocol_files() { if ( is_admin() || empty( $_SERVER['REQUEST_URI'] ) ) { return; } $request_path = wp_parse_url( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), PHP_URL_PATH ); if ( '/llms.txt' !== $request_path && '/agents.md' !== $request_path ) { return; } $site_name = get_bloginfo( 'name' ) ? get_bloginfo( 'name' ) : 'Verisource'; $site_url = home_url( '/' ); if ( '/llms.txt' === $request_path ) { $llms_body = get_option( 'verisource_llms_txt_body', '' ); if ( empty( trim( $llms_body ) ) ) { $llms_body = "# " . $site_name . "\n\n> Official machine-readable entity, pricing, and policy specification for " . $site_name . " (" . $site_url . ").\n\nCanonical Website: " . $site_url . "\nAgent Specification: " . home_url( '/agents.md' ) . "\n"; } status_header( 200 ); header( 'Content-Type: text/plain; charset=utf-8' ); header( 'Cache-Control: public, max-age=3600' ); echo $llms_body; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- plain-text Markdown payload exit; } if ( '/agents.md' === $request_path ) { $agents_body = get_option( 'verisource_agents_md_body', '' ); if ( empty( trim( $agents_body ) ) ) { $agents_body = "# " . $site_name . " — Autonomous Agent & Buyer Truth Specification\n\nCanonical Origin: " . $site_url . "\nMachine Summary: " . home_url( '/llms.txt' ) . "\n\n## Verified Commercial Policies\n- Publish verified pricing tiers, service areas, and return policies inside Settings -> Verisource GEO.\n"; } status_header( 200 ); header( 'Content-Type: text/markdown; charset=utf-8' ); header( 'Cache-Control: public, max-age=3600' ); echo $agents_body; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Markdown payload exit; } } add_action( 'init', 'verisource_geo_serve_virtual_protocol_files', 1 ); /** * Inject protocol discovery tags, schema.org JSON-LD, and optional AI referral pixel. */ function verisource_geo_inject_head_artifacts() { if ( is_admin() ) { return; } echo '' . "\n"; echo '' . "\n"; $json_ld = get_option( 'verisource_json_ld_schema', '' ); if ( ! empty( trim( $json_ld ) ) ) { $decoded = json_decode( $json_ld, true ); if ( is_array( $decoded ) && isset( $decoded['@context'] ) ) { echo '' . "\n"; } } $pixel_token = sanitize_text_field( get_option( 'verisource_pixel_token', '' ) ); if ( preg_match( '/^[0-9a-f-]{36}$/i', $pixel_token ) ) { echo '' . "\n"; } } add_action( 'wp_head', 'verisource_geo_inject_head_artifacts', 1 ); /** * Register Settings -> Verisource GEO admin page. */ function verisource_geo_register_settings() { register_setting( 'verisource_geo_group', 'verisource_llms_txt_body', array( 'sanitize_callback' => 'sanitize_textarea_field' ) ); register_setting( 'verisource_geo_group', 'verisource_agents_md_body', array( 'sanitize_callback' => 'sanitize_textarea_field' ) ); register_setting( 'verisource_geo_group', 'verisource_json_ld_schema' ); register_setting( 'verisource_geo_group', 'verisource_pixel_token', array( 'sanitize_callback' => 'sanitize_text_field' ) ); } add_action( 'admin_init', 'verisource_geo_register_settings' ); function verisource_geo_admin_menu() { add_options_page( 'Verisource GEO Connector', 'Verisource GEO', 'manage_options', 'verisource-geo-connector', 'verisource_geo_render_admin_page' ); } add_action( 'admin_menu', 'verisource_geo_admin_menu' ); function verisource_geo_render_admin_page() { if ( ! current_user_can( 'manage_options' ) ) { return; } ?>
Paste your syntax-validated /llms.txt, /agents.md, and schema.org JSON-LD artifacts generated at verisource.dev/dashboard.