Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
Zend_Http_UserAgent_AbstractDevice Class Reference
Inheritance diagram for Zend_Http_UserAgent_AbstractDevice:
Zend_Http_UserAgent_Device Zend_Http_UserAgent_Bot Zend_Http_UserAgent_Desktop Zend_Http_UserAgent_Feed Zend_Http_UserAgent_Mobile Zend_Http_UserAgent_Probe Zend_Http_UserAgent_Spam Zend_Http_UserAgent_Text Zend_Http_UserAgent_Checker Zend_Http_UserAgent_Console Zend_Http_UserAgent_Email Zend_Http_UserAgent_Offline Zend_Http_UserAgent_Validator

Public Member Functions

 __construct ($userAgent=null, array $server=array(), array $config=array())
 
 serialize ()
 
 unserialize ($serialized)
 
 getType ()
 
 hasFeature ($feature)
 
 getFeature ($feature)
 
 setFeature ($feature, $value=false, $group='')
 
 setGroup ($group, $feature)
 
 getGroup ($group)
 
 getAllFeatures ()
 
 getAllGroups ()
 
 getImageFormatSupport ()
 
 getMaxImageHeight ()
 
 getMaxImageWidth ()
 
 getPhysicalScreenHeight ()
 
 getPhysicalScreenWidth ()
 
 getPreferredMarkup ()
 
 getXhtmlSupportLevel ()
 
 hasFlashSupport ()
 
 hasPdfSupport ()
 
 hasPhoneNumber ()
 
 httpsSupport ()
 
 getBrowser ()
 
 getBrowserVersion ()
 
 getUserAgent ()
 
 getImages ()
 
 setBrowser ($browser)
 
 setBrowserVersion ($browserVersion)
 
 setUserAgent ($userAgent)
 
 setImages ($_images)
 

Static Public Member Functions

static extractFromUserAgent ($userAgent)
 
- Static Public Member Functions inherited from Zend_Http_UserAgent_Device
static match ($userAgent, $server)
 

Protected Member Functions

 _restoreFromArray (array $spec)
 
 _defineFeatures ()
 
 _getDefaultFeatures ()
 
 _loadFeaturesAdapter ()
 

Static Protected Member Functions

static _matchAgentAgainstSignatures ($userAgent, $signatures)
 

Protected Attributes

 $_browser = ''
 
 $_browserVersion = ''
 
 $_config
 
 $_userAgent
 
 $_server
 
 $_images
 
 $_aFeatures = array()
 
 $_aGroup = array()
 

Detailed Description

Definition at line 33 of file AbstractDevice.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $userAgent = null,
array  $server = array(),
array  $config = array() 
)

Constructor

Parameters
null | string | array$userAgentIf array, restores from serialized version
array$server
array$config
Returns
void

Implements Zend_Http_UserAgent_Device.

Definition at line 107 of file AbstractDevice.php.

108  {
109  if (is_array($userAgent)) {
110  // Restoring from serialized array
111  $this->_restoreFromArray($userAgent);
112  } else {
113  // Constructing new object
114  $this->setUserAgent($userAgent);
115  $this->_server = $server;
116  $this->_config = $config;
117  $this->_getDefaultFeatures();
118  $this->_defineFeatures();
119  }
120  }
$config
Definition: fraud_order.php:17

Member Function Documentation

◆ _defineFeatures()

_defineFeatures ( )
protected

Look for features

Returns
array|null

Definition at line 172 of file AbstractDevice.php.

173  {
174  $features = $this->_loadFeaturesAdapter();
175 
176  if (is_array($features)) {
177  $this->_aFeatures = array_merge($this->_aFeatures, $features);
178  }
179 
180  return $this->_aFeatures;
181  }

◆ _getDefaultFeatures()

_getDefaultFeatures ( )
protected

Sets all the standard features extracted from the User Agent chain and $this->_server vars

Returns
void

Definition at line 286 of file AbstractDevice.php.

