-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathaction.php
43 lines (34 loc) · 1.34 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
/**
* DokuWiki Plugin flowcharts (Action Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Jakob Schwichtenberg <[email protected]>
*/
// must be run within Dokuwiki
if (!defined('DOKU_INC')) {
die();
}
class action_plugin_flowcharts extends DokuWiki_Action_Plugin
{
public function register(Doku_Event_Handler $controller) {
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this,
'_loadmermaid');
}
public function _loadmermaid(Doku_Event $event, $param) {
$event->data['script'][] = array(
'type' => 'text/javascript',
'charset' => 'utf-8',
'_data' => '',
'src' => DOKU_BASE."lib/plugins/flowcharts/mermaid.min.js");
$event->data['script'][] = array(
'type' => 'text/javascript',
'charset' => 'utf-8',
'_data' => 'mermaid.initialize({securityLevel: "loose"});');
$event->data['link'][] = array (
'rel' => 'stylesheet',
'type' => 'text/css',
'href' => DOKU_BASE."lib/plugins/flowcharts/mermaid-override.css",
);
}
}