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

Last change on this file since 28022 was 28022, checked in by plg, 6 years ago

new plugin to avoid polluting history with search engine robots

File size: 649 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
16if (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.