Automattic\Jetpack\Device_Detection

User_Agent_Info::get_browser()publicWPSCache 1.0

A simple pattern matching method for extracting the browser from the user agent.

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

Хуков нет.

Возвращает

Строку.

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

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

Код User_Agent_Info::get_browser() WPSCache 1.12.4

public function get_browser() {
	$ua = $this->useragent;
	if ( empty( $ua ) ) {
		return self::OTHER;
	}

	if ( static::is_opera_mini() || static::is_opera_mobile() || static::is_opera_desktop() || static::is_opera_mini_dumb() ) {
		return self::BROWSER_OPERA;
	} elseif ( static::is_edge_browser() ) {
		return self::BROWSER_EDGE;
	} elseif ( static::is_chrome_desktop() || self::is_chrome_for_iOS() ) {
		return self::BROWSER_CHROME;
	} elseif ( static::is_safari_browser() ) {
		return self::BROWSER_SAFARI;
	} elseif ( static::is_firefox_mobile() || static::is_firefox_desktop() ) {
		return self::BROWSER_FIREFOX;
	} elseif ( static::is_ie_browser() ) {
		return self::BROWSER_IE;
	}
	return self::OTHER;
}