當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WURFL_Handlers_Utils::indexOfOrLength方法代碼示例

本文整理匯總了PHP中WURFL_Handlers_Utils::indexOfOrLength方法的典型用法代碼示例。如果您正苦於以下問題:PHP WURFL_Handlers_Utils::indexOfOrLength方法的具體用法?PHP WURFL_Handlers_Utils::indexOfOrLength怎麽用?PHP WURFL_Handlers_Utils::indexOfOrLength使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WURFL_Handlers_Utils的用法示例。


在下文中一共展示了WURFL_Handlers_Utils::indexOfOrLength方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: applyConclusiveMatch

 public function applyConclusiveMatch($userAgent)
 {
     $tolerance = WURFL_Handlers_Utils::ordinalIndexOf($userAgent, '/', 2);
     if ($tolerance === -1) {
         //  DoCoMo/2.0 F01A(c100;TB;W24H17)
         $tolerance = WURFL_Handlers_Utils::indexOfOrLength('(', $userAgent);
     }
     return $this->getDeviceIDFromRIS($userAgent, $tolerance);
 }
開發者ID:dcunited08,項目名稱:wurfl-api,代碼行數:9,代碼來源:DoCoMoHandler.php

示例2: lookForMatchingUserAgent

 /**
  *  If the User Agent contains the String Nokia, apply TokensMatcher strategy
  *  using the Nokia Tokens Provider else
  *	Apply then LD with a threshold of 3
  *
  * @param string $userAgent
  * @return string
  */
 function lookForMatchingUserAgent($userAgent)
 {
     $userAgents = array_keys($this->userAgentsWithDeviceID);
     if (WURFL_Handlers_Utils::checkIfContains($userAgent, "Nokia")) {
         $tollearnce = WURFL_Handlers_Utils::indexOfOrLength($userAgent, "/", strpos($userAgent, "Nokia"));
         return parent::applyRisWithTollerance($userAgents, $userAgent, $tollearnce);
     }
     return WURFL_Handlers_Utils::ldMatch($userAgents, $userAgent, self::TOLLERANCE);
 }
開發者ID:eusholli,項目名稱:drupal,代碼行數:17,代碼來源:VodafoneHandler.php

示例3: applyConclusiveMatch

 public function applyConclusiveMatch($userAgent)
 {
     $idx = strpos($userAgent, 'MobilePhone');
     if ($idx !== false) {
         $tolerance = WURFL_Handlers_Utils::indexOfOrLength($userAgent, '/', $idx);
     } else {
         $tolerance = WURFL_Handlers_Utils::firstSlash($userAgent);
     }
     return $this->getDeviceIDFromRIS($userAgent, $tolerance);
 }
開發者ID:acasademont,項目名稱:wurfl,代碼行數:10,代碼來源:SanyoHandler.php

示例4: applyRecoveryMatch

 public function applyRecoveryMatch($userAgent)
 {
     if (WURFL_Handlers_Utils::checkIfStartsWith($userAgent, 'SAMSUNG')) {
         $tolerance = 8;
         return $this->getDeviceIDFromLD($userAgent, $tolerance);
     } else {
         $tolerance = WURFL_Handlers_Utils::indexOfOrLength($userAgent, '/', strpos($userAgent, 'Samsung'));
         return $this->getDeviceIDFromRIS($userAgent, $tolerance);
     }
 }
開發者ID:godboko,項目名稱:modules,代碼行數:10,代碼來源:SamsungHandler.php

示例5: applyConclusiveMatch

 public function applyConclusiveMatch($userAgent)
 {
     // The tolerance is after UCWEB7, not before
     $find = 'UCWEB7';
     $tolerance = WURFL_Handlers_Utils::indexOfOrLength($userAgent, $find) + strlen($find);
     if ($tolerance > strlen($userAgent)) {
         $tolerance = strlen($userAgent);
     }
     $this->getDeviceIDFromRIS($userAgent, $tolerance);
 }
開發者ID:vazahat,項目名稱:dudex,代碼行數:10,代碼來源:Ucweb7OnAndroidHandler.php

示例6: tolerance

 private function tolerance($userAgent)
 {
     if (WURFL_Handlers_Utils::checkIfStartsWith($userAgent, "KDDI/")) {
         return WURFL_Handlers_Utils::secondSlash($userAgent);
     }
     if (WURFL_Handlers_Utils::checkIfStartsWith($userAgent, "KDDI")) {
         return WURFL_Handlers_Utils::firstSlash($userAgent);
     }
     return WURFL_Handlers_Utils::indexOfOrLength($userAgent, ")");
 }
開發者ID:realsoc,項目名稱:mediawiki-extensions,代碼行數:10,代碼來源:KDDIHandler.php

示例7: applyConclusiveMatch

 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);
 }
開發者ID:acasademont,項目名稱:wurfl,代碼行數:15,代碼來源:BlackBerryHandler.php

示例8: applyConclusiveMatch

 public function applyConclusiveMatch($userAgent)
 {
     $matches = array();
     if (preg_match('/^Mozilla\\/5\\.0 \\(.+?Trident.+?; rv:(\\d\\d)\\.(\\d+)\\)/', $userAgent, $matches) || preg_match('/^Mozilla\\/[45]\\.0 \\(compatible; MSIE (\\d+)\\.(\\d+);/', $userAgent, $matches)) {
         $major = (int) $matches[1];
         $minor = (int) $matches[2];
         // MSIE 5.5 is handled specifically
         if ($major == 5 && $minor == 5) {
             return 'msie_5_5';
         }
         // Look for version in constant ID array
         if (array_key_exists($major, self::$constantIDs)) {
             return self::$constantIDs[$major];
         }
     }
     return $this->getDeviceIDFromRIS($userAgent, WURFL_Handlers_Utils::indexOfOrLength($userAgent, 'Trident'));
 }
