Exemplo n.º 1
0
 /**
  *
  * Apply RIS with FS (First Slash) after Nokia String as a threshold.
  * 
  * 
  * @param string $userAgent
  * @return string
  */
 function lookForMatchingUserAgent($userAgent)
 {
     //$tolerance = WU
     $tolerance = WURFL_Handlers_Utils::indexOfAnyOrLength($userAgent, array("/", " "), strpos($userAgent, "Nokia"));
     $userAgents = array_keys($this->userAgentsWithDeviceID);
     return parent::applyRisWithTollerance($userAgents, $userAgent, $tolerance);
 }
Exemplo n.º 2
0
 public function applyConclusiveMatch($userAgent)
 {
     $tolerance = WURFL_Handlers_Utils::indexOfAnyOrLength($userAgent, array('/', ' '), strpos($userAgent, 'Nokia'));
     if (WURFL_Handlers_Utils::checkIfStartsWithAnyOf($userAgent, array('Nokia/', 'Nokia '))) {
         $tolerance = strlen($userAgent);
     }
     return $this->getDeviceIDFromRIS($userAgent, $tolerance);
 }
Exemplo n.º 3
0
 public function applyConclusiveMatch($userAgent)
 {
     $idx = strpos($userAgent, 'Nokia');
     if ($idx === false) {
         return WURFL_Constants::NO_MATCH;
     }
     $tolerance = WURFL_Handlers_Utils::indexOfAnyOrLength($userAgent, array('/', ' '), $idx);
     return $this->getDeviceIDFromRIS($userAgent, $tolerance);
 }
Exemplo n.º 4
0
 public function applyConclusiveMatch($userAgent)
 {
     $tolerance = WURFL_Handlers_Utils::toleranceToRisDelimeter($userAgent);
     if ($tolerance !== false) {
         return $this->getDeviceIDFromRIS($userAgent, $tolerance);
     }
     // Standard RIS Matching
     $tolerance = WURFL_Handlers_Utils::indexOfAnyOrLength($userAgent, array(' Build/', ' AppleWebKit'));
     return $this->getDeviceIDFromRIS($userAgent, $tolerance);
 }
Exemplo n.º 5
0
 public function applyConclusiveMatch($userAgent)
 {
     $tolerance = WURFL_Handlers_Utils::toleranceToRisDelimeter($userAgent);
     if ($tolerance !== false) {
         return $this->getDeviceIDFromRIS($userAgent, $tolerance);
     }
     //Return no match for UAs with no extractable Android version, model and that do not start with either Mozilla or Dalvik
     if (!WURFL_Handlers_Utils::checkIfStartsWithAnyOf($userAgent, array('Mozilla', 'Dalvik'))) {
         return WURFL_Constants::NO_MATCH;
     }
     // Standard RIS Matching
     $tolerance = WURFL_Handlers_Utils::indexOfAnyOrLength($userAgent, array(' Build/', ' AppleWebKit'));
     return $this->getDeviceIDFromRIS($userAgent, $tolerance);
 }
Exemplo n.º 6
0
 public function applyConclusiveMatch($userAgent)
 {
     $tolerance = WURFL_Handlers_Utils::indexOfAnyOrLength($userAgent, array('/', ' '), strpos($userAgent, 'Nokia'));
     return $this->getDeviceIDFromRIS($userAgent, $tolerance);
 }
Exemplo n.º 7
0
 /**
  * @dataProvider indexOfAnyOrLengthDataProvider
  */
 public function testIndexOfAnyOrLength($haystack, $expected)
 {
     $found = WURFL_Handlers_Utils::indexOfAnyOrLength($haystack, array(" ", "/"), 0);
     $this->assertEquals($expected, $found);
 }