Example #1
0
 /**
  * Perform match by device dimension.
  *
  * @return Tx_ContextsWurfl_Context_Type_Wurfl
  */
 protected function matchDeviceDimension()
 {
     $screenWidthMin = (int) $this->getConfValue('settings.screenWidthMin', null, 'sDimension');
     $screenWidthMax = (int) $this->getConfValue('settings.screenWidthMax', null, 'sDimension');
     $screenHeightMin = (int) $this->getConfValue('settings.screenHeightMin', null, 'sDimension');
     $screenHeightMax = (int) $this->getConfValue('settings.screenHeightMax', null, 'sDimension');
     if ($this->match) {
         $width = $this->wurfl->getScreenWidth();
         if ($screenWidthMin > 0) {
             $this->match &= $width >= $screenWidthMin;
         }
         if ($screenWidthMax > 0) {
             $this->match &= $width <= $screenWidthMax;
         }
     }
     if ($this->match) {
         $height = $this->wurfl->getScreenHeight();
         if ($screenHeightMin > 0) {
             $this->match &= $height >= $screenHeightMin;
         }
         if ($screenHeightMax > 0) {
             $this->match &= $height <= $screenHeightMax;
         }
     }
     return $this;
 }