-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathaction.php
42 lines (36 loc) · 1.05 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
<?php
use dokuwiki\Extension\ActionPlugin;
use dokuwiki\Extension\EventHandler;
use dokuwiki\Extension\Event;
/**
* DokuWiki Plugin vshare (Action Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Andreas Gohr <[email protected]>
*/
class action_plugin_vshare extends ActionPlugin
{
/** @inheritDoc */
public function register(EventHandler $controller)
{
$controller->register_hook('DOKUWIKI_STARTED', 'AFTER', $this, 'addSites');
}
/**
* Add the site regexes
*
* @param Event $event event object by reference
* @param mixed $param optional parameter passed when event was registered
* @return void
*/
public function addSites(Event $event, $param)
{
global $JSINFO;
$sites = parse_ini_file(__DIR__ . '/sites.ini', true, INI_SCANNER_RAW);
$js = [];
foreach ($sites as $site => $data) {
if (empty($data['rex'])) continue;
$js[$site] = $data['rex'];
}
$JSINFO['plugins']['vshare'] = $js;
}
}