本文整理汇总了PHP中WURFL_Handlers_Utils类的典型用法代码示例。如果您正苦于以下问题:PHP WURFL_Handlers_Utils类的具体用法?PHP WURFL_Handlers_Utils怎么用?PHP WURFL_Handlers_Utils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WURFL_Handlers_Utils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applyRecoveryMatch
public function applyRecoveryMatch($userAgent)
{
if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'Windows CE;')) {
return 'generic_ms_mobile';
}
return $this->getDeviceIDFromRIS($userAgent, 6);
}
示例2: applyRecoveryMatch
public function applyRecoveryMatch($userAgent)
{
if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'Froyo')) {
return 'generic_android_ver2_2';
}
$android_version = self::getAndroidVersion($userAgent);
$version_string = str_replace('.', '_', $android_version);
$deviceID = 'generic_android_ver' . $version_string;
if ($deviceID == 'generic_android_ver2_0') {
$deviceID = 'generic_android_ver2';
}
if ($deviceID == 'generic_android_ver4_0') {
$deviceID = 'generic_android_ver4';
}
if (($android_version < 3.0 || $android_version >= 4.0) && WURFL_Handlers_Utils::checkIfContains($userAgent, 'Safari') && !WURFL_Handlers_Utils::checkIfContains($userAgent, 'Mobile')) {
// This is probably a tablet (Android 3.x is always a tablet, so it doesn't have a "_tablet" ID)
if (in_array($deviceID . '_tablet', self::$constantIDs)) {
return $deviceID . '_tablet';
}
return 'generic_android_ver1_5_tablet';
}
if (in_array($deviceID, self::$constantIDs)) {
return $deviceID;
}
return 'generic_android';
}
示例3: canHandle
public function canHandle($userAgent)
{
if (WURFL_Handlers_Utils::isDesktopBrowser($userAgent)) {
return false;
}
return WURFL_Handlers_Utils::checkIfStartsWith($userAgent, 'Qtek');
}
示例4: canHandle
public function canHandle($userAgent)
{
if (WURFL_Handlers_Utils::isDesktopBrowser($userAgent)) {
return false;
}
return WURFL_Handlers_Utils::checkIfStartsWith($userAgent, "Philips") || WURFL_Handlers_Utils::checkIfStartsWith($userAgent, "PHILIPS");
}
示例5: applyRecoveryMatch
/**
* If the User Agent contains "MIB/2.2" or "MIB/BER2.2",
* return "mot_mib22_generic"
*
* @param string $userAgent
* @return string
*/
function applyRecoveryMatch($userAgent)
{
if (WURFL_Handlers_Utils::checkIfContains($userAgent, "MIB/2.2") || WURFL_Handlers_Utils::checkIfContains($userAgent, "MIB/BER2.2")) {
return "mot_mib22_generic";
}
return WURFL_Constants::GENERIC;
}
示例6: applyRecoveryMatch
public function applyRecoveryMatch($userAgent)
{
if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'Skyfire/2.')) {
return 'generic_skyfire_version2';
}
return 'generic_skyfire_version1';
}
示例7: canHandle
public function canHandle($userAgent)
{
if (WURFL_Handlers_Utils::isDesktopBrowser($userAgent)) {
return false;
}
return WURFL_Handlers_Utils::checkIfContainsAnyOf($userAgent, array('HTC', 'XV6875'));
}
示例8: applyRecoveryMatch
/**
* Apply Recovery Match
*
* @param string $userAgent
* @return string
*/
function applyRecoveryMatch($userAgent)
{
if (strpos($userAgent, "BlackBerry") === 0) {
$position = WURFL_Handlers_Utils::firstSlash($userAgent);
if ($position > 0 && $position + 4 <= strlen($userAgent)) {
$version = substr($userAgent, $position + 1, $position + 4);
if (strpos($version, "2.") === 0) {
return "blackberry_generic_ver2";
}
if (strpos($version, "3.2") === 0) {
return "blackberry_generic_ver3_sub2";
}
if (strpos($version, "3.3") === 0) {
return "blackberry_generic_ver3_sub30";
}
if (strpos($version, "3.5") === 0) {
return "blackberry_generic_ver3_sub50";
}
if (strpos($version, "3.6") === 0) {
return "blackberry_generic_ver3_sub60";
}
if (strpos($version, "3.7") === 0) {
return "blackberry_generic_ver3_sub70";
}
if (strpos($version, "4.") === 0) {
return "blackberry_generic_ver4";
}
}
}
}
示例9: normalize
public function normalize($userAgent)
{
// Normalize Android version
$userAgent = preg_replace('/(Android)[ \\-\\/](\\d\\.\\d)([^; \\/\\)]+)/', '$1 $2', $userAgent);
// Opera Mobi/Tablet
$is_opera_mobi = WURFL_Handlers_Utils::checkIfContains($userAgent, 'Opera Mobi');
$is_opera_tablet = WURFL_Handlers_Utils::checkIfContains($userAgent, 'Opera Tablet');
if ($is_opera_mobi || $is_opera_tablet) {
$opera_version = WURFL_Handlers_AndroidHandler::getOperaOnAndroidVersion($userAgent, false);
$android_version = WURFL_Handlers_AndroidHandler::getAndroidVersion($userAgent, false);
if ($opera_version !== null && $android_version !== null) {
$opera_model = $is_opera_tablet ? 'Opera Tablet' : 'Opera Mobi';
$prefix = $opera_model . ' ' . $opera_version . ' Android ' . $android_version . WURFL_Constants::RIS_DELIMITER;
return $prefix . $userAgent;
}
}
// Stock Android
if (!WURFL_Handlers_Utils::checkIfContainsAnyOf($userAgent, $this->skip_normalization)) {
$model = WURFL_Handlers_AndroidHandler::getAndroidModel($userAgent, false);
$version = WURFL_Handlers_AndroidHandler::getAndroidVersion($userAgent, false);
if ($model !== null && $version !== null) {
$prefix = $version . ' ' . $model . WURFL_Constants::RIS_DELIMITER;
return $prefix . $userAgent;
}
}
return $userAgent;
}
示例10: canHandle
public function canHandle($userAgent)
{
if (WURFL_Handlers_Utils::isDesktopBrowser($userAgent)) {
return false;
}
return WURFL_Handlers_Utils::checkIfContains($userAgent, 'Android') && WURFL_Handlers_Utils::checkIfContains($userAgent, 'NetFrontLifeBrowser/2.2');
}
示例11: lookForMatchingUserAgent
/**
*
* Apply RIS with FS (First Slash) after Nokia String as a threshold.
*
*
* @param string $userAgent
* @return string
*/
function lookForMatchingUserAgent($userAgent)
{
//$tolerance = WU
$tolerance = WURFL_Handlers_Utils::indexOfAnyOrLength($userAgent, array("/", " "), strpos($userAgent, "Nokia"));
$userAgents = array_keys($this->userAgentsWithDeviceID);
return parent::applyRisWithTollerance($userAgents, $userAgent, $tolerance);
}
示例12: applyRecoveryMatch
public function applyRecoveryMatch($userAgent)
{
$version = self::getWindowsPhoneVersion($userAgent);
if ($version == "8.1") {
return 'generic_ms_phone_os8_1';
}
if ($version == "8.0") {
return 'generic_ms_phone_os8';
}
if ($version == "7.8") {
return 'generic_ms_phone_os7_8';
}
if ($version == "7.5") {
return 'generic_ms_phone_os7_5';
}
if ($version == "7.0") {
return 'generic_ms_phone_os7';
}
if ($version == "6.5") {
return 'generic_ms_winmo6_5';
}
//These are probably UAs of the type "Windows Phone Ad Client (Xna)/5.1.0.0 BMID/E67970D969"
if (WURFL_Handlers_Utils::checkIfStartsWith($userAgent, 'Windows Phone Ad Client') || WURFL_Handlers_Utils::checkIfStartsWith($userAgent, 'WindowsPhoneAdClient')) {
return 'generic_ms_phone_os7';
}
return WURFL_Constants::NO_MATCH;
}
示例13: canHandle
public function canHandle($userAgent)
{
if (WURFL_Handlers_Utils::isDesktopBrowser($userAgent)) {
return false;
}
return WURFL_Handlers_Utils::checkIfStartsWithAnyOf($userAgent, array('kyocera', 'QC-', 'KWC-'));
}
示例14: applyRecoveryMatch
public function applyRecoveryMatch($userAgent)
{
if (WURFL_Handlers_Utils::checkIfContainsAnyOf($userAgent, array('MIB/2.2', 'MIB/BER2.2'))) {
return "mot_mib22_generic";
}
return null;
}
示例15: applyRecoveryMatch
public function applyRecoveryMatch($userAgent)
{
if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'Windows CE;')) {
return 'generic_ms_mobile';
}
return WURFL_Constants::NO_MATCH;
}