Completed
Pull Request — master (#56)
by Mark
02:06
created
src/CrawlerDetect.php 1 patch
Indentation   +403 added lines, -403 removed lines patch added patch discarded remove patch
@@ -4,425 +4,425 @@
 block discarded – undo
4 4
 
5 5
 class CrawlerDetect
6 6
 {
7
-    /**
8
-     * The user agent.
9
-     * 
10
-     * @var null
11
-     */
12
-    protected $userAgent = null;
7
+	/**
8
+	 * The user agent.
9
+	 * 
10
+	 * @var null
11
+	 */
12
+	protected $userAgent = null;
13 13
 
14
-    /**
15
-     * Headers that contain a user agent.
16
-     * 
17
-     * @var array
18
-     */
19
-    protected $httpHeaders = array();
14
+	/**
15
+	 * Headers that contain a user agent.
16
+	 * 
17
+	 * @var array
18
+	 */
19
+	protected $httpHeaders = array();
20 20
 
21
-    /**
22
-     * Store regex matches.
23
-     * 
24
-     * @var array
25
-     */
26
-    protected $matches = array();
21
+	/**
22
+	 * Store regex matches.
23
+	 * 
24
+	 * @var array
25
+	 */
26
+	protected $matches = array();
27 27
 
28
-    /**
29
-     * List of strings to remove from the user agent before running the crawler regex
30
-     * Over a large list of user agents, this gives us about a 55% speed increase!
31
-     * 
32
-     * @var array
33
-     */
34
-    protected static $ignore = array(
35
-        'Safari.[\d\.]*',
36
-        'Firefox.[\d\.]*',
37
-        'Chrome.[\d\.]*',
38
-        'Chromium.[\d\.]*',
39
-        'MSIE.[\d\.]',
40
-        'Opera\/[\d\.]*',
41
-        'Mozilla.[\d\.]*',
42
-        'AppleWebKit.[\d\.]*',
43
-        'Trident.[\d\.]*',
44
-        'Windows NT.[\d\.]*',
45
-        'Android.[\d\.]*',
46
-        'Macintosh.',
47
-        'Ubuntu',
48
-        'Linux',
49
-        '[ ]Intel',
50
-        'Mac OS X',
51
-        'Gecko.[\d\.]*',
52
-        'KHTML',
53
-        'CriOS.[\d\.]*',
54
-        'CPU iPhone OS ([0-9_])* like Mac OS X',
55
-        'CPU OS ([0-9_])* like Mac OS X',
56
-        'iPod',
57
-        'like Gecko',
58
-        'compatible',
59
-        'x86_..',
60
-        'i686',
61
-        'x64',
62
-        'X11',
63
-        'rv:[\d\.]*',
64
-        'Version.[\d\.]*',
65
-        'WOW64',
66
-        'Win64',
67
-        'Dalvik.[\d\.]*',
68
-        '\.NET CLR [\d\.]*',
69
-        'Presto.[\d\.]*',
70
-        'Media Center PC',
71
-    );
28
+	/**
29
+	 * List of strings to remove from the user agent before running the crawler regex
30
+	 * Over a large list of user agents, this gives us about a 55% speed increase!
31
+	 * 
32
+	 * @var array
33
+	 */
34
+	protected static $ignore = array(
35
+		'Safari.[\d\.]*',
36
+		'Firefox.[\d\.]*',
37
+		'Chrome.[\d\.]*',
38
+		'Chromium.[\d\.]*',
39
+		'MSIE.[\d\.]',
40
+		'Opera\/[\d\.]*',
41
+		'Mozilla.[\d\.]*',
42
+		'AppleWebKit.[\d\.]*',
43
+		'Trident.[\d\.]*',
44
+		'Windows NT.[\d\.]*',
45
+		'Android.[\d\.]*',
46
+		'Macintosh.',
47
+		'Ubuntu',
48
+		'Linux',
49
+		'[ ]Intel',
50
+		'Mac OS X',
51
+		'Gecko.[\d\.]*',
52
+		'KHTML',
53
+		'CriOS.[\d\.]*',
54
+		'CPU iPhone OS ([0-9_])* like Mac OS X',
55
+		'CPU OS ([0-9_])* like Mac OS X',
56
+		'iPod',
57
+		'like Gecko',
58
+		'compatible',
59
+		'x86_..',
60
+		'i686',
61
+		'x64',
62
+		'X11',
63
+		'rv:[\d\.]*',
64
+		'Version.[\d\.]*',
65
+		'WOW64',
66
+		'Win64',
67
+		'Dalvik.[\d\.]*',
68
+		'\.NET CLR [\d\.]*',
69
+		'Presto.[\d\.]*',
70
+		'Media Center PC',
71
+	);
72 72
 
73
-    /**
74
-     * Array of regular expressions to match against the user agent.
75
-     * 
76
-     * @var array
77
-     */
78
-    protected static $crawlers = array(
79
-        '008\\/',
80
-        'A6-Indexer',
81
-        'Aboundex',
82
-        'Accoona-AI-Agent',
83
-        'acoon',
84
-        'AddThis',
85
-        'ADmantX',
86
-        'AHC',
87
-        'Airmail',
88
-        'Anemone',
89
-        'Arachmo',
90
-        'archive-com',
91
-        'B-l-i-t-z-B-O-T',
92
-        'bibnum\.bnf',
93
-        'biglotron',
94
-        'binlar',
95
-        'BingPreview',
96
-        'boitho\.com-dc',
97
-        'BUbiNG',
98
-        'Butterfly\\/',
99
-        'BuzzSumo',
100
-        'CapsuleChecker',
101
-        'CC Metadata Scaper',
102
-        'Cerberian Drtrs',
103
-        'changedetection',
104
-        'Charlotte',
105
-        'clips\.ua\.ac\.be',
106
-        'CloudFlare-AlwaysOnline',
107
-        'coccoc',
108
-        'Commons-HttpClient',
109
-        'convera',
110
-        'cosmos',
111
-        'Covario-IDS',
112
-        'curl',
113
-        'CyberPatrol',
114
-        'DataparkSearch',
115
-        'dataprovider',
116
-        'Digg',
117
-        'DomainAppender',
118
-        'drupact',
119
-        'EARTHCOM',
120
-        'ec2linkfinder',
121
-        'ElectricMonk',
122
-        'Embedly',
123
-        'europarchive\.org',
124
-        'EventMachine HttpClient',
125
-        'ezooms',
126
-        'eZ Publish Link Validator',
127
-        'facebookexternalhit',
128
-        'Feedfetcher-Google',
129
-        'FeedValidator',
130
-        'FindLinks',
131
-        'findlink',
132
-        'findthatfile',
133
-        'Flamingo_SearchEngine',
134
-        'fluffy',
135
-        'getprismatic\.com',
136
-        'g00g1e\.net',
137
-        'GigablastOpenSource',
138
-        'grub-client',
139
-        'Genieo',
140
-        'Go-http-client',
141
-        'Google-HTTP-Java-Client',
142
-        'Google favicon',
143
-        'Google Keyword Suggestion',
144
-        'heritrix',
145
-        'Holmes',
146
-        'htdig',
147
-        'httpunit',
148
-        'httrack',
149
-        'HubSpot Marketing Grader',
150
-        'ichiro',
151
-        'infegy',
152
-        'igdeSpyder',
153
-        'InAGist',
154
-        'InfoWizards Reciprocal Link System PRO',
155
-        'integromedb',
156
-        'IODC',
157
-        'IOI',
158
-        'ips-agent',
159
-        'iZSearch',
160
-        'L\.webis',
161
-        'Larbin',
162
-        'libwww',
163
-        'Link Valet',
164
-        'linkdex',
165
-        'LinkExaminer',
166
-        'LinkWalker',
167
-        'Lipperhey Link Explorer',
168
-        'Lipperhey SEO Service',
169
-        'LongURL API',
170
-        'ltx71',
171
-        'lwp-trivial',
172
-        'MegaIndex\.ru',
173
-        'mabontland',
174
-        'MagpieRSS',
175
-        'Mediapartners-Google',
176
-        'MetaURI',
177
-        'Mnogosearch',
178
-        'mogimogi',
179
-        'Morning Paper',
180
-        'Mrcgiguy',
181
-        'MVAClient',
182
-        'netresearchserver',
183
-        'NewsGator',
184
-        'newsme',
185
-        'NG-Search',
186
-        '^NING\\/',
187
-        'Notifixious',
188
-        'nutch',
189
-        'NutchCVS',
190
-        'Nymesis',
191
-        'oegp',
192
-        'online link validator',
193
-        'Online Website Link Checker',
194
-        'Orbiter',
195
-        'ow\.ly',
196
-        'Ploetz \+ Zeller',
197
-        'page2rss',
198
-        'panscient',
199
-        'Peew',
200
-        'phpcrawl',
201
-        'Pizilla',
202
-        'Plukkie',
203
-        'Pompos',
204
-        'postano',
205
-        'PostPost',
206
-        'postrank',
207
-        'proximic',
208
-        'PycURL',
209
-        'Python-httplib2',
210
-        'python-requests',
211
-        'Python-urllib',
212
-        'Qseero',
213
-        'Qwantify',
214
-        'Radian6',
215
-        'RebelMouse',
216
-        'REL Link Checker',
217
-        'RetrevoPageAnalyzer',
218
-        'Riddler',
219
-        'Robosourcer',
220
-        'Ruby',
221
-        'SBIder',
222
-        'ScoutJet',
223
-        'ScoutURLMonitor',
224
-        'Scrapy',
225
-        'Scrubby',
226
-        'SearchSight',
227
-        'semanticdiscovery',
228
-        'SEOstats',
229
-        'Seznam screenshot-generator',
230
-        'ShopWiki',
231
-        'SiteBar',
232
-        'siteexplorer\.info',
233
-        'slider\.com',
234
-        'slurp',
235
-        'Snappy',
236
-        'sogou',
237
-        'speedy',
238
-        'Sqworm',
239
-        'StackRambler',
240
-        'Stratagems Kumo',
241
-        'summify',
242
-        'teoma',
243
-        'theoldreader\.com',
244
-        'TinEye',
245
-        'Traackr.com',
246
-        'truwoGPS',
247
-        'tweetedtimes\.com',
248
-        'Twikle',
249
-        'UnwindFetchor',
250
-        'updated',
251
-        'urlresolver',
252
-        'Validator\.nu\\/LV',
253
-        'Vagabondo',
254
-        'Vivante Link Checker',
255
-        'Vortex',
256
-        'voyager\\/',
257
-        'VYU2',
258
-        'W3C-checklink',
259
-        'W3C_CSS_Validator_JFouffa',
260
-        'W3C_I18n-Checker',
261
-        'W3C-mobileOK',
262
-        'W3C_Unicorn',
263
-        'W3C_Validator',
264
-        'WebIndex',
265
-        'Websquash\.com',
266
-        'webcollage',
267
-        'webmon ',
268
-        'WeSEE:Search',
269
-        'wf84',
270
-        'wget',
271
-        'WomlpeFactory',
272
-        'wotbox',
273
-        'Xenu Link Sleuth',
274
-        'XML Sitemaps Generator',
275
-        'Y!J-ASR',
276
-        'yacy',
277
-        'Yahoo Ad monitoring',
278
-        'Yahoo Link Preview',
279
-        'Yahoo! Slurp China',
280
-        'Yahoo! Slurp',
281
-        'YahooSeeker',
282
-        'YahooSeeker-Testing',
283
-        'YandexImages',
284
-        'YandexMetrika',
285
-        'YandexDirectDyn',
286
-        'yandex',
287
-        'yanga',
288
-        'yeti',
289
-        'yoogliFetchAgent',
290
-        'Zao',
291
-        'ZyBorg',
292
-        '[a-z0-9\\-_]*((?<!cu)bot|crawler|archiver|transcoder|spider)',
293
-    );
73
+	/**
74
+	 * Array of regular expressions to match against the user agent.
75
+	 * 
76
+	 * @var array
77
+	 */
78
+	protected static $crawlers = array(
79
+		'008\\/',
80
+		'A6-Indexer',
81
+		'Aboundex',
82
+		'Accoona-AI-Agent',
83
+		'acoon',
84
+		'AddThis',
85
+		'ADmantX',
86
+		'AHC',
87
+		'Airmail',
88
+		'Anemone',
89
+		'Arachmo',
90
+		'archive-com',
91
+		'B-l-i-t-z-B-O-T',
92
+		'bibnum\.bnf',
93
+		'biglotron',
94
+		'binlar',
95
+		'BingPreview',
96
+		'boitho\.com-dc',
97
+		'BUbiNG',
98
+		'Butterfly\\/',
99
+		'BuzzSumo',
100
+		'CapsuleChecker',
101
+		'CC Metadata Scaper',
102
+		'Cerberian Drtrs',
103
+		'changedetection',
104
+		'Charlotte',
105
+		'clips\.ua\.ac\.be',
106
+		'CloudFlare-AlwaysOnline',
107
+		'coccoc',
108
+		'Commons-HttpClient',
109
+		'convera',
110
+		'cosmos',
111
+		'Covario-IDS',
112
+		'curl',
113
+		'CyberPatrol',
114
+		'DataparkSearch',
115
+		'dataprovider',
116
+		'Digg',
117
+		'DomainAppender',
118
+		'drupact',
119
+		'EARTHCOM',
120
+		'ec2linkfinder',
121
+		'ElectricMonk',
122
+		'Embedly',
123
+		'europarchive\.org',
124
+		'EventMachine HttpClient',
125
+		'ezooms',
126
+		'eZ Publish Link Validator',
127
+		'facebookexternalhit',
128
+		'Feedfetcher-Google',
129
+		'FeedValidator',
130
+		'FindLinks',
131
+		'findlink',
132
+		'findthatfile',
133
+		'Flamingo_SearchEngine',
134
+		'fluffy',
135
+		'getprismatic\.com',
136
+		'g00g1e\.net',
137
+		'GigablastOpenSource',
138
+		'grub-client',
139
+		'Genieo',
140
+		'Go-http-client',
141
+		'Google-HTTP-Java-Client',
142
+		'Google favicon',
143
+		'Google Keyword Suggestion',
144
+		'heritrix',
145
+		'Holmes',
146
+		'htdig',
147
+		'httpunit',
148
+		'httrack',
149
+		'HubSpot Marketing Grader',
150
+		'ichiro',
151
+		'infegy',
152
+		'igdeSpyder',
153
+		'InAGist',
154
+		'InfoWizards Reciprocal Link System PRO',
155
+		'integromedb',
156
+		'IODC',
157
+		'IOI',
158
+		'ips-agent',
159
+		'iZSearch',
160
+		'L\.webis',
161
+		'Larbin',
162
+		'libwww',
163
+		'Link Valet',
164
+		'linkdex',
165
+		'LinkExaminer',
166
+		'LinkWalker',
167
+		'Lipperhey Link Explorer',
168
+		'Lipperhey SEO Service',
169
+		'LongURL API',
170
+		'ltx71',
171
+		'lwp-trivial',
172
+		'MegaIndex\.ru',
173
+		'mabontland',
174
+		'MagpieRSS',
175
+		'Mediapartners-Google',
176
+		'MetaURI',
177
+		'Mnogosearch',
178
+		'mogimogi',
179
+		'Morning Paper',
180
+		'Mrcgiguy',
181
+		'MVAClient',
182
+		'netresearchserver',
183
+		'NewsGator',
184
+		'newsme',
185
+		'NG-Search',
186
+		'^NING\\/',
187
+		'Notifixious',
188
+		'nutch',
189
+		'NutchCVS',
190
+		'Nymesis',
191
+		'oegp',
192
+		'online link validator',
193
+		'Online Website Link Checker',
194
+		'Orbiter',
195
+		'ow\.ly',
196
+		'Ploetz \+ Zeller',
197
+		'page2rss',
198
+		'panscient',
199
+		'Peew',
200
+		'phpcrawl',
201
+		'Pizilla',
202
+		'Plukkie',
203
+		'Pompos',
204
+		'postano',
205
+		'PostPost',
206
+		'postrank',
207
+		'proximic',
208
+		'PycURL',
209
+		'Python-httplib2',
210
+		'python-requests',
211
+		'Python-urllib',
212
+		'Qseero',
213
+		'Qwantify',
214
+		'Radian6',
215
+		'RebelMouse',
216
+		'REL Link Checker',
217
+		'RetrevoPageAnalyzer',
218
+		'Riddler',
219
+		'Robosourcer',
220
+		'Ruby',
221
+		'SBIder',
222
+		'ScoutJet',
223
+		'ScoutURLMonitor',
224
+		'Scrapy',
225
+		'Scrubby',
226
+		'SearchSight',
227
+		'semanticdiscovery',
228
+		'SEOstats',
229
+		'Seznam screenshot-generator',
230
+		'ShopWiki',
231
+		'SiteBar',
232
+		'siteexplorer\.info',
233
+		'slider\.com',
234
+		'slurp',
235
+		'Snappy',
236
+		'sogou',
237
+		'speedy',
238
+		'Sqworm',
239
+		'StackRambler',
240
+		'Stratagems Kumo',
241
+		'summify',
242
+		'teoma',
243
+		'theoldreader\.com',
244
+		'TinEye',
245
+		'Traackr.com',
246
+		'truwoGPS',
247
+		'tweetedtimes\.com',
248
+		'Twikle',
249
+		'UnwindFetchor',
250
+		'updated',
251
+		'urlresolver',
252
+		'Validator\.nu\\/LV',
253
+		'Vagabondo',
254
+		'Vivante Link Checker',
255
+		'Vortex',
256
+		'voyager\\/',
257
+		'VYU2',
258
+		'W3C-checklink',
259
+		'W3C_CSS_Validator_JFouffa',
260
+		'W3C_I18n-Checker',
261
+		'W3C-mobileOK',
262
+		'W3C_Unicorn',
263
+		'W3C_Validator',
264
+		'WebIndex',
265
+		'Websquash\.com',
266
+		'webcollage',
267
+		'webmon ',
268
+		'WeSEE:Search',
269
+		'wf84',
270
+		'wget',
271
+		'WomlpeFactory',
272
+		'wotbox',
273
+		'Xenu Link Sleuth',
274
+		'XML Sitemaps Generator',
275
+		'Y!J-ASR',
276
+		'yacy',
277
+		'Yahoo Ad monitoring',
278
+		'Yahoo Link Preview',
279
+		'Yahoo! Slurp China',
280
+		'Yahoo! Slurp',
281
+		'YahooSeeker',
282
+		'YahooSeeker-Testing',
283
+		'YandexImages',
284
+		'YandexMetrika',
285
+		'YandexDirectDyn',
286
+		'yandex',
287
+		'yanga',
288
+		'yeti',
289
+		'yoogliFetchAgent',
290
+		'Zao',
291
+		'ZyBorg',
292
+		'[a-z0-9\\-_]*((?<!cu)bot|crawler|archiver|transcoder|spider)',
293
+	);
294 294
 
295
-    /**
296
-     * All possible HTTP headers that represent the
297
-     * User-Agent string.
298
-     *
299
-     * @var array
300
-     */
301
-    protected static $uaHttpHeaders = array(
302
-        // The default User-Agent string.
303
-        'HTTP_USER_AGENT',
304
-        // Header can occur on devices using Opera Mini.
305
-        'HTTP_X_OPERAMINI_PHONE_UA',
306
-        // Vodafone specific header: http://www.seoprinciple.com/mobile-web-community-still-angry-at-vodafone/24/
307
-        'HTTP_X_DEVICE_USER_AGENT',
308
-        'HTTP_X_ORIGINAL_USER_AGENT',
309
-        'HTTP_X_SKYFIRE_PHONE',
310
-        'HTTP_X_BOLT_PHONE_UA',
311
-        'HTTP_DEVICE_STOCK_UA',
312
-        'HTTP_X_UCBROWSER_DEVICE_UA',
313
-    );
295
+	/**
296
+	 * All possible HTTP headers that represent the
297
+	 * User-Agent string.
298
+	 *
299
+	 * @var array
300
+	 */
301
+	protected static $uaHttpHeaders = array(
302
+		// The default User-Agent string.
303
+		'HTTP_USER_AGENT',
304
+		// Header can occur on devices using Opera Mini.
305
+		'HTTP_X_OPERAMINI_PHONE_UA',
306
+		// Vodafone specific header: http://www.seoprinciple.com/mobile-web-community-still-angry-at-vodafone/24/
307
+		'HTTP_X_DEVICE_USER_AGENT',
308
+		'HTTP_X_ORIGINAL_USER_AGENT',
309
+		'HTTP_X_SKYFIRE_PHONE',
310
+		'HTTP_X_BOLT_PHONE_UA',
311
+		'HTTP_DEVICE_STOCK_UA',
312
+		'HTTP_X_UCBROWSER_DEVICE_UA',
313
+	);
314 314
 
315
-    /**
316
-     * Class constructor.
317
-     */
318
-    public function __construct(array $headers = null, $userAgent = null)
319
-    {
320
-        $this->setHttpHeaders($headers);
321
-        $this->setUserAgent($userAgent);
322
-    }
315
+	/**
316
+	 * Class constructor.
317
+	 */
318
+	public function __construct(array $headers = null, $userAgent = null)
319
+	{
320
+		$this->setHttpHeaders($headers);
321
+		$this->setUserAgent($userAgent);
322
+	}
323 323
 
324
-    /**
325
-     * Set HTTP headers.
326
-     * 
327
-     * @param array $httpHeaders
328
-     */
329
-    public function setHttpHeaders($httpHeaders = null)
330
-    {
331
-        // use global _SERVER if $httpHeaders aren't defined
332
-        if (!is_array($httpHeaders) || !count($httpHeaders)) {
333
-            $httpHeaders = $_SERVER;
334
-        }
335
-        // clear existing headers
336
-        $this->httpHeaders = array();
337
-        // Only save HTTP headers. In PHP land, that means only _SERVER vars that
338
-        // start with HTTP_.
339
-        foreach ($httpHeaders as $key => $value) {
340
-            if (substr($key, 0, 5) === 'HTTP_') {
341
-                $this->httpHeaders[$key] = $value;
342
-            }
343
-        }
344
-    }
324
+	/**
325
+	 * Set HTTP headers.
326
+	 * 
327
+	 * @param array $httpHeaders
328
+	 */
329
+	public function setHttpHeaders($httpHeaders = null)
330
+	{
331
+		// use global _SERVER if $httpHeaders aren't defined
332
+		if (!is_array($httpHeaders) || !count($httpHeaders)) {
333
+			$httpHeaders = $_SERVER;
334
+		}
335
+		// clear existing headers
336
+		$this->httpHeaders = array();
337
+		// Only save HTTP headers. In PHP land, that means only _SERVER vars that
338
+		// start with HTTP_.
339
+		foreach ($httpHeaders as $key => $value) {
340
+			if (substr($key, 0, 5) === 'HTTP_') {
341
+				$this->httpHeaders[$key] = $value;
342
+			}
343
+		}
344
+	}
345 345
 
346
-    /**
347
-     * Return user agent headers.
348
-     * 
349
-     * @return array
350
-     */
351
-    public function getUaHttpHeaders()
352
-    {
353
-        return self::$uaHttpHeaders;
354
-    }
346
+	/**
347
+	 * Return user agent headers.
348
+	 * 
349
+	 * @return array
350
+	 */
351
+	public function getUaHttpHeaders()
352
+	{
353
+		return self::$uaHttpHeaders;
354
+	}
355 355
 
356
-    /**
357
-     * Set the user agent.
358
-     * 
359
-     * @param string $userAgent
360
-     */
361
-    public function setUserAgent($userAgent = null)
362
-    {
363
-        if (false === empty($userAgent)) {
364
-            return $this->userAgent = $userAgent;
365
-        } else {
366
-            $this->userAgent = null;
367
-            foreach ($this->getUaHttpHeaders() as $altHeader) {
368
-                if (false === empty($this->httpHeaders[$altHeader])) { // @todo: should use getHttpHeader(), but it would be slow.
369
-                    $this->userAgent .= $this->httpHeaders[$altHeader].' ';
370
-                }
371
-            }
356
+	/**
357
+	 * Set the user agent.
358
+	 * 
359
+	 * @param string $userAgent
360
+	 */
361
+	public function setUserAgent($userAgent = null)
362
+	{
363
+		if (false === empty($userAgent)) {
364
+			return $this->userAgent = $userAgent;
365
+		} else {
366
+			$this->userAgent = null;
367
+			foreach ($this->getUaHttpHeaders() as $altHeader) {
368
+				if (false === empty($this->httpHeaders[$altHeader])) { // @todo: should use getHttpHeader(), but it would be slow.
369
+					$this->userAgent .= $this->httpHeaders[$altHeader].' ';
370
+				}
371
+			}
372 372
 
373
-            return $this->userAgent = (!empty($this->userAgent) ? trim($this->userAgent) : null);
374
-        }
375
-    }
373
+			return $this->userAgent = (!empty($this->userAgent) ? trim($this->userAgent) : null);
374
+		}
375
+	}
376 376
 
377
-    /**
378
-     * Build the user agent regex.
379
-     * 
380
-     * @return string
381
-     */
382
-    public function getRegex()
383
-    {
384
-        return '('.implode('|', self::$crawlers).')';
385
-    }
377
+	/**
378
+	 * Build the user agent regex.
379
+	 * 
380
+	 * @return string
381
+	 */
382
+	public function getRegex()
383
+	{
384
+		return '('.implode('|', self::$crawlers).')';
385
+	}
386 386
 
387
-    /**
388
-     * Build the replacement regex.
389
-     * 
390
-     * @return string
391
-     */
392
-    public function getIgnored()
393
-    {
394
-        return '('.implode('|', self::$ignore).')';
395
-    }
387
+	/**
388
+	 * Build the replacement regex.
389
+	 * 
390
+	 * @return string
391
+	 */
392
+	public function getIgnored()
393
+	{
394
+		return '('.implode('|', self::$ignore).')';
395
+	}
396 396
 
397
-    /**
398
-     * Check user agent string against the regex.
399
-     * 
400
-     * @param string $userAgent
401
-     *
402
-     * @return bool
403
-     */
404
-    public function isCrawler($userAgent = null)
405
-    {
406
-        $agent = is_null($userAgent) ? $this->userAgent : $userAgent;
397
+	/**
398
+	 * Check user agent string against the regex.
399
+	 * 
400
+	 * @param string $userAgent
401
+	 *
402
+	 * @return bool
403
+	 */
404
+	public function isCrawler($userAgent = null)
405
+	{
406
+		$agent = is_null($userAgent) ? $this->userAgent : $userAgent;
407 407
 
408
-        $agent = preg_replace('/'.$this->getIgnored().'/i', '', $agent);
408
+		$agent = preg_replace('/'.$this->getIgnored().'/i', '', $agent);
409 409
 
410
-        $result = preg_match('/'.$this->getRegex().'/i', $agent, $matches);
410
+		$result = preg_match('/'.$this->getRegex().'/i', $agent, $matches);
411 411
 
412
-        if ($matches) {
413
-            $this->matches = $matches;
414
-        }
412
+		if ($matches) {
413
+			$this->matches = $matches;
414
+		}
415 415
 
416
-        return (bool) $result;
417
-    }
416
+		return (bool) $result;
417
+	}
418 418
 
419
-    /**
420
-     * Return the matches.
421
-     * 
422
-     * @return string
423
-     */
424
-    public function getMatches()
425
-    {
426
-        return $this->matches[0];
427
-    }
419
+	/**
420
+	 * Return the matches.
421
+	 * 
422
+	 * @return string
423
+	 */
424
+	public function getMatches()
425
+	{
426
+		return $this->matches[0];
427
+	}
428 428
 }
Please login to merge, or discard this patch.