Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
Zend_Http_UserAgent Class Reference
Inheritance diagram for Zend_Http_UserAgent:

Public Member Functions

 __construct ($options=null)
 
 serialize ()
 
 unserialize ($serialized)
 
 setOptions ($options)
 
 getUserAgent ()
 
 setUserAgent ($userAgent)
 
 getHttpAccept ($httpAccept=null)
 
 setHttpAccept ($httpAccept)
 
 getStorage ($browser=null)
 
 setStorage (Zend_Http_UserAgent_Storage $storage)
 
 clearStorage ($browser=null)
 
 getConfig ()
 
 setConfig ($config=array())
 
 getDevice ()
 
 getBrowserType ()
 
 setBrowserType ($browserType)
 
 getServer ()
 
 setServer ($server)
 
 getServerValue ($key)
 
 setServerValue ($key, $value)
 
 setPluginLoader ($type, $loader)
 
 getPluginLoader ($type)
 

Data Fields

const DEFAULT_IDENTIFICATION_SEQUENCE = 'mobile,desktop'
 
const DEFAULT_PERSISTENT_STORAGE_ADAPTER = 'Session'
 
const DEFAULT_BROWSER_TYPE = 'desktop'
 
const DEFAULT_HTTP_USER_AGENT = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)'
 
const DEFAULT_HTTP_ACCEPT = "application/xhtml+xml"
 
const DEFAULT_MARKUP_LANGUAGE = "xhtml"
 

Protected Member Functions

 _match ($deviceClass)
 
 _getUserAgentDevice ($browserType)
 
 _validateLoaderType ($type)
 
 _matchUserAgent ()
 
 _createDevice ()
 

Protected Attributes

 $_browserType
 
 $_browserTypeClass = array()
 
 $_config
 
 $_device
 
 $_immutable = false
 
 $_loaders = array()
 
 $_loaderTypes = array('storage', 'device')
 
 $_matchLog = array()
 
 $_server
 
 $_storage
 

Detailed Description

Definition at line 37 of file UserAgent.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $options = null)

Constructor

Parameters
null | array | Zend_Config | ArrayAccess$options
Returns
void

Definition at line 160 of file UserAgent.php.

161  {
162  if (null !== $options) {
163  $this->setOptions($options);
164  }
165  }
setOptions($options)
Definition: UserAgent.php:217

Member Function Documentation

◆ _createDevice()

_createDevice ( )
protected

Creates device object instance

Returns
void

Definition at line 847 of file UserAgent.php.

848  {
849  $browserType = $this->getBrowserType();
850  $classname = $this->_getUserAgentDevice($browserType);
851  $this->_device = new $classname($this->getUserAgent(), $this->getServer(), $this->getConfig());
852  }
_getUserAgentDevice($browserType)
Definition: UserAgent.php:312

◆ _getUserAgentDevice()

_getUserAgentDevice (   $browserType)
protected

Loads class for a user agent device

Parameters
string$browserTypeBrowser type
Returns
string
Exceptions
Zend_Loader_PluginLoader_Exceptionif unable to load UA device

Definition at line 312 of file UserAgent.php.

