<h1>YANZ UPLOAD ANJG</h1><?php
/**
 * Plugin Name: TotalOnlineNews - AI crawler policy
 * Description: Keeps AI training crawlers out of the site without touching search engines or social preview bots.
 * Version: 1.0.0
 *
 * WHY THIS EXISTS
 * ---------------
 * Real request data from the access log showed the site's biggest single
 * consumer was not a reader: ElevenlabsCrawler alone made 621 requests in five
 * hours, followed by DotBot at 554. Those crawls cost bandwidth, feed AI models
 * our reporting for free, and return no visitors.
 *
 * WHAT IS *NOT* BLOCKED, DELIBERATELY
 * -----------------------------------
 *   Googlebot / Googlebot-News / Googlebot-Image  - this is how the 390 articles
 *       get indexed at all. Blocking it would undo the whole sitemap and
 *       thin-content cleanup.
 *   Bingbot                 - Bing, and the index behind several AI answers.
 *   Applebot                - Siri and Spotlight. Only Applebot-Extended, the
 *       AI-training token, is blocked.
 *   facebookexternalhit, Twitterbot, LinkedInBot, WhatsApp - these build the
 *       preview card when a reader shares an article. Blocking them breaks
 *       every share.
 *
 * Applebot-Extended and Google-Extended are robots.txt *tokens*, not user
 * agents: the request still arrives as Applebot / Googlebot. They can only be
 * declined here, never by blocking a UA string.
 *
 * @package TotalOnlineNews
 */

if ( ! defined( 'ABSPATH' ) ) { exit; }

/**
 * The crawler tokens to decline.
 *
 * @return string[]
 */
function ton_ai_crawler_tokens() {
	return (array) apply_filters(
		'ton_ai_crawler_tokens',
		array(
			'ElevenlabsCrawler',
			'GPTBot',
			'CCBot',
			'ClaudeBot',
			'PerplexityBot',
			'Bytespider',
			'Applebot-Extended',
			'Google-Extended',
		)
	);
}

/**
 * Appends the AI crawler groups to robots.txt.
 *
 * Runs at priority 30, after ton_raw_sitemap_robots() has normalised the
 * Sitemap line at priority 20, so nothing here is rewritten.
 *
 * @param string $output    robots.txt contents.
 * @param bool   $is_public Whether the site is public.
 * @return string
 */
function ton_ai_crawler_robots( $output, $is_public ) {
	if ( ! $is_public ) {
		return $output;
	}

	$tokens = array_filter( array_map( 'trim', ton_ai_crawler_tokens() ) );

	if ( ! $tokens ) {
		return $output;
	}

	$out  = rtrim( (string) $output, "\n" );
	$out .= "\n\n# AI training crawlers: content is not licensed for model training.\n";
	$out .= "# Googlebot, Bingbot, Applebot and the social preview bots stay allowed.\n";

	foreach ( $tokens as $token ) {
		$out .= "\nUser-agent: " . $token . "\nDisallow: /\n";
	}

	return $out;
}
add_filter( 'robots_txt', 'ton_ai_c