Example #1
0
 /**
  * Perform match by product infos.
  *
  * @return Tx_ContextsWurfl_Context_Type_Wurfl
  */
 protected function matchProductInfo()
 {
     // Brand names
     $brandNames = $this->getConfValue('settings.brandName', null, 'sProductInfo');
     if (strlen($brandNames)) {
         $brandNames = explode(',', $brandNames);
         $brandMatch = false;
         foreach ($brandNames as $brandName) {
             $brandMatch |= strcasecmp($brandName, $this->wurfl->getBrandName()) === 0;
         }
         $this->match &= $brandMatch;
     }
     // Model names
     $modelNames = $this->getConfValue('settings.modelName', null, 'sProductInfo');
     if (strlen($modelNames)) {
         $modelNames = explode(',', $modelNames);
         $modelMatch = false;
         foreach ($modelNames as $modelName) {
             $modelMatch |= strcasecmp($modelName, $this->wurfl->getModelName()) === 0;
         }
         $this->match &= $modelMatch;
     }
     // Mobile browsers
     $mobileBrowsers = $this->getConfValue('settings.mobileBrowser', null, 'sProductInfo');
     if (strlen($mobileBrowsers)) {
         $mobileBrowsers = explode(',', $mobileBrowsers);
         $mobileMatch = false;
         foreach ($mobileBrowsers as $mobileBrowser) {
             $mobileMatch |= strcasecmp($mobileBrowser, $this->wurfl->getMobileBrowser()) === 0;
         }
         $this->match &= $mobileMatch;
     }
     return $this;
 }