Lists of User Agent chains for testing :

category Zend
package Zend_Http_UserAgent
subpackage UserAgent
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License

 Methods

Constructor

__construct(null|array|\Zend_Config|\ArrayAccess $options = null) : void

Parameters

$options

nullarray\Zend_Config\ArrayAccess

Clean the persistent storage

clearStorage(string $browser = null) : void

Parameters

$browser

string

Browser identifier (User Agent chain)

Retrieve the browser type

getBrowserType() : string

Returns

string$browserType

Get user configuration

getConfig() : array

Returns

array

Returns the device object

getDevice() : \Zend_Http_UserAgent_Device

This is the object that will contain the various discovered device capabilities.

Returns

\Zend_Http_UserAgent_Device$device

Returns the HTTP Accept server param

getHttpAccept(string $httpAccept = null) : string

Parameters

$httpAccept

string

(option) forced HTTP Accept chain

Returns

string

Get a plugin loader

getPluginLoader(string $type) : \Zend_Loader_PluginLoader

Parameters

$type

string

A valid plugin loader type; see {@link $_loaderTypes}

Returns

\Zend_Loader_PluginLoader

Retrieve the "$_SERVER" array

getServer() : 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

array

Retrieve a server value

getServerValue(string $key) : mixed

Parameters

$key

string

Returns

mixed

Returns the persistent storage handler

getStorage(string $browser = null) : \Zend_Http_UserAgent_Storage

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

$browser

string

Browser identifier (User Agent chain)

Returns

\Zend_Http_UserAgent_Storage

Returns the User Agent value

getUserAgent() : string

If $userAgent param is null, the value of $_server['HTTP_USER_AGENT'] is returned.

Returns

string

Serialized representation of the object

serialize() : string

Returns

string

Set the browser "type"

setBrowserType(string $browserType) : \Zend_Http_UserAgent

Parameters

$browserType

string

Returns

\Zend_Http_UserAgent

Config parameters is an Array or a Zend_Config object

setConfig(mixed $config = array()) : \Zend_Http_UserAgent

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

$config

mixed

(option) Config array

Returns

\Zend_Http_UserAgent

Force or replace the HTTP_ACCEPT chain in self::$_server variable

setHttpAccept(string $httpAccept) : \Zend_Http_UserAgent

Parameters

$httpAccept

string

Forced HTTP Accept chain

Returns

\Zend_Http_UserAgent

Configure instance

setOptions(array|\Zend_Config|\ArrayAccess $options) : \Zend_Http_UserAgent

Parameters

$options

array\Zend_Config\ArrayAccess

Returns

\Zend_Http_UserAgent

Set plugin loader

setPluginLoader(string $type, string|\Zend_Loader_PluginLoader $loader) : \Zend_Http_UserAgent

Parameters

$type

string

Type of plugin loader; one of 'storage', (?)

$loader

string\Zend_Loader_PluginLoader

Returns

\Zend_Http_UserAgent

Set the "$_SERVER" array

setServer(array|\ArrayAccess $server) : void

Basically, the $_SERVER array or an equivalent container storing the data that will be introspected.

Parameters

$server

array\ArrayAccess

Exceptions

\Zend_Http_UserAgent_Exception on invalid parameter

Set a server value

setServerValue(string|integer|float $key, mixed $value) : void

Parameters

$key

stringintegerfloat

$value

mixed

Sets the persistent storage handler

setStorage(\Zend_Http_UserAgent_Storage $storage) : \Zend_Http_UserAgent

Parameters

$storage

\Zend_Http_UserAgent_Storage

Returns

\Zend_Http_UserAgent

Force or replace the UA chain in $_server variable

setUserAgent(string $userAgent) : \Zend_Http_UserAgent

Parameters

$userAgent

string

Forced UserAgent chain

Returns

\Zend_Http_UserAgent

Unserialize a previous representation of the object

unserialize(string $serialized) : void

Parameters

$serialized

string

Creates device object instance

_createDevice() : void

Loads class for a user agent device

_getUserAgentDevice(string $browserType) : string

Parameters

$browserType

string

Browser type

Exceptions

\Zend_Loader_PluginLoader_Exception if unable to load UA device

Returns

string

Comparison of the UserAgent chain and browser signatures.

_match(string $deviceClass) : boolean

The comparison is case-insensitive : the browser signatures must be in lower case

Parameters

$deviceClass

string

Name of class against which a match will be attempted

Returns

boolean

Run the identification sequence to match the right browser type according to the user agent

_matchUserAgent() : \Zend_Http_UserAgent_Result

Returns

\Zend_Http_UserAgent_Result

Validate a plugin loader type

_validateLoaderType(string $type) : string

Verifies that it is in \$_loaderTypes, and returns a normalized version of the type.

Parameters

$type

string

Exceptions

\Zend_Http_UserAgent_Exception on invalid type

Returns

string

 Properties

 

Browser type

$_browserType : string

Default

 

Browser type class

$_browserTypeClass : array

Default

array()

Map of browser types to classes.

 

Array to store config

$_config : array

Default

array('identification_sequence' => self::DEFAULT_IDENTIFICATION_SEQUENCE, 'storage' => array('adapter' => self::DEFAULT_PERSISTENT_STORAGE_ADAPTER))

Default values are provided to ensure specific keys are present at instantiation.

 

Identified device

$_device : \Zend_Http_UserAgent_Device

Default

 

Whether or not this instance is immutable.

$_immutable : boolean

Default

false

If true, none of the following may be modified:

  • $_server
  • $_browserType
  • User-Agent (defined in $_server)
  • HTTP Accept value (defined in $_server)
  • $_storage
 

Valid plugin loader types

$_loaderTypes : array

Default

array('storage', 'device')
 

Plugin loaders

$_loaders : array

Default

array()
 

Trace of items matched to identify the browser type

$_matchLog : array

Default

array()
 

Server variable

$_server : array

Default

 

Persistent storage handler

$_storage : \Zend_Http_UserAgent_Storage

Default

 Constants

 

'desktop' by default if the sequence return false for each item

DEFAULT_BROWSER_TYPE = 'desktop' 
 

Default Http Accept param to prevent empty value

DEFAULT_HTTP_ACCEPT = "application/xhtml+xml" 
 

Default User Agent chain to prevent empty value

DEFAULT_HTTP_USER_AGENT = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)' 
 

'desktop' by default if the sequence return false for each item or is empty

DEFAULT_IDENTIFICATION_SEQUENCE = 'mobile,desktop' 
 

Default markup language

DEFAULT_MARKUP_LANGUAGE = "xhtml" 
 

Default persitent storage adapter : Session or NonPersitent

DEFAULT_PERSISTENT_STORAGE_ADAPTER = 'Session'