File indexing completed on 2024-12-22 05:36:47
0001 <?php 0002 /** 0003 * Zend Framework 0004 * 0005 * LICENSE 0006 * 0007 * This source file is subject to the new BSD license that is bundled 0008 * with this package in the file LICENSE.txt. 0009 * It is also available through the world-wide-web at this URL: 0010 * http://framework.zend.com/license/new-bsd 0011 * If you did not receive a copy of the license and are unable to 0012 * obtain it through the world-wide-web, please send an email 0013 * to license@zend.com so we can send you a copy immediately. 0014 * 0015 * @category Zend 0016 * @package Zend_Http 0017 * @subpackage UserAgent 0018 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0019 * @license http://framework.zend.com/license/new-bsd New BSD License 0020 */ 0021 // require_once 'Zend/Http/UserAgent/AbstractDevice.php'; 0022 0023 /** 0024 * Bot browser type matcher 0025 * 0026 * @category Zend 0027 * @package Zend_Http 0028 * @subpackage UserAgent 0029 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0030 * @license http://framework.zend.com/license/new-bsd New BSD License 0031 */ 0032 0033 class Zend_Http_UserAgent_Bot extends Zend_Http_UserAgent_AbstractDevice 0034 { 0035 0036 /** 0037 * User Agent Signatures 0038 * 0039 * @var array 0040 */ 0041 protected static $_uaSignatures = array( 0042 // The most common ones. 0043 'googlebot', 0044 'msnbot', 0045 'slurp', 0046 'yahoo', 0047 0048 // The rest, alphabetically. 0049 'alexa', 0050 'appie', 0051 'archiver', 0052 'ask jeeves', 0053 'baiduspider', 0054 'bot', 0055 'crawl', 0056 'crawler', 0057 'curl', 0058 'eventbox', 0059 'facebookexternal', 0060 'fast', 0061 'feedfetcher-google', 0062 'firefly', 0063 'froogle', 0064 'gigabot', 0065 'girafabot', 0066 'google', 0067 'htdig', 0068 'infoseek', 0069 'inktomi', 0070 'java', 0071 'larbin', 0072 'looksmart', 0073 'mechanize', 0074 'mediapartners-google', 0075 'monitor', 0076 'nambu', 0077 'nationaldirectory', 0078 'novarra', 0079 'pear', 0080 'perl', 0081 'python', 0082 'rabaz', 0083 'radian', 0084 'rankivabot', 0085 'scooter', 0086 'sogou web spider', 0087 'spade', 0088 'sphere', 0089 'spider', 0090 'technoratisnoop', 0091 'tecnoseek', 0092 'teoma', 0093 'toolbar', 0094 'transcoder', 0095 'twitt', 0096 'url_spider_sql', 0097 'webalta crawler', 0098 'webbug', 0099 'webfindbot', 0100 'wordpress', 0101 'www.galaxy.com', 0102 'yahoo! searchmonkey', 0103 'yahoo! slurp', 0104 'yandex', 0105 'zyborg', 0106 ); 0107 0108 /** 0109 * Comparison of the UserAgent chain and browser signatures 0110 * 0111 * @param string $userAgent User Agent chain 0112 * @param array $server $_SERVER like param 0113 * @return bool 0114 */ 0115 public static function match($userAgent, $server) 0116 { 0117 return self::_matchAgentAgainstSignatures($userAgent, self::$_uaSignatures); 0118 } 0119 0120 /** 0121 * Gives the current browser type 0122 * 0123 * @return string 0124 */ 0125 public function getType() 0126 { 0127 return 'bot'; 0128 } 0129 }