1<?php 2/** 3 * DokuWiki Plugin flowcharts (Action Component) 4 * 5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 6 * @author Jakob Schwichtenberg <mail@jakobschwichtenberg.com> 7 */ 8 9// must be run within Dokuwiki 10if (!defined('DOKU_INC')) { 11 die(); 12} 13 14class action_plugin_flowcharts extends DokuWiki_Action_Plugin 15{ 16 17 public function register(Doku_Event_Handler $controller) { 18 $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 19 '_loadmermaid'); 20 } 21 22 public function _loadmermaid(Doku_Event $event, $param) { 23 $event->data['script'][] = array( 24 'type' => 'text/javascript', 25 'charset' => 'utf-8', 26 '_data' => '', 27 'src' => DOKU_BASE."lib/plugins/flowcharts/mermaid.min.js"); 28 29 $event->data['script'][] = array( 30 'type' => 'text/javascript', 31 'charset' => 'utf-8', 32 '_data' => 'mermaid.initialize({securityLevel: "loose"});'); 33 34 $event->data['link'][] = array ( 35 'rel' => 'stylesheet', 36 'type' => 'text/css', 37 'href' => DOKU_BASE."lib/plugins/flowcharts/mermaid-override.css", 38 ); 39 40 } 41 42} 43 44