$data Collected site data. */ if ( ! defined( 'ABSPATH' ) ) { exit; } // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template variables scoped to including method. $identity = $data['identity']; $permissions = $data['permissions']; $settings = $data['settings']; $technical = $data['technical']; $map = AIDF_Permissions_Mapper::get_map( $data ); // Attribution header. // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Pre-built internal string. echo AIDF_Generator::get_attribution( '#', 'ai-txt' ); echo '# AI Usage Policy for ' . esc_html( $identity['name'] ) . "\n\n"; if ( ! empty( $technical['language'] ) ) { echo 'Lang: ' . esc_html( $technical['language'] ) . "\n"; } echo 'Website: [' . esc_html( $identity['url'] ) . '](' . esc_url( $identity['url'] ) . ')' . "\n"; echo 'Last Updated: ' . esc_html( wp_date( 'Y-m-d' ) ) . "\n\n"; // Permissions. echo "## Permissions\n\n"; echo "AI systems MAY:\n\n"; foreach ( $map['permissions'] as $entry ) { $line = '- ' . $entry['description']; if ( ! empty( $entry['conditions'] ) ) { $line .= ' (' . lcfirst( implode( '; ', $entry['conditions'] ) ) . ')'; } echo esc_html( $line ) . "\n"; } echo "\n"; // Restrictions. echo "## Restrictions\n\n"; $must_not = array(); $should_not = array(); foreach ( $map['restrictions'] as $entry ) { if ( 'should-not' === $entry['severity'] ) { $should_not[] = $entry; } else { $must_not[] = $entry; } } if ( ! empty( $must_not ) ) { echo "AI systems MUST NOT:\n\n"; foreach ( $must_not as $entry ) { echo '- ' . esc_html( $entry['reason'] ) . "\n"; } echo "\n"; } if ( ! empty( $should_not ) ) { echo "AI systems SHOULD NOT:\n\n"; foreach ( $should_not as $entry ) { echo '- ' . esc_html( $entry['reason'] ) . "\n"; } echo "\n"; } // Training policy summary. echo "## AI Training\n\n"; switch ( $permissions['ai_training'] ) { case 'allow': echo "This website's content may be used for AI model training.\n\n"; break; case 'restrict': echo "This website's content should not be used for AI model training without explicit permission.\n\n"; break; case 'prohibit': echo "This website's content must not be used for AI model training under any circumstances.\n\n"; break; } // Attribution requirements. if ( 'allow_with_attribution' === $permissions['ai_usage'] ) { echo "## Attribution Requirements\n\n"; echo 'When citing this website, reference ' . esc_html( $identity['name'] ) . ' and link to [' . esc_html( $identity['url'] ) . '](' . esc_url( $identity['url'] ) . ')' . "\n\n"; } // Content licence. $licence_label = AIDF_Generator::format_licence( $permissions['content_licence'] ); if ( ! empty( $licence_label ) ) { echo "## Content Licence\n\n"; echo 'Licence: ' . esc_html( $licence_label ) . "\n\n"; } // Citation format. if ( ! empty( $permissions['citation_format'] ) ) { echo "## Citation Format\n\n"; echo "When citing content from this website, use:\n\n"; echo esc_html( $permissions['citation_format'] ) . "\n\n"; } // Crawler access. echo "## Crawler Access\n\n"; switch ( $permissions['crawler_policy'] ) { case 'allow_all': echo "All AI crawlers are permitted to access this website.\n"; break; case 'allow_known': echo "Known AI crawlers (GPTBot, ClaudeBot, Google-Extended, etc.) are permitted to access this website.\n"; echo "See robots.txt and robots-ai.txt for specific directives.\n"; break; case 'restrict': echo "AI crawlers should respect robots.txt directives. Not all AI crawlers are permitted.\n"; echo "See robots.txt and robots-ai.txt for specific directives.\n"; break; } echo "\n## Contact\n\n"; if ( ! empty( $identity['email'] ) ) { echo 'Email: ' . esc_html( $identity['email'] ) . "\n"; } if ( ! empty( $identity['contact_url'] ) ) { echo '[Contact Page](' . esc_url( $identity['contact_url'] ) . ')' . "\n"; } if ( ! empty( $identity['privacy_policy_url'] ) ) { echo '[Privacy Policy](' . esc_url( $identity['privacy_policy_url'] ) . ')' . "\n"; } if ( ! empty( $identity['terms_url'] ) ) { echo '[Terms of Service](' . esc_url( $identity['terms_url'] ) . ')' . "\n"; } // Cross-reference. echo "\n## Related Files\n\n"; $active = isset( $settings['active_files'] ) ? (array) $settings['active_files'] : array(); if ( in_array( 'ai-json', $active, true ) ) { echo '- [Machine-parseable version (ai.json)](' . esc_url( home_url( '/ai.json' ) ) . ')' . "\n"; } if ( in_array( 'robots-ai-txt', $active, true ) ) { echo '- [AI crawler directives (robots-ai.txt)](' . esc_url( home_url( '/robots-ai.txt' ) ) . ')' . "\n"; } echo '- [robots.txt](' . esc_url( home_url( '/robots.txt' ) ) . ')' . "\n";