1<?php 2 3/** 4 * Keyboard Action Plugin: Inserts button for keyboard plugin into toolbar 5 * 6 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 7 * @author Gina Haeussge <osd@foosel.net> 8 */ 9 10class action_plugin_keyboard extends DokuWiki_Action_Plugin { 11 12 /** 13 * Register the eventhandlers 14 */ 15 function register(Doku_Event_Handler $contr) { 16 $contr->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insert_button', array ()); 17 } 18 19 /** 20 * Inserts the toolbar button 21 */ 22 function insert_button(&$event, $param) { 23 $event->data[] = array( 24 'type' => 'format', 25 'title' => $this->getLang('qb_keyboard'), 26 'icon' => '../../plugins/keyboard/keyboard.png', 27 'open' => '<key>', 28 'close' => '</key>', 29 ); 30 31 // Code for backwards compatibility 32 if (!method_exists ($event , 'mayRunDefault')) { 33 return $event->_default; 34 } 35 return $event->mayRunDefault(); 36 } 37} 38