313  {
314  $browserType = strtolower($browserType);
315  if (isset($this->_browserTypeClass[$browserType])) {
316  return $this->_browserTypeClass[$browserType];
317  }
318 
319  if (isset($this->_config[$browserType])
320  && isset($this->_config[$browserType]['device'])
321  ) {
322  $deviceConfig = $this->_config[$browserType]['device'];
323  if (is_array($deviceConfig) && isset($deviceConfig['classname'])) {
324  $device = (string) $deviceConfig['classname'];
325  if (!class_exists($device)) {
326  #require_once 'Zend/Http/UserAgent/Exception.php';
327  throw new Zend_Http_UserAgent_Exception(sprintf(
328  'Invalid classname "%s" provided in device configuration for browser type "%s"',
329  $device,
330  $browserType
331  ));
332  }
333  } elseif (is_array($deviceConfig) && isset($deviceConfig['path'])) {
334  $loader = $this->getPluginLoader('device');
335  $path = $deviceConfig['path'];
336  $prefix = isset($deviceConfig['prefix']) ? $deviceConfig['prefix'] : 'Zend_Http_UserAgent';
337  $loader->addPrefixPath($prefix, $path);
338 
339  $device = $loader->load($browserType);
340  } else {
341  $loader = $this->getPluginLoader('device');
342  $device = $loader->load($browserType);
343  }
344  } else {
345  $loader = $this->getPluginLoader('device');
346  $device = $loader->load($browserType);
347  }
348 
349  $this->_browserTypeClass[$browserType] = $device;
350 
351  return $device;
352  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
$loader
Definition: autoload.php:8
$prefix
Definition: name.phtml:25

◆ _match()

_match (   $deviceClass)
protected

Comparison of the UserAgent chain and browser signatures.

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

Parameters
string$deviceClassName of class against which a match will be attempted
Returns
bool

Definition at line 284 of file UserAgent.php.

285  {
286  // Validate device class
287  $r = new ReflectionClass($deviceClass);
288  if (!$r->implementsInterface('Zend_Http_UserAgent_Device')) {
289  throw new Zend_Http_UserAgent_Exception(sprintf(
290  'Invalid device class provided ("%s"); must implement Zend_Http_UserAgent_Device',
291  $deviceClass
292  ));
293  }
294 
295  $userAgent = $this->getUserAgent();
296 
297  // Call match method on device class
298  return call_user_func(
299  array($deviceClass, 'match'),
300  $userAgent,
301  $this->getServer()
302  );
303  }

◆ _matchUserAgent()

_matchUserAgent ( )
protected

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

Returns
Zend_Http_UserAgent_Result

Definition at line 804 of file UserAgent.php.

805  {
807 
808  // If we have no identification sequence, just return the default type
809  if (empty($this->_config['identification_sequence'])) {
810  return $type;
811  }
812 
813  // Get sequence against which to match
814  $sequence = explode(',', $this->_config['identification_sequence']);
815 
816  // If a browser type is already configured, push that to the front of the list
817  if (null !== ($browserType = $this->getBrowserType())) {
818  array_unshift($sequence, $browserType);
819  }
820 
821  // Append the default browser type to the list if not alread in the list
822  if (!in_array($type, $sequence)) {
823  $sequence[] = $type;
824  }
825 
826  // Test each type until we find a match
827  foreach ($sequence as $browserType) {
828  $browserType = trim($browserType);
829  $className = $this->_getUserAgentDevice($browserType);
830 
831  // Attempt to match this device class
832  if ($this->_match($className)) {
833  $type = $browserType;
834  $this->_browserTypeClass[$type] = $className;
835  break;
836  }
837  }
838 
839  return $type;
840  }
_getUserAgentDevice($browserType)
Definition: UserAgent.php:312
_match($deviceClass)
Definition: UserAgent.php:284
$type
Definition: item.phtml:13
const DEFAULT_BROWSER_TYPE
Definition: UserAgent.php:52
if($currentSelectedMethod==$_code) $className
Definition: form.phtml:31

◆ _validateLoaderType()

_validateLoaderType (   $type)
protected

Validate a plugin loader type

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

Parameters
string$type
Returns
string
Exceptions
Zend_Http_UserAgent_Exceptionon invalid type

Definition at line 782 of file UserAgent.php.

783  {
784  $type = strtolower($type);
785  if (!in_array($type, $this->_loaderTypes)) {
786  $types = implode(', ', $this->_loaderTypes);
787 
788  #require_once 'Zend/Http/UserAgent/Exception.php';
789  throw new Zend_Http_UserAgent_Exception(sprintf(
790  'Expected one of "%s" for plugin loader type; received "%s"',
791  $types,
792  (string) $type
793  ));
794  }
795  return $type;
796  }
$type
Definition: item.phtml:13

◆ clearStorage()

clearStorage (   $browser = null)

Clean the persistent storage

Parameters
string$browserBrowser identifier (User Agent chain)
Returns
void

Definition at line 469 of file UserAgent.php.

470  {
471  $this->getStorage($browser)->clear();
472  }
getStorage($browser=null)
Definition: UserAgent.php:422

◆ getBrowserType()

getBrowserType ( )

Retrieve the browser type

Returns
string $browserType

Definition at line 578 of file UserAgent.php.

579  {
580  return $this->_browserType;
581  }

◆ getConfig()

getConfig ( )

Get user configuration

Returns
array

Definition at line 479 of file UserAgent.php.

480  {
481  return $this->_config;
482  }

◆ getDevice()

getDevice ( )

Returns the device object

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

Returns
Zend_Http_UserAgent_Device $device

Definition at line 539 of file UserAgent.php.

540  {
541  if (null !== $this->_device) {
542  return $this->_device;
543  }
544 
545  $userAgent = $this->getUserAgent();
546 
547  // search an existing identification in the session
548  $storage = $this->getStorage($userAgent);
549 
550  if (!$storage->isEmpty()) {
551  // If the user agent and features are already existing, the
552  // Zend_Http_UserAgent object is serialized in the session
553  $object = $storage->read();
554  $this->unserialize($object);
555  } else {
556  // Otherwise, the identification is made and stored in the session.
557  // Find the browser type:
558  $this->setBrowserType($this->_matchUserAgent());
559  $this->_createDevice();
560 
561  // put the result in storage:
562  $this->getStorage($userAgent)
563  ->write($this->serialize());
564  }
565 
566  // Mark the object as immutable
567  $this->_immutable = true;
568 
569  // Return the device instance
570  return $this->_device;
571  }
getStorage($browser=null)
Definition: UserAgent.php:422
setBrowserType($browserType)
Definition: UserAgent.php:589
unserialize($serialized)
Definition: UserAgent.php:192

◆ getHttpAccept()

getHttpAccept (   $httpAccept = null)

Returns the HTTP Accept server param

Parameters
string$httpAccept(option) forced HTTP Accept chain
Returns
string

Definition at line 390 of file UserAgent.php.

391  {
392  if (null === ($accept = $this->getServerValue('http_accept'))) {
393  $accept = self::DEFAULT_HTTP_ACCEPT;
394  $this->setHttpAccept($accept);
395  }
396  return $accept;
397  }
setHttpAccept($httpAccept)
Definition: UserAgent.php:405
const DEFAULT_HTTP_ACCEPT
Definition: UserAgent.php:62

◆ getPluginLoader()

getPluginLoader (   $type)

Get a plugin loader

Parameters
string$typeA valid plugin loader type; see $_loaderTypes
Returns
Zend_Loader_PluginLoader

Definition at line 762 of file UserAgent.php.

763  {
764  $type = $this->_validateLoaderType($type);
765  if (!isset($this->_loaders[$type])) {
766  #require_once 'Zend/Loader/PluginLoader.php';
767  $this->setPluginLoader($type, new Zend_Loader_PluginLoader());
768  }
769  return $this->_loaders[$type];
770  }
_validateLoaderType($type)
Definition: UserAgent.php:782
$type
Definition: item.phtml:13
setPluginLoader($type, $loader)
Definition: UserAgent.php:714

◆ getServer()

getServer ( )

Retrieve 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
array

Definition at line 613 of file UserAgent.php.

614  {
615  if (null === $this->_server) {
616  $this->setServer($_SERVER);
617  }
618  return $this->_server;
619  }

◆ getServerValue()

getServerValue (   $key)

Retrieve a server value

Parameters
string$key
Returns
mixed

Definition at line 673 of file UserAgent.php.

674  {
675  $key = strtolower($key);
676  $server = $this->getServer();
677  $return = null;
678  if (isset($server[$key])) {
679  $return = $server[$key];
680  }
681  unset($server);
682  return $return;
683  }

◆ getStorage()

getStorage (   $browser = null)

Returns 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
string$browserBrowser identifier (User Agent chain)
Returns
Zend_Http_UserAgent_Storage

Definition at line 422 of file UserAgent.php.

423  {
424  if (null === $browser) {
425  $browser = $this->getUserAgent();
426  }
427  if (null === $this->_storage) {
428  $config = $this->_config['storage'];
429  $adapter = $config['adapter'];
430  if (!class_exists($adapter)) {
431  $loader = $this->getPluginLoader('storage');
432  $adapter = $loader->load($adapter);
433  $loader = $this->getPluginLoader('storage');
434  }
435  $options = array('browser_type' => $browser);
436  if (isset($config['options'])) {
437  $options = array_merge($options, $config['options']);
438  }
439  $this->setStorage(new $adapter($options));
440  }
441  return $this->_storage;
442  }
$config
Definition: fraud_order.php:17
$loader
Definition: autoload.php:8
$adapter
Definition: webapi_user.php:16
setStorage(Zend_Http_UserAgent_Storage $storage)
Definition: UserAgent.php:450

◆ getUserAgent()

getUserAgent ( )

Returns the User Agent value

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

Returns
string

Definition at line 362 of file UserAgent.php.

363  {
364  if (null === ($ua = $this->getServerValue('http_user_agent'))) {
366  $this->setUserAgent($ua);
367  }
368 
369  return $ua;
370  }
setUserAgent($userAgent)
Definition: UserAgent.php:378
const DEFAULT_HTTP_USER_AGENT
Definition: UserAgent.php:57

◆ serialize()

serialize ( )

Serialized representation of the object

Returns
string

Definition at line 172 of file UserAgent.php.

173  {
174  $device = $this->getDevice();
175  $spec = array(
176  'browser_type' => $this->_browserType,
177  'config' => $this->_config,
178  'device_class' => get_class($device),
179  'device' => $device->serialize(),
180  'user_agent' => $this->getServerValue('http_user_agent'),
181  'http_accept' => $this->getServerValue('http_accept'),
182  );
183  return serialize($spec);
184  }

◆ setBrowserType()

setBrowserType (   $browserType)

Set the browser "type"

Parameters
string$browserType
Returns
Zend_Http_UserAgent

Definition at line 589 of file UserAgent.php.

590  {
591  if ($this->_immutable) {
592  #require_once 'Zend/Http/UserAgent/Exception.php';
594  'The User-Agent device object has already been retrieved; the browser type is now immutable'
595  );
596  }
597 
598  $this->_browserType = $browserType;
599  return $this;
600  }

