Automattic\Jetpack\Device_Detection

User_Agent_Info::is_bot_user_agent()public staticWPSCache 1.0

Is the given user-agent a known bot? If you want an is_bot check for the current request's UA, use is_bot() instead of passing a user-agent to this method.

Метод класса: User_Agent_Info{}

Хуков нет.

Возвращает

true|false.

Использование

$result = User_Agent_Info::is_bot_user_agent( $ua );
$ua(строка)
A user-agent string.
По умолчанию: null

Код User_Agent_Info::is_bot_user_agent() WPSCache 1.9.1

public static function is_bot_user_agent( $ua = null ) {

	if ( empty( $ua ) ) {
		return false;
	}

	$bot_agents = array(
		'alexa',
		'altavista',
		'ask jeeves',
		'attentio',
		'baiduspider',
		'bingbot',
		'chtml generic',
		'crawler',
		'fastmobilecrawl',
		'feedfetcher-google',
		'firefly',
		'froogle',
		'gigabot',
		'googlebot',
		'googlebot-mobile',
		'heritrix',
		'httrack',
		'ia_archiver',
		'irlbot',
		'iescholar',
		'infoseek',
		'jumpbot',
		'linkcheck',
		'lycos',
		'mediapartners',
		'mediobot',
		'motionbot',
		'msnbot',
		'mshots',
		'openbot',
		'pss-webkit-request',
		'pythumbnail',
		'scooter',
		'slurp',
		'snapbot',
		'spider',
		'taptubot',
		'technoratisnoop',
		'teoma',
		'twiceler',
		'yahooseeker',
		'yahooysmcm',
		'yammybot',
		'ahrefsbot',
		'pingdom.com_bot',
		'kraken',
		'yandexbot',
		'twitterbot',
		'tweetmemebot',
		'openhosebot',
		'queryseekerspider',
		'linkdexbot',
		'grokkit-crawler',
		'livelapbot',
		'germcrawler',
		'domaintunocrawler',
		'grapeshotcrawler',
		'cloudflare-alwaysonline',
	);

	foreach ( $bot_agents as $bot_agent ) {
		if ( false !== stripos( $ua, $bot_agent ) ) {
			return true;
		}
	}

	return false;
}