Http/UserAgent.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Http_UserAgent
- Subpackage
- UserAgent
Package: Zend_Http_UserAgent\UserAgentLists of User Agent chains for testing :
- http://www.useragentstring.com/layout/useragentstring.php
- http://user-agent-string.info/list-of-ua
- http://www.user-agents.org/allagents.xml
- http://en.wikipedia.org/wiki/List_of_user_agents_for_mobile_phones
- http://www.mobilemultimedia.be/fr/
- Implements
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants
Properties



bool $_immutable = falseWhether or not this instance is immutable.
If true, none of the following may be modified:
- $_server
- $_browserType
- User-Agent (defined in $_server)
- HTTP Accept value (defined in $_server)
- $_storage
Default valuefalseDetails- Type
- bool



array $_loaderTypes = array('storage', 'device')Valid plugin loader types
Default valuearray('storage', 'device')Details- Type
- array



array $_matchLog = array()Trace of items matched to identify the browser type
Default valuearray()Details- Type
- array
Methods



_getUserAgentDevice(string $browserType) : stringLoads class for a user agent device
Parameters| Name | Type | Description |
|---|
| $browserType | string | Browser type |
|---|
ReturnsThrows 


_match(string $deviceClass) : boolComparison of the UserAgent chain and browser signatures.
The comparison is case-insensitive : the browser signatures must be in lower
case
Parameters| Name | Type | Description |
|---|
| $deviceClass | string | Name of class against which a match will be attempted |
|---|
Returns


_validateLoaderType(string $type) : stringValidate a plugin loader type
Verifies that it is in {@link $_loaderTypes}, and returns a normalized
version of the type.
Parameters| Name | Type | Description |
|---|
| $type | string | |
|---|
ReturnsThrows


clearStorage(string $browser = null) : voidClean the persistent storage
Parameters| Name | Type | Description |
|---|
| $browser | string | Browser identifier (User Agent chain) |
|---|



getBrowserType() : stringRetrieve the browser type
Returns| Type | Description |
|---|
| string | $browserType |



getDevice() : \Zend_Http_UserAgent_DeviceReturns the device object
This is the object that will contain the various discovered device
capabilities.
Returns


getHttpAccept(string $httpAccept = null) : stringReturns the HTTP Accept server param
Parameters| Name | Type | Description |
|---|
| $httpAccept | string | (option) forced HTTP Accept chain |
|---|
Returns 


getPluginLoader(string $type) : \Zend_Loader_PluginLoaderParameters| Name | Type | Description |
|---|
| $type | string | A valid plugin loader type; see {@link $_loaderTypes} |
|---|
Returns 


getServer() : arrayRetrieve the "$_SERVER" array
Basically, the $_SERVER array or an equivalent container storing the
data that will be introspected.
If the value has not been previously set, it sets itself from the
$_SERVER superglobal.
Returns


getStorage(string $browser = null) : \Zend_Http_UserAgent_StorageReturns the persistent storage handler
Session storage is used by default unless a different storage adapter
has been set via the "persistent_storage_adapter" key. That key should
contain either a fully qualified class name, or a short name that
resolves via the plugin loader.
Parameters| Name | Type | Description |
|---|
| $browser | string | Browser identifier (User Agent chain) |
|---|
Returns


getUserAgent() : stringReturns the User Agent value
If $userAgent param is null, the value of $_server['HTTP_USER_AGENT'] is
returned.
Returns


setConfig(mixed $config = array()) : \Zend_Http_UserAgentConfig parameters is an Array or a Zend_Config object
The allowed parameters are :
- the identification sequence (can be empty) => desktop browser type is the
default browser type returned
$config['identification_sequence'] : ',' separated browser types
- the persistent storage adapter
$config['persistent_storage_adapter'] = "Session" or "NonPersistent"
- to add or replace a browser type device
$config[(type)]['device']['path']
$config[(type)]['device']['classname']
- to add or replace a browser type features adapter
$config[(type)]['features']['path']
$config[(type)]['features']['classname']
Parameters| Name | Type | Description |
|---|
| $config | mixed | (option) Config array |
|---|
Returns


setHttpAccept(string $httpAccept) : \Zend_Http_UserAgentForce or replace the HTTP_ACCEPT chain in self::$_server variable
Parameters| Name | Type | Description |
|---|
| $httpAccept | string | Forced HTTP Accept chain |
|---|
Returns 


setUserAgent(string $userAgent) : \Zend_Http_UserAgentForce or replace the UA chain in $_server variable
Parameters| Name | Type | Description |
|---|
| $userAgent | string | Forced UserAgent chain |
|---|
Returns 


unserialize(string $serialized) : voidUnserialize a previous representation of the object
Parameters| Name | Type | Description |
|---|
| $serialized | string | |
|---|