Automattic\Jetpack\Device_Detection

User_Agent_Info::is_chrome_for_iOS()public staticWPSCache 1.0

Detects if the current UA is Chrome for iOS

The User-Agent string in Chrome for iOS is the same as the Mobile Safari User-Agent, with CriOS/<ChromeRevision> instead of Version/<VersionNum>.

  • Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$result = User_Agent_Info::is_chrome_for_iOS();

Код User_Agent_Info::is_chrome_for_iOS() WPSCache 1.12.0

public static function is_chrome_for_iOS() {
	if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
		return false;
	}

	if ( self::is_iphone_or_ipod( 'iphone-safari' ) === false ) {
		return false;
	}

	$ua = strtolower( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- This is validating.

	if ( strpos( $ua, 'crios/' ) !== false ) {
		return true;
	} else {
		return false;
	}
}