-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.php
38 lines (35 loc) · 948 Bytes
/
action.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/**
* DokuWiki plugin for Matomo
*
* Hook into application -> executed after header metadata was rendered
*
* @license GPLv3 (http://www.gnu.org/licenses/gpl.html)
* @author Marcel Lange <info@ask-sheldon.con>
*/
if (!defined('DOKU_INC')) {
die();
}
if (!defined('DOKU_PLUGIN')) {
define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
}
require_once DOKU_PLUGIN . 'action.php';
require_once DOKU_PLUGIN . 'matomo/code.php';
class action_plugin_matomo extends DokuWiki_Action_Plugin
{
function register(Doku_Event_Handler $controller)
{
$controller->register_hook(
'TPL_METAHEADER_OUTPUT', 'BEFORE', $this, '_hook_header'
);
}
function _hook_header(Doku_Event $event, $param)
{
$data = matomo_code();
$event->data['script'][] = array(
'type' => 'text/javascript',
'charset' => 'utf-8',
'_data' => $data,
);
}
}