1<?php 2/** 3 * DokuWiki Plugin caption (Action Component) 4 * 5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 6 * @author Till Biskup <till@till-biskup.de> 7 */ 8 9class action_plugin_caption extends DokuWiki_Action_Plugin { 10 11 public function register(Doku_Event_Handler $controller) { 12 $controller->register_hook("TOOLBAR_DEFINE", "AFTER", $this, "insert_button", array ()); 13 } 14 15 /** 16 * Inserts a toolbar button 17 */ 18 public function insert_button(&$event, $param) { 19 $event->data[] = array ( 20 'type' => 'picker', 21 'title' => $this->getLang('picker'), 22 'icon' => '../../plugins/caption/images/picker.png', 23 'class' => 'captionpicker', 24 'list' => array( 25 array( 26 'type' => 'format', 27 'title' => $this->getLang('figure'), 28 'icon' => '../../plugins/caption/images/fig.png', 29 'open' => '<figure fig_label>\n', 30 'sample' => '{{:img |title}}', 31 'close' => '\n<caption>caption</caption>\n</figure>', 32 ), 33 array( 34 'type' => 'format', 35 'title' => $this->getLang('table'), 36 'icon' => '../../plugins/caption/images/tab.png', 37 'open' => '<table tab_label>\n<caption>caption</caption>\n', 38 'sample' => '^ Header1 ^ Header2 ^\n| foo | bar |\n', 39 'close' => '</table>', 40 ), 41 array( 42 'type' => 'format', 43 'title' => $this->getLang('code'), 44 'icon' => '../../plugins/caption/images/code.png', 45 'open' => '<codeblock code_label>\n<caption>caption</caption>\n', 46 'sample' => '<code>\n...\n</code>\n', 47 'close' => '</codeblock>', 48 ), 49 array( 50 'type' => 'format', 51 'title' => $this->getLang('file'), 52 'icon' => '../../plugins/caption/images/file.png', 53 'open' => '<fileblock file_label>\n<caption>caption</caption>\n', 54 'sample' => '<file "" foo.txt>\n...\n</file>\n', 55 'close' => '</fileblock>', 56 ), 57 array( 58 'type' => 'insert', 59 'title' => $this->getLang('reference'), 60 'icon' => '../../plugins/caption/images/ref.png', 61 'insert' => '{{ref>label}}', 62 ) 63 ) 64 ); 65 } 66} 67