TeraWurflUserAgentMatchers
[ class tree: TeraWurflUserAgentMatchers ] [ index: TeraWurflUserAgentMatchers ] [ all elements ]

Source for file MSIEUserAgentMatcher.php

Documentation is available at MSIEUserAgentMatcher.php

  1. <?php
  2. /**
  3.  * Tera_WURFL - PHP MySQL driven WURFL
  4.  * 
  5.  * Tera-WURFL was written by Steve Kamerman, and is based on the
  6.  * Java WURFL Evolution package by Luca Passani and WURFL PHP Tools by Andrea Trassati.
  7.  * This version uses a MySQL database to store the entire WURFL file, multiple patch
  8.  * files, and a persistent caching mechanism to provide extreme performance increases.
  9.  * 
  10.  * @package TeraWurflUserAgentMatchers
  11.  * @author Steve Kamerman <stevekamerman AT gmail.com>
  12.  * @version Stable 2.1.3 $Date: 2010/09/18 15:43:21
  13.  * @license http://www.mozilla.org/MPL/ MPL Vesion 1.1
  14.  */
  15. /**
  16.  * Provides a specific user agent matching technique
  17.  * @package TeraWurflUserAgentMatchers
  18.  */
  19.     
  20.     public static $constantIDs array("msie","msie_4","msie_5","msie_5_5","msie_6","msie_7","msie_8");
  21.     
  22.     public function __construct(TeraWurfl $wurfl){
  23.         parent::__construct($wurfl);
  24.     }
  25.     public function applyConclusiveMatch($ua{
  26.         $matches array();
  27.         if(preg_match('/^Mozilla\/4\.0 \(compatible; MSIE (\d)\.(\d);/',$ua,$matches)){
  28.             if(TeraWurflConfig::$SIMPLE_DESKTOP_ENGINE_ENABLE){
  29.                 return WurflConstants::$GENERIC_WEB_BROWSER;
  30.             }
  31.             switch($matches[1]){
  32.                 // cases are intentionally out of sequnce for performance
  33.                 case 7:
  34.                     return 'msie_7';
  35.                     break;
  36.                 case 8:
  37.                     return 'msie_8';
  38.                     break;
  39.                 case 6:
  40.                     return 'msie_6';
  41.                     break;
  42.                 case 4:
  43.                     return 'msie_4';
  44.                     break;
  45.                 case 5:
  46.                     return ($matches[2]==5)'msie_5_5''msie_5';
  47.                     break;
  48.                 default:
  49.                     return 'msie';
  50.                     break;
  51.             }
  52.         }
  53.         $ua preg_replace('/( \.NET CLR [\d\.]+;?| Media Center PC [\d\.]+;?| OfficeLive[a-zA-Z0-9\.\d]+;?| InfoPath[\.\d]+;?)/','',$ua);
  54.         $tolerance UserAgentUtils::firstSlash($ua);
  55.         $this->wurfl->toLog("Applying ".get_class($this)." Conclusive Match: RIS with threshold $tolerance",LOG_INFO);
  56.         return $this->risMatch($ua$tolerance);
  57.     }
  58.     public function recoveryMatch($ua){
  59.         if(self::contains($ua,array(
  60.             'SLCC1',
  61.             'Media Center PC',
  62.             '.NET CLR',
  63.             'OfficeLiveConnector'
  64.           ))){
  65.             return WurflConstants::$GENERIC_WEB_BROWSER;
  66.         }
  67.         return WurflConstants::$GENERIC;
  68.     }
  69. }

Documentation generated on Sun, 19 Sep 2010 00:15:51 +0000 by phpDocumentor 1.4.3