◆ setConfig()

setConfig (   $config = array())

Config 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
mixed$config(option) Config array
Returns
Zend_Http_UserAgent

Definition at line 503 of file UserAgent.php.

504  {
505  if ($config instanceof Zend_Config) {
506  $config = $config->toArray();
507  }
508 
509  // Verify that Config parameters are in an array.
510  if (!is_array($config) && !$config instanceof Traversable) {
511  #require_once 'Zend/Http/UserAgent/Exception.php';
512  throw new Zend_Http_UserAgent_Exception(sprintf(
513  'Config parameters must be in an array or a Traversable object; received "%s"',
514  (is_object($config) ? get_class($config) : gettype($config))
515  ));
516  }
517 
518  if ($config instanceof Traversable) {
519  $tmp = array();
520  foreach ($config as $key => $value) {
521  $tmp[$key] = $value;
522  }
523  $config = $tmp;
524  unset($tmp);
525  }
526 
527  $this->_config = array_merge($this->_config, $config);
528  return $this;
529  }
$config
Definition: fraud_order.php:17
$value
Definition: gender.phtml:16

◆ setHttpAccept()

setHttpAccept (   $httpAccept)

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

Parameters
string$httpAcceptForced HTTP Accept chain
Returns
Zend_Http_UserAgent

