Automattic\Jetpack\Device_Detection

User_Agent_Info::is_MaemoTablet()public staticWPSCache 1.0

Detects if the current UA is on one of the Maemo-based Nokia Internet Tablets.

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

Хуков нет.

Возвращает

null. Ничего.

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

$result = User_Agent_Info::is_MaemoTablet();

Код User_Agent_Info::is_MaemoTablet() WPSCache 1.9.1

public static function is_MaemoTablet() {

	if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
		return false;
	}

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

	$pos_maemo = strpos( $agent, 'maemo' );
	if ( false === $pos_maemo ) {
		return false;
	}

	// Must be Linux + Tablet, or else it could be something else.
	if ( strpos( $agent, 'tablet' ) !== false && strpos( $agent, 'linux' ) !== false ) {
		if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) {
			return false;
		} else {
			return true;
		}
	} else {
		return false;
	}
}