Automattic\Jetpack\Device_Detection

User_Agent_Info::is_TouchPadpublic staticWPSCache 1.0

Detects if the current browser is the HP TouchPad default browser. This excludes phones wt WebOS.

TouchPad Emulator: Mozilla/5.0 (hp-desktop; Linux; hpwOS/2.0; U; it-IT) AppleWebKit/534.6 (KHTML, like Gecko) wOSBrowser/233.70 Safari/534.6 Desktop/1.0 TouchPad: Mozilla/5.0 (hp-tablet; Linux; hpwOS/3.0.0; U; en-US) AppleWebKit/534.6 (KHTML, like Gecko) wOSBrowser/233.70 Safari/534.6 TouchPad/1.0

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

Хуков нет.

Возвращает

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

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

$result = User_Agent_Info::is_TouchPad( $user_agent );
$user_agent(строка|null)
User agent string to check. If not provided, uses $_SERVER['HTTP_USER_AGENT'].
По умолчанию: null

Код User_Agent_Info::is_TouchPad() WPSCache 3.0.3

public static function is_TouchPad( $user_agent = null ) {
	$user_agent = self::maybe_get_user_agent_from_server( $user_agent );
	if ( empty( $user_agent ) ) {
		return false;
	}

	$http_user_agent = strtolower( wp_unslash( $user_agent ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- This is validating.
	if ( false !== strpos( $http_user_agent, 'hp-tablet' ) || false !== strpos( $http_user_agent, 'hpwos' ) || false !== strpos( $http_user_agent, 'touchpad' ) ) {
		if ( self::is_opera_mini( $user_agent ) || self::is_opera_mobile( $user_agent ) || self::is_firefox_mobile( $user_agent ) ) {
			return false;
		} else {
			return true;
		}
	} else {
		return false;
	}
}