Definition at line 405 of file UserAgent.php.

406  {
407  $this->setServerValue('http_accept', $httpAccept);
408  return $this;
409  }
setServerValue($key, $value)
Definition: UserAgent.php:692

◆ setOptions()

setOptions (   $options)

Configure instance

Parameters
array | Zend_Config | ArrayAccess$options
Returns
Zend_Http_UserAgent

Definition at line 217 of file UserAgent.php.

218  {
219  if ($options instanceof Zend_Config) {
220  $options = $options->toArray();
221  }
222 
223  if (!is_array($options)
224  && !$options instanceof ArrayAccess
225  && !$options instanceof Traversable
226  ) {
227  #require_once 'Zend/Http/UserAgent/Exception.php';
228  throw new Zend_Http_UserAgent_Exception(sprintf(
229  'Invalid argument; expected array, Zend_Config object, or object implementing ArrayAccess and Traversable; received %s',
230  (is_object($options) ? get_class($options) : gettype($options))
231  ));
232  }
233 
234  // Set $_SERVER first
235  if (isset($options['server'])) {
236  $this->setServer($options['server']);
237  unset($options['server']);
238  }
239 
240  // Get plugin loaders sorted
241  if (isset($options['plugin_loader'])) {
242  $plConfig = $options['plugin_loader'];
243  if (is_array($plConfig) || $plConfig instanceof Traversable) {
244  foreach ($plConfig as $type => $class) {
245  $this->setPluginLoader($type, $class);
246  }
247  }
248  unset($plConfig, $options['plugin_loader']);
249  }
250 
251  // And then loop through the remaining options
252  $config = array();
253  foreach ($options as $key => $value) {
254  switch (strtolower($key)) {
255  case 'browser_type':
256  $this->setBrowserType($value);
257  break;
258  case 'http_accept':
259  $this->setHttpAccept($value);
260  break;
261  case 'user_agent':
262  $this->setUserAgent($value);
263  break;
264  default:
265  // Cache remaining options for $_config
266  $config[$key] = $value;
267  break;
268  }
269  }
270  $this->setConfig($config);
271 
272  return $this;
273  }
setConfig($config=array())
Definition: UserAgent.php:503
setHttpAccept($httpAccept)
Definition: UserAgent.php:405
$config
Definition: fraud_order.php:17
setUserAgent($userAgent)
Definition: UserAgent.php:378
$type
Definition: item.phtml:13
setPluginLoader($type, $loader)
Definition: UserAgent.php:714
$_option $_optionId $class
Definition: date.phtml:13
$value
Definition: gender.phtml:16
setBrowserType($browserType)
Definition: UserAgent.php:589

