blob: 7fc7a2cc09371de909bd76f76fe49650c7403603 (
plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
* @category Piwik_Plugins
* @package Piwik_ExamplePlugin
*/
use Piwik\Plugin;
/**
*
* @package Piwik_ExamplePlugin
*/
class Piwik_ExamplePlugin extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
*/
public function getListHooksRegistered()
{
return array(
// 'Controller.renderView' => 'addUniqueVisitorsColumnToGivenReport',
'WidgetsList.add' => 'addWidgets',
);
}
function activate()
{
// Executed every time plugin is Enabled
}
function deactivate()
{
// Executed every time plugin is disabled
}
public function addUniqueVisitorsColumnToGivenReport($view)
{
$view = $view['view'];
if ($view->getCurrentControllerName() == 'Referers'
&& $view->getCurrentControllerAction() == 'getWebsites'
) {
$view->addColumnToDisplay('nb_uniq_visitors');
}
}
public function addWidgets()
{
// we register the widgets so they appear in the "Add a new widget" window in the dashboard
// Note that the first two parameters can be either a normal string, or an index to a translation string
Piwik_AddWidget('ExamplePlugin_exampleWidgets', 'ExamplePlugin_exampleWidget', 'ExamplePlugin', 'exampleWidget');
Piwik_AddWidget('ExamplePlugin_exampleWidgets', 'ExamplePlugin_photostreamMatt', 'ExamplePlugin', 'photostreamMatt');
Piwik_AddWidget('ExamplePlugin_exampleWidgets', 'ExamplePlugin_piwikForumVisits', 'ExamplePlugin', 'piwikDownloads');
}
}
|