本文整理汇总了PHP中WURFL_Handlers_Utils::isMobileBrowser方法的典型用法代码示例。如果您正苦于以下问题:PHP WURFL_Handlers_Utils::isMobileBrowser方法的具体用法?PHP WURFL_Handlers_Utils::isMobileBrowser怎么用?PHP WURFL_Handlers_Utils::isMobileBrowser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WURFL_Handlers_Utils
的用法示例。
在下文中一共展示了WURFL_Handlers_Utils::isMobileBrowser方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: canHandle
/**
* Intercept all UAs Containing AOL and are not mobile browsers
*
* @param string $userAgent
* @return boolean
*/
public function canHandle($userAgent)
{
if (WURFL_Handlers_Utils::isMobileBrowser($userAgent)) {
return false;
}
return WURFL_Handlers_Utils::checkIfContains($userAgent, "AOL");
}
示例2: canHandle
public function canHandle($userAgent)
{
if (WURFL_Handlers_Utils::isMobileBrowser($userAgent)) {
return false;
}
return WURFL_Handlers_Utils::checkIfContains($userAgent, 'Safari') && WURFL_Handlers_Utils::checkIfStartsWithAnyOf($userAgent, array('Mozilla/5.0 (Macintosh', 'Mozilla/5.0 (Windows'));
}
示例3: canHandle
public function canHandle($userAgent)
{
if (WURFL_Handlers_Utils::isMobileBrowser($userAgent)) {
return false;
}
return WURFL_Handlers_Utils::checkIfStartsWith($userAgent, 'Mozilla') && WURFL_Handlers_Utils::checkIfContains($userAgent, 'Safari');
}
示例4: canHandle
public function canHandle($userAgent)
{
if (WURFL_Handlers_Utils::isMobileBrowser($userAgent)) {
return false;
}
return WURFL_Handlers_Utils::checkIfContainsAnyOf($userAgent, array('Opera', 'OPR/'));
}
示例5: canHandle
public function canHandle($userAgent)
{
if (WURFL_Handlers_Utils::isMobileBrowser($userAgent)) {
return false;
}
return WURFL_Handlers_Utils::checkIfContainsAnyOf($userAgent, array('Thunderbird', 'Microsoft Outlook', 'MSOffice'));
}
示例6: canHandle
public function canHandle($userAgent)
{
if (WURFL_Handlers_Utils::isMobileBrowser($userAgent)) {
return false;
}
if (WURFL_Handlers_Utils::checkIfContainsAnyOf($userAgent, array('Tablet', 'Sony', 'Novarra', 'Opera'))) {
return false;
}
return WURFL_Handlers_Utils::checkIfContains($userAgent, 'Firefox');
}
示例7: canHandle
public function canHandle($userAgent)
{
if (WURFL_Handlers_Utils::isMobileBrowser($userAgent)) {
return false;
}
if (WURFL_Handlers_Utils::checkIfContainsAnyOf($userAgent, array('Opera', 'armv', 'MOTO', 'BREW'))) {
return false;
}
return WURFL_Handlers_Utils::checkIfStartsWith($userAgent, 'Mozilla') && WURFL_Handlers_Utils::checkIfContains($userAgent, 'MSIE');
}
示例8: canHandle
public function canHandle($userAgent)
{
if (WURFL_Handlers_Utils::isMobileBrowser($userAgent)) {
return false;
}
if (WURFL_Handlers_Utils::checkIfContainsAnyOf($userAgent, array('Opera', 'armv', 'MOTO', 'BREW'))) {
return false;
}
// IE 11 signature
$has_trident_rv = WURFL_Handlers_Utils::checkIfContains($userAgent, 'Trident') && WURFL_Handlers_Utils::checkIfContains($userAgent, 'rv:');
// IE < 11 signature
$has_msie = WURFL_Handlers_Utils::checkIfContains($userAgent, 'MSIE');
return $has_msie || $has_trident_rv;
}
示例9: isDesktopBrowserHeavyDutyAnalysis
/**
* Is the given user agent very likely to be a desktop browser
* @param string $userAgent
* @return bool
*/
public static function isDesktopBrowserHeavyDutyAnalysis($userAgent)
{
// Check Smart TV keywords
if (WURFL_Handlers_Utils::isSmartTV($userAgent)) {
return false;
}
// Chrome
if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'Chrome') && !WURFL_Handlers_Utils::checkIfContainsAnyOf($userAgent, array('Android', 'Ventana'))) {
return true;
}
// Check mobile keywords
if (WURFL_Handlers_Utils::isMobileBrowser($userAgent)) {
return false;
}
if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'PPC')) {
return false;
}
// PowerPC; not always mobile, but we'll kick it out
// Firefox; fennec is already handled in the WURFL_Constants::$MOBILE_BROWSERS keywords
if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'Firefox') && !WURFL_Handlers_Utils::checkIfContains($userAgent, 'Tablet')) {
return true;
}
// Safari
if (preg_match('#^Mozilla/5\\.0 \\((?:Macintosh|Windows)[^\\)]+\\) AppleWebKit/[\\d\\.]+ \\(KHTML, like Gecko\\) Version/[\\d\\.]+ Safari/[\\d\\.]+$#', $userAgent)) {
return true;
}
// Opera Desktop
if (WURFL_Handlers_Utils::checkIfStartsWith($userAgent, 'Opera/9.80 (Windows NT', 'Opera/9.80 (Macintosh')) {
return true;
}
// Check desktop keywords
if (WURFL_Handlers_Utils::isDesktopBrowser($userAgent)) {
return true;
}
// Internet Explorer 11
if (preg_match('/^Mozilla\\/5\\.0 \\(Windows NT.+?Trident.+?; rv:\\d\\d\\.\\d+\\)/', $userAgent)) {
return true;
}
// Internet Explorer 9 or 10
if (preg_match('/^Mozilla\\/5\\.0 \\(compatible; MSIE (9|10)\\.0; Windows NT \\d\\.\\d/', $userAgent)) {
return true;
}
// Internet Explorer <9
if (preg_match('/^Mozilla\\/4\\.0 \\(compatible; MSIE \\d\\.\\d; Windows NT \\d\\.\\d/', $userAgent)) {
return true;
}
return false;
}
示例10: applyRecoveryCatchAllMatch
/**
* Applies Catch-All match
* @param string $userAgent
* @return string WURFL deviceID
*/
public function applyRecoveryCatchAllMatch($userAgent)
{
if (WURFL_Handlers_Utils::isDesktopBrowserHeavyDutyAnalysis($userAgent)) {
return WURFL_Constants::GENERIC_WEB_BROWSER;
}
$mobile = WURFL_Handlers_Utils::isMobileBrowser($userAgent);
$desktop = WURFL_Handlers_Utils::isDesktopBrowser($userAgent);
if (!$desktop) {
$deviceId = WURFL_Handlers_Utils::getMobileCatchAllId($userAgent);
if ($deviceId !== WURFL_Constants::NO_MATCH) {
return $deviceId;
}
}
if ($mobile) {
return WURFL_Constants::GENERIC_MOBILE;
}
if ($desktop) {
return WURFL_Constants::GENERIC_WEB_BROWSER;
}
return WURFL_Constants::GENERIC;
}
示例11: applyRecoveryCatchAllMatch
/**
* Applies Catch-All match
* @param string $userAgent
* @return string WURFL deviceID
*/
public function applyRecoveryCatchAllMatch($userAgent)
{
if (WURFL_Handlers_Utils::isDesktopBrowserHeavyDutyAnalysis($userAgent)) {
return WURFL_Constants::GENERIC_WEB_BROWSER;
}
if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'CoreMedia')) {
return 'apple_iphone_coremedia_ver1';
}
if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'Windows CE')) {
return 'generic_ms_mobile';
}
if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'UP.Browser/7.2')) {
return 'opwv_v72_generic';
}
if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'UP.Browser/7')) {
return 'opwv_v7_generic';
}
if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'UP.Browser/6.2')) {
return 'opwv_v62_generic';
}
if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'UP.Browser/6')) {
return 'opwv_v6_generic';
}
if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'UP.Browser/5')) {
return 'upgui_generic';
}
if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'UP.Browser/4')) {
return 'uptext_generic';
}
if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'UP.Browser/3')) {
return 'uptext_generic';
}
// Series 60
if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'Series60')) {
return 'nokia_generic_series60';
}
// Access/Net Front
if (WURFL_Handlers_Utils::checkIfContainsAnyOf($userAgent, array('NetFront/3.0', 'ACS-NF/3.0'))) {
return 'generic_netfront_ver3';
}
if (WURFL_Handlers_Utils::checkIfContainsAnyOf($userAgent, array('NetFront/3.1', 'ACS-NF/3.1'))) {
return 'generic_netfront_ver3_1';
}
if (WURFL_Handlers_Utils::checkIfContainsAnyOf($userAgent, array('NetFront/3.2', 'ACS-NF/3.2'))) {
return 'generic_netfront_ver3_2';
}
if (WURFL_Handlers_Utils::checkIfContainsAnyOf($userAgent, array('NetFront/3.3', 'ACS-NF/3.3'))) {
return 'generic_netfront_ver3_3';
}
if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'NetFront/3.4')) {
return 'generic_netfront_ver3_4';
}
if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'NetFront/3.5')) {
return 'generic_netfront_ver3_5';
}
if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'NetFront/4.0')) {
return 'generic_netfront_ver4_0';
}
// Contains Mozilla/, but not at the beginning of the UA
// ie: MOTORAZR V8/R601_G_80.41.17R Mozilla/4.0 (compatible; MSIE 6.0 Linux; MOTORAZR V88.50) Profile/MIDP-2.0 Configuration/CLDC-1.1 Opera 8.50[zh]
if (strpos($userAgent, 'Mozilla/') > 0) {
return WURFL_Constants::GENERIC_XHTML;
}
if (WURFL_Handlers_Utils::checkIfContainsAnyOf($userAgent, array('Obigo', 'AU-MIC/2', 'AU-MIC-', 'AU-OBIGO/', 'Teleca Q03B1'))) {
return WURFL_Constants::GENERIC_XHTML;
}
// DoCoMo
if (WURFL_Handlers_Utils::checkIfStartsWithAnyOf($userAgent, array('DoCoMo', 'KDDI'))) {
return 'docomo_generic_jap_ver1';
}
if (WURFL_Handlers_Utils::isMobileBrowser($userAgent)) {
return WURFL_Constants::GENERIC_MOBILE;
}
return WURFL_Constants::GENERIC;
}