本文整理汇总了PHP中UserAgentUtils类的典型用法代码示例。如果您正苦于以下问题:PHP UserAgentUtils类的具体用法?PHP UserAgentUtils怎么用?PHP UserAgentUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserAgentUtils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: applyConclusiveMatch
public function applyConclusiveMatch($ua)
{
$matches = array();
if (preg_match('/^Mozilla\\/4\\.0 \\(compatible; MSIE (\\d)\\.(\\d);/', $ua, $matches)) {
if (TeraWurflConfig::$SIMPLE_DESKTOP_ENGINE_ENABLE) {
return WurflConstants::$GENERIC_WEB_BROWSER;
}
switch ($matches[1]) {
// cases are intentionally out of sequnce for performance
case 7:
return 'msie_7';
break;
case 8:
return 'msie_8';
break;
case 6:
return 'msie_6';
break;
case 4:
return 'msie_4';
break;
case 5:
return $matches[2] == 5 ? 'msie_5_5' : 'msie_5';
break;
default:
return 'msie';
break;
}
}
$ua = preg_replace('/( \\.NET CLR [\\d\\.]+;?| Media Center PC [\\d\\.]+;?| OfficeLive[a-zA-Z0-9\\.\\d]+;?| InfoPath[\\.\\d]+;?)/', '', $ua);
$tolerance = UserAgentUtils::firstSlash($ua);
$this->wurfl->toLog("Applying " . get_class($this) . " Conclusive Match: RIS with threshold {$tolerance}", LOG_INFO);
return $this->risMatch($ua, $tolerance);
}
开发者ID:vuong93st,项目名称:w-game,代码行数:34,代码来源:MSIEUserAgentMatcher.php
示例2: applyConclusiveMatch
public function applyConclusiveMatch($ua)
{
$clean_ua = $ua;
if (self::contains($ua, "/SN") && !self::contains($ua, "XXXXXXXXXXXX")) {
//not using RegEx for the time being
$start_idx = strpos($ua, "/SN") + 3;
$sub_str = substr($ua, $start_idx);
$end_idx = strpos($sub_str, " ");
if ($end_idx !== false && $sub_str != "" && strlen($sub_str) > $end_idx) {
$num_digits = strlen($sub_str) - $end_idx;
$new_ua = substr($ua, 0, $start_idx);
for ($i = 0; $i < $end_idx; $i++) {
$new_ua .= "X";
}
$new_ua .= substr($ua, $end_idx);
$clean_ua = $new_ua;
}
}
$tolerance = UserAgentUtils::firstSlash($clean_ua);
$this->wurfl->toLog("Applying " . get_class($this) . " Conclusive Match: RIS with threshold {$tolerance}", LOG_INFO);
$match = $this->risMatch($clean_ua, $tolerance);
if ($match == WurflConstants::$GENERIC) {
$this->wurfl->toLog("Applying " . get_class($this) . " Conclusive Match: LD", LOG_INFO);
return $this->ldMatch($ua);
}
return $match;
}
开发者ID:vallejos,项目名称:samples,代码行数:27,代码来源:VodafoneUserAgentMatcher.php
示例3: isDesktopBrowser
/**
* Is the given user agent very likely to be a desktop browser
* @param String User agent
* @return Bool
*/
public static function isDesktopBrowser($ua)
{
if (UserAgentUtils::isMobileBrowser($ua)) {
return false;
}
if (self::contains($ua, array('HTC', 'PPC', 'Nintendo'))) {
return false;
}
// Firefox
if (self::contains($ua, "Firefox") && !self::contains($ua, 'Tablet')) {
return true;
}
if (UserAgentUtils::isDesktopBrowser($ua)) {
return true;
}
if (self::startsWith($ua, 'Opera/')) {
return true;
}
if (self::regexContains($ua, array('/^Mozilla\\/5\\.0 \\(compatible; MSIE 9\\.0; Windows NT \\d\\.\\d/', '/^Mozilla\\/4\\.0 \\(compatible; MSIE \\d\\.\\d; Windows NT \\d\\.\\d/'))) {
return true;
}
if (self::contains($ua, array("Chrome", "yahoo.com", "google.com", "Comcast"))) {
return true;
}
return false;
}
开发者ID:vallejos,项目名称:samples,代码行数:31,代码来源:SimpleDesktopUserAgentMatcher.php
示例4: applyConclusiveMatch
public function applyConclusiveMatch($ua)
{
$deviceId = '';
$tolerance = UserAgentUtils::indexOfOrLength($ua, ';', 0);
$this->wurfl->toLog("Applying " . get_class($this) . " Conclusive Match: RIS with threshold {$tolerance}", LOG_INFO);
$deviceId = $this->risMatch($ua, $tolerance);
return $deviceId;
}
开发者ID:vuong93st,项目名称:w-game,代码行数:8,代码来源:AppleUserAgentMatcher.php
示例5: parseDevice
protected function parseDevice()
{
if (count($this->pendingInsert) > 0) {
foreach ($this->pendingInsert as $device) {
$matcher = UserAgentFactory::userAgentType($this->wurfl, $device['user_agent']);
$uatable = TeraWurflConfig::$TABLE_PREFIX . '_' . $matcher;
}
$this->pendingInsert = array();
}
$this->pendingInsert[$this->xml->getAttribute('id')] = array();
$device =& $this->pendingInsert[$this->xml->getAttribute('id')];
$device = array('id' => $this->xml->getAttribute('id'), 'user_agent' => UserAgentUtils::cleanUserAgent($this->xml->getAttribute('user_agent')), 'fall_back' => $this->xml->getAttribute('fall_back'));
if ($this->xml->getAttribute('actual_device_root')) {
$device['actual_device_root'] = $this->xml->getAttribute('actual_device_root') == "true" ? 1 : 0;
}
$groupdevice = '';
$groupname = '';
$filtering = TeraWurflConfig::$CAPABILITY_FILTER ? true : false;
$includegroup = false;
while ($this->xml->read()) {
if ($this->xml->nodeType != XMLReader::ELEMENT) {
continue;
}
// recurse back into this function for the rest of the devices
switch ($this->xml->name) {
case "device":
$this->parseDevice();
break;
case "group":
$groupname = $this->xml->getAttribute('id');
if ($filtering && $this->enabled($this->xml->getAttribute('id'))) {
$includegroup = true;
} else {
$includegroup = false;
continue;
}
$device[$groupname] = array();
break;
case "capability":
if (!$filtering || $filtering && $includegroup) {
// the groupdevice array must already exist
$device[$groupname][$this->xml->getAttribute('name')] = self::cleanValue($this->xml->getAttribute('value'));
continue;
}
if ($filtering && !$includegroup && $this->enabled($this->xml->getAttribute('name'))) {
// the groupdevice array might already exists
if (!array_key_exists($groupname, $device)) {
$device[$groupname] = array();
}
$device[$groupname][$this->xml->getAttribute('name')] = self::cleanValue($this->xml->getAttribute('value'));
continue;
}
break;
}
}
}
开发者ID:vuong93st,项目名称:w-game,代码行数:56,代码来源:TeraWurflXMLParser_XMLReader_LowMem.php
示例6: applyConclusiveMatch
public function applyConclusiveMatch($ua)
{
if (self::startsWith($ua, "BlackBerry;")) {
$tolerance = UserAgentUtils::ordinalIndexOf($ua, ';', 3);
} else {
$tolerance = UserAgentUtils::firstSlash($ua);
}
$this->wurfl->toLog("Applying " . get_class($this) . " Conclusive Match: RIS with threshold {$tolerance}", LOG_INFO);
return $this->risMatch($ua, $tolerance);
}
开发者ID:vallejos,项目名称:samples,代码行数:10,代码来源:BlackBerryUserAgentMatcher.php
示例7: applyConclusiveMatch
public function applyConclusiveMatch($ua)
{
if (self::startsWith($ua, 'KDDI/')) {
$tolerance = UserAgentUtils::secondSlash($ua);
} else {
$tolerance = UserAgentUtils::firstSlash($ua);
}
$this->wurfl->toLog("Applying " . get_class($this) . " Conclusive Match: RIS with threshold {$tolerance}", LOG_INFO);
return $this->risMatch($ua, $tolerance);
}
开发者ID:anubhaBhargava,项目名称:OpenRecommender,代码行数:10,代码来源:KddiUserAgentMatcher.php
示例8: recoveryMatch
public function recoveryMatch($ua)
{
if (self::startsWith($ua, "SAMSUNG")) {
$tolerance = 8;
return $this->ldMatch($ua, $tolerance);
} else {
$tolerance = UserAgentUtils::indexOfOrLength($ua, '/', strpos($ua, 'Samsung'));
return $this->risMatch($ua, $tolerance);
}
}
开发者ID:anubhaBhargava,项目名称:OpenRecommender,代码行数:10,代码来源:SamsungUserAgentMatcher.php
示例9: applyConclusiveMatch
public function applyConclusiveMatch($ua)
{
if (self::contains($ua, "MobilePhone")) {
$tolerance = UserAgentUtils::indexOfOrLength($ua, '/', strpos($ua, "MobilePhone"));
} else {
$tolerance = UserAgentUtils::firstSlash($ua);
}
$this->wurfl->toLog("Applying " . get_class($this) . " Conclusive Match: RIS with threshold {$tolerance}", LOG_INFO);
return $this->risMatch($ua, $tolerance);
}
开发者ID:vallejos,项目名称:samples,代码行数:10,代码来源:SanyoUserAgentMatcher.php
示例10: applyConclusiveMatch
public function applyConclusiveMatch($ua)
{
// firstSlash() - 1 because some UAs have revisions that aren't getting detected properly:
// SonyEricssonW995a/R1FA Browser/NetFront/3.4 Profile/MIDP-2.1 Configuration/CLDC-1.1 JavaPlatform/JP-8.4.3
$tolerance = UserAgentUtils::firstSlash($ua) - 1;
$this->wurfl->toLog("Applying " . get_class($this) . " Conclusive Match: RIS with threshold {$tolerance}", LOG_INFO);
if (self::startsWith($ua, "SonyEricsson")) {
return $this->risMatch($ua, $tolerance);
}
$tolerance = UserAgentUtils::secondSlash($ua);
return $this->risMatch($ua, $tolerance);
}
开发者ID:anubhaBhargava,项目名称:OpenRecommender,代码行数:12,代码来源:SonyEricssonUserAgentMatcher.php
示例11: applyConclusiveMatch
public function applyConclusiveMatch($ua)
{
$deviceId = '';
if (UserAgentUtils::numSlashes($ua) >= 2) {
$tolerance = UserAgentUtils::secondSlash($ua);
} else {
// DoCoMo/2.0 F01A(c100;TB;W24H17)
$tolerance = UserAgentUtils::firstOpenParen($ua);
}
$this->wurfl->toLog("Applying " . get_class($this) . " Conclusive Match: RIS with threshold {$tolerance}", LOG_INFO);
$deviceId = $this->risMatch($ua, $tolerance);
return $deviceId;
}
开发者ID:vallejos,项目名称:samples,代码行数:13,代码来源:DoCoMoUserAgentMatcher.php
示例12: applyConclusiveMatch
public function applyConclusiveMatch($ua)
{
$deviceId = '';
if (self::startsWith($ua, 'Apple')) {
if (($tolerance = UserAgentUtils::ordinalIndexOf($ua, ' ', 3)) == -1) {
$tolerance = strlen($ua);
}
} else {
$tolerance = UserAgentUtils::indexOfOrLength($ua, ';', 0);
}
$this->wurfl->toLog("Applying " . get_class($this) . " Conclusive Match: RIS with threshold {$tolerance}", LOG_INFO);
$deviceId = $this->risMatch($ua, $tolerance);
return $deviceId;
}
开发者ID:anubhaBhargava,项目名称:OpenRecommender,代码行数:14,代码来源:AppleUserAgentMatcher.php
示例13: applyConclusiveMatch
public function applyConclusiveMatch($ua)
{
if (UserAgentUtils::checkIfContains($ua, "Opera/10")) {
return "opera_10";
} elseif (UserAgentUtils::checkIfContains($ua, "Opera/9")) {
return "opera_9";
} elseif (UserAgentUtils::checkIfContains($ua, "Opera/8")) {
return "opera_8";
} elseif (UserAgentUtils::checkIfContains($ua, "Opera/7")) {
return "opera_7";
}
$tolerance = 5;
$this->wurfl->toLog("Applying " . get_class($this) . " Conclusive Match: LD with threshold {$tolerance}", LOG_INFO);
return $this->ldMatch($ua, $tolerance);
}
开发者ID:vuong93st,项目名称:w-game,代码行数:15,代码来源:OperaUserAgentMatcher.php
示例14: recoveryMatch
public function recoveryMatch($ua)
{
if (UserAgentUtils::checkIfContains($ua, 'Froyo')) {
return 'generic_android_ver2_2';
}
if (preg_match('#Android[\\s/](\\d)\\.(\\d)#', $ua, $matches)) {
$version = 'generic_android_ver' . $matches[1] . '_' . $matches[2];
if ($version == 'generic_android_ver2_0') {
$version = 'generic_android_ver2';
}
if (in_array($version, self::$constantIDs)) {
return $version;
}
}
return 'generic_android';
}
开发者ID:vallejos,项目名称:samples,代码行数:16,代码来源:AndroidUserAgentMatcher.php
示例15: applyConclusiveMatch
public function applyConclusiveMatch($ua)
{
$this->match_type = "conclusive";
$tolerance = UserAgentUtils::firstSlash($ua);
if (self::startsWith($ua, "Mozilla")) {
$tolerance = 5;
$this->wurfl->toLog("Applying CatchAll Conclusive Match: LD {$tolerance}, UA:\n{$ua}", LOG_INFO);
$deviceID = $this->ldMatch($ua, $tolerance);
if ($deviceID != WurflConstants::$GENERIC) {
$this->match = true;
}
return $deviceID;
}
$this->wurfl->toLog("Applying " . get_class($this) . " Conclusive Match: RIS with threshold {$tolerance}", LOG_INFO);
$deviceID = $this->risMatch($ua, $tolerance);
if ($deviceID != WurflConstants::$GENERIC) {
$this->match = true;
}
return $deviceID;
}
开发者ID:vallejos,项目名称:samples,代码行数:20,代码来源:CatchAllUserAgentMatcher.php
示例16: recoveryMatch
public function recoveryMatch($ua)
{
// BlackBerry
$ua = preg_replace('/^BlackBerry (\\d+.*)$/', 'BlackBerry$1', $ua);
$this->wurfl->toLog("Applying " . get_class($this) . " recovery match ({$ua})", LOG_INFO);
if (self::startsWith($ua, "BlackBerry")) {
$position = UserAgentUtils::firstSlash($ua);
if ($position !== false && $position + 4 <= strlen($ua)) {
$version = substr($ua, $position + 1, $position + 4);
$this->wurfl->toLog("BlackBerry version substring is {$version}", LOG_INFO);
if (self::startsWith($version, "2.")) {
return "blackberry_generic_ver2";
}
if (self::startsWith($version, "3.2")) {
return "blackberry_generic_ver3_sub2";
}
if (self::startsWith($version, "3.3")) {
return "blackberry_generic_ver3_sub30";
}
if (self::startsWith($version, "3.5")) {
return "blackberry_generic_ver3_sub50";
}
if (self::startsWith($version, "3.6")) {
return "blackberry_generic_ver3_sub60";
}
if (self::startsWith($version, "3.7")) {
return "blackberry_generic_ver3_sub70";
}
if (self::startsWith($version, "4.")) {
return "blackberry_generic_ver4";
}
$this->wurfl->toLog("No version matched, User-Agent: {$ua} version: {$version}", LOG_INFO);
}
}
return WurflConstants::$GENERIC;
}
开发者ID:vuong93st,项目名称:w-game,代码行数:36,代码来源:BlackBerryUserAgentMatcher.php
示例17: ldMatch
/**
* Attempts to match given user agent string to a device from the database by calculating their Levenshtein Distance (LD)
* @param String User agent
* @param int Tolerance, how much difference is allowed
* @return String WURFL ID
*/
public function ldMatch($ua, $tolerance = NULL)
{
if ($this->wurfl->db->db_implements_ld) {
return $this->wurfl->db->getDeviceFromUA_LD($ua, $tolerance, $this);
}
$this->updateDeviceList();
return UserAgentUtils::ldMatch($ua, $tolerance, $this);
}
开发者ID:anubhaBhargava,项目名称:OpenRecommender,代码行数:14,代码来源:UserAgentMatcher.php
示例18: getDeviceCapabilitiesFromAgent
/**
* Detects the capabilities of a device from a given user agent and optionally, the HTTP Accept Headers
* @param String HTTP User Agent
* @param String HTTP Accept Header
* @return Bool matching device was found
*/
public function getDeviceCapabilitiesFromAgent($userAgent = null, $httpAccept = null)
{
$this->db->numQueries = 0;
$this->matchData = array("num_queries" => 0, "actual_root_device" => '', "match_type" => '', "matcher" => '', "match" => false, "lookup_time" => 0, "fall_back_tree" => '');
$this->lookup_start = microtime(true);
$this->foundInCache = false;
$this->capabilities = array();
// Define User Agent
$this->userAgent = is_null($userAgent) ? WurflSupport::getUserAgent() : $userAgent;
if (strlen($this->userAgent) > 255) {
$this->userAgent = substr($this->userAgent, 0, 255);
}
// Use the ultra high performance SimpleDesktopMatcher if enabled
if (TeraWurflConfig::$SIMPLE_DESKTOP_ENGINE_ENABLE) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/SimpleDesktopUserAgentMatcher.php');
if (SimpleDesktopUserAgentMatcher::isDesktopBrowser($userAgent)) {
$this->userAgent = WurflConstants::$SIMPLE_DESKTOP_UA;
}
}
// Define HTTP ACCEPT header. Default: DO NOT use HTTP_ACCEPT headers
//$this->httpAccept= (is_null($httpAccept))? WurflSupport::getAcceptHeader(): $httpAccept;
$this->userAgent = UserAgentUtils::cleanUserAgent($this->userAgent);
// Check cache for device
if (TeraWurflConfig::$CACHE_ENABLE) {
$cacheData = $this->db->getDeviceFromCache($this->userAgent);
// Found in cache
if ($cacheData !== false) {
$this->capabilities = $cacheData;
$this->foundInCache = true;
$deviceID = $cacheData['id'];
}
}
if (!$this->foundInCache) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/SimpleDesktopUserAgentMatcher.php');
// Find appropriate user agent matcher
$this->userAgentMatcher = UserAgentFactory::createUserAgentMatcher($this, $this->userAgent);
// Find the best matching WURFL ID
$deviceID = $this->getDeviceIDFromUALoose($userAgent);
// Get the capabilities of this device and all its ancestors
$this->getFullCapabilities($deviceID);
// Now add in the Tera-WURFL results array
$this->lookup_end = microtime(true);
$this->matchData['num_queries'] = $this->db->numQueries;
$this->matchData['lookup_time'] = $this->lookup_end - $this->lookup_start;
// Add the match data to the capabilities array so it gets cached
$this->addCapabilities(array($this->matchDataKey => $this->matchData));
}
if (TeraWurflConfig::$CACHE_ENABLE == true && !$this->foundInCache) {
// Since this device was not cached, cache it now.
$this->db->saveDeviceInCache($this->userAgent, $this->capabilities);
}
return $this->capabilities[$this->matchDataKey]['match'];
}
开发者ID:vuong93st,项目名称:w-game,代码行数:59,代码来源:TeraWurfl.php
示例19: createUserAgentMatcher
/**
* Determines which UserAgentMatcher is the best fit for the incoming user agent and returns it
* @param TeraWurfl $wurfl
* @param String $userAgent
* @return UserAgentMatcher
*/
public static function createUserAgentMatcher(TeraWurfl $wurfl, $userAgent)
{
// $isMobile means it IS MOBILE, $isDesktop means it IS DESKTOP
// $isMobile does NOT mean it IS DESKTOP and vica-versa
$isMobile = UserAgentUtils::isMobileBrowser($userAgent);
$isDesktop = UserAgentUtils::isDesktopBrowser($userAgent);
$userAgent_lcase = strtolower($userAgent);
// Process exceptions
if (TeraWurflConfig::$SIMPLE_DESKTOP_ENGINE_ENABLE && $userAgent == WurflConstants::$SIMPLE_DESKTOP_UA) {
// SimpleDesktopUserAgentMatcher is included via require_once realpath(dirname(__FILE__).'/in TeraWurfl.php
return new SimpleDesktopUserAgentMatcher($wurfl);
}
// Process MOBILE user agents
if (!$isDesktop) {
// High workload UAMs go first
// Nokia
if (UserAgentMatcher::contains($userAgent_lcase, 'nokia')) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/NokiaUserAgentMatcher.php');
return new NokiaUserAgentMatcher($wurfl);
}
// Samsung
if (UserAgentMatcher::contains($userAgent, array("Samsung/SGH", "SAMSUNG-SGH")) || UserAgentMatcher::startsWith($userAgent, array("SEC-", "Samsung", "SAMSUNG", "SPH", "SGH", "SCH")) || stripos($userAgent, 'samsung') !== false) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/SamsungUserAgentMatcher.php');
return new SamsungUserAgentMatcher($wurfl);
}
// Blackberry
if (stripos($userAgent, "blackberry") !== false) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/BlackBerryUserAgentMatcher.php');
return new BlackBerryUserAgentMatcher($wurfl);
}
// SonyEricsson
if (UserAgentMatcher::contains($userAgent, 'Sony')) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/SonyEricssonUserAgentMatcher.php');
return new SonyEricssonUserAgentMatcher($wurfl);
}
// Motorola
if (UserAgentMatcher::startsWith($userAgent, array('Mot-', 'MOT-', 'MOTO', 'moto')) || UserAgentMatcher::contains($userAgent, 'Motorola')) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/MotorolaUserAgentMatcher.php');
return new MotorolaUserAgentMatcher($wurfl);
}
// Continue processing UAMs in alphabetical order
// Alcatel
if (UserAgentMatcher::startsWith($userAgent_lcase, "alcatel")) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/AlcatelUserAgentMatcher.php');
return new AlcatelUserAgentMatcher($wurfl);
}
// Apple
if (UserAgentMatcher::contains($userAgent, array("iPhone", "iPod", "iPad", "(iphone"))) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/AppleUserAgentMatcher.php');
return new AppleUserAgentMatcher($wurfl);
}
// BenQ
if (UserAgentMatcher::startsWith($userAgent_lcase, "benq")) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/BenQUserAgentMatcher.php');
return new BenQUserAgentMatcher($wurfl);
}
// DoCoMo
if (UserAgentMatcher::startsWith($userAgent, "DoCoMo")) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/DoCoMoUserAgentMatcher.php');
return new DoCoMoUserAgentMatcher($wurfl);
}
// Grundig
if (UserAgentMatcher::startsWith($userAgent_lcase, "grundig")) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/GrundigUserAgentMatcher.php');
return new GrundigUserAgentMatcher($wurfl);
}
// HTC
if (UserAgentMatcher::contains($userAgent, array("HTC", "XV6875"))) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/HTCUserAgentMatcher.php');
return new HTCUserAgentMatcher($wurfl);
}
// KDDI
if (UserAgentMatcher::contains($userAgent, "KDDI-")) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/KddiUserAgentMatcher.php');
return new KddiUserAgentMatcher($wurfl);
}
// Kyocera
if (UserAgentMatcher::startsWith($userAgent, array("kyocera", "QC-", "KWC-"))) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/KyoceraUserAgentMatcher.php');
return new KyoceraUserAgentMatcher($wurfl);
}
// LG
if (UserAgentMatcher::startsWith($userAgent_lcase, "lg")) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/LGUserAgentMatcher.php');
return new LGUserAgentMatcher($wurfl);
}
// Mitsubishi
if (UserAgentMatcher::startsWith($userAgent, "Mitsu")) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/MitsubishiUserAgentMatcher.php');
return new MitsubishiUserAgentMatcher($wurfl);
}
// NEC
if (UserAgentMatcher::startsWith($userAgent, array("NEC-", "KGT"))) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/NecUserAgentMatcher.php');
//.........这里部分代码省略.........
开发者ID:anubhaBhargava,项目名称:OpenRecommender,代码行数:101,代码来源:UserAgentFactory.php
示例20: applyConclusiveMatch
public function applyConclusiveMatch($ua)
{
$tolerance = UserAgentUtils::firstSlash($ua);
$this->wurfl->toLog("Applying " . get_class($this) . " Conclusive Match: RIS with threshold {$tolerance}", LOG_INFO);
return $this->risMatch($ua, $tolerance);
}
开发者ID:anubhaBhargava,项目名称:OpenRecommender,代码行数:6,代码来源:OperaMiniUserAgentMatcher.php
注:本文中的UserAgentUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论