開發者ID:vazahat,項目名稱:dudex,代碼行數:17,代碼來源:MSIEHandler.php

示例9: applyConclusiveMatch

 public function applyConclusiveMatch($userAgent)
 {
     if (WURFL_Handlers_Utils::checkIfContains($userAgent, ' Build/')) {
         return $this->getDeviceIDFromRIS($userAgent, WURFL_Handlers_Utils::indexOfOrLength($userAgent, ' Build/'));
     }
     $prefixes = array('Opera/9.80 (J2ME/MIDP; Opera Mini/5' => 'uabait_opera_mini_android_v50', 'Opera/9.80 (Android; Opera Mini/5.0' => 'uabait_opera_mini_android_v50', 'Opera/9.80 (Android; Opera Mini/5.1' => 'uabait_opera_mini_android_v51');
     foreach ($prefixes as $prefix => $defaultID) {
         if (WURFL_Handlers_Utils::checkIfStartsWith($userAgent, $prefix)) {
             // If RIS returns a non-generic match, return it, else, return the default
             $tolerance = strlen($prefix);
             $deviceID = $this->getDeviceIDFromRIS($userAgent, $tolerance);
             if ($deviceID == WURFL_Constants::NO_MATCH) {
                 return $defaultID;
             }
             return $deviceID;
         }
     }
     return WURFL_Constants::NO_MATCH;
 }
開發者ID:vazahat,項目名稱:dudex,代碼行數:19,代碼來源:OperaMiniOnAndroidHandler.php

示例10: applyConclusiveMatch

 public function applyConclusiveMatch($userAgent)
 {
     $model = self::getOperaModel($userAgent, false);
     if ($model !== null) {
         $prefix = $model . WURFL_Constants::RIS_DELIMITER;
         $userAgent = $prefix . $userAgent;
         return $this->getDeviceIDFromRIS($userAgent, strlen($prefix));
     }
     $opera_mini_idx = WURFL_Handlers_Utils::indexOfOrLength($userAgent, 'Opera Mini');
     if ($opera_mini_idx !== false) {
         // Match up to the first '.' after 'Opera Mini'
         $tolerance = strpos($userAgent, '.', $opera_mini_idx);
         if ($tolerance !== false) {
             // +1 to match just after the '.'
             return $this->getDeviceIDFromRIS($userAgent, $tolerance + 1);
         }
     }
     $tolerance = WURFL_Handlers_Utils::firstSlash($userAgent);
     return $this->getDeviceIDFromRIS($userAgent, $tolerance);
 }
開發者ID:acasademont,項目名稱:wurfl,代碼行數:20,代碼來源:OperaMiniHandler.php

示例11: lookForMatchingUserAgent

	function lookForMatchingUserAgent($userAgent) {
		$tollerance = WURFL_Handlers_Utils::indexOfOrLength ( $userAgent, ";", strpos ( $userAgent, "SPV" ) );
		return parent::applyRisWithTollerance ( array_keys ( $this->userAgentsWithDeviceID ), $userAgent, $tollerance );
	}
開發者ID:richard-cai,項目名稱:Zend-Framework-Extended,代碼行數:4,代碼來源:SPVHandler.php

示例12: applyConclusiveMatch

 public function applyConclusiveMatch($userAgent)
 {
     $skyfire_idx = strpos($userAgent, 'Skyfire');
     // Matches the first decimal point after the Skyfire keyword: Skyfire/2.0
     return $this->getDeviceIDFromRIS($userAgent, WURFL_Handlers_Utils::indexOfOrLength($userAgent, '.', $skyfire_idx));
 }
開發者ID:vazahat,項目名稱:dudex,代碼行數:6,代碼來源:SkyfireHandler.php

示例13: indexOfAnyOrLength

 /**
  * Lowest char index of the first instance of any of the $needles found in $userAgent, starting at $startIndex;
  * if no match is found, the length of the string is returned
  * @param string $userAgent haystack
  * @param array $needles Array of (string)needles to search for in $userAgent
  * @param int $startingIndex Char index for start of search
  * @return int Char index of left-most match or length of string
  */
 public static function indexOfAnyOrLength($userAgent, $needles = array(), $startingIndex = 0)
 {
     if (count($needles) === 0) {
         return strlen($userAgent);
     }
     $min = strlen($userAgent);
     foreach ($needles as $needle) {
         $index = WURFL_Handlers_Utils::indexOfOrLength($userAgent, $needle, $startingIndex);
         if ($index < $min) {
             $min = $index;
         }
     }
     return $min;
 }
開發者ID:conversionstudio,項目名稱:cpatracker,代碼行數:22,代碼來源:Utils.php

示例14: applyConclusiveMatch

 public function applyConclusiveMatch($userAgent)
 {
     $tolerance = WURFL_Handlers_Utils::indexOfOrLength($userAgent, '/', stripos($userAgent, 'LG'));
     return $this->getDeviceIDFromRIS($userAgent, $tolerance);
 }
開發者ID:conversionstudio,項目名稱:cpatracker,代碼行數:5,代碼來源:LGHandler.php

示例15: applyConclusiveMatch

 public function applyConclusiveMatch($userAgent)
 {
     return $this->getDeviceIDFromRIS($userAgent, WURFL_Handlers_Utils::indexOfOrLength($userAgent, '.'));
 }
開發者ID:vazahat,項目名稱:dudex,代碼行數:4,代碼來源:FirefoxHandler.php


注:本文中的WURFL_Handlers_Utils::indexOfOrLength方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。