287  {
288  $server = array();
289 
290  // gets info from user agent chain
291  $uaExtract = $this->extractFromUserAgent($this->getUserAgent());
292 
293  if (is_array($uaExtract)) {
294  foreach ($uaExtract as $key => $info) {
295  $this->setFeature($key, $info, 'product_info');
296  }
297  }
298 
299  if (isset($uaExtract['browser_name'])) {
300  $this->_browser = $uaExtract['browser_name'];
301  }
302  if (isset($uaExtract['browser_version'])) {
303  $this->_browserVersion = $uaExtract['browser_version'];
304  }
305  if (isset($uaExtract['device_os'])) {
306  $this->device_os = $uaExtract['device_os_name'];
307  }
308 
309  /* browser & device info */
310  $this->setFeature('is_wireless_device', false, 'product_info');
311  $this->setFeature('is_mobile', false, 'product_info');
312  $this->setFeature('is_desktop', false, 'product_info');
313  $this->setFeature('is_tablet', false, 'product_info');
314  $this->setFeature('is_bot', false, 'product_info');
315  $this->setFeature('is_email', false, 'product_info');
316  $this->setFeature('is_text', false, 'product_info');
317  $this->setFeature('device_claims_web_support', false, 'product_info');
318 
319  $this->setFeature('is_' . strtolower($this->getType()), true, 'product_info');
320 
321  /* sets the browser name */
322  if (isset($this->list) && empty($this->_browser)) {
323  $lowerUserAgent = strtolower($this->getUserAgent());
324  foreach ($this->list as $browser_signature) {
325  if (strpos($lowerUserAgent, $browser_signature) !== false) {
326  $this->_browser = strtolower($browser_signature);
327  $this->setFeature('browser_name', $this->_browser, 'product_info');
328  }
329  }
330  }
331 
332  /* sets the client IP */
333  if (isset($this->_server['remote_addr'])) {
334  $this->setFeature('client_ip', $this->_server['remote_addr'], 'product_info');
335  } elseif (isset($this->_server['http_x_forwarded_for'])) {
336  $this->setFeature('client_ip', $this->_server['http_x_forwarded_for'], 'product_info');
337  } elseif (isset($this->_server['http_client_ip'])) {
338  $this->setFeature('client_ip', $this->_server['http_client_ip'], 'product_info');
339  }
340 
341  /* sets the server infos */
342  if (isset($this->_server['server_software'])) {
343  if (strpos($this->_server['server_software'], 'Apache') !== false || strpos($this->_server['server_software'], 'LiteSpeed') !== false) {
344  $server['version'] = 1;
345  if (strpos($this->_server['server_software'], 'Apache/2') !== false) {
346  $server['version'] = 2;
347  }
348  $server['server'] = 'apache';
349  }
350 
351  if (strpos($this->_server['server_software'], 'Microsoft-IIS') !== false) {
352  $server['server'] = 'iis';
353  }
354 
355  if (strpos($this->_server['server_software'], 'Unix') !== false) {
356  $server['os'] = 'unix';
357  if (isset($_ENV['MACHTYPE'])) {
358  if (strpos($_ENV['MACHTYPE'], 'linux') !== false) {
359  $server['os'] = 'linux';
360  }
361  }
362  } elseif (strpos($this->_server['server_software'], 'Win') !== false) {
363  $server['os'] = 'windows';
364  }
365 
366  if (preg_match('/Apache\/([0-9\.]*)/', $this->_server['server_software'], $arr)) {
367  if ($arr[1]) {
368  $server['version'] = $arr[1];
369  $server['server'] = 'apache';
370  }
371  }
372  }
373 
374  $this->setFeature('php_version', phpversion(), 'server_info');
375  if (isset($server['server'])) {
376  $this->setFeature('server_os', $server['server'], 'server_info');
377  }
378  if (isset($server['version'])) {
379  $this->setFeature('server_os_version', $server['version'], 'server_info');
380  }
381  if (isset($this->_server['http_accept'])) {
382  $this->setFeature('server_http_accept', $this->_server['http_accept'], 'server_info');
383  }
384  if (isset($this->_server['http_accept_language'])) {
385  $this->setFeature('server_http_accept_language', $this->_server['http_accept_language'], 'server_info');
386  }
387  if (isset($this->_server['server_addr'])) {
388  $this->setFeature('server_ip', $this->_server['server_addr'], 'server_info');
389  }
390  if (isset($this->_server['server_name'])) {
391  $this->setFeature('server_name', $this->_server['server_name'], 'server_info');
392  }
393  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
foreach( $_productCollection as $_product)() ?>" class $info
Definition: listing.phtml:52
setFeature($feature, $value=false, $group='')

◆ _loadFeaturesAdapter()

_loadFeaturesAdapter ( )
protected

Loads the Features Adapter if it's defined in the $config array Otherwise, nothing is done

Parameters
string$browserTypeBrowser type
Returns
array

Definition at line 764 of file AbstractDevice.php.

765  {
767  $browserType = $this->getType();
768  if (!isset($config[$browserType]) || !isset($config[$browserType]['features'])) {
769  return array();
770  }
771  $config = $config[$browserType]['features'];
772 
773  if (empty($config['classname'])) {
774  #require_once 'Zend/Http/UserAgent/Exception.php';
775  throw new Zend_Http_UserAgent_Exception('The ' . $this->getType() . ' features adapter must have a "classname" config parameter defined');
776  }
777 
778  $className = $config['classname'];
779  if (!class_exists($className)) {
780  if (isset($config['path'])) {
781  $path = $config['path'];
782  } else {
783  #require_once 'Zend/Http/UserAgent/Exception.php';
784  throw new Zend_Http_UserAgent_Exception('The ' . $this->getType() . ' features adapter must have a "path" config parameter defined');
785  }
786 
787  if (false === include_once ($path)) {
788  #require_once 'Zend/Http/UserAgent/Exception.php';
789  throw new Zend_Http_UserAgent_Exception('The ' . $this->getType() . ' features adapter path that does not exist');
790  }
791  }
792 
793  return call_user_func(array($className, 'getFromRequest'), $this->_server, $this->_config);
794  }
$config
Definition: fraud_order.php:17
if($currentSelectedMethod==$_code) $className
Definition: form.phtml:31

◆ _matchAgentAgainstSignatures()

static _matchAgentAgainstSignatures (   $userAgent,
  $signatures 
)
staticprotected

Match a user agent string against a list of signatures

Parameters
string$userAgent
array$signatures
Returns
bool

Definition at line 984 of file AbstractDevice.php.

985  {
986  $userAgent = strtolower($userAgent);
987  foreach ($signatures as $signature) {
988  if (!empty($signature)) {
989  if (strpos($userAgent, $signature) !== false) {
990  // Browser signature was found in user agent string
991  return true;
992  }
993  }
994  }
995  return false;
996  }

◆ _restoreFromArray()

_restoreFromArray ( array  $spec)
protected

Restore object state from array

Parameters
array$spec
Returns
void

Definition at line 158 of file AbstractDevice.php.

159  {
160  foreach ($spec as $key => $value) {
161  if (property_exists($this, $key)) {
162  $this->{$key} = $value;
163  }
164  }
165  }
$value
Definition: gender.phtml:16

◆ extractFromUserAgent()

static extractFromUserAgent (   $userAgent)
static

Extract and sets informations from the User Agent chain

Parameters
string$userAgentUser Agent chain
Returns
array
See also
http://www.texsoft.it/index.php?c=software&m=sw.php.useragent&l=it

Security level

windows

Definition at line 401 of file AbstractDevice.php.

402  {
403  $userAgent = trim($userAgent);
404 
408  $pattern = "(([^/\s]*)(/(\S*))?)(\s*\[[a-zA-Z][a-zA-Z]\])?\s*(\\((([^()]|(\\([^()]*\\)))*)\\))?\s*";
409  preg_match("#^$pattern#", $userAgent, $match);
410 
411  $comment = array();
412  if (isset($match[7])) {
413  $comment = explode(';', $match[7]);
414  }
415 
416  // second part if exists
417  $end = substr($userAgent, strlen($match[0]));
418  if (!empty($end)) {
419  $result['others']['full'] = $end;
420  }
421 
422  $match2 = array();
423  if (isset($result['others'])) {
424  preg_match_all('/(([^\/\s]*)(\/)?([^\/\(\)\s]*)?)(\s\((([^\)]*)*)\))?/i', $result['others']['full'], $match2);
425  }
426  $result['user_agent'] = trim($match[1]);
427  $result['product_name'] = isset($match[2]) ? trim($match[2]) : '';
428  $result['browser_name'] = $result['product_name'];
429  if (isset($match[4]) && trim($match[4])) {
430  $result['product_version'] = trim($match[4]);
431  $result['browser_version'] = trim($match[4]);
432  }
433  if (count($comment) && !empty($comment[0])) {
434  $result['comment']['full'] = trim($match[7]);
435  $result['comment']['detail'] = $comment;
436  $result['compatibility_flag'] = trim($comment[0]);
437  if (isset($comment[1])) {
438  $result['browser_token'] = trim($comment[1]);
439  }
440  if (isset($comment[2])) {
441  $result['device_os_token'] = trim($comment[2]);
442  }
443  }
444  if (empty($result['device_os_token']) && !empty($result['compatibility_flag'])) {
445  // some browsers do not have a platform token
446  $result['device_os_token'] = $result['compatibility_flag'];
447  }
448  if ($match2) {
449  $i = 0;
450  $max = count($match2[0]);
451  for ($i = 0; $i < $max; $i ++) {
452  if (!empty($match2[0][$i])) {
453  $result['others']['detail'][] = array(
454  $match2[0][$i],
455  $match2[2][$i],
456  $match2[4][$i],
457  );
458  }
459  }
460  }
461 
463  $security = array(
464  'N' => 'no security',
465  'U' => 'strong security',
466  'I' => 'weak security',
467  );
468  if (!empty($result['browser_token'])) {
469  if (isset($security[$result['browser_token']])) {
470  $result['security_level'] = $security[$result['browser_token']];
471  unset($result['browser_token']);
472  }
473  }
474 
475  $product = strtolower($result['browser_name']);
476 
477  // Mozilla : true && false
478  $compatibleOrIe = false;
479  if (isset($result['compatibility_flag']) && isset($result['comment'])) {
480  $compatibleOrIe = ($result['compatibility_flag'] == 'compatible' || strpos($result['comment']['full'], "MSIE") !== false);
481  }
482  if ($product == 'mozilla' && $compatibleOrIe) {
483  if (!empty($result['browser_token'])) {
484  // Classic Mozilla chain
485  preg_match_all('/([^\/\s].*)(\/|\s)(.*)/i', $result['browser_token'], $real);
486  } else {
487  // MSIE specific chain with 'Windows' compatibility flag
488  foreach ($result['comment']['detail'] as $v) {
489  if (strpos($v, 'MSIE') !== false) {
490  $real[0][1] = trim($v);
491  $result['browser_engine'] = "MSIE";
492  $real[1][0] = "Internet Explorer";
493  $temp = explode(' ', trim($v));
494  $real[3][0] = $temp[1];
495 
496  }
497  if (strpos($v, 'Win') !== false) {
498  $result['device_os_token'] = trim($v);
499  }
500  }
501  }
502 
503  if (!empty($real[0])) {
504  $result['browser_name'] = $real[1][0];
505  $result['browser_version'] = $real[3][0];
506  } else {
507  if(isset($result['browser_token'])) {
508  $result['browser_name'] = $result['browser_token'];
509  }
510  $result['browser_version'] = '??';
511  }
512  } elseif ($product == 'mozilla' && isset($result['browser_version'])
513  && $result['browser_version'] < 5.0
514  ) {
515  // handles the real Mozilla (or old Netscape if version < 5.0)
516  $result['browser_name'] = 'Netscape';
517  }
518 
520  if ($result['browser_name'] == 'MSIE') {
521  $result['browser_engine'] = 'MSIE';
522  $result['browser_name'] = 'Internet Explorer';
523  }
524  if (isset($result['device_os_token'])) {
525  if (strpos($result['device_os_token'], 'Win') !== false) {
526 
527  $windows = array(
528  'Windows NT 6.1' => 'Windows 7',
529  'Windows NT 6.0' => 'Windows Vista',
530  'Windows NT 5.2' => 'Windows Server 2003',
531  'Windows NT 5.1' => 'Windows XP',
532  'Windows NT 5.01' => 'Windows 2000 SP1',
533  'Windows NT 5.0' => 'Windows 2000',
534  'Windows NT 4.0' => 'Microsoft Windows NT 4.0',
535  'WinNT' => 'Microsoft Windows NT 4.0',
536  'Windows 98; Win 9x 4.90' => 'Windows Me',
537  'Windows 98' => 'Windows 98',
538  'Win98' => 'Windows 98',
539  'Windows 95' => 'Windows 95',
540  'Win95' => 'Windows 95',
541  'Windows CE' => 'Windows CE',
542  );
543  if (isset($windows[$result['device_os_token']])) {
544  $result['device_os_name'] = $windows[$result['device_os_token']];
545  } else {
546  $result['device_os_name'] = $result['device_os_token'];
547  }
548  }
549  }
550 
551  // iphone
552  $apple_device = array(
553  'iPhone',
554  'iPod',
555  'iPad',
556  );
557  if (isset($result['compatibility_flag'])) {
558  if (in_array($result['compatibility_flag'], $apple_device)) {
559  $result['device'] = strtolower($result['compatibility_flag']);
560  $result['device_os_token'] = 'iPhone OS';
561  if (isset($comment[3])) {
562  $result['browser_language'] = trim($comment[3]);
563  }
564  if (isset($result['others']['detail'][1])) {
565  $result['browser_version'] = $result['others']['detail'][1][2];
566  } elseif (isset($result['others']['detail']) && count($result['others']['detail'])) {
567  $result['browser_version'] = $result['others']['detail'][0][2];
568  }
569  if (!empty($result['others']['detail'][2])) {
570  $result['firmware'] = $result['others']['detail'][2][2];
571  }
572  if (!empty($result['others']['detail'][3])) {
573  $result['browser_name'] = $result['others']['detail'][3][1];
574  $result['browser_build'] = $result['others']['detail'][3][2];
575  }
576  }
577  }
578 
579  // Safari
580  if (isset($result['others'])) {
581  if ($result['others']['detail'][0][1] == 'AppleWebKit') {
582  $result['browser_engine'] = 'AppleWebKit';
583  if (isset($result['others']['detail'][1]) && $result['others']['detail'][1][1] == 'Version') {
584  $result['browser_version'] = $result['others']['detail'][1][2];
585  } else {
586  $result['browser_version'] = $result['others']['detail'][count($result['others']['detail']) - 1][2];
587  }
588  if (isset($comment[3])) {
589  $result['browser_language'] = trim($comment[3]);
590  }
591 
592  $last = $result['others']['detail'][count($result['others']['detail']) - 1][1];
593 
594  if (empty($result['others']['detail'][2][1]) || $result['others']['detail'][2][1] == 'Safari') {
595  if (isset($result['others']['detail'][1])) {
596  $result['browser_name'] = ($result['others']['detail'][1][1] && $result['others']['detail'][1][1] != 'Version' ? $result['others']['detail'][1][1] : 'Safari');
597  $result['browser_version'] = ($result['others']['detail'][1][2] ? $result['others']['detail'][1][2] : $result['others']['detail'][0][2]);
598  } else {
599  $result['browser_name'] = ($result['others']['detail'][0][1] && $result['others']['detail'][0][1] != 'Version' ? $result['others']['detail'][0][1] : 'Safari');
600  $result['browser_version'] = $result['others']['detail'][0][2];
601  }
602  } else {
603  $result['browser_name'] = $result['others']['detail'][2][1];
604  $result['browser_version'] = $result['others']['detail'][2][2];
605 
606  // mobile version
607  if ($result['browser_name'] == 'Mobile') {
608  $result['browser_name'] = 'Safari ' . $result['browser_name'];
609  if ($result['others']['detail'][1][1] == 'Version') {
610  $result['browser_version'] = $result['others']['detail'][1][2];
611  }
612  }
613  }
614 
615  // For Safari < 2.2, AppleWebKit version gives the Safari version
616  if (strpos($result['browser_version'], '.') > 2 || (int) $result['browser_version'] > 20) {
617  $temp = explode('.', $result['browser_version']);
618  $build = (int) $temp[0];
619  $awkVersion = array(
620  48 => '0.8',
621  73 => '0.9',
622  85 => '1.0',
623  103 => '1.1',
624  124 => '1.2',
625  300 => '1.3',
626  400 => '2.0',
627  );
628  foreach ($awkVersion as $k => $v) {
629  if ($build >= $k) {
630  $result['browser_version'] = $v;
631  }
632  }
633  }
634  }
635 
636  // Gecko (Firefox or compatible)
637  if ($result['others']['detail'][0][1] == 'Gecko') {
638  $searchRV = true;
639  if (!empty($result['others']['detail'][1][1]) && !empty($result['others']['detail'][count($result['others']['detail']) - 1][2]) || strpos(strtolower($result['others']['full']), 'opera') !== false) {
640  $searchRV = false;
641  $result['browser_engine'] = $result['others']['detail'][0][1];
642 
643  // the name of the application is at the end indepenently
644  // of quantity of information in $result['others']['detail']
645  $last = count($result['others']['detail']) - 1;
646 
647  // exception : if the version of the last information is
648  // empty we take the previous one
649  if (empty($result['others']['detail'][$last][2])) {
650  $last --;
651  }
652 
653  // exception : if the last one is 'Red Hat' or 'Debian' =>
654  // use rv: to find browser_version */
655  if (in_array($result['others']['detail'][$last][1], array(
656  'Debian',
657  'Hat',
658  ))) {
659  $searchRV = true;
660  }
661  $result['browser_name'] = $result['others']['detail'][$last][1];
662  $result['browser_version'] = $result['others']['detail'][$last][2];
663  if (isset($comment[4])) {
664  $result['browser_build'] = trim($comment[4]);
665  }
666  if (isset($comment[3])) {
667  $result['browser_language'] = trim($comment[3]);
668  }
669 
670  // Netscape
671  if ($result['browser_name'] == 'Navigator' || $result['browser_name'] == 'Netscape6') {
672  $result['browser_name'] = 'Netscape';
673  }
674  }
675  if ($searchRV) {
676  // Mozilla alone : the version is identified by rv:
677  $result['browser_name'] = 'Mozilla';
678  if (isset($result['comment']['detail'])) {
679  foreach ($result['comment']['detail'] as $rv) {
680  if (strpos($rv, 'rv:') !== false) {
681  $result['browser_version'] = trim(str_replace('rv:', '', $rv));
682  }
683  }
684  }
685  }
686  }
687 
688  // Netscape
689  if ($result['others']['detail'][0][1] == 'Netscape') {
690  $result['browser_name'] = 'Netscape';
691  $result['browser_version'] = $result['others']['detail'][0][2];
692  }
693 
694  // Opera
695  // Opera: engine Presto
696  if ($result['others']['detail'][0][1] == 'Presto') {
697  $result['browser_engine'] = 'Presto';
698  if (!empty($result['others']['detail'][1][2])) {
699  $result['browser_version'] = $result['others']['detail'][1][2];
700  }
701  }
702 
703  // UA ends with 'Opera X.XX' or 'Opera/X.XX'
704  if ($result['others']['detail'][0][1] == 'Opera') {
705  $result['browser_name'] = $result['others']['detail'][0][1];
706  // Opera X.XX
707  if (isset($result['others']['detail'][1][1])) {
708  $result['browser_version'] = $result['others']['detail'][1][1];
709  // Opera/X.XX
710  } elseif (isset($result['others']['detail'][0][2])) {
711  $result['browser_version'] = $result['others']['detail'][0][2];
712  }
713  }
714 
715  // Opera Mini
716  if (isset($result["browser_token"])) {
717  if (strpos($result["browser_token"], 'Opera Mini') !== false) {
718  $result['browser_name'] = 'Opera Mini';
719  }
720  }
721 
722  // Symbian
723  if ($result['others']['detail'][0][1] == 'SymbianOS') {
724  $result['device_os_token'] = 'SymbianOS';
725  }
726  }
727 
728  // UA ends with 'Opera X.XX'
729  if (isset($result['browser_name']) && isset($result['browser_engine'])) {
730  if ($result['browser_name'] == 'Opera' && $result['browser_engine'] == 'Gecko' && empty($result['browser_version'])) {
731  $result['browser_version'] = $result['others']['detail'][count($result['others']['detail']) - 1][1];
732  }
733  }
734 
735  // cleanup
736  if (isset($result['browser_version']) && isset($result['browser_build'])) {
737  if ($result['browser_version'] == $result['browser_build']) {
738  unset($result['browser_build']);
739  }
740  }
741 
742  // compatibility
743  $compatibility['AppleWebKit'] = 'Safari';
744  $compatibility['Gecko'] = 'Firefox';
745  $compatibility['MSIE'] = 'Internet Explorer';
746  $compatibility['Presto'] = 'Opera';
747  if (!empty($result['browser_engine'])) {
748  if (isset($compatibility[$result['browser_engine']])) {
749  $result['browser_compatibility'] = $compatibility[$result['browser_engine']];
750  }
751  }
752 
753  ksort($result);
754  return $result;
755  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
$pattern
Definition: website.php:22
$i
Definition: gallery.phtml:31

◆ getAllFeatures()

getAllFeatures ( )

Gets all the browser/device features

Returns
array

Implements Zend_Http_UserAgent_Device.

Definition at line 265 of file AbstractDevice.php.

◆ getAllGroups()

getAllGroups ( )

Gets all the browser/device features' groups

Returns
array

Implements Zend_Http_UserAgent_Device.

Definition at line 275 of file AbstractDevice.php.

276  {
277  return $this->_aGroup;
278  }

◆ getBrowser()

getBrowser ( )

Get the browser type

Returns
string

Implements Zend_Http_UserAgent_Device.

Definition at line 911 of file AbstractDevice.php.

◆ getBrowserVersion()

getBrowserVersion ( )

Get the browser version

Returns
string

Implements Zend_Http_UserAgent_Device.

Definition at line 921 of file AbstractDevice.php.

◆ getFeature()

getFeature (   $feature)

Gets the value of the current browser/device feature

Parameters
string$featureFeature to search
Returns
string|null

Implements Zend_Http_UserAgent_Device.

Definition at line 207 of file AbstractDevice.php.

208  {
209  if ($this->hasFeature($feature)) {
210  return $this->_aFeatures[$feature];
211  }
212  }

◆ getGroup()

getGroup (   $group)

Gets an array of features associated to a group

Parameters
string$groupGroup param
Returns
array

Implements Zend_Http_UserAgent_Device.

Definition at line 255 of file AbstractDevice.php.

256  {
257  return $this->_aGroup[$group];
258  }
$group
Definition: sections.phtml:16

◆ getImageFormatSupport()

getImageFormatSupport ( )

Retrieve image format support

Returns
array

Implements Zend_Http_UserAgent_Device.

Definition at line 801 of file AbstractDevice.php.

802  {
803  return $this->_images;
804  }

◆ getImages()

getImages ( )
Returns
the $_images

Implements Zend_Http_UserAgent_Device.

Definition at line 939 of file AbstractDevice.php.

940  {
941  return $this->_images;
942  }

◆ getMaxImageHeight()

getMaxImageHeight ( )

Get maximum image height supported by this device

Returns
int

Implements Zend_Http_UserAgent_Device.

Definition at line 811 of file AbstractDevice.php.

812  {
813  return null;
814  }

◆ getMaxImageWidth()

getMaxImageWidth ( )

Get maximum image width supported by this device

Returns
int

Implements Zend_Http_UserAgent_Device.

Definition at line 821 of file AbstractDevice.php.

822  {
823  return null;
824  }

◆ getPhysicalScreenHeight()

getPhysicalScreenHeight ( )

Get physical screen height of this device

Returns
int

Implements Zend_Http_UserAgent_Device.

Definition at line 831 of file AbstractDevice.php.

832  {
833  return null;
834  }

◆ getPhysicalScreenWidth()

getPhysicalScreenWidth ( )

Get physical screen width of this device

Returns
int

Implements Zend_Http_UserAgent_Device.

Definition at line 841 of file AbstractDevice.php.

842  {
843  return null;
844  }

◆ getPreferredMarkup()

getPreferredMarkup ( )

Get preferred markup type

Returns
string

Implements Zend_Http_UserAgent_Device.

Definition at line 851 of file AbstractDevice.php.

852  {
853  return 'xhtml';
854  }

◆ getType()

getType ( )
abstract

Gets the browser type identifier

Returns
string

◆ getUserAgent()

getUserAgent ( )

Get the user agent string

Returns
string

Implements Zend_Http_UserAgent_Device.

Definition at line 931 of file AbstractDevice.php.

◆ getXhtmlSupportLevel()

getXhtmlSupportLevel ( )

Get supported X/HTML version

Returns
int

Implements Zend_Http_UserAgent_Device.

Definition at line 861 of file AbstractDevice.php.

862  {
863  return 4;
864  }

◆ hasFeature()

hasFeature (   $feature)

Check a feature for the current browser/device.

Parameters
string$featureThe feature to check.
Returns
bool

Implements Zend_Http_UserAgent_Device.

Definition at line 196 of file AbstractDevice.php.

197  {
198  return (isset($this->_aFeatures[$feature]) && !is_null($this->_aFeatures[$feature]));
199  }

◆ hasFlashSupport()

hasFlashSupport ( )

Does the device support Flash?

Returns
bool

Implements Zend_Http_UserAgent_Device.

Definition at line 871 of file AbstractDevice.php.

872  {
873  return true;
874  }

◆ hasPdfSupport()

hasPdfSupport ( )

Does the device support PDF?

Returns
bool

Implements Zend_Http_UserAgent_Device.

Definition at line 881 of file AbstractDevice.php.

882  {
883  return true;
884  }

◆ hasPhoneNumber()

hasPhoneNumber ( )

Does the device have a phone number associated with it?

Returns
bool

Implements Zend_Http_UserAgent_Device.

Definition at line 891 of file AbstractDevice.php.

892  {
893  return false;
894  }

◆ httpsSupport()

httpsSupport ( )

Does the device support HTTPS?

Returns
bool

Implements Zend_Http_UserAgent_Device.

Definition at line 901 of file AbstractDevice.php.

902  {
903  return true;
904  }

◆ serialize()

serialize ( )

Serialize object

Returns
string

Definition at line 127 of file AbstractDevice.php.

128  {
129  $spec = array(
130  '_aFeatures' => $this->_aFeatures,
131  '_aGroup' => $this->_aGroup,
132  '_browser' => $this->_browser,
133  '_browserVersion' => $this->_browserVersion,
134  '_userAgent' => $this->_userAgent,
135  '_images' => $this->_images,
136  );
137  return serialize($spec);
138  }

◆ setBrowser()

setBrowser (   $browser)
Parameters
string$browser

Definition at line 947 of file AbstractDevice.php.

948  {
949  $this->_browser = $browser;
950  }

◆ setBrowserVersion()

setBrowserVersion (   $browserVersion)
Parameters
string$browserVersion

Definition at line 955 of file AbstractDevice.php.

956  {
957  $this->_browserVersion = $browserVersion;
958  }

◆ setFeature()

setFeature (   $feature,
  $value = false,
  $group = '' 
)

Set a feature for the current browser/device.

Parameters
string$featureThe feature to set.
string$value(option) feature value.
string$group(option) Group to associate with the feature
Returns
Zend_Http_UserAgent_AbstractDevice

Definition at line 222 of file AbstractDevice.php.

223  {
224  $this->_aFeatures[$feature] = $value;
225  if (!empty($group)) {
226  $this->setGroup($group, $feature);
227  }
228  return $this;
229  }
$group
Definition: sections.phtml:16
$value
Definition: gender.phtml:16

◆ setGroup()

setGroup (   $group,
  $feature 
)

Affects a feature to a group

Parameters
string$groupGroup name
string$featureFeature name
Returns
Zend_Http_UserAgent_AbstractDevice

Definition at line 238 of file AbstractDevice.php.

239  {
240  if (!isset($this->_aGroup[$group])) {
241  $this->_aGroup[$group] = array();
242  }
243  if (!in_array($feature, $this->_aGroup[$group])) {
244  $this->_aGroup[$group][] = $feature;
245  }
246  return $this;
247  }
$group
Definition: sections.phtml:16

◆ setImages()

setImages (   $_images)
Parameters
array$_images

Definition at line 972 of file AbstractDevice.php.

973  {
974  $this->_images = $_images;
975  }

◆ setUserAgent()

setUserAgent (   $userAgent)
Parameters
string$userAgent

Definition at line 963 of file AbstractDevice.php.

964  {
965  $this->_userAgent = $userAgent;
966  return $this;
967  }

◆ unserialize()

unserialize (   $serialized)

Unserialize

Parameters
string$serialized
Returns
void

Definition at line 146 of file AbstractDevice.php.

147  {
148  $spec = unserialize($serialized);
149  $this->_restoreFromArray($spec);
150  }

Field Documentation

◆ $_aFeatures

$_aFeatures = array()
protected

Definition at line 90 of file AbstractDevice.php.

◆ $_aGroup

$_aGroup = array()
protected

Definition at line 97 of file AbstractDevice.php.

◆ $_browser

$_browser = ''
protected

Definition at line 41 of file AbstractDevice.php.

◆ $_browserVersion

$_browserVersion = ''
protected

Definition at line 48 of file AbstractDevice.php.

◆ $_config

$_config
protected

Definition at line 55 of file AbstractDevice.php.

◆ $_images

$_images
protected
Initial value:
= array(
'jpeg',
'gif',
'png',
'pjpeg',
'x-png',
'bmp',
)

Definition at line 76 of file AbstractDevice.php.

◆ $_server

$_server
protected

Definition at line 69 of file AbstractDevice.php.

◆ $_userAgent

$_userAgent
protected

Definition at line 62 of file AbstractDevice.php.


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