1 | <?php |
||
3 | class PiwikExtension extends Extension |
||
|
|||
4 | { |
||
5 | |||
6 | /** |
||
7 | * @var string the url to the server, without protocol and trailing slash, e.g. //piwik.foo.com/ |
||
8 | */ |
||
9 | private static $piwik_server = '//piwik.foo.com/'; |
||
10 | |||
11 | /** |
||
12 | * @var int the piwik site id |
||
13 | */ |
||
14 | private static $piwik_site_id = 0; |
||
15 | |||
16 | /** |
||
17 | * @var bool Do you want tracking code in dev environments? |
||
18 | */ |
||
19 | private static $show_on_dev = false; |
||
20 | |||
21 | /** |
||
22 | * @var bool do you want tracking code in test environments? |
||
23 | */ |
||
24 | private static $show_on_test = false; |
||
25 | |||
26 | /** |
||
27 | * @var bool we want tracking code in live environments |
||
28 | */ |
||
29 | private static $show_on_live = true; |
||
30 | |||
31 | /** |
||
32 | * @var bool include tracking code on contentcontrollerInit |
||
33 | */ |
||
34 | private static $auto_include = true; |
||
35 | |||
36 | /** |
||
37 | * @var bool include tracking code automatically in backend, subclasses of LeftAndMain |
||
38 | */ |
||
39 | private static $include_in_backend = false; |
||
40 | |||
41 | private static $excluded_controllers = array( |
||
42 | 'DevelopmentAdmin', |
||
43 | 'DevBuildController', |
||
44 | 'DatabaseAdmin' |
||
45 | ); |
||
46 | |||
47 | /** |
||
48 | * includes the piwik tracking code when ContentController initializes... |
||
49 | * @todo: get it working ;) |
||
50 | */ |
||
51 | public function onAfterInit(&$controller) |
||
57 | |||
58 | /** |
||
59 | * generates piwik tracking code out of config vars and Piwik.ss template |
||
60 | * @param $wrap wrap inside <script> tags, e.g. for templates |
||
61 | */ |
||
62 | public function getPiwik($wrap = true) |
||
89 | |||
90 | /** |
||
91 | * Helper function to define if tracking code should be included automatically |
||
92 | * @return bool |
||
93 | */ |
||
94 | public function autoInclude() |
||
115 | |||
116 | |||
117 | /** |
||
118 | * @return bool is the extended controller an instance of LeftAndMain |
||
119 | */ |
||
120 | public function isBackend() |
||
124 | |||
125 | /** |
||
126 | * Checks if the current controller is in a list of blocked controllers (e.g. dev/build) |
||
127 | * |
||
128 | * @return mixed |
||
129 | */ |
||
130 | public function isBlockedController() |
||
139 | } |
||
140 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.