1<?php 2/** 3 * Action Component for the flowchartjs Plugin 4 * 5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6 * @author Hua Gao <ghbore@gmail.com> 7 */ 8 9// must be run within Dokuwiki 10if(!defined('DOKU_INC')) die(); 11 12if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC.'lib/plugins/'); 13 14require_once(DOKU_PLUGIN.'action.php'); 15require_once(DOKU_INC.'inc/confutils.php'); 16 17class action_plugin_flowchartjs extends DokuWiki_Action_Plugin { 18 function register(Doku_Event_Handler $controller){ 19 $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insert_button', array ()); 20 } 21 22 function insert_button (Doku_Event $event, $param) { 23 $event->data[] = array( 24 'type' => 'format', 25 'title' => 'flowchartjs', 26 'icon' => '../../plugins/flowchartjs/images/toolbar/fc.png', 27 'open' => '<flowchartjs >\n', 28 'sample' => '\n', 29 'close' => '</flowchartjs>\n', 30 ); 31 $event->data[] = array( 32 'type' => 'picker', 33 'title' => 'flowchartjs style', 34 'icon' => '../../plugins/flowchartjs/images/toolbar/fcs.png', 35 'list' => array_map(function ($fn){return pathinfo($fn, PATHINFO_FILENAME);}, 36 glob(DOKU_PLUGIN.'flowchartjs/styles/*.json') 37 ), 38 ); 39 } 40} 41 42//Setup VIM: ex: et ts=4 : 43