◆ setPluginLoader()

setPluginLoader (   $type,
  $loader 
)

Set plugin loader

Parameters
string$typeType of plugin loader; one of 'storage', (?)
string | Zend_Loader_PluginLoader$loader
Returns
Zend_Http_UserAgent

Definition at line 714 of file UserAgent.php.

715  {
716  $type = $this->_validateLoaderType($type);
717 
718  if (is_string($loader)) {
719  if (!class_exists($loader)) {
720  #require_once 'Zend/Loader.php';
722  }
723  $loader = new $loader();
724  } elseif (!is_object($loader)) {
725  #require_once 'Zend/Http/UserAgent/Exception.php';
726  throw new Zend_Http_UserAgent_Exception(sprintf(
727  'Expected a plugin loader class or object; received %s',
728  gettype($loader)
729  ));
730  }
731  if (!$loader instanceof Zend_Loader_PluginLoader) {
732  #require_once 'Zend/Http/UserAgent/Exception.php';
733  throw new Zend_Http_UserAgent_Exception(sprintf(
734  'Expected an object extending Zend_Loader_PluginLoader; received %s',
735  get_class($loader)
736  ));
737  }
738 
739  $basePrefix = 'Zend_Http_UserAgent_';
740  $basePath = 'Zend/Http/UserAgent/';
741  switch ($type) {
742  case 'storage':
743  $prefix = $basePrefix . 'Storage';
744  $path = $basePath . 'Storage';
745  break;
746  case 'device':
747  $prefix = $basePrefix;
748  $path = $basePath;
749  break;
750  }
751  $loader->addPrefixPath($prefix, $path);
752  $this->_loaders[$type] = $loader;
753  return $this;
754  }
_validateLoaderType($type)
Definition: UserAgent.php:782
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
static loadClass($class, $dirs=null)
Definition: Loader.php:52
$loader
Definition: autoload.php:8
$type
Definition: item.phtml:13
$prefix
Definition: name.phtml:25

◆ setServer()

setServer (   $server)

Set the "$_SERVER" array

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

Parameters
array | ArrayAccess$server
Returns
void
Exceptions
Zend_Http_UserAgent_Exceptionon invalid parameter

Definition at line 631 of file UserAgent.php.

632  {
633  if ($this->_immutable) {
634  #require_once 'Zend/Http/UserAgent/Exception.php';
636  'The User-Agent device object has already been retrieved; the server array is now immutable'
637  );
638  }
639 
640  if (!is_array($server) && !$server instanceof Traversable) {
641  #require_once 'Zend/Http/UserAgent/Exception.php';
642  throw new Zend_Http_UserAgent_Exception(sprintf(
643  'Expected an array or object implementing Traversable; received %s',
644  (is_object($server) ? get_class($server) : gettype($server))
645  ));
646  }
647 
648  // Get an array if we don't have one
649  if ($server instanceof ArrayObject) {
650  $server = $server->getArrayCopy();
651  } elseif ($server instanceof Traversable) {
652  $tmp = array();
653  foreach ($server as $key => $value) {
654  $tmp[$key] = $value;
655  }
656  $server = $tmp;
657  unset($tmp);
658  }
659 
660  // Normalize key case
661  $server = array_change_key_case($server, CASE_LOWER);
662 
663  $this->_server = $server;
664  return $this;
665  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
$value
Definition: gender.phtml:16

◆ setServerValue()

setServerValue (   $key,
  $value 
)

Set a server value

Parameters
string | int | float$key
mixed$value
Returns
void

Definition at line 692 of file UserAgent.php.

693  {
694  if ($this->_immutable) {
695  #require_once 'Zend/Http/UserAgent/Exception.php';
697  'The User-Agent device object has already been retrieved; the server array is now immutable'
698  );
699  }
700 
701  $server = $this->getServer(); // ensure it's been initialized
702  $key = strtolower($key);
703  $this->_server[$key] = $value;
704  return $this;
705  }
$value
Definition: gender.phtml:16

