JBrowser

Extends \JObject

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

deprecated

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.

package

Joomla.Platform

subpackage

Environment

since

11.1

deprecated

This API may be changed in the near future and should not be considered stable

Methods

__construct

Class constructor, overridden in descendant classes.

__construct(mixed $properties = null) 
inherited
since

11.1

Arguments

$properties

mixedEither and associative array or another object to set the initial properties of the object.

__toString

Magic method to convert the object to a string gracefully.

__toString() : string
inherited deprecated
since

11.1

deprecated

12.3 Classes should provide their own __toString() implementation.

Response

stringThe classname.

_setFeature

Internal copy of JBrowser::setFeature() to prevent deprecation warning.

_setFeature(string $feature, string $value = true) : void
deprecated
since

11.4

deprecated

12.1 This function will be dropped without replacement

Arguments

$feature

stringThe capability to set.

$value

stringSpecial capability parameter.

_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

_setQuirk

Set unique behavior for the current browser.

_setQuirk(string $quirk, string $value = true) : void
deprecated
since

11.1

deprecated

12.1 This function will be dropped without replacement

Arguments

$quirk

stringThe behavior to set.

$value

stringSpecial behavior parameter.

_sortMime

Identify which of two types is preferred

_sortMime(string $a, string $b) : void
static
since

11.1

Arguments

$a

stringThe first item in the comparision

$b

stringThe second item in the comparison

def

Sets a default value if not alreay assigned

def(string $property, mixed $default = null) : mixed
inherited
since

11.1

Arguments

$property

stringThe name of the property.

$default

mixedThe default value.

Response

mixed

get

Returns a property of the object or the default value if the property is not set.

get(string $property, mixed $default = null) : mixed
inherited
since

11.1

see \JObject::getProperties()

Arguments

$property

stringThe name of the property.

$default

mixedThe default value.

Response

mixedThe value of the property.

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.

getError

Get the most recent error message.

getError(integer $i = null, boolean $toString = true) : string
inherited deprecated
since

11.1

see \JError
deprecated

12.3 JError has been deprecated

Arguments

$i

integerOption error index.

$toString

booleanIndicates if JError objects should return their error message.

Response

stringError message

getErrors

Return all errors, if any.

getErrors() : array
inherited deprecated
since

11.1

see \JError
deprecated

12.3 JError has been deprecated

Response

arrayArray of error messages or JErrors.

getFeature

Retrieve the current browser capability.

getFeature(string $feature) : string
deprecated
since

11.1

deprecated

12.1 This function will be dropped without replacement

Arguments

$feature

stringThe capability to retrieve.

Response

stringThe value of the requested capability.

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.

getProperties

Returns an associative array of object properties.

getProperties(boolean $public = true) : array
inherited
since

11.1

see \JObject::get()

Arguments

$public

booleanIf true, returns only the public properties.

Response

array

getQuirk

Retrieve unique behavior for the current browser.

getQuirk(string $quirk) : string
deprecated
since

11.1

deprecated

12.1 This function will be dropped without replacement

Arguments

$quirk

stringThe behavior to retrieve.

Response

stringThe value for the requested behavior.

getVersion

Retrieve the current browser's version.

getVersion() : string
since

11.1

Response

stringThe current browser's version.

hasFeature

Check the current browser capabilities.

hasFeature(string $feature) : boolean
deprecated
since

11.1

deprecated

12.1 This function will be dropped without replacement

Arguments

$feature

stringThe capability to check.

Response

booleanDoes the browser have the capability set?

hasQuirk

Check unique behavior for the current browser.

hasQuirk(string $quirk) : boolean
deprecated
since

11.1

deprecated

12.1 This function will be dropped without replacement

Arguments

$quirk

stringThe behavior to check.

Response

booleanDoes the browser have the behavior set?

identifyBrowserVersion

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

identifyBrowserVersion() : void

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
since

11.1

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.

set

Modifies a property of the object, creating it if it does not already exist.

set(string $property, mixed $value = null) : mixed
inherited
since

11.1

Arguments

$property

stringThe name of the property.

$value

mixedThe value of the property to set.

Response

mixedPrevious value of the property.

setBrowser

Sets the current browser.

setBrowser(string $browser) : void
since

11.1

Arguments

$browser

stringThe browser to set as current.

setError

Add an error message.

setError(string $error) : void
inherited deprecated
since

11.1

see \JError
deprecated

12.3 JError has been deprecated

Arguments

$error

stringError message.

setFeature

Set capabilities for the current browser.

setFeature(string $feature, string $value = true) : void
deprecated
since

11.1

deprecated

12.1 This function will be dropped without replacement

Arguments

$feature

stringThe capability to set.

$value

stringSpecial capability parameter.

setProperties

Set the object properties based on a named array/hash.

setProperties(mixed $properties) : boolean
inherited
since

11.1

see \JObject::set()

Arguments

$properties

mixedEither an associative array or another object.

Response

boolean

setQuirk

Internal copy of JBrowser::setQuirk() to prevent deprecation warning.

setQuirk(string $quirk, string $value = true) : void
deprecated
since

11.1

deprecated

12.1 This function will be dropped without replacement

Arguments

$quirk

stringThe behavior to set.

$value

stringSpecial behavior parameter.

toString

Converts the object to a string (the class name).

toString() : string
inherited deprecated
since

11.1

deprecated

12.1 Use magic method __toString()

see \JObject::__toString()

Response

string

Properties

_majorVersion

Major version number

since

11.1

Type(s)

integer

_minorVersion

Minor version number

since

11.1

Type(s)

integer

_browser

Browser name.

since

11.1

Type(s)

string

_agent

Full user agent string.

since

11.1

Type(s)

string

_lowerAgent

Lower-case user agent string

since

11.1

Type(s)

string

_accept

HTTP_ACCEPT string.

since

11.1

Type(s)

string

_accept_parsed

Parsed HTTP_ACCEPT string

since

11.1

Type(s)

array

_platform

Platform the browser is running on

since

11.1

Type(s)

string

_robots

Known robots.

since

11.1

Type(s)

array

_mobile

Is this a mobile browser?

since

11.1

Type(s)

boolean

_features

Features.

deprecated
since

11.1

deprecated

12.1 This variable will be dropped without replacement

Type(s)

array

_quirks

Quirks.

deprecated
since

11.1

deprecated

12.1 This variable will be dropped without replacement

Type(s)

array

_images

List of viewable image MIME subtypes.

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

since

11.1

Type(s)

array

instances

JBrowser instances container.

static
since

11.3

Type(s)

array

_errors

An array of error messages or Exception objects.

inherited deprecated
since

11.1

see \JError
deprecated

12.3 JError has been deprecated

Type(s)

array