1<?php
2/**
3 * Referrers for DokuWiki
4 *
5 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author     Terence J. Grant<tjgrant@tatewake.com>
7 */
8
9if (!defined('DOKU_INC')) {
10    die();
11}
12if (!defined('DOKU_PLUGIN')) {
13    define('DOKU_PLUGIN', DOKU_INC.'lib/plugins/');
14}
15require_once(DOKU_PLUGIN.'action.php');
16include_once(DOKU_PLUGIN.'referrers/code.php');
17
18class action_plugin_referrers extends DokuWiki_Action_Plugin
19{
20    public function register(Doku_Event_Handler $controller)
21    {
22        $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, '_addHeaders');
23    }
24
25    public function _addHeaders(&$event, $param)
26    {
27        global $INFO;
28
29        if (!($this->getConf('re_dont_count_admin') && $INFO['isadmin']) &&
30            !($this->getConf('re_dont_count_users') && $_SERVER['REMOTE_USER'])) {
31            re_log_referrers_new($this->getConf('re_URL_ignore'));
32        }
33    }
34}
35