PHP Class Browser, Browser.php

Show file Open project: cbschuld/browser.php Class Usage Examples

Public Methods

Method Description
__construct ( $userAgent = "" ) Class constructor
__toString ( ) : string Returns a formatted string with a summary of the details of the browser.
getAolVersion ( ) : string The version of AOL.
getBrowser ( ) : string The name of the browser. All return types are from the class contants
getPlatform ( ) : string The name of the platform. All return types are from the class contants
getUserAgent ( ) : string Get the user agent value in use to determine the browser
getVersion ( ) : string The version of the browser.
isAol ( ) : boolean Is the browser from AOL?
isBrowser ( string $browserName ) : boolean Check to see if the specific browser is valid
isChromeFrame ( ) : boolean Used to determine if the browser is actually "chromeframe"
isFacebook ( ) : boolean Is the browser from facebook?
isMobile ( ) : boolean Is the browser from a mobile device?
isRobot ( ) : boolean Is the browser from a robot (ex Slurp,GoogleBot)?
isTablet ( ) : boolean Is the browser from a tablet device?
reset ( ) Reset all properties
setAol ( $isAol ) Set the browser to be from AOL
setAolVersion ( string $version ) Set the version of AOL
setBrowser ( $browser ) Set the name of the browser
setPlatform ( string $platform ) Set the name of the platform
setUserAgent ( string $agent_string ) Set the user agent value (the construction will use the HTTP header value - this will overwrite it)
setVersion ( string $version ) Set the version of the browser

Protected Methods

