PHP Класс Browser, Browser.php

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__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

Защищенные методы

Метод Описание
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

Описание методов

__construct() публичный Метод

Class constructor
public __construct ( $userAgent = "" )

__toString() публичный Метод

Returns a formatted string with a summary of the details of the browser.
public __toString ( ) : string
Результат string formatted string with a summary of the browser

checkBrowserAmaya() защищенный Метод

Determine if the browser is Amaya or not (last updated 1.7)
protected checkBrowserAmaya ( ) : boolean
Результат boolean True if the browser is Amaya otherwise false

checkBrowserAndroid() защищенный Метод

Determine if the browser is Android or not (last updated 1.7)
protected checkBrowserAndroid ( ) : boolean
Результат boolean True if the browser is Android otherwise false

checkBrowserBingBot() защищенный Метод

Determine if the browser is the BingBot or not (last updated 1.9)
protected checkBrowserBingBot ( ) : boolean
Результат boolean True if the browser is the BingBot otherwise false

checkBrowserBlackBerry() защищенный Метод

Determine if the user is using a BlackBerry (last updated 1.7)
protected checkBrowserBlackBerry ( ) : boolean
Результат boolean True if the browser is the BlackBerry browser otherwise false

checkBrowserChrome() защищенный Метод

Determine if the browser is Chrome or not (last updated 1.7)
protected checkBrowserChrome ( ) : boolean
Результат boolean True if the browser is Chrome otherwise false

checkBrowserEdge() защищенный Метод

Determine if the browser is Edge or not
protected checkBrowserEdge ( ) : boolean
Результат boolean True if the browser is Edge otherwise false

checkBrowserFirebird() защищенный Метод

Determine if the browser is Firebird or not (last updated 1.7)
protected checkBrowserFirebird ( ) : boolean
Результат boolean True if the browser is Firebird otherwise false

checkBrowserFirefox() защищенный Метод

Determine if the browser is Firefox or not (last updated 1.7)
protected checkBrowserFirefox ( ) : boolean
Результат boolean True if the browser is Firefox otherwise false

checkBrowserGaleon() защищенный Метод

Determine if the browser is Galeon or not (last updated 1.7)
protected checkBrowserGaleon ( ) : boolean
Результат boolean True if the browser is Galeon otherwise false

checkBrowserGoogleBot() защищенный Метод

Determine if the browser is the GoogleBot or not (last updated 1.7)
protected checkBrowserGoogleBot ( ) : boolean
Результат boolean True if the browser is the GoogletBot otherwise false

checkBrowserIcab() защищенный Метод

Determine if the browser is iCab or not (last updated 1.7)
protected checkBrowserIcab ( ) : boolean
Результат boolean True if the browser is iCab otherwise false

checkBrowserIceCat() защищенный Метод

