Exemplo n.º 1
0
 /**
  * Apply RIS on Firts slash
  *
  * @param string $userAgent
  * @return string
  */
 public function applyConclusiveMatch($userAgent)
 {
     if (WURFL_Handlers_Utils::checkIfStartsWith($userAgent, "CFNetwork/")) {
         $tolerance = WURFL_Handlers_Utils::firstSpace($userAgent);
     } else {
         $tolerance = WURFL_Handlers_Utils::firstSlash($userAgent);
     }
     return $this->getDeviceIDFromRIS($userAgent, $tolerance);
 }
	/**
	 * If UA starts with one of the following ("SEC-", "SAMSUNG-", "SCH"), apply RIS with FS.
	 * If UA starts with one of the following ("Samsung-","SPH", "SGH" ), apply RIS with First Space (not FS).
	 * If UA starts with "SAMSUNG/", apply RIS with threshold SS (Second Slash)
	 *
	 * @param string $userAgent
	 * @return string
	 */
	function lookForMatchingUserAgent($userAgent) {
		if (WURFL_Handlers_Utils::checkIfStartsWith ( $userAgent, "SEC-" ) || WURFL_Handlers_Utils::checkIfStartsWith ( $userAgent, "SAMSUNG-" ) || WURFL_Handlers_Utils::checkIfStartsWith ( $userAgent, "SCH" )) {
			$tollerance = WURFL_Handlers_Utils::firstSlash ( $userAgent );
		} else if (WURFL_Handlers_Utils::checkIfStartsWith ( $userAgent, "Samsung" ) || WURFL_Handlers_Utils::checkIfStartsWith ( $userAgent, "SPH" ) || WURFL_Handlers_Utils::checkIfStartsWith ( $userAgent, "SGH" )) {
			$tollerance = WURFL_Handlers_Utils::firstSpace ( $userAgent );
		} else {
			$tollerance = WURFL_Handlers_Utils::secondSlash ( $userAgent );
		}
		$this->logger->log ( "$this->prefix :Applying Conclusive Match for ua: $userAgent with tollerance $tollerance" );
		return WURFL_Handlers_Utils::risMatch ( array_keys ( $this->userAgentsWithDeviceID ), $userAgent, $tollerance );
	}
Exemplo n.º 3
0
 public function applyConclusiveMatch($userAgent)
 {
     if (WURFL_Handlers_Utils::checkIfStartsWithAnyOf($userAgent, array("SEC-", "SAMSUNG-", "SCH"))) {
         $tolerance = WURFL_Handlers_Utils::firstSlash($userAgent);
     } elseif (WURFL_Handlers_Utils::checkIfStartsWithAnyOf($userAgent, array("Samsung", "SPH", "SGH"))) {
         $tolerance = WURFL_Handlers_Utils::firstSpace($userAgent);
     } else {
         $tolerance = WURFL_Handlers_Utils::secondSlash($userAgent);
     }
     return $this->getDeviceIDFromRIS($userAgent, $tolerance);
 }
 private function tolerance($userAgent)
 {
     if (WURFL_Handlers_Utils::checkIfStartsWithAnyOf($userAgent, array("SEC-", "SAMSUNG-", "SCH"))) {
         return WURFL_Handlers_Utils::firstSlash($userAgent);
     }
     if (WURFL_Handlers_Utils::checkIfStartsWithAnyOf($userAgent, array("Samsung-", "SPH", "SGH"))) {
         return WURFL_Handlers_Utils::firstSpace($userAgent);
     }
     if (WURFL_Handlers_Utils::checkIfStartsWith($userAgent, "SAMSUNG/")) {
         return WURFL_Handlers_Utils::secondSlash($userAgent);
     }
     return WURFL_Handlers_Utils::firstSlash($userAgent);
 }
Exemplo n.º 5
0
 public function applyConclusiveMatch($userAgent)
 {
     $tolerance = WURFL_Handlers_Utils::firstSpace($userAgent);
     return $this->getDeviceIDFromRIS($userAgent, $tolerance);
 }
Exemplo n.º 6
0
 public function testFirstSpace()
 {
     $this->assertEquals(6, WURFL_Handlers_Utils::firstSpace('Value 12'));
     $this->assertNull(WURFL_Handlers_Utils::firstSpace('Value'));
 }
Exemplo n.º 7
0
 function lookForMatchingUserAgent($userAgent)
 {
     $tollerance = WURFL_Handlers_Utils::firstSpace($userAgent);
     return WURFL_Handlers_Utils::risMatch(array_keys($this->userAgentsWithDeviceID), $userAgent, $tollerance);
 }