8000 Rector changes by alexlehm · Pull Request #2 · alexlehm/dokuwiki-plugin-piwik · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _test/action_plugin_piwiktagmanagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function testPiwikTa 8000 gManager()
idx_addPage($pageId);

$request = new TestRequest();
$response = $request->get(array('id' => $pageId, '/doku.php'));
$response = $request->get(['id' => $pageId, '/doku.php']);

$domElements = $response->queryHTML("script");

Expand Down
33 changes: 9 additions & 24 deletions action.php
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
<?php

class action_plugin_piwiktagmanager extends DokuWiki_Action_Plugin
use dokuwiki\Extension\ActionPlugin;
use dokuwiki\Extension\EventHandler;

class action_plugin_piwiktagmanager extends ActionPlugin
{
public const PWTMID = 'PWTMID';
public const PWTMHOST = 'PWTMHOST';

/**
* return some info
*/
public function getInfo()
{
return array(
'author' => 'Alexander Lehmann',
'email' => 'alexlehm@gmail.com',
'date' => '2026-01-02',
'name' => 'Piwik (Matomo) Tag Manager',
'desc' => 'Plugin to embed Piwik/Matomo Tag Manager in your wiki.',
'url' => 'https://wiki.lehmann.cx/projects:dokuwiki_piwik',
);
}

/**
* Register its handlers with the DokuWiki's event controller
*/
public function register(Doku_Event_Handler $controller)
* Register its handlers with the DokuWiki's event controller
*/
public function register(EventHandler $controller)
{
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'addHeaders');
}
Expand All @@ -33,9 +21,7 @@ public function addHeaders(&$event, $param)

if (!$this->getConf(self::PWTMID)) return;

$event->data['script'][] = array (
'type' => 'text/javascript',
'_data' => "
$event->data['script'][] = ['type' => 'text/javascript', '_data' => "
var _mtm = window._mtm = window._mtm || [];
_mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'});
(function() {
Expand All @@ -45,7 +31,6 @@ public function addHeaders(&$event, $param)
"/piwik/js/container_" .
$this->getConf(self::PWTMID) .
".js'; s.parentNode.insertBefore(g,s);
})();",
);
})();"];
}
}
4 changes: 2 additions & 2 deletions conf/metadata.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

$meta['PWTMID'] = array('string');
$meta['PWTMHOST'] = array('string');
$meta['PWTMID'] = ['string'];
$meta['PWTMHOST'] = ['string'];
Loading
0