1<?php 2/** 3 * Action Component for the Ad-Hoc Tags Plugin 4 * 5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6 * @author Andreas Gohr <andi@splitbrain.org> 7 * @author Sascha Leib <sascha.leib(at)kolmio.com> 8 */ 9 10class action_plugin_adhoctags extends DokuWiki_Action_Plugin { 11 12 /** 13 * register the eventhandlers 14 * 15 * @author Andreas Gohr <andi@splitbrain.org> 16 * @author Sascha Leib <sascha.leib(at)kolmio.com> 17 */ 18 function register(Doku_Event_Handler $controller){ 19 $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'handle_toolbar', array ()); 20 } 21 22 function handle_toolbar(Doku_Event $event, $param) { 23 $syntaxDiv = $this->getConf('syntaxDiv'); 24 $syntaxSpan = $this->getConf('syntaxSpan'); 25 26 $event->data[] = array ( 27 'type' => 'picker', 28 'title' => $this->getLang('picker'), 29 'icon' => '../../plugins/adhoctags/images/code-tags.svg', 30 'id' => 'tbbtn_adhoctagsInline', 31 'list' => array( 32 /* inline elements */ 33 array( 34 'type' => 'format', 35 'title' => $this->getLang('b').': <>', 36 'icon' => '../../plugins/adhoctags/images/format-bold.svg', 37 'open' => '<b>', 38 'close' => '</b>', 39 'sample' => 'Bold' 40 ), 41 array( 42 'type' => 'format', 43 'title' => $this->getLang('i').': <>', 44 'icon' => '../../plugins/adhoctags/images/format-italic.svg', 45 'open' => '<i>', 46 'close' => '</i>', 47 'sample' => 'Italic' 48 ), 49 array( 50 'type' => 'format', 51 'title' => $this->getLang('s').': <>', 52 'icon' => '../../plugins/adhoctags/images/format-strikethrough-variant.svg', 53 'open' => '<s>', 54 'close' => '</s>', 55 'sample' => 'Strikethrough' 56 ), 57 array( 58 'type' => 'format', 59 'title' => $this->getLang('u').': <>', 60 'icon' => '../../plugins/adhoctags/images/format-underline-wavy.svg', 61 'open' => '<u>', 62 'close' => '</u>', 63 'sample' => 'Underline' 64 ), 65 array( 66 'type' => 'format', 67 'title' => $this->getLang('small').': <>', 68 'icon' => '../../plugins/adhoctags/images/format-size.svg', 69 'open' => '<small>', 70 'close' => '</small>', 71 'sample' => 'smaller' 72 ), 73 array( 74 'type' => 'format', 75 'title' => $this->getLang('q').': <>', 76 'icon' => '../../plugins/adhoctags/images/format-quote-open.svg', 77 'open' => '<q>', 78 'close' => '</q>', 79 'sample' => 'Quotation' 80 ), 81 array( 82 'type' => 'format', 83 'title' => $this->getLang('abbr').': <>', 84 'icon' => '../../plugins/adhoctags/images/abbr.svg', 85 'open' => '<abbr>', 86 'close' => '</abbr>', 87 'sample' => 'ABBR' 88 ), 89 array( 90 'type' => 'format', 91 'title' => $this->getLang('dfn').': <>', 92 'icon' => '../../plugins/adhoctags/images/def.svg', 93 'open' => '<dfn>', 94 'close' => '</dfn>', 95 'sample' => 'Definition' 96 ), 97 array( 98 'type' => 'format', 99 'title' => $this->getLang('kbd').': <>', 100 'icon' => '../../plugins/adhoctags/images/keyboard-variant.svg', 101 'open' => '<kbd>', 102 'close' => '</kbd>', 103 'sample' => 'Ctrl' 104 ), 105 array( 106 'type' => 'format', 107 'title' => $this->getLang('samp').': <>', 108 'icon' => '../../plugins/adhoctags/images/export.svg', 109 'open' => '<samp>', 110 'close' => '</samp>', 111 'sample' => 'Output' 112 ), 113 array( 114 'type' => 'format', 115 'title' => $this->getLang('var').': <>', 116 'icon' => '../../plugins/adhoctags/images/variable.svg', 117 'open' => '<var>', 118 'close' => '</var>', 119 'sample' => 'x' 120 ), 121 array( 122 'type' => 'format', 123 'title' => $this->getLang('mark').': <>', 124 'icon' => '../../plugins/adhoctags/images/format-color-highlight.svg', 125 'open' => '<mark>', 126 'close' => '</mark>', 127 'sample' => 'marked' 128 ), 129 array( 130 'type' => 'format', 131 'title' => $this->getLang('cite').': <>', 132 'icon' => '../../plugins/adhoctags/images/comment-quote-outline.svg', 133 'open' => '<cite>', 134 'close' => '</cite>', 135 'sample' => 'Citation' 136 ), 137 array( 138 'type' => 'format', 139 'title' => $this->getLang('time').': <>', 140 'icon' => '../../plugins/adhoctags/images/calendar-clock.svg', 141 'open' => '<time>', 142 'close' => '</time>', 143 'sample' => 'datetime' 144 ), 145 /* block-level elements: */ 146 array( 147 'type' => 'format', 148 'title' => $this->getLang('section').': <>', 149 'icon' => '../../plugins/adhoctags/images/code-brackets.svg', 150 'open' => '<section>\n', 151 'close' => '\n</section>', 152 'sample' => 'Section' 153 ), 154 array( 155 'type' => 'format', 156 'title' => $this->getLang('figure').': <>/<>', 157 'icon' => '../../plugins/adhoctags/images/figure-caption.svg', 158 'open' => '<figure>\n', 159 'close' => '\n<figcaption>Caption</figcaption>\n</figure>', 160 'sample' => 'figure content' 161 ), 162 array( 163 'type' => 'format', 164 'title' => $this->getLang('aside').': <>', 165 'icon' => '../../plugins/adhoctags/images/aside.svg', 166 'open' => '<aside>\n', 167 'close' => '\n</aside>', 168 'sample' => 'Aside text' 169 ), 170 array( 171 'type' => 'format', 172 'title' => $this->getLang('article').': <>', 173 'icon' => '../../plugins/adhoctags/images/subtitles-outline.svg', 174 'open' => '<article>\n', 175 'close' => '\n</article>', 176 'sample' => 'Article text' 177 ), 178 array( 179 'type' => 'format', 180 'title' => $this->getLang('dl').': <>/<>/<>', 181 'icon' => '../../plugins/adhoctags/images/definition-list.svg', 182 'open' => '<dl>\n<dt>', 183 'close' => '</dt>\n<dd>Description</dd>\n</dl>', 184 'sample' => 'Term' 185 ), 186 array( 187 'type' => 'format', 188 'title' => $this->getLang('address').': <>', 189 'icon' => '../../plugins/adhoctags/images/card-account-details-outline.svg', 190 'open' => '<address>\n', 191 'close' => '\n</address>', 192 'sample' => 'Address' 193 ), 194 array( 195 'type' => 'format', 196 'title' => $this->getLang('details').': <>/<>', 197 'icon' => '../../plugins/adhoctags/images/details-summary.svg', 198 'open' => '<details><summary>', 199 'close' => '</summary>\nDetails\n</details>', 200 'sample' => 'Summary' 201 ) 202 ) 203 ); 204 } 205} 206 207