/**
  * If UA starts with Mozilla, apply LD with tolerance 5.
  *
  * @param string $userAgent
  * @return string
  */
 public function applyConclusiveMatch($userAgent)
 {
     if (WURFL_Configuration_ConfigHolder::getWURFLConfig()->isHighPerformance()) {
         //High performance mode
         $tolerance = WURFL_Handlers_Utils::firstCloseParen($userAgent) + 1;
         return $this->getDeviceIDFromRIS($userAgent, $tolerance);
     } else {
         //High accuracy mode
         return $this->getDeviceIDFromLD($userAgent, 5);
     }
 }
 public function applyConclusiveMatch($userAgent)
 {
     if (WURFL_Handlers_Utils::checkIfContains($userAgent, "GoogleImageProxy")) {
         return 'google_image_proxy';
     }
     if (WURFL_Handlers_Utils::checkIfStartsWith($userAgent, "Mozilla")) {
         $tolerance = WURFL_Handlers_Utils::firstCloseParen($userAgent);
     } else {
         $tolerance = WURFL_Handlers_Utils::firstSlash($userAgent);
     }
     return $this->getDeviceIDFromRIS($userAgent, $tolerance);
 }
Exemplo n.º 3
0
 public function applyConclusiveMatch($userAgent)
 {
     if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'BB10')) {
         $tolerance = WURFL_Handlers_Utils::indexOfOrLength($userAgent, ')');
     } elseif (WURFL_Handlers_Utils::checkIfStartsWith($userAgent, 'Mozilla/4')) {
         $tolerance = WURFL_Handlers_Utils::secondSlash($userAgent);
     } elseif (WURFL_Handlers_Utils::checkIfStartsWith($userAgent, 'Mozilla/5')) {
         $tolerance = WURFL_Handlers_Utils::ordinalIndexOf($userAgent, ';', 3);
     } elseif (WURFL_Handlers_Utils::checkIfStartsWith($userAgent, 'PlayBook')) {
         $tolerance = WURFL_Handlers_Utils::firstCloseParen($userAgent);
     } else {
         $tolerance = WURFL_Handlers_Utils::firstSlash($userAgent);
     }
     return $this->getDeviceIDFromRIS($userAgent, $tolerance);
 }
Exemplo n.º 4
0
 public function testCloseParen()
 {
     $this->assertEquals(9, WURFL_Handlers_Utils::firstCloseParen('Value(12)'));
     $this->assertNull(WURFL_Handlers_Utils::firstCloseParen('Value'));
 }