class JBrowser extends JObject


Located at : UKNOWVA_ROOT/libraries/joomla/environment/browser.php

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

Browser identification is performed by examining the HTTPUSERAGENT 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.

Methods

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

Create a browser instance (constructor).

string
__toString()

Magic method to convert the object to a string gracefully.

from JObject
mixed
def(string $property, mixed $default = null)

Sets a default value if not alreay assigned

from JObject
mixed
get(string $property, mixed $default = null)

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

from JObject
array
getProperties(boolean $public = true)

Returns an associative array of object properties.

from JObject
string
getError(integer $i = null, boolean $toString = true)

Get the most recent error message.

from JObject
array
getErrors()

Return all errors, if any.

from JObject
mixed
set(string $property, mixed $value = null)

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

from JObject
boolean
setProperties(mixed $properties)

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

from JObject
void
setError(string $error)

Add an error message.

from JObject
string
toString() deprecated

No description

from JObject
static JBrowser
getInstance(string $userAgent = null, string $accept = null)

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

static 
_sortMime($a, $b)

No description

match(string $userAgent = null, string $accept = null)

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

string
getPlatform()

Return the currently matched platform.

setBrowser(string $browser)

Sets the current browser.

string
getBrowser()

Retrieve the current browser.

integer
getMajor()

Retrieve the current browser's major version.

integer
getMinor()

Retrieve the current browser's minor version.

string
getVersion()

Retrieve the current browser's version.

string
getAgentString()

Return the full browser agent string.

string
getHTTPProtocol()

Returns the server protocol in use on the current server.

setQuirk(string $quirk, string $value = true)

Set unique behavior for the current browser.

boolean
hasQuirk(string $quirk)

Check unique behavior for the current browser.

string
getQuirk(string $quirk)

Retrieve unique behavior for the current browser.

setFeature(string $feature, string $value = true)

Set capabilities for the current browser.

boolean
hasFeature(string $feature)

Check the current browser capabilities.

string
getFeature(string $feature)

Retrieve the current browser capability.

boolean
isViewable(string $mimetype)

Determines if a browser can display a given MIME type.

boolean
isBrowser(string $browser)

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

boolean
isRobot()

Determines if the browser is a robot or not.

boolean
isMobile()

Determines if the browser is mobile version or not.

isTablet()

No description

boolean
isMobileApp()

Detects if the system is being accessed through the uKnowva mobile app

boolean
isSSLConnection()

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

Details

at line 199
JObject __construct(string $userAgent = null, string $accept = null)

Create a browser instance (constructor).

Parameters

string $userAgent The browser string to parse.
string $accept The HTTP_ACCEPT settings to use.

Return Value

JObject

in JObject at line 56
string __toString()

Magic method to convert the object to a string gracefully.

Return Value

string The classname.

in JObject at line 70
mixed def(string $property, mixed $default = null)

Sets a default value if not alreay assigned

Parameters

string $property The name of the property.
mixed $default The default value.

Return Value

mixed

in JObject at line 88
mixed get(string $property, mixed $default = null)

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

Parameters

string $property The name of the property.
mixed $default The default value.

Return Value

mixed The value of the property.

See also

getProperties()

in JObject at line 107
array getProperties(boolean $public = true)

Returns an associative array of object properties.

Parameters

boolean $public If true, returns only the public properties.

Return Value

array

See also

get()

in JObject at line 133
string getError(integer $i = null, boolean $toString = true)

Get the most recent error message.

Parameters

integer $i Option error index.
boolean $toString Indicates if JError objects should return their error message.

Return Value

string Error message

in JObject at line 165
array getErrors()

Return all errors, if any.

Return Value

array Array of error messages or JErrors.

in JObject at line 180
mixed set(string $property, mixed $value = null)

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

Parameters

string $property The name of the property.
mixed $value The value of the property to set.

Return Value

mixed Previous value of the property.

in JObject at line 198
boolean setProperties(mixed $properties)

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

Parameters

mixed $properties Either an associative array or another object.

Return Value

boolean

See also

set()

in JObject at line 222
void setError(string $error)

Add an error message.

Parameters

string $error Error message.

Return Value

void

in JObject at line 235
string toString() deprecated

deprecated 12.1 Use magic method __toString()

Return Value

string

See also

__toString()

at line 214
static JBrowser getInstance(string $userAgent = null, string $accept = null)

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

Parameters

string $userAgent The browser string to parse.
string $accept The HTTP_ACCEPT settings to use.

Return Value

JBrowser The Browser object.

at line 231
static _sortMime($a, $b)

Parameters

$a
$b

at line 254
match(string $userAgent = null, string $accept = null)

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

Parameters

string $userAgent The browser string to parse.
string $accept The HTTP_ACCEPT settings to use.

at line 657
string getPlatform()

Return the currently matched platform.

Return Value

string The user's platform.

at line 670
setBrowser(string $browser)

Sets the current browser.

Parameters

string $browser The browser to set as current.

at line 681
string getBrowser()

Retrieve the current browser.

Return Value

string The current browser.

at line 692
integer getMajor()

Retrieve the current browser's major version.

Return Value

integer The current browser's major version

at line 703
integer getMinor()

Retrieve the current browser's minor version.

Return Value

integer The current browser's minor version.

at line 714
string getVersion()

Retrieve the current browser's version.

Return Value

string The current browser's version.

at line 725
string getAgentString()

Return the full browser agent string.

Return Value

string The browser agent string

at line 736
string getHTTPProtocol()

Returns the server protocol in use on the current server.

Return Value

string The HTTP server protocol version.

at line 755
setQuirk(string $quirk, string $value = true)

Set unique behavior for the current browser.

Parameters

string $quirk The behavior to set.
string $value Special behavior parameter.

at line 768
boolean hasQuirk(string $quirk)

Check unique behavior for the current browser.

Parameters

string $quirk The behavior to check.

Return Value

boolean Does the browser have the behavior set?

at line 781
string getQuirk(string $quirk)

Retrieve unique behavior for the current browser.

Parameters

string $quirk The behavior to retrieve.

Return Value

string The value for the requested behavior.

at line 797
setFeature(string $feature, string $value = true)

Set capabilities for the current browser.

Parameters

string $feature The capability to set.
string $value Special capability parameter.

at line 811
boolean hasFeature(string $feature)

Check the current browser capabilities.

Parameters

string $feature The capability to check.

Return Value

boolean Does the browser have the capability set?

at line 824
string getFeature(string $feature)

Retrieve the current browser capability.

Parameters

string $feature The capability to retrieve.

Return Value

string The value of the requested capability.

at line 843
boolean isViewable(string $mimetype)

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.

Parameters

string $mimetype The MIME type to check.

Return Value

boolean True if the browser can display the MIME type.

at line 889
boolean isBrowser(string $browser)

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

Parameters

string $browser The browser to check.

Return Value

boolean Is the given browser the same as the current?

at line 900
boolean isRobot()

Determines if the browser is a robot or not.

Return Value

boolean True if browser is a known robot.

at line 916
boolean isMobile()

Determines if the browser is mobile version or not.

Return Value

boolean True if browser is a known mobile version.

at line 928
isTablet()

at line 937
boolean isMobileApp()

Detects if the system is being accessed through the uKnowva mobile app

Return Value

boolean True if browser is the uknowva mobile app.

at line 946
boolean isSSLConnection()

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

Return Value

boolean True if using SSL, false if not.