本文整理汇总了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);
}