1<?php 2/** 3 * PlantUML-Plugin: Add a toolbar button to insert a plantuml block 4 * 5 * @license GPL v3 (http://www.gnu.org/licenses/gpl.html) 6 * @author Andreone 7 */ 8 9if (!defined('DOKU_INC')) die(); 10if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/'); 11require_once (DOKU_PLUGIN . 'action.php'); 12 13/** 14 * All DokuWiki plugins to extend the parser/rendering mechanism 15 * need to inherit from this class 16 */ 17class action_plugin_plantuml extends DokuWiki_Action_Plugin { 18 19 /** 20 * Register the event handler 21 */ 22 function register(&$controller) { 23 if($this->getConf('button_enabled') == '1') 24 $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insert_button', array ()); 25 } 26 27 /** 28 * Inserts the toolbar button 29 */ 30 function insert_button(& $event, $param) { 31 $event->data[] = array ( 32 'type' => 'format', 33 'title' => htmlspecialchars($this->getLang('tooltip')), 34 'icon' => '../../plugins/plantuml/'.$this->getConf('button_icon'), 35 'open' => '<uml>', 36 'close' => '</uml>', 37 'sample' => '', 38 ); 39 } 40}