public function normalize($userAgent) { if (WURFL_Handlers_Utils::checkIfContainsAnyOf($userAgent, array('WPDesktop', 'ZuneWP7')) || WURFL_Handlers_Utils::checkIfContainsAll($userAgent, array('Mozilla/5.0 (Windows NT ', ' ARM;', ' Edge/'))) { $model = WURFL_Handlers_WindowsPhoneHandler::getWindowsPhoneDesktopModel($userAgent); $version = WURFL_Handlers_WindowsPhoneHandler::getWindowsPhoneDesktopVersion($userAgent); } else { if (WURFL_Handlers_Utils::checkIfStartsWithAnyOf($userAgent, array('Windows Phone Ad Client', 'WindowsPhoneAdClient'))) { $model = WURFL_Handlers_WindowsPhoneHandler::getWindowsPhoneAdClientModel($userAgent); $version = WURFL_Handlers_WindowsPhoneHandler::getWindowsPhoneVersion($userAgent); } else { if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'NativeHost')) { return $userAgent; } else { $model = WURFL_Handlers_WindowsPhoneHandler::getWindowsPhoneModel($userAgent); $version = WURFL_Handlers_WindowsPhoneHandler::getWindowsPhoneVersion($userAgent); } } } if ($model !== null && $version !== null) { // "WP" is for Windows Phone $prefix = 'WP' . $version . ' ' . $model . WURFL_Constants::RIS_DELIMITER; return $prefix . $userAgent; } return $userAgent; }
public function normalize($userAgent) { $model = WURFL_Handlers_WindowsPhoneHandler::getWindowsPhoneModel($userAgent); $version = WURFL_Handlers_WindowsPhoneHandler::getWindowsPhoneVersion($userAgent); if ($model !== null && $version !== null) { $prefix = 'WP' . $version . ' ' . $model . WURFL_Constants::RIS_DELIMITER; return $prefix . $userAgent; } return $userAgent; }
public function applyRecoveryMatch($userAgent) { // Windows Phone if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'Windows Phone')) { $version = WURFL_Handlers_WindowsPhoneHandler::getWindowsPhoneVersion($userAgent); $significant_version = explode('.', $version); if ($significant_version[0] !== null) { if ($significant_version[1] === 0) { $deviceID = 'generic_ms_phone_os' . $significant_version[0] . '_subuaucweb'; } else { $deviceID = 'generic_ms_phone_os' . $significant_version[0] . '_' . $significant_version[1] . '_subuaucweb'; } if (in_array($deviceID, self::$constantIDs)) { return $deviceID; } } return 'generic_ms_phone_os8_subuaucweb'; } else { if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'Android')) { $version = WURFL_Handlers_AndroidHandler::getAndroidVersion($userAgent, false); $significant_version = explode('.', $version); if ($significant_version[0] !== null) { $deviceID = 'generic_ucweb_android_ver' . $significant_version[0]; if (in_array($deviceID, self::$constantIDs)) { return $deviceID; } } return 'generic_ucweb_android_ver1'; } else { if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'iPhone;')) { if (preg_match('/iPhone OS (\\d+)(?:_\\d+)?.+ like/', $userAgent, $matches)) { $significant_version = $matches[1]; $deviceID = 'apple_iphone_ver' . $significant_version . '_subuaucweb'; if (in_array($deviceID, self::$constantIDs)) { return $deviceID; } } return 'apple_iphone_ver1_subuaucweb'; } else { if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'iPad')) { if (preg_match('/CPU OS (\\d+)(?:_\\d+)?.+like Mac/', $userAgent, $matches)) { $significant_version = $matches[1]; $deviceID = 'apple_ipad_ver1_sub' . $significant_version . '_subuaucweb'; if (in_array($deviceID, self::$constantIDs)) { return $deviceID; } } return 'apple_ipad_ver1_subuaucweb'; } } } } return 'generic_ucweb'; }
public function normalize($userAgent) { $ucb_version = WURFL_Handlers_UcwebU3Handler::getUcBrowserVersion($userAgent); if ($ucb_version === null) { return $userAgent; } // Windows Phone goes before Android if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'Windows Phone')) { // Apply Version+Model--- matching normalization $model = WURFL_Handlers_WindowsPhoneHandler::getWindowsPhoneModel($userAgent); $version = WURFL_Handlers_WindowsPhoneHandler::getWindowsPhoneVersion($userAgent); if ($model !== null && $version !== null) { $prefix = "{$version} U3WP {$ucb_version} {$model}" . WURFL_Constants::RIS_DELIMITER; return $prefix . $userAgent; } } else { if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'Android')) { // Apply Version+Model--- matching normalization $model = WURFL_Handlers_AndroidHandler::getAndroidModel($userAgent, false); $version = WURFL_Handlers_AndroidHandler::getAndroidVersion($userAgent, false); if ($model !== null && $version !== null) { $prefix = "{$version} U3Android {$ucb_version} {$model}" . WURFL_Constants::RIS_DELIMITER; return $prefix . $userAgent; } } else { if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'iPhone;')) { if (preg_match('/iPhone OS (\\d+)(?:_(\\d+))?(?:_\\d+)* like/', $userAgent, $matches)) { $version = $matches[1] . '.' . $matches[2]; $prefix = "{$version} U3iPhone {$ucb_version}" . WURFL_Constants::RIS_DELIMITER; return $prefix . $userAgent; } } else { if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'iPad')) { if (preg_match('/CPU OS (\\d)_?(\\d)?.+like Mac.+; iPad([0-9,]+)\\) AppleWebKit/', $userAgent, $matches)) { $version = $matches[1] . '.' . $matches[2]; $model = $matches[3]; $prefix = "{$version} U3iPad {$ucb_version} {$model}" . WURFL_Constants::RIS_DELIMITER; return $prefix . $userAgent; } } } } } return $userAgent; }
public function normalize($userAgent) { if (WURFL_Handlers_Utils::checkIfStartsWith($userAgent, 'Windows Phone Ad Client')) { $model = WURFL_Handlers_WindowsPhoneHandler::getWindowsPhoneAdClientModel($userAgent); $version = WURFL_Handlers_WindowsPhoneHandler::getWindowsPhoneAdClientVersion($userAgent); } else { if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'NativeHost')) { return $userAgent; } else { $model = WURFL_Handlers_WindowsPhoneHandler::getWindowsPhoneModel($userAgent); $version = WURFL_Handlers_WindowsPhoneHandler::getWindowsPhoneVersion($userAgent); } } if ($model !== null && $version !== null) { $prefix = 'WP' . $version . ' ' . $model . WURFL_Constants::RIS_DELIMITER; return $prefix . $userAgent; } return $userAgent; }