◆ setStorage()

setStorage ( Zend_Http_UserAgent_Storage  $storage)

Sets the persistent storage handler

Parameters
Zend_Http_UserAgent_Storage$storage
Returns
Zend_Http_UserAgent

Definition at line 450 of file UserAgent.php.

451  {
452  if ($this->_immutable) {
453  #require_once 'Zend/Http/UserAgent/Exception.php';
455  'The User-Agent device object has already been retrieved; the storage object is now immutable'
456  );
457  }
458 
459  $this->_storage = $storage;
460  return $this;
461  }

◆ setUserAgent()

setUserAgent (   $userAgent)

Force or replace the UA chain in $_server variable

Parameters
string$userAgentForced UserAgent chain
Returns
Zend_Http_UserAgent

Definition at line 378 of file UserAgent.php.

379  {
380  $this->setServerValue('http_user_agent', $userAgent);
381  return $this;
382  }
setServerValue($key, $value)
Definition: UserAgent.php:692

◆ unserialize()

unserialize (   $serialized)

Unserialize a previous representation of the object

Parameters
string$serialized
Returns
void

Definition at line 192 of file UserAgent.php.

193  {
194  $spec = unserialize($serialized);
195 
196  $this->setOptions($spec);
197 
198  // Determine device class and ensure the class is loaded
199  $deviceClass = $spec['device_class'];
200  if (!class_exists($deviceClass)) {
201  $this->_getUserAgentDevice($this->getBrowserType());
202  }
203 
204  // Get device specification and instantiate
205  $deviceSpec = unserialize($spec['device']);
206  $deviceSpec['_config'] = $this->getConfig();
207  $deviceSpec['_server'] = $this->getServer();
208  $this->_device = new $deviceClass($deviceSpec);
209  }
_getUserAgentDevice($browserType)
Definition: UserAgent.php:312
setOptions($options)
Definition: UserAgent.php:217
unserialize($serialized)
Definition: UserAgent.php:192

Field Documentation

◆ $_browserType

$_browserType
protected

Definition at line 74 of file UserAgent.php.

◆ $_browserTypeClass

$_browserTypeClass = array()
protected

Definition at line 83 of file UserAgent.php.

◆ $_config

$_config
protected
Initial value:
= array(
'identification_sequence' => self::DEFAULT_IDENTIFICATION_SEQUENCE,
'storage' => array(
'adapter' => self::DEFAULT_PERSISTENT_STORAGE_ADAPTER,
),
)

Definition at line 93 of file UserAgent.php.

◆ $_device

$_device
protected

Definition at line 105 of file UserAgent.php.

◆ $_immutable

$_immutable = false
protected

Definition at line 119 of file UserAgent.php.

◆ $_loaders

$_loaders = array()
protected

Definition at line 125 of file UserAgent.php.

◆ $_loaderTypes

$_loaderTypes = array('storage', 'device')
protected

Definition at line 131 of file UserAgent.php.

◆ $_matchLog

$_matchLog = array()
protected

Definition at line 138 of file UserAgent.php.

◆ $_server

$_server
protected

Definition at line 145 of file UserAgent.php.

◆ $_storage

$_storage
protected

Definition at line 152 of file UserAgent.php.

◆ DEFAULT_BROWSER_TYPE

const DEFAULT_BROWSER_TYPE = 'desktop'

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

Definition at line 52 of file UserAgent.php.

◆ DEFAULT_HTTP_ACCEPT

const DEFAULT_HTTP_ACCEPT = "application/xhtml+xml"

Default Http Accept param to prevent empty value

Definition at line 62 of file UserAgent.php.

◆ DEFAULT_HTTP_USER_AGENT

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

Default User Agent chain to prevent empty value

Definition at line 57 of file UserAgent.php.

◆ DEFAULT_IDENTIFICATION_SEQUENCE

const DEFAULT_IDENTIFICATION_SEQUENCE = 'mobile,desktop'

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

Definition at line 42 of file UserAgent.php.

◆ DEFAULT_MARKUP_LANGUAGE

const DEFAULT_MARKUP_LANGUAGE = "xhtml"

Default markup language

Definition at line 67 of file UserAgent.php.

◆ DEFAULT_PERSISTENT_STORAGE_ADAPTER

const DEFAULT_PERSISTENT_STORAGE_ADAPTER = 'Session'

Default persitent storage adapter : Session or NonPersitent

Definition at line 47 of file UserAgent.php.


The documentation for this class was generated from the following file: