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