PluginProbe ʕ •ᴥ•ʔ
Post Views Counter / 1.2.4
Post Views Counter v1.2.4
1.7.13 1.7.12 1.7.11 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.2.0 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.2 1.3.2.1 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.7.0 1.7.1 1.7.10 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9
post-views-counter / includes / crawler-detect.php
post-views-counter / includes Last commit date
columns.php 9 years ago counter.php 9 years ago crawler-detect.php 9 years ago cron.php 9 years ago dashboard.php 9 years ago frontend.php 9 years ago functions.php 9 years ago query.php 9 years ago settings.php 9 years ago update.php 9 years ago widgets.php 9 years ago
crawler-detect.php
969 lines
1 <?php
2 // exit if accessed directly
3 if ( ! defined( 'ABSPATH' ) )
4 exit;
5
6 /**
7 * Post_Views_Counter_Crawler_Detect class.
8 *
9 * Based on CrawlerDetect php class adjusted to PHP 5.2
10 * https://github.com/JayBizzle/Crawler-Detect/blob/master/src/CrawlerDetect.php
11 *
12 * @since 1.2.4
13 * @class Post_Views_Counter_Crawler_Detect
14 */
15 class Post_Views_Counter_Crawler_Detect {
16
17 /**
18 * The user agent.
19 *
20 * @var null
21 */
22 protected $user_agent = null;
23
24 /**
25 * Headers that contain a user agent.
26 *
27 * @var array
28 */
29 protected $http_headers = array();
30
31 /**
32 * Store regex matches.
33 *
34 * @var array
35 */
36 protected $matches = array();
37
38 /**
39 * Crawlers object.
40 *
41 * @var object
42 */
43 protected $crawlers;
44
45 /**
46 * Exclusions object.
47 *
48 * @var object
49 */
50 protected $exclusions;
51
52 /**
53 * Headers object.
54 *
55 * @var object
56 */
57 protected $ua_http_headers;
58
59 /**
60 * Class constructor.
61 */
62 public function __construct() {
63 add_action( 'after_setup_theme', array( $this, 'init' ) );
64 }
65
66 /**
67 * Initialize class.
68 */
69 public function init() {
70 // break on admin side
71 if ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )
72 return;
73
74 $this->crawlers = $this->get_crawlers_list();
75 $this->exclusions = $this->get_exclusions_list();
76 $this->ua_http_headers = $this->get_headers_list();
77 $this->set_http_headers();
78 $this->set_user_agent();
79 }
80
81 /**
82 * Set HTTP headers.
83 *
84 * @param array $http_headers
85 */
86 public function set_http_headers( $http_headers = null ) {
87 // use global _SERVER if $http_headers aren't defined
88 if ( ! is_array( $http_headers ) || ! count( $http_headers ) ) {
89 $http_headers = $_SERVER;
90 }
91 // clear existing headers
92 $this->http_headers = array();
93 // only save HTTP headers - in PHP land, that means only _SERVER vars that start with HTTP_.
94 foreach ( $http_headers as $key => $value ) {
95 if ( substr( $key, 0, 5 ) === 'HTTP_' ) {
96 $this->http_headers[$key] = $value;
97 }
98 }
99 }
100
101 /**
102 * Return user agent headers.
103 *
104 * @return array
105 */
106 public function get_ua_http_headers() {
107 return $this->ua_http_headers;
108 }
109
110 /**
111 * Return the user agent.
112 *
113 * @return string
114 */
115 public function get_user_agent() {
116 return $this->user_agent;
117 }
118
119 /**
120 * Set the user agent.
121 *
122 * @param string $user_agent
123 */
124 public function set_user_agent( $user_agent = null ) {
125 if ( false === empty( $user_agent ) ) {
126 return $this->user_agent = $user_agent;
127 } else {
128 $this->user_agent = null;
129 foreach ( $this->get_ua_http_headers() as $alt_header ) {
130 if ( false === empty( $this->http_headers[$alt_header] ) ) { // @todo: should use get_http_header(), but it would be slow.
131 $this->user_agent .= $this->http_headers[$alt_header] . ' ';
132 }
133 }
134 return $this->user_agent = ( ! empty( $this->user_agent ) ? trim( $this->user_agent ) : null);
135 }
136 }
137
138 /**
139 * Build the user agent regex.
140 *
141 * @return string
142 */
143 public function get_regex() {
144 return '(' . implode( '|', $this->crawlers ) . ')';
145 }
146
147 /**
148 * Build the replacement regex.
149 *
150 * @return string
151 */
152 public function get_exclusions() {
153 return '(' . implode( '|', $this->exclusions ) . ')';
154 }
155
156 /**
157 * Check user agent string against the regex.
158 *
159 * @param string $user_agent
160 *
161 * @return bool
162 */
163 public function is_crawler( $user_agent = null ) {
164 $agent = is_null( $user_agent ) ? $this->user_agent : $user_agent;
165 $agent = preg_replace( '/' . $this->get_exclusions() . '/i', '', $agent );
166 if ( strlen( trim( $agent ) ) == 0 ) {
167 return false;
168 } else {
169 $result = preg_match( '/' . $this->get_regex() . '/i', trim( $agent ), $matches );
170 }
171 if ( $matches ) {
172 $this->matches = $matches;
173 }
174 return (bool) $result;
175 }
176
177 /**
178 * Return the matches.
179 *
180 * @return string
181 */
182 public function get_matches() {
183 return isset( $this->matches[0] ) ? $this->matches[0] : null;
184 }
185
186 /**
187 * Return the regular expressions to match against the user agent.
188 *
189 * @return array
190 */
191 protected function get_crawlers_list() {
192 $data = array(
193 '.*Java.*outbrain',
194 '008\/',
195 '192.comAgent',
196 '2ip\.ru',
197 '404checker',
198 '^bluefish ',
199 '^FDM ',
200 '^Goose\/',
201 '^Java\/',
202 '^Mget',
203 '^NG\/[0-9\.]',
204 '^NING\/',
205 '^PHP\/[0-9]',
206 '^RMA\/',
207 '^Ruby|Ruby\/[0-9]',
208 '^scrutiny\/',
209 '^VSE\/[0-9]',
210 '^WordPress\.com',
211 '^XRL\/[0-9]',
212 'a3logics\.in',
213 'A6-Indexer',
214 'a\.pr-cy\.ru',
215 'Aboundex',
216 'aboutthedomain',
217 'Accoona-AI-Agent',
218 'acoon',
219 'acrylicapps\.com\/pulp',
220 'adbeat',
221 'AddThis',
222 'ADmantX',
223 'adressendeutschland',
224 'Advanced Email Extractor v',
225 'agentslug',
226 'AHC',
227 'aihit',
228 'aiohttp\/',
229 'Airmail',
230 'akula\/',
231 'alertra',
232 'alexa site audit',
233 'alyze\.info',
234 'amagit',
235 'AndroidDownloadManager',
236 'Anemone',
237 'Ant\.com',
238 'Anturis Agent',
239 'AnyEvent-HTTP\/',
240 'Apache-HttpClient\/',
241 'AportWorm\/[0-9]',
242 'AppEngine-Google',
243 'Arachmo',
244 'arachnode',
245 'Arachnophilia',
246 'archive-com',
247 'aria2',
248 'asafaweb.com',
249 'AskQuickly',
250 'Astute',
251 'autocite',
252 'Autonomy',
253 'B-l-i-t-z-B-O-T',
254 'Backlink-Ceck\.de',
255 'Bad-Neighborhood',
256 'baidu\.com',
257 'baypup\/[0-9]',
258 'baypup\/colbert',
259 'BazQux',
260 'BCKLINKS',
261 'BDFetch',
262 'BegunAdvertising\/',
263 'bibnum\.bnf',
264 'BigBozz',
265 'biglotron',
266 'BingLocalSearch',
267 'BingPreview',
268 'binlar',
269 'biz_Directory',
270 'Blackboard Safeassign',
271 'Bloglovin',
272 'BlogPulseLive',
273 'BlogSearch',
274 'Blogtrottr',
275 'boitho\.com-dc',
276 'BPImageWalker',
277 'Braintree-Webhooks',
278 'Branch Metrics API',
279 'Branch-Passthrough',
280 'Browsershots',
281 'BUbiNG',
282 'Butterfly\/',
283 'BuzzSumo',
284 'CakePHP',
285 'CapsuleChecker',
286 'CaretNail',
287 'cb crawl',
288 'CC Metadata Scaper',
289 'Cerberian Drtrs',
290 'CERT\.at-Statistics-Survey',
291 'cg-eye',
292 'changedetection',
293 'Charlotte',
294 'CheckHost',
295 'chkme\.com',
296 'CirrusExplorer\/',
297 'CISPA Vulnerability Notification',
298 'CJNetworkQuality',
299 'clips\.ua\.ac\.be',
300 'Cloud mapping experiment',
301 'CloudFlare-AlwaysOnline',
302 'Cloudinary\/[0-9]',
303 'cmcm\.com',
304 'coccoc',
305 'CommaFeed',
306 'Commons-HttpClient',
307 'Comodo SSL Checker',
308 'contactbigdatafr',
309 'convera',
310 'copyright sheriff',
311 'cosmos\/[0-9]',
312 'Covario-IDS',
313 'CrawlForMe\/[0-9]',
314 'cron-job\.org',
315 'Crowsnest',
316 'curb',
317 'Curious George',
318 'curl',
319 'cuwhois\/[0-9]',
320 'CyberPatrol',
321 'cybo\.com',
322 'DareBoost',
323 'DataparkSearch',
324 'dataprovider',
325 'Daum(oa)?[ \/][0-9]',
326 'DeuSu',
327 'developers\.google\.com\/\+\/web\/snippet\/',
328 'Digg',
329 'Dispatch\/',
330 'dlvr',
331 'DNS-Tools Header-Analyzer',
332 'DNSPod-reporting',
333 'docoloc',
334 'DomainAppender',
335 'dotSemantic',
336 'downforeveryoneorjustme',
337 'downnotifier\.com',
338 'DowntimeDetector',
339 'Dragonfly File Reader',
340 'drupact',
341 'Drupal (\+http:\/\/drupal\.org\/)',
342 'dubaiindex',
343 'EARTHCOM',
344 'Easy-Thumb',
345 'ec2linkfinder',
346 'eCairn-Grabber',
347 'ECCP',
348 'ElectricMonk',
349 'elefent',
350 'EMail Exractor',
351 'EmailWolf',
352 'Embed PHP Library',
353 'Embedly',
354 'europarchive\.org',
355 'evc-batch\/[0-9]',
356 'EventMachine HttpClient',
357 'Evidon',
358 'Evrinid',
359 'ExactSearch',
360 'ExaleadCloudview',
361 'Excel\/',
362 'Exploratodo',
363 'ezooms',
364 'facebookexternalhit',
365 'facebookplatform',
366 'fairshare',
367 'Faraday v',
368 'Faveeo',
369 'Favicon downloader',
370 'FavOrg',
371 'Feed Wrangler',
372 'Feedbin',
373 'FeedBooster',
374 'FeedBucket',
375 'FeedBurner',
376 'FeedChecker',
377 'Feedly',
378 'Feedspot',
379 'feeltiptop',
380 'Fetch API',
381 'Fetch\/[0-9]',
382 'Fever\/[0-9]',
383 'findlink',
384 'findthatfile',
385 'Flamingo_SearchEngine',
386 'FlipboardBrowserProxy',
387 'FlipboardProxy',
388 'FlipboardRSS',
389 'fluffy',
390 'flynxapp',
391 'forensiq',
392 'FoundSeoTool\/[0-9]',
393 'free thumbnails',
394 'FreeWebMonitoring SiteChecker',
395 'Funnelback',
396 'g00g1e\.net',
397 'GAChecker',
398 'geek-tools',
399 'Genderanalyzer',
400 'Genieo',
401 'GentleSource',
402 'GetLinkInfo',
403 'getprismatic\.com',
404 'GetURLInfo\/[0-9]',
405 'GigablastOpenSource',
406 'Go [\d\.]* package http',
407 'Go-http-client',
408 'GomezAgent',
409 'gooblog',
410 'Goodzer\/[0-9]',
411 'Google favicon',
412 'Google Keyword Suggestion',
413 'Google Keyword Tool',
414 'Google Page Speed Insights',
415 'Google PP Default',
416 'Google Search Console',
417 'Google Web Preview',
418 'Google-Adwords',
419 'Google-Apps-Script',
420 'Google-Calendar-Importer',
421 'Google-HTTP-Java-Client',
422 'Google-Publisher-Plugin',
423 'Google-SearchByImage',
424 'Google-Site-Verification',
425 'Google-Structured-Data-Testing-Tool',
426 'google_partner_monitoring',
427 'GoogleDocs',
428 'GoogleHC\/',
429 'GoogleProducer',
430 'GoScraper',
431 'GoSpotCheck',
432 'GoSquared-Status-Checker',
433 'gosquared-thumbnailer',
434 'GotSiteMonitor',
435 'Grammarly',
436 'grouphigh',
437 'grub-client',
438 'GTmetrix',
439 'Hatena',
440 'hawkReader',
441 'HEADMasterSEO',
442 'HeartRails_Capture',
443 'heritrix',
444 'hledejLevne\.cz\/[0-9]',
445 'Holmes',
446 'HootSuite Image proxy',
447 'Hootsuite-WebFeed\/[0-9]',
448 'HostTracker',
449 'ht:\/\/check',
450 'htdig',
451 'HTMLParser\/',
452 'HTTP-Header-Abfrage',
453 'http-kit',
454 'HTTP-Tiny',
455 'HTTP_Compression_Test',
456 'http_request2',
457 'http_requester',
458 'HttpComponents',
459 'httphr',
460 'HTTPMon',
461 'httpscheck',
462 'httpssites_power',
463 'httpunit',
464 'HttpUrlConnection',
465 'httrack',
466 'hosterstats',
467 'huaweisymantec',
468 'HubPages.*crawlingpolicy',
469 'HubSpot Connect',
470 'HubSpot Marketing Grader',
471 'HyperZbozi.cz Feeder',
472 'ichiro',
473 'IdeelaborPlagiaat',
474 'IDG Twitter Links Resolver',
475 'IDwhois\/[0-9]',
476 'Iframely',
477 'igdeSpyder',
478 'IlTrovatore',
479 'ImageEngine\/',
480 'Imagga',
481 'InAGist',
482 'inbound\.li parser',
483 'InDesign%20CC',
484 'infegy',
485 'infohelfer',
486 'InfoWizards Reciprocal Link System PRO',
487 'inpwrd\.com',
488 'Integrity',
489 'integromedb',
490 'internet_archive',
491 'InternetSeer',
492 'internetVista monitor',
493 'IODC',
494 'IOI',
495 'ips-agent',
496 'iqdb\/',
497 'Irokez',
498 'isitup\.org',
499 'iskanie',
500 'iZSearch',
501 'janforman',
502 'Jigsaw',
503 'Jobboerse',
504 'jobo',
505 'Jobrapido',
506 'KeepRight OpenStreetMap Checker',
507 'KimonoLabs\/',
508 'knows\.is',
509 'kouio',
510 'KrOWLer',
511 'kulturarw3',
512 'KumKie',
513 'L\.webis',
514 'Larbin',
515 'LayeredExtractor',
516 'LibVLC',
517 'libwww',
518 'link checker',
519 'Link Valet',
520 'link_thumbnailer',
521 'linkCheck',
522 'linkdex',
523 'LinkExaminer',
524 'linkfluence',
525 'linkpeek',
526 'LinkTiger',
527 'LinkWalker',
528 'Lipperhey',
529 'livedoor ScreenShot',
530 'LoadImpactPageAnalyzer',
531 'LoadImpactRload',
532 'LongURL API',
533 'looksystems\.net',
534 'ltx71',
535 'lwp-trivial',
536 'lycos',
537 'LYT\.SR',
538 'mabontland',
539 'MagpieRSS',
540 'Mail.Ru',
541 'MailChimp\.com',
542 'Mandrill',
543 'marketinggrader',
544 'Mediapartners-Google',
545 'MegaIndex\.ru',
546 'Melvil Rawi\/',
547 'MergeFlow-PageReader',
548 'MetaInspector',
549 'Metaspinner',
550 'MetaURI',
551 'Microsearch',
552 'Microsoft Office ',
553 'Microsoft Windows Network Diagnostics',
554 'Mindjet',
555 'Miniflux',
556 'Mnogosearch',
557 'mogimogi',
558 'Mojolicious (Perl)',
559 'monitis',
560 'Monitority\/[0-9]',
561 'montastic',
562 'MonTools',
563 'Moreover',
564 'Morning Paper',
565 'mowser',
566 'Mrcgiguy',
567 'mShots',
568 'MVAClient',
569 'nagios',
570 'Najdi\.si\/',
571 'NETCRAFT',
572 'NetLyzer FastProbe',
573 'netresearch',
574 'NetShelter ContentScan',
575 'NetTrack',
576 'Netvibes',
577 'Neustar WPM',
578 'NeutrinoAPI',
579 'NewsBlur .*Finder',
580 'NewsGator',
581 'newsme',
582 'newspaper\/',
583 'NG-Search',
584 'nineconnections\.com',
585 'NLNZ_IAHarvester',
586 'Nmap Scripting Engine',
587 'node-superagent',
588 'node\.io',
589 'nominet\.org\.uk',
590 'Norton-Safeweb',
591 'Notifixious',
592 'notifyninja',
593 'nuhk',
594 'nutch',
595 'Nuzzel',
596 'nWormFeedFinder',
597 'Nymesis',
598 'Ocelli\/[0-9]',
599 'oegp',
600 'okhttp',
601 'Omea Reader',
602 'omgili',
603 'Online Domain Tools',
604 'OpenCalaisSemanticProxy',
605 'Openstat\/',
606 'OpenVAS',
607 'Optimizer',
608 'Orbiter',
609 'OrgProbe\/[0-9]',
610 'ow\.ly',
611 'ownCloud News',
612 'Page Analyzer',
613 'Page Valet',
614 'page2rss',
615 'page_verifier',
616 'PagePeeker',
617 'Pagespeed\/[0-9]',
618 'Panopta',
619 'panscient',
620 'parsijoo',
621 'PayPal IPN',
622 'Pcore-HTTP',
623 'Pearltrees',
624 'peerindex',
625 'Peew',
626 'PhantomJS\/',
627 'Photon\/',
628 'phpcrawl',
629 'phpservermon',
630 'Pi-Monster',
631 'Pingdom\.com',
632 'Pingoscope',
633 'PingSpot',
634 'Pinterest',
635 'Pizilla',
636 'Ploetz \+ Zeller',
637 'Plukkie',
638 'PocketParser',
639 'Pompos',
640 'Porkbun',
641 'Port Monitor',
642 'postano',
643 'PostPost',
644 'postrank',
645 'PowerPoint\/',
646 'Priceonomics Analysis Engine',
647 'Prlog',
648 'probethenet',
649 'Project 25499',
650 'Promotion_Tools_www.searchenginepromotionhelp.com',
651 'prospectb2b',
652 'Protopage',
653 'proximic',
654 'PTST ',
655 'PTST\/[0-9]+',
656 'Pulsepoint XT3 web scraper',
657 'Python-httplib2',
658 'python-requests',
659 'Python-urllib',
660 'Qirina Hurdler',
661 'Qseero',
662 'Qualidator.com SiteAnalyzer',
663 'Quora Link Preview',
664 'Qwantify',
665 'Radian6',
666 'RankSonicSiteAuditor',
667 'Readability',
668 'RealPlayer%20Downloader',
669 'RebelMouse',
670 'redback\/',
671 'Redirect Checker Tool',
672 'ReederForMac',
673 'ResponseCodeTest\/[0-9]',
674 'RestSharp',
675 'RetrevoPageAnalyzer',
676 'Riddler',
677 'Rival IQ',
678 'Robosourcer',
679 'Robozilla\/[0-9]',
680 'ROI Hunter',
681 'SalesIntelligent',
682 'SauceNAO',
683 'SBIder',
684 'Scoop',
685 'scooter',
686 'ScoutJet',
687 'ScoutURLMonitor',
688 'Scrapy',
689 'Scrubby',
690 'SearchSight',
691 'semanticdiscovery',
692 'semanticjuice',
693 'SEO Browser',
694 'Seo Servis',
695 'seo-nastroj.cz',
696 'Seobility',
697 'SEOCentro',
698 'SeoCheck',
699 'SeopultContentAnalyzer',
700 'SEOstats',
701 'Server Density Service Monitoring',
702 'servernfo\.com',
703 'Seznam screenshot-generator',
704 'Shelob',
705 'Shoppimon Analyzer',
706 'ShoppimonAgent\/[0-9]',
707 'ShopWiki',
708 'ShortLinkTranslate',
709 'shrinktheweb',
710 'SilverReader',
711 'SimplePie',
712 'SimplyFast',
713 'Site-Shot\/',
714 'Site24x7',
715 'SiteBar',
716 'SiteCondor',
717 'siteexplorer\.info',
718 'SiteGuardian',
719 'Siteimprove\.com',
720 'Sitemap(s)? Generator',
721 'Siteshooter B0t',
722 'SiteTruth',
723 'sitexy\.com',
724 'SkypeUriPreview',
725 'slider\.com',
726 'slurp',
727 'SMRF URL Expander',
728 'Snappy',
729 'SniffRSS',
730 'sniptracker',
731 'Snoopy',
732 'sogou web',
733 'SortSite',
734 'spaziodati',
735 'Specificfeeds',
736 'speedy',
737 'SPEng',
738 'Spinn3r',
739 'spray-can',
740 'Sprinklr ',
741 'spyonweb',
742 'Sqworm',
743 'SSL Labs',
744 'StackRambler',
745 'Statastico\/',
746 'StatusCake',
747 'Stratagems Kumo',
748 'Stroke.cz',
749 'StudioFACA',
750 'suchen',
751 'summify',
752 'Super Monitoring',
753 'Surphace Scout',
754 'SwiteScraper',
755 'Symfony2 BrowserKit',
756 'Sysomos',
757 'T0PHackTeam',
758 'Tarantula\/',
759 'teoma',
760 'terrainformatica\.com',
761 'The Expert HTML Source Viewer',
762 'theinternetrules',
763 'theoldreader\.com',
764 'Thumbshots',
765 'ThumbSniper',
766 'TinEye',
767 'Tiny Tiny RSS',
768 'topster',
769 'touche.com',
770 'Traackr.com',
771 'truwoGPS',
772 'tweetedtimes\.com',
773 'Tweetminster',
774 'Twikle',
775 'Twingly',
776 'Typhoeus',
777 'ubermetrics-technologies',
778 'uclassify',
779 'UdmSearch',
780 'UnwindFetchor',
781 'updated',
782 'Upflow',
783 'URLChecker',
784 'URLitor.com',
785 'urlresolver',
786 'Urlstat',
787 'UrlTrends Ranking Updater',
788 'Vagabondo',
789 'via ggpht\.com GoogleImageProxy',
790 'visionutils',
791 'vkShare',
792 'voltron',
793 'Vortex\/[0-9]',
794 'voyager\/',
795 'VSAgent\/[0-9]',
796 'VSB-TUO\/[0-9]',
797 'VYU2',
798 'w3af\.org',
799 'W3C-checklink',
800 'W3C-mobileOK',
801 'W3C_I18n-Checker',
802 'W3C_Unicorn',
803 'wangling',
804 'Wappalyzer',
805 'WatchMouse',
806 'WbSrch\/',
807 'web-capture\.net',
808 'Web-Monitoring',
809 'Web-sniffer',
810 'Webauskunft',
811 'WebCapture',
812 'webcollage',
813 'WebCookies',
814 'WebCorp',
815 'WebDoc',
816 'WebFetch',
817 'WebImages',
818 'WebIndex',
819 'webkit2png',
820 'webmastercoffee',
821 'webmon ',
822 'webscreenie',
823 'Webshot',
824 'Website Analyzer\/',
825 'websitepulse[+ ]checker',
826 'Websnapr\/',
827 'Websquash\.com',
828 'Webthumb\/[0-9]',
829 'WebThumbnail',
830 'WeCrawlForThePeace',
831 'WeLikeLinks',
832 'WEPA',
833 'WeSEE',
834 'wf84',
835 'wget',
836 'WhatsApp',
837 'WhatsMyIP',
838 'WhatWeb',
839 'Whibse',
840 'Whynder Magnet',
841 'Windows-RSS-Platform',
842 'WinHttpRequest',
843 'wkhtmlto',
844 'wmtips',
845 'Woko',
846 'WomlpeFactory',
847 'Word\/',
848 'WordPress\/',
849 'wotbox',
850 'WP Engine Install Performance API',
851 'WPScan',
852 'wscheck',
853 'WWW-Mechanize',
854 'www\.monitor\.us',
855 'XaxisSemanticsClassifier',
856 'Xenu Link Sleuth',
857 'XING-contenttabreceiver\/[0-9]',
858 'XmlSitemapGenerator',
859 'xpymep([0-9]?)\.exe',
860 'Y!J-(ASR|BSC)',
861 'Yaanb',
862 'yacy',
863 'Yahoo Ad monitoring',
864 'Yahoo Link Preview',
865 'YahooCacheSystem',
866 'YahooSeeker',
867 'YahooYSMcm',
868 'YandeG',
869 'yandex',
870 'yanga',
871 'yeti',
872 'Yo-yo',
873 'Yoleo Consumer',
874 'yoogliFetchAgent',
875 'YottaaMonitor',
876 'yourls\.org',
877 'Zao',
878 'Zemanta Aggregator',
879 'Zend\\\\Http\\\\Client',
880 'Zend_Http_Client',
881 'zgrab',
882 'ZnajdzFoto',
883 'ZyBorg',
884 '[a-z0-9\-_]*((?<!cu)bot|crawler|archiver|transcoder|spider|uptime|validator|fetcher)',
885 );
886
887 return $data;
888 }
889
890 /**
891 * Return the list of strings to remove from the user agent before running the crawler regex.
892 *
893 * @return array
894 */
895 public function get_exclusions_list() {
896 $data = array(
897 'Safari.[\d\.]*',
898 'Firefox.[\d\.]*',
899 'Chrome.[\d\.]*',
900 'Chromium.[\d\.]*',
901 'MSIE.[\d\.]',
902 'Opera\/[\d\.]*',
903 'Mozilla.[\d\.]*',
904 'AppleWebKit.[\d\.]*',
905 'Trident.[\d\.]*',
906 'Windows NT.[\d\.]*',
907 'Android [\d\.]*',
908 'Macintosh.',
909 'Ubuntu',
910 'Linux',
911 '[ ]Intel',
912 'Mac OS X [\d_]*',
913 '(like )?Gecko(.[\d\.]*)?',
914 'KHTML,',
915 'CriOS.[\d\.]*',
916 'CPU iPhone OS ([0-9_])* like Mac OS X',
917 'CPU OS ([0-9_])* like Mac OS X',
918 'iPod',
919 'compatible',
920 'x86_..',
921 'i686',
922 'x64',
923 'X11',
924 'rv:[\d\.]*',
925 'Version.[\d\.]*',
926 'WOW64',
927 'Win64',
928 'Dalvik.[\d\.]*',
929 ' \.NET CLR [\d\.]*',
930 'Presto.[\d\.]*',
931 'Media Center PC',
932 'BlackBerry',
933 'Build',
934 'Opera Mini\/\d{1,2}\.\d{1,2}\.[\d\.]*\/\d{1,2}\.',
935 'Opera',
936 ' \.NET[\d\.]*',
937 '\(|\)|;|,', // remove the following characters ( ) : ,
938 );
939
940 return $data;
941 }
942
943 /**
944 * Return all possible HTTP headers that represent the User-Agent string.
945 *
946 * @return array
947 */
948 public function get_headers_list() {
949 $data = array(
950 // the default User-Agent string.
951 'HTTP_USER_AGENT',
952 // header can occur on devices using Opera Mini.
953 'HTTP_X_OPERAMINI_PHONE_UA',
954 // vodafone specific header: http://www.seoprinciple.com/mobile-web-community-still-angry-at-vodafone/24/
955 'HTTP_X_DEVICE_USER_AGENT',
956 'HTTP_X_ORIGINAL_USER_AGENT',
957 'HTTP_X_SKYFIRE_PHONE',
958 'HTTP_X_BOLT_PHONE_UA',
959 'HTTP_DEVICE_STOCK_UA',
960 'HTTP_X_UCBROWSER_DEVICE_UA',
961 // sometimes, bots (especially Google) use a genuine user agent, but fill this header in with their email address
962 'HTTP_FROM',
963 );
964
965 return $data;
966 }
967
968 }
969