Method Description
checkBrowserAmaya ( ) : boolean Determine if the browser is Amaya or not (last updated 1.7)
checkBrowserAndroid ( ) : boolean Determine if the browser is Android or not (last updated 1.7)
checkBrowserBingBot ( ) : boolean Determine if the browser is the BingBot or not (last updated 1.9)
checkBrowserBlackBerry ( ) : boolean Determine if the user is using a BlackBerry (last updated 1.7)
checkBrowserChrome ( ) : boolean Determine if the browser is Chrome or not (last updated 1.7)
checkBrowserEdge ( ) : boolean Determine if the browser is Edge or not
checkBrowserFirebird ( ) : boolean Determine if the browser is Firebird or not (last updated 1.7)
checkBrowserFirefox ( ) : boolean Determine if the browser is Firefox or not (last updated 1.7)
checkBrowserGaleon ( ) : boolean Determine if the browser is Galeon or not (last updated 1.7)
checkBrowserGoogleBot ( ) : boolean Determine if the browser is the GoogleBot or not (last updated 1.7)
checkBrowserIcab ( ) : boolean Determine if the browser is iCab or not (last updated 1.7)
checkBrowserIceCat ( ) : boolean Determine if the browser is Ice Cat or not (http://en.wikipedia.org/wiki/GNU_IceCat) (last updated 1.7)
checkBrowserIceweasel ( ) : boolean Determine if the browser is Firefox or not (last updated 1.7)
checkBrowserInternetExplorer ( ) : boolean Determine if the browser is Internet Explorer or not (last updated 1.7)
checkBrowserKonqueror ( ) : boolean Determine if the browser is Konqueror or not (last updated 1.7)
checkBrowserLynx ( ) : boolean Determine if the browser is Lynx or not (last updated 1.7)
checkBrowserMSNBot ( ) : boolean Determine if the browser is the MSNBot or not (last updated 1.9)
checkBrowserMozilla ( ) : boolean Determine if the browser is Mozilla or not (last updated 1.7)
checkBrowserNetPositive ( ) : boolean Determine if the browser is NetPositive or not (last updated 1.7)
checkBrowserNetscapeNavigator9Plus ( ) : 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)
checkBrowserNokia ( ) : boolean Determine if the browser is Nokia or not (last updated 1.7)
checkBrowserOmniWeb ( ) : boolean Determine if the browser is OmniWeb or not (last updated 1.7)
checkBrowserOpera ( ) : boolean Determine if the browser is Opera or not (last updated 1.7)
checkBrowserPhoenix ( ) : boolean Determine if the browser is Phoenix or not (last updated 1.7)
checkBrowserPlayStation ( ) : boolean Determine if the browser is a PlayStation
checkBrowserSafari ( ) : boolean Determine if the browser is Safari or not (last updated 1.7)
checkBrowserShiretoko ( ) : boolean Determine if the browser is Shiretoko or not (https://wiki.mozilla.org/Projects/shiretoko) (last updated 1.7)
checkBrowserSlurp ( ) : boolean Determine if the browser is the Yahoo! Slurp Robot or not (last updated 1.7)
checkBrowserVivaldi ( ) : boolean Determine if the browser is Vivaldi
checkBrowserW3CValidator ( ) : boolean Determine if the browser is the W3C Validator or not (last updated 1.7)
checkBrowserWebTv ( ) : boolean Determine if the browser is WebTv or not (last updated 1.7)
checkBrowseriPad ( ) : boolean Determine if the browser is iPad or not (last updated 1.7)
checkBrowseriPhone ( ) : boolean Determine if the browser is iPhone or not (last updated 1.7)
checkBrowseriPod ( ) : boolean Determine if the browser is iPod or not (last updated 1.7)
checkBrowsers ( ) : boolean Protected routine to determine the browser type
checkFacebookExternalHit ( ) : boolean Detect if URL is loaded from FacebookExternalHit
checkForAol ( ) : boolean Determine if the user is using an AOL User Agent (last updated 1.7)
checkForFacebookIos ( ) : boolean Detect if URL is being loaded from internal Facebook browser
checkPlatform ( ) Determine the user's platform (last updated 2.0)
determine ( ) Protected routine to calculate and determine what the browser is in use (including platform)
getChromeVersionOnIos ( ) : boolean Detect Version for the Chrome browser on iOS devices
getSafariVersionOnIos ( ) : boolean Detect Version for the Safari browser on iOS devices
setFacebook ( boolean $value = true ) Set the Browser to be a Facebook request
setMobile ( boolean $value = true ) Set the Browser to be mobile
setRobot ( boolean $value = true ) Set the Browser to be a robot
setTablet ( boolean $value = true ) Set the Browser to be tablet

Method Details

__construct() public method

Class constructor
public __construct ( $userAgent = "" )

__toString() public method

Returns a formatted string with a summary of the details of the browser.
public __toString ( ) : string
return string formatted string with a summary of the browser

checkBrowserAmaya() protected method

Determine if the browser is Amaya or not (last updated 1.7)
protected checkBrowserAmaya ( ) : boolean
return boolean True if the browser is Amaya otherwise false

checkBrowserAndroid() protected method

Determine if the browser is Android or not (last updated 1.7)
protected checkBrowserAndroid ( ) : boolean
return boolean True if the browser is Android otherwise false

checkBrowserBingBot() protected method

Determine if the browser is the BingBot or not (last updated 1.9)
protected checkBrowserBingBot ( ) : boolean
return boolean True if the browser is the BingBot otherwise false

checkBrowserBlackBerry() protected method

Determine if the user is using a BlackBerry (last updated 1.7)
protected checkBrowserBlackBerry ( ) : boolean
return boolean True if the browser is the BlackBerry browser otherwise false

checkBrowserChrome() protected method

Determine if the browser is Chrome or not (last updated 1.7)
protected checkBrowserChrome ( ) : boolean
return boolean True if the browser is Chrome otherwise false

checkBrowserEdge() protected method

Determine if the browser is Edge or not
protected checkBrowserEdge ( ) : boolean
return boolean True if the browser is Edge otherwise false

checkBrowserFirebird() protected method

Determine if the browser is Firebird or not (last updated 1.7)
protected checkBrowserFirebird ( ) : boolean
return boolean True if the browser is Firebird otherwise false

checkBrowserFirefox() protected method

Determine if the browser is Firefox or not (last updated 1.7)
protected checkBrowserFirefox ( ) : boolean
return boolean True if the browser is Firefox otherwise false

checkBrowserGaleon() protected method

Determine if the browser is Galeon or not (last updated 1.7)
protected checkBrowserGaleon ( ) : boolean
return boolean True if the browser is Galeon otherwise false

checkBrowserGoogleBot() protected method

Determine if the browser is the GoogleBot or not (last updated 1.7)
protected checkBrowserGoogleBot ( ) : boolean
return boolean True if the browser is the GoogletBot otherwise false

checkBrowserIcab() protected method

Determine if the browser is iCab or not (last updated 1.7)
protected checkBrowserIcab ( ) : boolean
return boolean True if the browser is iCab otherwise false

checkBrowserIceCat() protected method

Determine if the browser is Ice Cat or not (http://en.wikipedia.org/wiki/GNU_IceCat) (last updated 1.7)
protected checkBrowserIceCat ( ) : boolean
return boolean True if the browser is Ice Cat otherwise false

checkBrowserIceweasel() protected method

Determine if the browser is Firefox or not (last updated 1.7)
protected checkBrowserIceweasel ( ) : boolean
return boolean True if the browser is Firefox otherwise false

checkBrowserInternetExplorer() protected method

Determine if the browser is Internet Explorer or not (last updated 1.7)
protected checkBrowserInternetExplorer ( ) : boolean
return boolean True if the browser is Internet Explorer otherwise false

checkBrowserKonqueror() protected method

Determine if the browser is Konqueror or not (last updated 1.7)
protected checkBrowserKonqueror ( ) : boolean
return boolean True if the browser is Konqueror otherwise false

checkBrowserLynx() protected method

Determine if the browser is Lynx or not (last updated 1.7)
protected checkBrowserLynx ( ) : boolean
return boolean True if the browser is Lynx otherwise false

checkBrowserMSNBot() protected method

Determine if the browser is the MSNBot or not (last updated 1.9)
protected checkBrowserMSNBot ( ) : boolean
return boolean True if the browser is the MSNBot otherwise false

checkBrowserMozilla() protected method

Determine if the browser is Mozilla or not (last updated 1.7)
protected checkBrowserMozilla ( ) : boolean
return boolean True if the browser is Mozilla otherwise false

checkBrowserNetPositive() protected method

Determine if the browser is NetPositive or not (last updated 1.7)
protected checkBrowserNetPositive ( ) : boolean
return boolean True if the browser is NetPositive otherwise false

checkBrowserNetscapeNavigator9Plus() protected method

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)
protected checkBrowserNetscapeNavigator9Plus ( ) : boolean
return boolean True if the browser is Netscape Navigator 9+ otherwise false

checkBrowserNokia() protected method

Determine if the browser is Nokia or not (last updated 1.7)
protected checkBrowserNokia ( ) : boolean
return boolean True if the browser is Nokia otherwise false

checkBrowserOmniWeb() protected method

Determine if the browser is OmniWeb or not (last updated 1.7)
protected checkBrowserOmniWeb ( ) : boolean
return boolean True if the browser is OmniWeb otherwise false

checkBrowserOpera() protected method

Determine if the browser is Opera or not (last updated 1.7)
protected checkBrowserOpera ( ) : boolean
return boolean True if the browser is Opera otherwise false

checkBrowserPhoenix() protected method

Determine if the browser is Phoenix or not (last updated 1.7)
protected checkBrowserPhoenix ( ) : boolean
return boolean True if the browser is Phoenix otherwise false

checkBrowserPlayStation() protected method

Determine if the browser is a PlayStation
protected checkBrowserPlayStation ( ) : boolean
return boolean True if the browser is PlayStation otherwise false

checkBrowserSafari() protected method

Determine if the browser is Safari or not (last updated 1.7)
protected checkBrowserSafari ( ) : boolean
return boolean True if the browser is Safari otherwise false

checkBrowserShiretoko() protected method

Determine if the browser is Shiretoko or not (https://wiki.mozilla.org/Projects/shiretoko) (last updated 1.7)
protected checkBrowserShiretoko ( ) : boolean
return boolean True if the browser is Shiretoko otherwise false

checkBrowserSlurp() protected method

Determine if the browser is the Yahoo! Slurp Robot or not (last updated 1.7)
protected checkBrowserSlurp ( ) : boolean
return boolean True if the browser is the Yahoo! Slurp Robot otherwise false

checkBrowserVivaldi() protected method

Determine if the browser is Vivaldi
protected checkBrowserVivaldi ( ) : boolean
return boolean True if the browser is Vivaldi otherwise false

checkBrowserW3CValidator() protected method

Determine if the browser is the W3C Validator or not (last updated 1.7)
protected checkBrowserW3CValidator ( ) : boolean
return boolean True if the browser is the W3C Validator otherwise false

checkBrowserWebTv() protected method

Determine if the browser is WebTv or not (last updated 1.7)
protected checkBrowserWebTv ( ) : boolean
return boolean True if the browser is WebTv otherwise false

checkBrowseriPad() protected method

Determine if the browser is iPad or not (last updated 1.7)
protected checkBrowseriPad ( ) : boolean
return boolean True if the browser is iPad otherwise false

checkBrowseriPhone() protected method

Determine if the browser is iPhone or not (last updated 1.7)
protected checkBrowseriPhone ( ) : boolean
return boolean True if the browser is iPhone otherwise false

checkBrowseriPod() protected method

Determine if the browser is iPod or not (last updated 1.7)
protected checkBrowseriPod ( ) : boolean
return boolean True if the browser is iPod otherwise false

checkBrowsers() protected method

Protected routine to determine the browser type
protected checkBrowsers ( ) : boolean
return boolean True if the browser was detected otherwise false

checkFacebookExternalHit() protected method

Detect if URL is loaded from FacebookExternalHit
protected checkFacebookExternalHit ( ) : boolean
return boolean True if it detects FacebookExternalHit otherwise false

checkForAol() protected method

Determine if the user is using an AOL User Agent (last updated 1.7)
protected checkForAol ( ) : boolean
return boolean True if the browser is from AOL otherwise false

checkForFacebookIos() protected method

Detect if URL is being loaded from internal Facebook browser
protected checkForFacebookIos ( ) : boolean
return boolean True if it detects internal Facebook browser otherwise false

checkPlatform() protected method

Determine the user's platform (last updated 2.0)
protected checkPlatform ( )

determine() protected method

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

getAolVersion() public method

The version of AOL.
public getAolVersion ( ) : string
return string Version of AOL (will only contain alpha-numeric characters and a period)

getBrowser() public method

The name of the browser. All return types are from the class contants
public getBrowser ( ) : string
return string Name of the browser

getChromeVersionOnIos() protected method

Detect Version for the Chrome browser on iOS devices
protected getChromeVersionOnIos ( ) : boolean
return boolean True if it detects the version correctly otherwise false

getPlatform() public method

The name of the platform. All return types are from the class contants
public getPlatform ( ) : string
return string Name of the browser

getSafariVersionOnIos() protected method

Detect Version for the Safari browser on iOS devices
protected getSafariVersionOnIos ( ) : boolean
return boolean True if it detects the version correctly otherwise false

getUserAgent() public method

Get the user agent value in use to determine the browser
public getUserAgent ( ) : string
return string The user agent from the HTTP header

getVersion() public method

The version of the browser.
public getVersion ( ) : string
return string Version of the browser (will only contain alpha-numeric characters and a period)

isAol() public method

Is the browser from AOL?
public isAol ( ) : boolean
return boolean True if the browser is from AOL otherwise false

isBrowser() public method

Check to see if the specific browser is valid
public isBrowser ( string $browserName ) : boolean
$browserName string
return boolean True if the browser is the specified browser

isChromeFrame() public method

Used to determine if the browser is actually "chromeframe"
Since: 1.7
public isChromeFrame ( ) : boolean
return boolean True if the browser is using chromeframe

isFacebook() public method

Is the browser from facebook?
public isFacebook ( ) : boolean
return boolean True if the browser is from facebook otherwise false

isMobile() public method

Is the browser from a mobile device?
public isMobile ( ) : boolean
return boolean True if the browser is from a mobile device otherwise false

isRobot() public method

Is the browser from a robot (ex Slurp,GoogleBot)?
public isRobot ( ) : boolean
return boolean True if the browser is from a robot otherwise false

isTablet() public method

Is the browser from a tablet device?
public isTablet ( ) : boolean
return boolean True if the browser is from a tablet device otherwise false

reset() public method

Reset all properties
public reset ( )

setAol() public method

Set the browser to be from AOL
public setAol ( $isAol )
$isAol

setAolVersion() public method

Set the version of AOL
public setAolVersion ( string $version )
$version string The version of AOL

setBrowser() public method

Set the name of the browser
public setBrowser ( $browser )
$browser string The name of the Browser

setFacebook() protected method

Set the Browser to be a Facebook request
protected setFacebook ( boolean $value = true )
$value boolean is the browser a robot or not

setMobile() protected method

Set the Browser to be mobile
protected setMobile ( boolean $value = true )
$value boolean is the browser a mobile browser or not

setPlatform() public method

Set the name of the platform
public setPlatform ( string $platform )
$platform string The name of the Platform

setRobot() protected method

Set the Browser to be a robot
protected setRobot ( boolean $value = true )
$value boolean is the browser a robot or not

setTablet() protected method

Set the Browser to be tablet
protected setTablet ( boolean $value = true )
$value boolean is the browser a tablet browser or not

setUserAgent() public method

Set the user agent value (the construction will use the HTTP header value - this will overwrite it)
public setUserAgent ( string $agent_string )
$agent_string string The value for the User Agent

setVersion() public method

Set the version of the browser
public setVersion ( string $version )
$version string The version of the Browser