Browser
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 |
1.7.0 |
---|---|
package |
Joomla CMS |
Methods
__construct
Create a browser instance (constructor).
__construct(string userAgent = null, string accept = null) : mixed
since |
1.7.0 |
---|
Arguments
- userAgent
string
The browser string to parse.- accept
string
The HTTP_ACCEPT settings to use.
Response
mixed
_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 |
1.7.0 |
---|
getAgentString
Return the full browser agent string.
getAgentString() : string
since |
1.7.0 |
---|
Response
string
The browser agent string
getBrowser
Retrieve the current browser.
getBrowser() : string
since |
1.7.0 |
---|
Response
string
The current browser.
getHTTPProtocol
Returns the server protocol in use on the current server.
getHTTPProtocol() : string
since |
1.7.0 |
---|
Response
string
The 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) : \Joomla\CMS\Environment\Browser
since |
1.7.0 |
---|
Arguments
- userAgent
string
The browser string to parse.- accept
string
The HTTP_ACCEPT settings to use.
Response
\Joomla\CMS\Environment\Browser
The Browser object.
getMajor
Retrieve the current browser's major version.
getMajor() : int
since |
1.7.0 |
---|
Response
int
The current browser's major version
getMinor
Retrieve the current browser's minor version.
getMinor() : int
since |
1.7.0 |
---|
Response
int
The current browser's minor version.
getPlatform
Return the currently matched platform.
getPlatform() : string
since |
1.7.0 |
---|
Response
string
The user's platform.
getVersion
Retrieve the current browser's version.
getVersion() : string
since |
1.7.0 |
---|
Response
string
The 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 |
1.7.0 |
---|
isBrowser
Determine if the given browser is the same as the current.
isBrowser(string browser) : bool
since |
1.7.0 |
---|
Arguments
- browser
string
The browser to check.
Response
bool
Is the given browser the same as the current?
isMobile
Determines if the browser is mobile version or not.
isMobile() : bool
since |
1.7.0 |
---|
Response
bool
True if browser is a known mobile version.
isRobot
Determines if the browser is a robot or not.
isRobot() : bool
since |
1.7.0 |
---|
Response
bool
True if browser is a known robot.
isViewable
Determines if a browser can display a given MIME type.
isViewable(string mimetype) : bool
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 |
1.7.0 |
---|
Arguments
- mimetype
string
The MIME type to check.
Response
bool
True 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 |
1.7.0 |
---|
Arguments
- userAgent
string
The browser string to parse.- accept
string
The HTTP_ACCEPT settings to use.
setBrowser
Sets the current browser.
setBrowser(string browser) : void
since |
1.7.0 |
---|
Arguments
- browser
string
The browser to set as current.
Properties
images
List of viewable image MIME subtypes.