當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserAgentUtils::isRobot方法代碼示例

本文整理匯總了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);
 }
開發者ID:anubhaBhargava,項目名稱:OpenRecommender,代碼行數:101,代碼來源:UserAgentFactory.php


注:本文中的UserAgentUtils::isRobot方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。