Class JBrowser

Description

Browser class, provides capability information about the current web client.

Browser identification is performed by examining the HTTP_USER_AGENT environment variable provided by the web server.

This class has many influences from the lib/Browser.php code in version 3 of Horde by Chuck Hagenbuch and Jon Parise.

  • since: 11.1

Located in /libraries/joomla/environment/browser.php (line 25)


	
			
Variable Summary
 static array $instances
 string $accept
 string $agent
 string $browser
 array $images
 string $lowerAgent
 integer $majorVersion
 integer $minorVersion
 boolean $mobile
 string $platform
 array $robots
Method Summary
 static JBrowser getInstance ([string $userAgent = null], [string $accept = null])
 JBrowser __construct ([string $userAgent = null], [string $accept = null])
 string getAgentString ()
 string getBrowser ()
 string getHTTPProtocol ()
 integer getMajor ()
 integer getMinor ()
 string getPlatform ()
 string getVersion ()
 boolean isBrowser (string $browser)
 boolean isMobile ()
 boolean isRobot ()
 boolean isSSLConnection ()
 boolean isViewable (string $mimetype)
 void match ([string $userAgent = null], [string $accept = null])
 void setBrowser (string $browser)
 void _setPlatform ()
Variables
static array $instances = array() (line 147)
  • var: JBrowser instances container.
  • since: 11.3
  • access: protected
string $accept = '' (line 61)
  • var: HTTP_ACCEPT string.
  • since: 12.1
  • access: protected
array $acceptParsed = array() (line 67)
  • var: Parsed HTTP_ACCEPT string
  • since: 12.1
  • access: protected
string $agent = '' (line 49)
  • var: Full user agent string.
  • since: 12.1
  • access: protected
string $browser = '' (line 43)
  • var: Browser name.
  • since: 12.1
  • access: protected
array $images = array('jpeg', 'gif', 'png', 'pjpeg', 'x-png', 'bmp') (line 141)

List of viewable image MIME subtypes.

This list of viewable images works for IE and Netscape/Mozilla.

  • since: 12.1
  • access: protected
string $lowerAgent = '' (line 55)
  • var: Lower-case user agent string
  • since: 12.1
  • access: protected
integer $majorVersion = 0 (line 31)
  • var: Major version number
  • since: 12.1
  • access: protected
integer $minorVersion = 0 (line 37)
  • var: Minor version number
  • since: 12.1
  • access: protected
boolean $mobile = false (line 132)
  • var: Is this a mobile browser?
  • since: 12.1
  • access: protected
string $platform = '' (line 73)
  • var: Platform the browser is running on
  • since: 12.1
  • access: protected
array $robots = array(
/* The most common ones. */
'Googlebot',
'msnbot',
'Slurp',
'Yahoo',
/* The rest alphabetically. */
'Arachnoidea',
'ArchitextSpider',
'Ask Jeeves',
'B-l-i-t-z-Bot',
'Baiduspider',
'BecomeBot',
'cfetch',
'ConveraCrawler',
'ExtractorPro',
'FAST-WebCrawler',
'FDSE robot',
'fido',
'geckobot',
'Gigabot',
'Girafabot',
'grub-client',
'Gulliver',
'HTTrack',
'ia_archiver',
'InfoSeek',
'kinjabot',
'KIT-Fireball',
'larbin',
'LEIA',
'lmspider',
'Lycos_Spider',
'Mediapartners-Google',
'MuscatFerret',
'NaverBot',
'OmniExplorer_Bot',
'polybot',
'Pompos',
'Scooter',
'Teoma',
'TheSuBot',
'TurnitinBot',
'Ultraseek',
'ViolaBot',
'webbandit',
'www.almaden.ibm.com/cs/crawler',
'ZyBorg')
(line 79)
  • var: Known robots.
  • since: 12.1
  • access: protected
Methods
static getInstance (line 173)

