1<?php 2/** 3 * Action Plugin: Inserts a button into the toolbar to add file tags 4 * 5 * @author Heiko Barth 6 */ 7 8if (!defined('DOKU_INC')) die(); 9if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/'); 10require_once (DOKU_PLUGIN . 'action.php'); 11 12class action_plugin_codebutton extends DokuWiki_Action_Plugin { 13 14 /** 15 * Return some info 16 */ 17 function getInfo() { 18 return array ( 19 'author' => 'Heiko Barth', 20 'date' => '2018-09-17', 21 'name' => 'Toolbar Code Button', 22 'desc' => 'Inserts a code button into the toolbar', 23 'url' => 'https://www.heiko-barth.de/downloads/dw_codebutton.zip', 24 ); 25 } 26 27 /** 28 * Register the eventhandlers 29 */ 30 function register(Doku_Event_Handler $controller) { 31 $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insert_button', array ()); 32 } 33 34 /** 35 * Inserts the toolbar button 36 */ 37 function insert_button(& $event, $param) { 38 $event->data[] = array ( 39 'type' => 'format', 40 'title' => $this->getLang('insertcode'), 41 'icon' => '../../plugins/codebutton/image/code.png', 42 'open' => '<file>\n', 43 'close' => '\n</file>', 44 ); 45 } 46 47} 48