Automattic\Jetpack\Device_Detection

User_Agent_Info::get_mobile_user_agent_name()publicWPSCache 1.0

This method detects the mobile User Agent name.

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

Хуков нет.

Возвращает

Строку. The matched User Agent name, false otherwise.

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

$User_Agent_Info = new User_Agent_Info();
$User_Agent_Info->get_mobile_user_agent_name();

Код User_Agent_Info::get_mobile_user_agent_name() WPSCache 1.9.1

public function get_mobile_user_agent_name() {
	if ( $this->is_chrome_for_iOS() ) { // Keep this check before the safari rule.
		return 'chrome-for-ios';
	} elseif ( $this->is_iphone_or_ipod( 'iphone-safari' ) ) {
		return 'iphone';
	} elseif ( $this->is_ipad( 'ipad-safari' ) ) {
		return 'ipad';
	} elseif ( $this->is_android_tablet() ) { // Keep this check before the android rule.
		return 'android_tablet';
	} elseif ( $this->is_android() ) {
		return 'android';
	} elseif ( $this->is_blackberry_10() ) {
		return 'blackberry_10';
	} elseif ( $this->is_blackbeberry() ) {
		return 'blackberry';
	} elseif ( $this->is_WindowsPhone7() ) {
		return 'win7';
	} elseif ( $this->is_windows_phone_8() ) {
		return 'winphone8';
	} elseif ( $this->is_opera_mini() ) {
		return 'opera-mini';
	} elseif ( $this->is_opera_mini_dumb() ) {
		return 'opera-mini-dumb';
	} elseif ( $this->is_opera_mobile() ) {
		return 'opera-mobi';
	} elseif ( $this->is_blackberry_tablet() ) {
		return 'blackberry_tablet';
	} elseif ( $this->is_kindle_fire() ) {
		return 'kindle-fire';
	} elseif ( $this->is_PalmWebOS() ) {
		return 'webos';
	} elseif ( $this->is_S60_OSSBrowser() ) {
		return 'series60';
	} elseif ( $this->is_firefox_os() ) {
		return 'firefoxOS';
	} elseif ( $this->is_firefox_mobile() ) {
		return 'firefox_mobile';
	} elseif ( $this->is_MaemoTablet() ) {
		return 'maemo';
	} elseif ( $this->is_MeeGo() ) {
		return 'meego';
	} elseif ( $this->is_TouchPad() ) {
		return 'hp_tablet';
	} elseif ( $this->is_facebook_for_iphone() ) {
		return 'facebook-for-iphone';
	} elseif ( $this->is_facebook_for_ipad() ) {
		return 'facebook-for-ipad';
	} elseif ( $this->is_twitter_for_iphone() ) {
		return 'twitter-for-iphone';
	} elseif ( $this->is_twitter_for_ipad() ) {
		return 'twitter-for-ipad';
	} elseif ( $this->is_wordpress_for_ios() ) {
		return 'ios-app';
	} elseif ( $this->is_iphone_or_ipod( 'iphone-not-safari' ) ) {
		return 'iphone-unknown';
	} elseif ( $this->is_ipad( 'ipad-not-safari' ) ) {
		return 'ipad-unknown';
	} elseif ( $this->is_Nintendo_3DS() ) {
		return 'nintendo-3ds';
	} else {
		$agent       = $this->useragent;
		$dumb_agents = $this->dumb_agents;
		foreach ( $dumb_agents as $dumb_agent ) {
			if ( false !== strpos( $agent, $dumb_agent ) ) {
				return $dumb_agent;
			}
		}
	}

	return false;
}