JBrowser

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

package

Joomla.Platform

Methods

__construct

Create a browser instance (constructor).

__construct(string $userAgent = null, string $accept = null) 
since

11.1

Arguments

$userAgent

stringThe browser string to parse.

$accept

stringThe HTTP_ACCEPT settings to use.

_setPlatform

Match the platform of the browser.

_setPlatform() : void

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

getAgentString

Return the full browser agent string.

getAgentString() : string
since

11.1

Response

stringThe browser agent string

getBrowser

Retrieve the current browser.

getBrowser() : string
since

11.1

Response

stringThe current browser.

getHTTPProtocol

Returns the server protocol in use on the current server.

getHTTPProtocol() : string
since

11.1

Response

stringThe HTTP server protocol version.

getInstance

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

getInstance(string $userAgent = null, string $accept = null) : \JBrowser
static
since

11.1

Arguments

$userAgent

stringThe browser string to parse.

$accept

stringThe HTTP_ACCEPT settings to use.

Response

\JBrowserThe Browser object.

getMajor

Retrieve the current browser's major version.

getMajor() : integer
since

11.1

Response

integerThe current browser's major version

getMinor

Retrieve the current browser's minor version.

getMinor() : integer
since

11.1

Response

integerThe current browser's minor version.

getPlatform

Return the currently matched platform.

getPlatform() : string
since

11.1

Response

stringThe user's platform.

getVersion

Retrieve the current browser's version.

getVersion() : string
since

11.1

Response

stringThe current browser's version.

identifyBrowserVersion

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

identifyBrowserVersion() : void
since

11.1

isBrowser

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

isBrowser(string $browser) : boolean
since

11.1

Arguments

$browser

stringThe browser to check.

Response

booleanIs the given browser the same as the current?

isMobile

Determines if the browser is mobile version or not.

isMobile() : boolean
since

11.1

Response

booleanTrue if browser is a known mobile version.

isRobot

Determines if the browser is a robot or not.

isRobot() : boolean
since

11.1

Response

booleanTrue if browser is a known robot.

isSSLConnection

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

isSSLConnection() : boolean
deprecated
since

11.1

deprecated

13.3 (Platform) & 4.0 (CMS) - Use the isSSLConnection method on the application object.

Response

booleanTrue if using SSL, false if not.

isViewable

Determines if a browser can display a given MIME type.

isViewable(string $mimetype) : boolean

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.

since

11.1

Arguments

$mimetype

stringThe MIME type to check.

Response

booleanTrue if the browser can display the MIME type.

match

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

match(string $userAgent = null, string $accept = null) : void
since

11.1

Arguments

$userAgent

stringThe browser string to parse.

$accept

stringThe HTTP_ACCEPT settings to use.

setBrowser

Sets the current browser.

setBrowser(string $browser) : void
since

11.1

Arguments

$browser

stringThe browser to set as current.

Properties

majorVersion

Major version number

Type(s)

integer

minorVersion

Minor version number

Type(s)

integer

browser

Browser name.

Type(s)

string

agent

Full user agent string.

Type(s)

string

lowerAgent

Lower-case user agent string

Type(s)

string

accept

HTTP_ACCEPT string.

Type(s)

string

acceptParsed

Parsed HTTP_ACCEPT string

Type(s)

array

platform

Platform the browser is running on

Type(s)

string

robots

Known robots.

Type(s)

array

mobile

Is this a mobile browser?

Type(s)

boolean

images

List of viewable image MIME subtypes.

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

Type(s)

array

instances

JBrowser instances container.

static

Type(s)

array