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

Source for file SamsungUserAgentMatcher.php

Documentation is available at SamsungUserAgentMatcher.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.     public function __construct(TeraWurfl $wurfl){
  20.         parent::__construct($wurfl);
  21.     }
  22.     public function applyConclusiveMatch($ua{
  23.         if(self::startsWith($ua,array("SAMSUNG-","SEC-","SCH"))){
  24.             $tolerance UserAgentUtils::firstSlash($ua);
  25.             $this->wurfl->toLog("Applying ".get_class($this)." Conclusive Match: RIS with threshold (first slash) $tolerance",LOG_INFO);
  26.         }elseif(self::startsWith($ua,"Samsung"|| self::startsWith($ua,"SPH"|| self::startsWith($ua,"SGH")){
  27.             $tolerance UserAgentUtils::firstSpace($ua);
  28.             $this->wurfl->toLog("Applying ".get_class($this)." Conclusive Match: RIS with threshold (first space) $tolerance",LOG_INFO);
  29.         }else{
  30.             $tolerance UserAgentUtils::secondSlash($ua);
  31.             $this->wurfl->toLog("Applying ".get_class($this)." Conclusive Match: RIS with threshold (second slash) $tolerance",LOG_INFO);
  32.         }
  33.         return $this->risMatch($ua$tolerance);
  34.     }
  35.     public function recoveryMatch($ua){
  36.         if(self::startsWith($ua,"SAMSUNG")){
  37.             $tolerance 8;
  38.             return $this->ldMatch($ua,$tolerance);
  39.         }else{
  40.             $tolerance UserAgentUtils::indexOfOrLength($ua,'/',strpos($ua,'Samsung'));
  41.             return $this->risMatch($ua$tolerance);
  42.         }
  43.     }
  44. }

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