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

Source for file VodafoneUserAgentMatcher.php

Documentation is available at VodafoneUserAgentMatcher.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.         $clean_ua $ua;
  24.         if(self::contains($ua,"/SN"&& !self::contains($ua,"XXXXXXXXXXXX")){
  25.             //not using RegEx for the time being
  26.             $start_idx strpos($ua,"/SN")+3;
  27.             $sub_str substr($ua,$start_idx);
  28.             $end_idx strpos($sub_str," ");
  29.             if($end_idx !== false && $sub_str != "" && strlen($sub_str$end_idx){
  30.                 $num_digits strlen($sub_str$end_idx;
  31.                 $new_ua substr($ua,0,$start_idx);
  32.                 for($i=0;$i<$end_idx;$i++){
  33.                     $new_ua .= "X";
  34.                 }
  35.                 $new_ua .= substr($ua,$end_idx);
  36.                 $clean_ua $new_ua;
  37.             }
  38.         }
  39.         
  40.         $tolerance UserAgentUtils::firstSlash($clean_ua);
  41.         $this->wurfl->toLog("Applying ".get_class($this)." Conclusive Match: RIS with threshold $tolerance",LOG_INFO);
  42.         $match $this->risMatch($clean_ua$tolerance);
  43.         if($match == WurflConstants::$GENERIC){
  44.             $this->wurfl->toLog("Applying ".get_class($this)." Conclusive Match: LD",LOG_INFO);
  45.             return $this->ldMatch($ua);
  46.         }
  47.         return $match;
  48.     }
  49. }

Documentation generated on Sun, 19 Sep 2010 00:16:08 +0000 by phpDocumentor 1.4.3