Last change
on this file since 28819 was
28022,
checked in by plg, 11 years ago
|
new plugin to avoid polluting history with search engine robots
|
File size:
649 bytes
|
Line | |
---|
1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: No Stats For Robots |
---|
4 | Version: auto |
---|
5 | Description: Do not log visits from search engine robots (history and hits) |
---|
6 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid= |
---|
7 | Author: plg |
---|
8 | Author URI: http://le-gall.net/pierrick |
---|
9 | */ |
---|
10 | |
---|
11 | if (!defined('PHPWG_ROOT_PATH')) |
---|
12 | { |
---|
13 | die('Hacking attempt!'); |
---|
14 | } |
---|
15 | |
---|
16 | if (isset($_SERVER["HTTP_USER_AGENT"]) |
---|
17 | and preg_match('/(Googlebot|bingbot|Baiduspider|yandex|AhrefsBot|msnbot|Slurp)/', $_SERVER['HTTP_USER_AGENT'])) |
---|
18 | { |
---|
19 | add_event_handler('pwg_log_allowed', create_function('', 'return false;')); |
---|
20 | add_event_handler('allow_increment_element_hit_count', create_function('$b', 'return false;')); |
---|
21 | } |
---|
22 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.