1<?php 2/** 3 * DokuWiki Plugin tabbox (Action Component) 4 * 5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 6 * @author Andreas Gohr <dokuwiki@cosmocode.de> 7 */ 8 9// must be run within Dokuwiki 10if(!defined('DOKU_INC')) die(); 11 12class action_plugin_tabbox extends DokuWiki_Action_Plugin { 13 14 public function register(Doku_Event_Handler $controller) { 15 $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insert_button'); 16 } 17 18 19 /** 20 * Inserts a toolbar button 21 */ 22 function insert_button(& $event, $param) { 23 24 $tabs = explode(',', $this->getConf('tabs')); 25 $tabs = array_map('trim', $tabs); 26 27 $tab = array_shift($tabs); 28 $open = '<tabbox '.$tab.'>\n\n'; 29 $close = '\n\n'; 30 foreach($tabs as $tab) { 31 $close .= '<tabbox '.$tab.'>\n\n'; 32 } 33 $close .= '</tabbox>'; 34 35 $event->data[] = array ( 36 'type' => 'format', 37 'title' => $this->getLang('tabbox_btn'), 38 'icon' => '../../plugins/tabbox/button.png', 39 'open' => $open, 40 'close' => $close, 41 'block' => true, 42 ); 43 } 44 45}