本文整理匯總了PHP中WURFL_Handlers_Utils::isSmartTV方法的典型用法代碼示例。如果您正苦於以下問題:PHP WURFL_Handlers_Utils::isSmartTV方法的具體用法?PHP WURFL_Handlers_Utils::isSmartTV怎麽用?PHP WURFL_Handlers_Utils::isSmartTV使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WURFL_Handlers_Utils
的用法示例。
在下文中一共展示了WURFL_Handlers_Utils::isSmartTV方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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;
}
示例2: canHandle
public function canHandle($userAgent)
{
return WURFL_Handlers_Utils::isSmartTV($userAgent);
}