Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: Joomla-Framework

License

Content on this site is copyright © 2005 - 2008 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5. Some parts of this website may be subject to other licenses.

 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.

Located in /joomla/environment/browser.php (line 36)

Class JObject   (Subpackage Base)

Class JBrowser   (Subpackage Environment)
Variable Summary
Variable string $_accept
Variable string $_agent
Variable string $_browser
Variable array $_features
Variable array $_images
Variable string $_lowerAgent
Variable integer $_majorVersion
Variable integer $_minorVersion
Variable boolean $_mobile
Variable string $_platform
Variable array $_quirks
Variable array $_robots
Method Summary
Constructor JBrowser __construct ([string $userAgent = null], [string $accept = null])
Method string getAgentString ()
Method string getBrowser ()
Method string getFeature (string $feature)
Method string getHTTPProtocol ()
Method JBrowser &getInstance ([string $userAgent = null], [string $accept = null])
Method integer getMajor ()
Method integer getMinor ()
Method string getPlatform ()
Method string getQuirk (string $quirk)
Method string getVersion ()
Method boolean hasFeature (string $feature)
Method boolean hasQuirk (string $quirk)
Method boolean isBrowser (string $browser)
Method boolean isRobot ()
Method boolean isSSLConnection ()
Method boolean isViewable (string $mimetype)
Method void match ([string $userAgent = null], [string $accept = null])
Method void setBrowser (string $browser)
Method void setFeature (string $feature, [string $value = true])
Method void setQuirk (string $quirk, [string $value = true])
Method void _setPlatform ()
Variables
string $_accept = '' (line 78)

HTTP_ACCEPT string

string $_agent = '' (line 64)

Full user agent string.

string $_browser = '' (line 57)

Browser name.

array $_features = array(
'html' => true,
'hdml' => false,
'wml' => false,
'images' => true,
'iframes' => false,
'frames' => true,
'tables' => true,
'java' => true,
'javascript' => true,
'dom' => false,
'utf' => false,
'rte' => false,
'homepage' => false,
'accesskey' => false,
'optgroup' => false,
'xmlhttpreq' => false,
'cite' => false,
'xhtml+xml' => false,
'mathml' => false,
'svg' => false
)
(line 154)

Features.

array $_images = array('jpeg', 'gif', 'png', 'pjpeg', 'x-png', 'bmp') (line 207)

List of viewable image MIME subtypes.

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

string $_lowerAgent = '' (line 71)

Lower-case user agent string.

integer $_majorVersion = 0 (line 43)

Major version number.

integer $_minorVersion = 0 (line 50)

Minor version number.

boolean $_mobile = false (line 147)

Is this a mobile browser?

string $_platform = '' (line 85)

Platform the browser is running on.

array $_quirks = array(
'avoid_popup_windows' => false,
'break_disposition_header' => false,
'break_disposition_filename' => false,
'broken_multipart_form' => false,
'cache_same_url' => false,
'cache_ssl_downloads' => false,
'double_linebreak_textarea' => false,
'empty_file_input_value' => false,
'must_cache_forms' => false,
'no_filename_spaces' => false,
'no_hidden_overflow_tables' => false,
'ow_gui_1.3' => false,
'png_transparency' => false,
'scrollbar_in_way' => false,
'scroll_tds' => false,
'windowed_controls' => false,
)
(line 182)

Quirks

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

Known robots.

Inherited Variables

Inherited from JObject

Variable JObject::$_errors
Methods
Constructor __construct (line 216)

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.
getAgentString (line 688)

Return the full browser agent string.

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

Retrieve the current browser.

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

Retrieve the current browser capability.

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

Returns the server protocol in use on the current server.

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

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

Retrieve the current browser's major version.

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

Retrieve the current browser's minor version.

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

Return the currently matched platform.

  • return: The user's platform.
string getPlatform ()
getQuirk (line 733)

Retrieve unique behavior for the current browser.

  • return: The value for the requested behavior.
string getQuirk (string $quirk)
  • string $quirk: The behavior to retrieve.
getVersion (line 679)

Retrieve the current browser's version.

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

Check the current browser capabilities.

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

Check unique behavior for the current browser.

  • return: Does the browser have the behavior set?
boolean hasQuirk (string $quirk)
  • string $quirk: The behavior to check.
isBrowser (line 826)

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

Determines if the browser is a robot or not.

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

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

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

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

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.
setBrowser (line 645)

Sets the current browser.

void setBrowser (string $browser)
  • string $browser: The browser to set as current.
setFeature (line 746)

Set capabilities for the current browser.

void setFeature (string $feature, [string $value = true])
  • string $feature: The capability to set.
  • string $value: Special capability parameter.
setQuirk (line 713)

Set unique behavior for the current browser.

void setQuirk (string $quirk, [string $value = true])
  • string $quirk: The behavior to set.
  • string $value: Special behavior parameter.
_setPlatform (line 620)

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.

void _setPlatform ()

Inherited Methods

Inherited From JObject

 JObject::JObject()
 JObject::__construct()
 JObject::get()
 JObject::getError()
 JObject::getErrors()
 JObject::getProperties()
 JObject::getPublicProperties()
 JObject::set()
 JObject::setError()
 JObject::setProperties()
 JObject::toString()

Documentation generated on Tue, 29 Jan 2008 18:44:44 +0000 by phpDocumentor 1.3.1