class-wms7-browser.phpView Source

Show: PublicProtectedPrivateinherited
Table of Contents
Description: Parses user-agent to get the names: browser, platform, operating system.
Author
Oleg Klenitskiy (modified the code for standard WordPress)  
Category
Wms7_Browser  
Copyright
2018 Oleg Klenitskiy  
License
GPLv2 or later  
Package
WatchMan-Site7  
Version
3.0.0  

\Wms7_Browser

Package: WatchMan-Site7
Description: Parses user-agent to get the names: browser, platform, operating system.
Author
Chris Schuld (http://chrisschuld.com/)  
Category
Class  
Copyright
August 20th, 2010  
License
GPLv2 or later  
Version
1.9  

Constants

>VConstant  BROWSER_UNKNOWN = 'unknown'
>VConstant  VERSION_UNKNOWN = 'unknown'
>VConstant  BROWSER_OPERA = 'Opera'
>VConstant  BROWSER_OPERA_MINI = 'Opera Mini'
>VConstant  BROWSER_WEBTV = 'WebTV'
>VConstant  BROWSER_IE = 'Internet Explorer'
>VConstant  BROWSER_POCKET_IE = 'Pocket Internet Explorer'
>VConstant  BROWSER_KONQUEROR = 'Konqueror'
>VConstant  BROWSER_ICAB = 'iCab'
>VConstant  BROWSER_OMNIWEB = 'OmniWeb'
>VConstant  BROWSER_FIREBIRD = 'Firebird'
>VConstant  BROWSER_FIREFOX = 'Firefox'
>VConstant  BROWSER_ICEWEASEL = 'Iceweasel'
>VConstant  BROWSER_SHIRETOKO = 'Shiretoko'
>VConstant  BROWSER_MOZILLA = 'Mozilla'
>VConstant  BROWSER_AMAYA = 'Amaya'
>VConstant  BROWSER_LYNX = 'Lynx'
>VConstant  BROWSER_SAFARI = 'Safari'
>VConstant  BROWSER_IPHONE = 'iPhone'
>VConstant  BROWSER_IPOD = 'iPod'
>VConstant  BROWSER_IPAD = 'iPad'
>VConstant  BROWSER_CHROME = 'Chrome'
>VConstant  BROWSER_ANDROID = 'Android'
>VConstant  BROWSER_IEMOBILE = 'IEMobile'
>VConstant  BROWSER_WEB_OS = 'WebOS'
>VConstant  BROWSER_BLACKBERRY = 'BlackBerry'
>VConstant  BROWSER_ICECAT = 'IceCat'
>VConstant  BROWSER_NOKIA_S60 = 'Nokia S60 OSS Browser'
>VConstant  BROWSER_NOKIA = 'Nokia Browser'
>VConstant  BROWSER_MSN = 'MSN Browser'
>VConstant  BROWSER_NETSCAPE_NAVIGATOR = 'Netscape Navigator'
>VConstant  BROWSER_GALEON = 'Galeon'
>VConstant  BROWSER_NETPOSITIVE = 'NetPositive'
>VConstant  BROWSER_PHOENIX = 'Phoenix'
>VConstant  BROWSER_YANDEXBOT = 'YandexBot'
>VConstant  BROWSER_RAMBLERBOT = 'RamblerBot'
>VConstant  BROWSER_MAILRUBOT = 'MailRuBot'
>VConstant  BROWSER_MSNBOT = 'MSN Bot'
>VConstant  BROWSER_GOOGLEBOT = 'GoogleBot'
>VConstant  BROWSER_SLURP = 'Yahoo! Slurp'
>VConstant  BROWSER_BINGBOT = 'BingBot'
>VConstant  BROWSER_VIRUSDIEBOT = 'VirusDieBot'
>VConstant  BROWSER_CRAWLERBOT = 'CrawlerBot'
>VConstant  BROWSER_QWANTIFYBOT = 'QwantifyBot'
>VConstant  BROWSER_TWITTERBOT = 'TwitterBot'
>VConstant  PLATFORM_UNKNOWN = 'unknown'
>VConstant  PLATFORM_WINDOWS = 'Windows'
>VConstant  PLATFORM_WINDOWS_10 = 'Windows 10'
>VConstant  PLATFORM_WINDOWS_8_1 = 'Windows 8.1'
>VConstant  PLATFORM_WINDOWS_8 = 'Windows 8'
>VConstant  PLATFORM_WINDOWS_7 = 'Windows 7'
>VConstant  PLATFORM_WINDOWS_2K = 'Windows 2K'
>VConstant  PLATFORM_WINDOWS_XP = 'Windows XP'
>VConstant  PLATFORM_WINDOWS_98 = 'Windows 98'
>VConstant  PLATFORM_WINDOWS_95 = 'Windows 95'
>VConstant  PLATFORM_WINDOWS_CE = 'Windows CE'
>VConstant  PLATFORM_APPLE = 'Apple'
>VConstant  PLATFORM_LINUX = 'Linux'
>VConstant  PLATFORM_OS2 = 'OS/2'
>VConstant  PLATFORM_BEOS = 'BeOS'
>VConstant  PLATFORM_IPHONE = 'iPhone'
>VConstant  PLATFORM_IPOD = 'iPod'
>VConstant  PLATFORM_IPAD = 'iPad'
>VConstant  PLATFORM_BLACKBERRY = 'BlackBerry'
>VConstant  PLATFORM_NOKIA = 'Nokia'
>VConstant  PLATFORM_FREEBSD = 'FreeBSD'
>VConstant  PLATFORM_OPENBSD = 'OpenBSD'
>VConstant  PLATFORM_NETBSD = 'NetBSD'
>VConstant  PLATFORM_SUNOS = 'SunOS'
>VConstant  PLATFORM_OPENSOLARIS = 'OpenSolaris'
>VConstant  PLATFORM_ANDROID = 'Android'
>VConstant  OPERATING_SYSTEM_UNKNOWN = 'unknown'

Properties

>VPropertyprivatestring $_agent = ''
Internal variable $_agent.
Default value''Details
Type
string
>VPropertyprivatestring $_browser_name = ''
Internal variable $_browser_name.
Default value''Details
Type
string
>VPropertyprivateboolean $_is_mobile = false
Internal variable $_is_mobile.
Default valuefalseDetails
Type
boolean
>VPropertyprivateboolean $_is_robot = false
Internal variable $_is_robot.
Default valuefalseDetails
Type
boolean
>VPropertyprivatestring $_os = ''
Internal variable $_os.
Default value''Details
Type
string
>VPropertyprivatestring $_platform = ''
Internal variable $_platform.
Default value''Details
Type
string
>VPropertyprivatestring $_version = ''
Internal variable $_version.
Default value''Details
Type
string

Methods

methodpublic__toString() : string

Returns a formatted string with a summary of the details of the browser.

Returns
TypeDescription
stringformatted string with a summary of the browser
methodpublicbrowser(string $user_agent = '') : void

Set user agent

Parameters
NameTypeDescription
$user_agentstring

Data of user agent.

methodprotectedcheck_browser() : boolean

Protected routine to determine the browser type

Returns
TypeDescription
booleanTrue if the browser was detected otherwise false
methodprotectedcheck_browser_amaya() : boolean

Determine if the browser is Amaya or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is Amaya otherwise false
methodprotectedcheck_browser_android() : boolean

Determine if the browser is Android or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is Android otherwise false
methodprotectedcheck_browser_bingbot() : boolean

Determine if the browser is the BingBot or not (last updated 1.9)

Returns
TypeDescription
booleanTrue if the browser is the BingBot otherwise false
methodprotectedcheck_browser_blackberry() : boolean

Determine if the user is using a BlackBerry (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is the BlackBerry browser otherwise false
methodprotectedcheck_browser_chrome() : boolean

Determine if the browser is Chrome or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is Chrome otherwise false
methodprotectedcheck_browser_crawlerbot() : boolean

Determine if the browser is the CrawlerBot or not

Returns
TypeDescription
booleanTrue if the browser is the CrawlerBot otherwise false
methodprotectedcheck_browser_firebird() : boolean

Determine if the browser is Firebird or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is Firebird otherwise false
methodprotectedcheck_browser_firefox() : boolean

Determine if the browser is Firefox or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is Firefox otherwise false
methodprotectedcheck_browser_galeon() : boolean

Determine if the browser is Galeon or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is Galeon otherwise false
methodprotectedcheck_browser_googlebot() : boolean

Determine if the browser is the GoogleBot or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is the GoogletBot otherwise false
methodprotectedcheck_browser_icab() : boolean

Determine if the browser is iCab or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is iCab otherwise false
methodprotectedcheck_browser_icecat() : boolean

Determine if the browser is Ice Cat or not (http://en.wikipedia.org/wiki/GNU_IceCat) (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is Ice Cat otherwise false
methodprotectedcheck_browser_iceweasel() : boolean

Determine if the browser is Firefox or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is Firefox otherwise false
methodprotectedcheck_browser_iemobile() : boolean

Determine if the browser is IEMobile or not (add new function)

Returns
TypeDescription
booleanTrue if the browser is IEMobile otherwise false
methodprotectedcheck_browser_internetexplorer() : boolean

Determine if the browser is Internet Explorer or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is Internet Explorer otherwise false
methodprotectedcheck_browser_ipad() : boolean

Determine if the browser is iPod or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is iPad otherwise false
methodprotectedcheck_browser_iphone() : boolean

Determine if the browser is iPhone or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is iPhone otherwise false
methodprotectedcheck_browser_ipod() : boolean

Determine if the browser is iPod or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is iPod otherwise false
methodprotectedcheck_browser_konqueror() : boolean

Determine if the browser is Konqueror or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is Konqueror otherwise false
methodprotectedcheck_browser_lynx() : boolean

Determine if the browser is Lynx or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is Lynx otherwise false
methodprotectedcheck_browser_mailrubot() : boolean

Determine if the browser is the MailRuBot or not

Returns
TypeDescription
booleanTrue if the browser is the MailRuBot otherwise false
methodprotectedcheck_browser_mozilla() : boolean

Determine if the browser is Mozilla or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is Mozilla otherwise false
methodprotectedcheck_browser_msnbot() : boolean

Determine if the browser is the MSNBot or not (last updated 1.9)

Returns
TypeDescription
booleanTrue if the browser is the MSNBot otherwise false
methodprotectedcheck_browser_netscapenavigator9plus() : boolean

Determine if the browser is Netscape Navigator 9+ or not (last updated 1.7) NOTE: (http://browser.netscape.com/ - Official support ended on March 1st, 2008)

Returns
TypeDescription
booleanTrue if the browser is Netscape Navigator 9+ otherwise false
methodprotectedcheck_browser_nokia() : boolean

Determine if the browser is Nokia or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is Nokia otherwise false
methodprotectedcheck_browser_omniweb() : boolean

Determine if the browser is OmniWeb or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is OmniWeb otherwise false
methodprotectedcheck_browser_opera() : boolean

Determine if the browser is Opera or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is Opera otherwise false
methodprotectedcheck_browser_phoenix() : boolean

Determine if the browser is Phoenix or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is Phoenix otherwise false
methodprotectedcheck_browser_positive() : boolean

Determine if the browser is NetPositive or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is NetPositive otherwise false
methodprotectedcheck_browser_qwantifybot() : boolean

Determine if the browser is the Qwantify or not

Returns
TypeDescription
booleanTrue if the browser is the Qwantify otherwise false
methodprotectedcheck_browser_ramblerbot() : boolean

Determine if the browser is the RamblerBot or not

Returns
TypeDescription
booleanTrue if the browser is the RamblerBot otherwise false
methodprotectedcheck_browser_safari() : boolean

Determine if the browser is Safari or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is Safari otherwise false
methodprotectedcheck_browser_shiretoko() : boolean

Determine if the browser is Shiretoko or not (https://wiki.mozilla.org/Projects/shiretoko) (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is Shiretoko otherwise false
methodprotectedcheck_browser_slurp() : boolean

Determine if the browser is the Yahoo! Slurp Robot or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is the Yahoo! Slurp Robot otherwise false
methodprotectedcheck_browser_twitterbot() : boolean

Determine if the browser is the Twitter or not

Returns
TypeDescription
booleanTrue if the browser is the Twitter otherwise false
methodprotectedcheck_browser_virusdiebot() : boolean

Determine if the browser is the VirusDieBot or not

Returns
TypeDescription
booleanTrue if the browser is the VirusDieBot otherwise false
methodprotectedcheck_browser_web_os() : boolean

Determine if the browser is webOS or not (add new function)

Returns
TypeDescription
booleanTrue if the browser is webOS otherwise false
methodprotectedcheck_browser_webtv() : boolean

Determine if the browser is WebTv or not (last updated 1.7)

Returns
TypeDescription
booleanTrue if the browser is WebTv otherwise false
methodprotectedcheck_browser_yandexbot() : boolean

Determine if the browser is the YandexBot or not

Returns
TypeDescription
booleanTrue if the browser is the YandexBot otherwise false
methodprotectedcheck_platform() : void

Determine the user's platform (last updated 1.7)

methodprotecteddetermine() : void

Protected routine to calculate and determine what the browser is in use (including platform).

methodpublicget_browser() : string

The name of the browser. All return types are from the class contants

Returns
TypeDescription
stringName of the browser
methodpublicget_platform() : string

The name of the platform. All return types are from the class contants

Returns
TypeDescription
stringName of the browser
methodpublicget_user_agent() : string

Get the user agent value in use to determine the browser

Returns
TypeDescription
stringThe user agent from the HTTP header
methodpublicget_version() : string

The version of the browser.

Returns
TypeDescription
stringVersion of the browser (will only contain alpha-numeric characters and a period)
methodpublicis_browser(string $browser_name) : True

Check to see if the specific browser is valid

Parameters
NameTypeDescription
$browser_namestring

The name of the Browser.

Returns
TypeDescription
Trueif the browser is the specified browser
methodpublicis_chrome_frame() : boolean

Used to determine if the browser is actually "chromeframe"

Returns
TypeDescription
booleanTrue if the browser is using chromeframe
Details
Since
1.7  
methodpublicis_mobile() : boolean

Is the browser from a mobile device?

Returns
TypeDescription
booleanTrue if the browser is from a mobile device otherwise false
methodpublicis_robot() : boolean

Is the browser from a robot (ex Slurp,GoogleBot)

Returns
TypeDescription
booleanTrue if the browser is from a robot otherwise false
methodpublicreset() : void

Reset all properties

methodpublicset_browser(string $browser) : void

Set the name of the browser

Parameters
NameTypeDescription
$browserstring

The name of the Browser.

methodprotectedset_mobile(boolean $value = true) : void

Set the Browser to be mobile

Parameters
NameTypeDescription
$valueboolean

is the browser a mobile browser or not.

methodpublicset_platform(string $platform) : void

Set the name of the platform

Parameters
NameTypeDescription
$platformstring

The name of the Platform.

methodprotectedset_robot(boolean $value = true) : void

Set the Browser to be a robot

Parameters
NameTypeDescription
$valueboolean

is the browser a robot or not.

methodpublicset_user_agent(string $agent_string) : void

Set the user agent value (the construction will use the HTTP header value - this will overwrite it).

Parameters
NameTypeDescription
$agent_stringstring

The value for the User Agent.

methodpublicset_version(string $version) : void

Set the version of the browser

Parameters
NameTypeDescription
$versionstring

The version of the Browser.

Documentation was generated by phpDocumentor 2.8.5.