Returns the global Browser object, only creating it if it doesn't already exist.

  • return: The Browser object.
  • since: 11.1
  • access: public
static JBrowser getInstance ([string $userAgent = null], [string $accept = null])
  • string $userAgent: The browser string to parse.
  • string $accept: The HTTP_ACCEPT settings to use.
Constructor __construct (line 157)

Create a browser instance (constructor).

  • since: 11.1
  • access: public
JBrowser __construct ([string $userAgent = null], [string $accept = null])
  • string $userAgent: The browser string to parse.
  • string $accept: The HTTP_ACCEPT settings to use.
getAgentString (line 536)

Return the full browser agent string.

  • return: The browser agent string
  • since: 11.1
  • access: public
string getAgentString ()
getBrowser (line 488)

Retrieve the current browser.

  • return: The current browser.
  • since: 11.1
  • access: public
string getBrowser ()
getHTTPProtocol (line 548)

Returns the server protocol in use on the current server.

  • return: The HTTP server protocol version.
  • since: 11.1
  • access: public
string getHTTPProtocol ()
getMajor (line 500)

Retrieve the current browser's major version.

  • return: The current browser's major version
  • since: 11.1
  • access: public
integer getMajor ()
getMinor (line 512)

Retrieve the current browser's minor version.

  • return: The current browser's minor version.
  • since: 11.1
  • access: public
integer getMinor ()
getPlatform (line 439)

Return the currently matched platform.

  • return: The user's platform.
  • since: 11.1
  • access: public
string getPlatform ()
getVersion (line 524)

Retrieve the current browser's version.

  • return: The current browser's version.
  • since: 11.1
  • access: public
string getVersion ()
identifyBrowserVersion (line 452)

Set browser version, not by engine version Fallback to use when no other method identify the engine version

  • since: 11.1
  • access: protected
void identifyBrowserVersion ()
isBrowser (line 627)

Determine if the given browser is the same as the current.

  • return: Is the given browser the same as the current?
  • since: 11.1
  • access: public
boolean isBrowser (string $browser)
  • string $browser: The browser to check.
isMobile (line 659)

Determines if the browser is mobile version or not.

  • return: True if browser is a known mobile version.
  • since: 11.1
  • access: public
boolean isMobile ()
isRobot (line 639)

Determines if the browser is a robot or not.

  • return: True if browser is a known robot.
  • since: 11.1
  • access: public
boolean isRobot ()
isSSLConnection (line 672)

Determine if we are using a secure (SSL) connection.

  • return: True if using SSL, false if not.
  • deprecated: 13.3 (Platform) & 4.0 (CMS) - Use the isSSLConnection method on the application object.
  • since: 11.1
  • access: public
boolean isSSLConnection ()
isViewable (line 574)

Determines if a browser can display a given MIME type.

Note that image/jpeg and image/pjpeg *appear* to be the same entity, but Mozilla doesn't seem to want to accept the latter. For our purposes, we will treat them the same.

  • return: True if the browser can display the MIME type.
  • since: 11.1
  • access: public
boolean isViewable (string $mimetype)
  • string $mimetype: The MIME type to check.
match (line 196)

Parses the user agent string and inititializes the object with all the known features and quirks for the given browser.

  • since: 11.1
  • access: public
void match ([string $userAgent = null], [string $accept = null])
  • string $userAgent: The browser string to parse.
  • string $accept: The HTTP_ACCEPT settings to use.
setBrowser (line 476)

Sets the current browser.

  • since: 11.1
  • access: public
void setBrowser (string $browser)
  • string $browser: The browser to set as current.
_setPlatform (line 416)

Match the platform of the browser.

This is a pretty simplistic implementation, but it's intended to let us tell what line breaks to send, so it's good enough for its purpose.

  • since: 11.1
  • access: protected
void _setPlatform ()

Documentation generated on Tue, 19 Nov 2013 14:54:46 +0100 by phpDocumentor 1.4.3