当前位置: 首页>>代码示例>>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;未经允许,请勿转载。