forked from Andreone/dokuwiki_plantuml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.php
40 lines (36 loc) · 1.12 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
<?php
/**
* PlantUML-Plugin: Add a toolbar button to insert a plantuml block
*
* @license GPL v3 (http://www.gnu.org/licenses/gpl.html)
* @author Andreone
*/
if (!defined('DOKU_INC')) die();
if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
require_once (DOKU_PLUGIN . 'action.php');
/**
* All DokuWiki plugins to extend the parser/rendering mechanism
* need to inherit from this class
*/
class action_plugin_plantuml extends DokuWiki_Action_Plugin {
/**
* Register the event handler
*/
function register(&$controller) {
if($this->getConf('button_enabled') == '1')
$controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insert_button', array ());
}
/**
* Inserts the toolbar button
*/
function insert_button(& $event, $param) {
$event->data[] = array (
'type' => 'format',
'title' => htmlspecialchars($this->getLang('tooltip')),
'icon' => '../../plugins/plantuml/'.$this->getConf('button_icon'),
'open' => '<uml>',
'close' => '</uml>',
'sample' => '',
);
}
}