forked from michael-dev/dokuwiki-plugin-quicktext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.php
46 lines (39 loc) · 1.32 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
<?php
/**
* Action Component for the Quicktext Plugin
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Michael Braun <[email protected]>
*/
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'action.php');
class action_plugin_quicktext extends DokuWiki_Action_Plugin {
/**
* register the eventhandlers
*
* @author Andreas Gohr <[email protected]>
*/
public function register(Doku_Event_Handler $controller){
$controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'handle_toolbar', array ());
}
function handle_toolbar(&$event, $param) {
$items = Array();
for ($i=0; $this->getConf('name'.$i) != ''; $i++) {
$items[] = array(
'type' => 'insert',
'title' => $this->getConf('name'.$i),
'icon' => $this->getConf('icon'.$i),
'insert' => $this->getConf('value'.$i),
'block' => true
);
}
$event->data[] = array (
'type' => 'picker',
'title' => $this->getLang('picker'),
'icon' => $this->getConf('icon'),
'list' => $items
);
}
}