Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de la classe Browser

Fonctions membres publiques

 __construct ($userAgent=null, $accept=null)
 
 match ($userAgent=null, $accept=null)
 
 getPlatform ()
 
 setBrowser ($browser)
 
 getBrowser ()
 
 getMajor ()
 
 getMinor ()
 
 getVersion ()
 
 getAgentString ()
 
 getHTTPProtocol ()
 
 isViewable ($mimetype)
 
 isBrowser ($browser)
 
 isRobot ()
 
 isMobile ()
 

Fonctions membres publiques statiques

static getInstance ($userAgent=null, $accept=null)
 

Fonctions membres protégées

 _setPlatform ()
 
 identifyBrowserVersion ()
 

Attributs protégés

 $majorVersion = 0
 
 $minorVersion = 0
 
 $browser = ''
 
 $agent = ''
 
 $lowerAgent = ''
 
 $accept = ''
 
 $acceptParsed = array()
 
 $platform = ''
 
 $robots
 
 $mobile = false
 
 $images = array('jpeg', 'gif', 'png', 'pjpeg', 'x-png', 'bmp')
 

Attributs protégés statiques

static $instances = array()
 

Description détaillée

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.

Depuis
1.7.0

Documentation des constructeurs et destructeur

◆ __construct()

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

Create a browser instance (constructor).

Paramètres
string$userAgentThe browser string to parse.
string$acceptThe HTTP_ACCEPT settings to use.
Depuis
1.7.0

Documentation des fonctions membres

◆ _setPlatform()

_setPlatform ( )
protected

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.

Renvoie
void
Depuis
1.7.0

Références elseif.

◆ getAgentString()

getAgentString ( )

Return the full browser agent string.

Renvoie
string The browser agent string
Depuis
1.7.0

◆ getBrowser()

getBrowser ( )

Retrieve the current browser.

Renvoie
string The current browser.
Depuis
1.7.0

◆ getHTTPProtocol()

getHTTPProtocol ( )

Returns the server protocol in use on the current server.

Renvoie
string The HTTP server protocol version.
Depuis
1.7.0

◆ getInstance()

static getInstance (   $userAgent = null,
  $accept = null 
)
static

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

Paramètres
string$userAgentThe browser string to parse.
string$acceptThe HTTP_ACCEPT settings to use.
Renvoie
Browser The Browser object.
Depuis
1.7.0
Exemples:
C:/laragon/www/_install/Joomla_422-Stable-Full_Package_French_v1/libraries/src/HTML/HTMLHelper.php.

Référencé par BannersHelper\getList(), et HTMLHelper\includeRelativeFiles().

◆ getMajor()

getMajor ( )

Retrieve the current browser's major version.

Renvoie
integer The current browser's major version
Depuis
1.7.0

◆ getMinor()

getMinor ( )

Retrieve the current browser's minor version.

Renvoie
integer The current browser's minor version.
Depuis
1.7.0

Références $minorVersion.

◆ getPlatform()

getPlatform ( )

Return the currently matched platform.

Renvoie
string The user's platform.
Depuis
1.7.0

◆ getVersion()

getVersion ( )

Retrieve the current browser's version.

Renvoie
string The current browser's version.
Depuis
1.7.0

Références $minorVersion.

◆ identifyBrowserVersion()

identifyBrowserVersion ( )
protected

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

Renvoie
void
Depuis
1.7.0

Références $version.

◆ isBrowser()

isBrowser (   $browser)

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

Paramètres
string$browserThe browser to check.
Renvoie
boolean Is the given browser the same as the current?
Depuis
1.7.0

◆ isMobile()

isMobile ( )

Determines if the browser is mobile version or not.

Renvoie
boolean True if browser is a known mobile version.
Depuis
1.7.0

◆ isRobot()

isRobot ( )

Determines if the browser is a robot or not.

Renvoie
boolean True if browser is a known robot.
Depuis
1.7.0

◆ isViewable()

isViewable (   $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.

Paramètres
string$mimetypeThe MIME type to check.
Renvoie
boolean True if the browser can display the MIME type.
Depuis
1.7.0

Références $type.

◆ match()

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

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

Paramètres
string$userAgentThe browser string to parse.
string$acceptThe HTTP_ACCEPT settings to use.
Renvoie
void
Depuis
1.7.0

We have to check for Edge as the first browser, because Edge has something like: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3738.0 Safari/537.36 Edg/75.0.107.0

Références $version, et elseif.

◆ setBrowser()

setBrowser (   $browser)

Sets the current browser.

Paramètres
string$browserThe browser to set as current.
Renvoie
void
Depuis
1.7.0

Documentation des champs

◆ $accept

$accept = ''
protected

◆ $acceptParsed

$acceptParsed = array()
protected

◆ $agent

$agent = ''
protected

◆ $browser

$browser = ''
protected

◆ $images

$images = array('jpeg', 'gif', 'png', 'pjpeg', 'x-png', 'bmp')
protected

◆ $instances

$instances = array()
staticprotected

◆ $lowerAgent

$lowerAgent = ''
protected

◆ $majorVersion

$majorVersion = 0
protected

◆ $minorVersion

$minorVersion = 0
protected

◆ $mobile

$mobile = false
protected

◆ $platform

$platform = ''
protected

◆ $robots

$robots
protected

La documentation de cette classe a été générée à partir du fichier suivant :