source: extensions/no_stats_for_robots/main.inc.php @ 31024

Last change on this file since 31024 was 28935, checked in by plg, 10 years ago

new robots VoilaBot and BLEXBot

File size: 756 bytes
Line 
1<?php
2/*
3Plugin Name: No Stats For Robots
4Version: auto
5Description: Do not log visits from search engine robots (history and hits)
6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=
7Author: plg
8Author URI: http://le-gall.net/pierrick
9*/
10
11if (!defined('PHPWG_ROOT_PATH'))
12{
13  die('Hacking attempt!');
14}
15
16$bots = array(
17  'Googlebot',
18  'bingbot',
19  'Baiduspider',
20  'yandex',
21  'AhrefsBot',
22  'msnbot',
23  'Slurp',
24  'BLEXBot',
25  'VoilaBot',
26  );
27
28if (isset($_SERVER["HTTP_USER_AGENT"])
29    and preg_match('/('.implode('|', $bots).')/', $_SERVER['HTTP_USER_AGENT']))
30{
31  add_event_handler('pwg_log_allowed', create_function('', 'return false;'));
32  add_event_handler('allow_increment_element_hit_count', create_function('$b', 'return false;'));
33}
34?>
Note: See TracBrowser for help on using the repository browser.