Determine if the browser is Ice Cat or not (http://en.wikipedia.org/wiki/GNU_IceCat) (last updated 1.7)
protected checkBrowserIceCat ( ) : boolean
Результат boolean True if the browser is Ice Cat otherwise false

checkBrowserIceweasel() защищенный Метод

Determine if the browser is Firefox or not (last updated 1.7)
protected checkBrowserIceweasel ( ) : boolean
Результат boolean True if the browser is Firefox otherwise false

checkBrowserInternetExplorer() защищенный Метод

Determine if the browser is Internet Explorer or not (last updated 1.7)
protected checkBrowserInternetExplorer ( ) : boolean
Результат boolean True if the browser is Internet Explorer otherwise false

checkBrowserKonqueror() защищенный Метод

Determine if the browser is Konqueror or not (last updated 1.7)
protected checkBrowserKonqueror ( ) : boolean
Результат boolean True if the browser is Konqueror otherwise false

checkBrowserLynx() защищенный Метод

Determine if the browser is Lynx or not (last updated 1.7)
protected checkBrowserLynx ( ) : boolean
Результат boolean True if the browser is Lynx otherwise false

checkBrowserMSNBot() защищенный Метод

Determine if the browser is the MSNBot or not (last updated 1.9)
protected checkBrowserMSNBot ( ) : boolean
Результат boolean True if the browser is the MSNBot otherwise false

checkBrowserMozilla() защищенный Метод

Determine if the browser is Mozilla or not (last updated 1.7)
protected checkBrowserMozilla ( ) : boolean
Результат boolean True if the browser is Mozilla otherwise false

checkBrowserNetPositive() защищенный Метод

Determine if the browser is NetPositive or not (last updated 1.7)
protected checkBrowserNetPositive ( ) : boolean
Результат boolean True if the browser is NetPositive otherwise false

checkBrowserNetscapeNavigator9Plus() защищенный Метод

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
Результат boolean True if the browser is Netscape Navigator 9+ otherwise false

checkBrowserNokia() защищенный Метод

Determine if the browser is Nokia or not (last updated 1.7)
protected checkBrowserNokia ( ) : boolean
Результат boolean True if the browser is Nokia otherwise false

checkBrowserOmniWeb() защищенный Метод

Determine if the browser is OmniWeb or not (last updated 1.7)
protected checkBrowserOmniWeb ( ) : boolean
Результат boolean True if the browser is OmniWeb otherwise false

checkBrowserOpera() защищенный Метод

Determine if the browser is Opera or not (last updated 1.7)
protected checkBrowserOpera ( ) : boolean
Результат boolean True if the browser is Opera otherwise false

checkBrowserPhoenix() защищенный Метод

Determine if the browser is Phoenix or not (last updated 1.7)
protected checkBrowserPhoenix ( ) : boolean
Результат boolean True if the browser is Phoenix otherwise false

checkBrowserPlayStation() защищенный Метод

Determine if the browser is a PlayStation
protected checkBrowserPlayStation ( ) : boolean
Результат boolean True if the browser is PlayStation otherwise false

checkBrowserSafari() защищенный Метод

Determine if the browser is Safari or not (last updated 1.7)
protected checkBrowserSafari ( ) : boolean
Результат boolean True if the browser is Safari otherwise false

checkBrowserShiretoko() защищенный Метод

Determine if the browser is Shiretoko or not (https://wiki.mozilla.org/Projects/shiretoko) (last updated 1.7)
protected checkBrowserShiretoko ( ) : boolean
Результат boolean True if the browser is Shiretoko otherwise false

checkBrowserSlurp() защищенный Метод

Determine if the browser is the Yahoo! Slurp Robot or not (last updated 1.7)
protected checkBrowserSlurp ( ) : boolean
Результат boolean True if the browser is the Yahoo! Slurp Robot otherwise false

checkBrowserVivaldi() защищенный Метод

Determine if the browser is Vivaldi
protected checkBrowserVivaldi ( ) : boolean
Результат boolean True if the browser is Vivaldi otherwise false

checkBrowserW3CValidator() защищенный Метод

Determine if the browser is the W3C Validator or not (last updated 1.7)
protected checkBrowserW3CValidator ( ) : boolean
Результат boolean True if the browser is the W3C Validator otherwise false

checkBrowserWebTv() защищенный Метод

Determine if the browser is WebTv or not (last updated 1.7)
protected checkBrowserWebTv ( ) : boolean
Результат boolean True if the browser is WebTv otherwise false

checkBrowseriPad() защищенный Метод

Determine if the browser is iPad or not (last updated 1.7)
protected checkBrowseriPad ( ) : boolean
Результат boolean True if the browser is iPad otherwise false

checkBrowseriPhone() защищенный Метод

Determine if the browser is iPhone or not (last updated 1.7)
protected checkBrowseriPhone ( ) : boolean
Результат boolean True if the browser is iPhone otherwise false

checkBrowseriPod() защищенный Метод

Determine if the browser is iPod or not (last updated 1.7)
protected checkBrowseriPod ( ) : boolean
Результат boolean True if the browser is iPod otherwise false

checkBrowsers() защищенный Метод

Protected routine to determine the browser type
protected checkBrowsers ( ) : boolean
Результат boolean True if the browser was detected otherwise false

checkFacebookExternalHit() защищенный Метод

Detect if URL is loaded from FacebookExternalHit
protected checkFacebookExternalHit ( ) : boolean
Результат boolean True if it detects FacebookExternalHit otherwise false

checkForAol() защищенный Метод

Determine if the user is using an AOL User Agent (last updated 1.7)
protected checkForAol ( ) : boolean
Результат boolean True if the browser is from AOL otherwise false

checkForFacebookIos() защищенный Метод

Detect if URL is being loaded from internal Facebook browser
protected checkForFacebookIos ( ) : boolean
Результат boolean True if it detects internal Facebook browser otherwise false

checkPlatform() защищенный Метод

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

determine() защищенный Метод

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

getAolVersion() публичный Метод

The version of AOL.
public getAolVersion ( ) : string
Результат string Version of AOL (will only contain alpha-numeric characters and a period)

getBrowser() публичный Метод

The name of the browser. All return types are from the class contants
public getBrowser ( ) : string
Результат string Name of the browser

getChromeVersionOnIos() защищенный Метод

Detect Version for the Chrome browser on iOS devices
protected getChromeVersionOnIos ( ) : boolean
Результат boolean True if it detects the version correctly otherwise false

getPlatform() публичный Метод

The name of the platform. All return types are from the class contants
public getPlatform ( ) : string
Результат string Name of the browser

getSafariVersionOnIos() защищенный Метод

Detect Version for the Safari browser on iOS devices
protected getSafariVersionOnIos ( ) : boolean
Результат boolean True if it detects the version correctly otherwise false

getUserAgent() публичный Метод

Get the user agent value in use to determine the browser
public getUserAgent ( ) : string
Результат string The user agent from the HTTP header

getVersion() публичный Метод

The version of the browser.
public getVersion ( ) : string
Результат string Version of the browser (will only contain alpha-numeric characters and a period)

isAol() публичный Метод

Is the browser from AOL?
public isAol ( ) : boolean
Результат boolean True if the browser is from AOL otherwise false

isBrowser() публичный Метод

Check to see if the specific browser is valid
public isBrowser ( string $browserName ) : boolean
$browserName string
Результат boolean True if the browser is the specified browser

isChromeFrame() публичный Метод

Used to determine if the browser is actually "chromeframe"
С версии: 1.7
public isChromeFrame ( ) : boolean
Результат boolean True if the browser is using chromeframe

isFacebook() публичный Метод

Is the browser from facebook?
public isFacebook ( ) : boolean
Результат boolean True if the browser is from facebook otherwise false

isMobile() публичный Метод

Is the browser from a mobile device?
public isMobile ( ) : boolean
Результат boolean True if the browser is from a mobile device otherwise false

isRobot() публичный Метод

Is the browser from a robot (ex Slurp,GoogleBot)?
public isRobot ( ) : boolean
Результат boolean True if the browser is from a robot otherwise false

isTablet() публичный Метод

Is the browser from a tablet device?
public isTablet ( ) : boolean
Результат boolean True if the browser is from a tablet device otherwise false

reset() публичный Метод

Reset all properties
public reset ( )

setAol() публичный Метод

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

setAolVersion() публичный Метод

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

setBrowser() публичный Метод

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

setFacebook() защищенный Метод

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

setMobile() защищенный Метод

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

setPlatform() публичный Метод

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

setRobot() защищенный Метод

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

setTablet() защищенный Метод

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

setUserAgent() публичный Метод

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() публичный Метод

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