-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.php
60 lines (56 loc) · 2.19 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
// phpcs:disable Squiz.Classes.ValidClassName.NotCamelCaps
// phpcs:disable PSR1.Files.SideEffects
/*
* Copyright (c) 2022 Mark C. Prins <[email protected]>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
use dokuwiki\Extension\Plugin;
use dokuwiki\Extension\EventHandler;
use dokuwiki\Extension\Event;
use Composer\InstalledVersions;
require_once __DIR__ . '/vendor/autoload.php';
/**
* DokuWiki Plugin geophp (Action Component).
*
* @author Mark Prins
*/
class action_plugin_geophp extends Plugin
{
/**
* plugin should use this method to register its handlers with the DokuWiki's event controller
*
* @param $controller DokuWiki's event controller object. Also available as global $EVENT_HANDLER
*/
final public function register(EventHandler $controller): void
{
$controller->register_hook('PLUGIN_POPULARITY_DATA_SETUP', 'AFTER', $this, 'popularity');
}
/**
* Produce popularity data for this plugin.
*
* @param Event $event The DokuWiki event
*/
final public function popularity(Event $event): void
{
$versionInfo = getVersionData();
$geoPHP = InstalledVersions::getPrettyVersion('funiq/geophp');
$plugin_info = $this->getInfo();
$event->data['geophp']['version'] = $plugin_info['date'];
$event->data['geophp']['geophp'] = $geoPHP;
$event->data['geophp']['dwversion'] = $versionInfo['date'];
$event->data['geophp']['combinedversion'] = $versionInfo['date'] . '_' . $plugin_info['date'] . '_' . $geoPHP;
}
}