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 module has many influences from the lib/Browser.php code in version 3 of Horde.

Located in /application/environment/browser.php (line 32)

JObject
   |
   --JBrowser
Variable Summary
 string $_accept
 string $_agent
 array $_browser
 string $_lowerAgent
 array $_robots
Method Summary
 JBrowser __construct ([string $userAgent = null], [string $accept = null])
 mixed get (string $property, [mixed $default = null])
 string getAgentString ()
 string getBrowser ()
 string getFeature (string $feature)
 string getHTTPProtocol ()
 JBrowser &getInstance ([string $userAgent = null], [string $accept = null])
 integer getMajor ()
 integer getMinor ()
 string getPlatform ()
 string getVersion ()
 boolean hasFeature (string $feature)
 boolean isBrowser (string $browser)
 boolean isRobot ()
 boolean isSSLConnection ()
 boolean isViewable (string $mimetype)
 void match ([string $userAgent = null], [string $accept = null])
 void set (string $property, [mixed $value = null])
 void _get_browser (mixed $userAgent, [mixed $return_array = false], [mixed $db = './browscap.ini'])
Variables
string $_accept = '' (line 53)

HTTP_ACCEPT string

string $_agent = '' (line 39)

Full user agent string.

array $_browser = null (line 61)

Browser information array using PHP get_browser function

string $_lowerAgent = '' (line 46)

Lower-case user agent string.

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 68)

Known robots.

Methods
Constructor __construct (line 124)

Create a browser instance (Constructor).

JBrowser __construct ([string $userAgent = null], [string $accept = null])
  • string $userAgent: The browser string to parse.
  • string $accept: The HTTP_ACCEPT settings to use.

Redefinition of:
JObject::__construct()
Class constructor, overridden in descendant classes.
get (line 382)
  • return: The value of the property
mixed get (string $property, [mixed $default = null])
  • string $property: The name of the property
  • mixed $default: The default value

Redefinition of:
JObject::get()
getAgentString (line 246)

Return the full browser agent string.

  • return: The browser agent string.
string getAgentString ()
getBrowser (line 212)

Retrieve the current browser.

  • return: The current browser.
string getBrowser ()
getFeature (line 280)

Retrieve the current browser capability.

  • return: The value of the requested capability.
string getFeature (string $feature)
  • string $feature: The capability to retrieve.
getHTTPProtocol (line 255)

Returns the server protocol in use on the current server.

  • return: The HTTP server protocol version.
string getHTTPProtocol ()
getInstance (line 141)

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

This method must be invoked as:

  $browser = &JBrowser::getInstance([$userAgent[, $accept]]);

  • return: The Browser object.
  • access: public
JBrowser &getInstance ([string $userAgent = null], [string $accept = null])
  • string $userAgent: The browser string to parse.
  • string $accept: The HTTP_ACCEPT settings to use.
getMajor (line 221)

Retrieve the current browser's major version.

  • return: The current browser's major version.
integer getMajor ()
getMinor (line 229)

Retrieve the current browser's minor version.

  • return: The current browser's minor version.
integer getMinor ()
getPlatform (line 203)

Return the currently matched platform.

  • return: The user's platform.
string getPlatform ()
getVersion (line 237)

Retrieve the current browser's version.

  • return: The current browser's version.
string getVersion ()
hasFeature (line 270)

Check the current browser capabilities.

  • return: Does the browser have the capability set?
boolean hasFeature (string $feature)
  • string $feature: The capability to check.
isBrowser (line 338)

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

  • return: Is the given browser the same as the current?
boolean isBrowser (string $browser)
  • string $browser: The browser to check.
isRobot (line 347)

Determines if the browser is a robot or not.

  • return: True if browser is a known robot.
boolean isRobot ()
isSSLConnection (line 362)

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

  • return: True if using SSL, false if not.
boolean isSSLConnection ()
isViewable (line 290)

Determines if a browser can display a given MIME type.

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

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

void match ([string $userAgent = null], [string $accept = null])
  • string $userAgent: The browser string to parse.
  • string $accept: The HTTP_ACCEPT settings to use.
set (line 373)
void set (string $property, [mixed $value = null])
  • string $property: The name of the property
  • mixed $value: The value of the property to set

Redefinition of:
JObject::set()
_get_browser (line 389)
void _get_browser (mixed $userAgent, [mixed $return_array = false], [mixed $db = './browscap.ini'])

Inherited Methods

Inherited From JObject

 JObject::__construct()
 JObject::JObject()
 JObject::get()
 JObject::set()
 JObject::toString()
 JObject::__destruct()

Documentation generated on Sat, 4 Feb 2006 14:22:47 +0100 by phpDocumentor 1.3.0RC4