本文整理汇总了PHP中UserAgentUtils::isRobot方法的典型用法代码示例。如果您正苦于以下问题:PHP UserAgentUtils::isRobot方法的具体用法?PHP UserAgentUtils::isRobot怎么用?PHP UserAgentUtils::isRobot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserAgentUtils
的用法示例。
在下文中一共展示了UserAgentUtils::isRobot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createUserAgentMatcher
//.........这里部分代码省略.........
}
// Sagem
if (UserAgentMatcher::startsWith($userAgent_lcase, "sagem")) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/SagemUserAgentMatcher.php');
return new SagemUserAgentMatcher($wurfl);
}
// Sanyo
if (UserAgentMatcher::startsWith($userAgent_lcase, "sanyo") || UserAgentMatcher::contains($userAgent, "MobilePhone")) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/SanyoUserAgentMatcher.php');
return new SanyoUserAgentMatcher($wurfl);
}
// Sharp
if (UserAgentMatcher::startsWith($userAgent_lcase, "sharp")) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/SharpUserAgentMatcher.php');
return new SharpUserAgentMatcher($wurfl);
}
// Siemens
if (UserAgentMatcher::startsWith($userAgent, "SIE-")) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/SiemensUserAgentMatcher.php');
return new SiemensUserAgentMatcher($wurfl);
}
// SPV
if (UserAgentMatcher::contains($userAgent, 'SPV')) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/SPVUserAgentMatcher.php');
return new SPVUserAgentMatcher($wurfl);
}
// Toshiba
if (UserAgentMatcher::startsWith($userAgent, "Toshiba")) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/ToshibaUserAgentMatcher.php');
return new ToshibaUserAgentMatcher($wurfl);
}
// Vodafone
if (UserAgentMatcher::startsWith($userAgent, 'Vodafone')) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/VodafoneUserAgentMatcher.php');
return new VodafoneUserAgentMatcher($wurfl);
}
// Process mobile browsers after mobile devices
// Android
if (UserAgentMatcher::contains($userAgent, "Android")) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/AndroidUserAgentMatcher.php');
return new AndroidUserAgentMatcher($wurfl);
}
// Opera Mini
if (UserAgentMatcher::contains($userAgent, array('Opera Mini', 'Opera Mobi'))) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/OperaMiniUserAgentMatcher.php');
return new OperaMiniUserAgentMatcher($wurfl);
}
// Windows CE
if (UserAgentMatcher::contains($userAgent, "Mozilla/") && UserAgentMatcher::contains($userAgent, "Windows CE")) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/WindowsCEUserAgentMatcher.php');
return new WindowsCEUserAgentMatcher($wurfl);
}
}
// End if(!$isDesktop)
// Process Robots (Web Crawlers and the like)
if (UserAgentUtils::isRobot($userAgent)) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/BotUserAgentMatcher.php');
return new BotUserAgentMatcher($wurfl);
}
// Process NON-MOBILE user agents
if (!$isMobile) {
// MSIE
if (UserAgentMatcher::startsWith($userAgent, "Mozilla") && UserAgentMatcher::contains($userAgent, "MSIE") && !UserAgentMatcher::contains($userAgent, array("Opera", "armv", "MOTO", "BREW"))) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/MSIEUserAgentMatcher.php');
return new MSIEUserAgentMatcher($wurfl);
}
// Firefox
if (UserAgentMatcher::contains($userAgent, "Firefox") && !UserAgentMatcher::contains($userAgent, array("Sony", "Novarra", "Opera"))) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/FirefoxUserAgentMatcher.php');
return new FirefoxUserAgentMatcher($wurfl);
}
// Chrome
if (UserAgentMatcher::contains($userAgent, "Chrome")) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/ChromeUserAgentMatcher.php');
return new ChromeUserAgentMatcher($wurfl);
}
// Konqueror
if (UserAgentMatcher::contains($userAgent, "Konqueror")) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/KonquerorUserAgentMatcher.php');
return new KonquerorUserAgentMatcher($wurfl);
}
// Opera
if (UserAgentMatcher::contains($userAgent, "Opera")) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/OperaUserAgentMatcher.php');
return new OperaUserAgentMatcher($wurfl);
}
// Safari
if (UserAgentMatcher::startsWith($userAgent, "Mozilla") && UserAgentMatcher::contains($userAgent, "Safari")) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/SafariUserAgentMatcher.php');
return new SafariUserAgentMatcher($wurfl);
}
// AOL
if (UserAgentMatcher::contains($userAgent, array("AOL", "America Online")) || UserAgentMatcher::contains($userAgent_lcase, "aol 9")) {
require_once realpath(dirname(__FILE__) . '/UserAgentMatchers/AOLUserAgentMatcher.php');
return new AOLUserAgentMatcher($wurfl);
}
}
// Nothing has matched so we will have to use the CatchAllUserAgentMatcher
return new CatchAllUserAgentMatcher($wurfl);
}