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_xssnipper extends DokuWiki_Action_Plugin { 13 14 /** 15 * Return some info 16 */ 17 function getInfo() { 18 return array ( 19 'author' => 'Heiko Barth', 20 'date' => '2016-06-02', 21 'name' => 'Toolbar Code Button', 22 'desc' => 'Inserts a code button into the toolbar', 23 'url' => 'http://www.heiko-barth.de/download.php?id=dw_codebutton', 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' => 'picker', 40 'title' => 'Code select', 41 'icon' => '../../plugins/xssnipper/images/code.png', 42 'list' => array( 43 array( 44 'type' => 'format', 45 'title' => 'xssnip', 46 'icon' => '../../plugins/xssnipper/images/code_xssnip.png', 47 'open' => '{(xssnipper>', 48 'close' => ')}', 49 ), 50 array( 51 'type' => 'format', 52 'title' => 'code', 53 'icon' => '../../plugins/xssnipper/images/code_code.png', 54 'open' => '<code>\n', 55 'close' => '\n</code>', 56 ), 57 array( 58 'type' => 'format', 59 'title' => 'php', 60 'icon' => '../../plugins/xssnipper/images/code_php.png', 61 'open' => '<code php>\n', 62 'close' => '\n</code>', 63 ), 64 array( 65 'type' => 'format', 66 'title' => 'html', 67 'icon' => '../../plugins/xssnipper/images/code_html.png', 68 'open' => '<code html>\n', 69 'close' => '\n</code>', 70 ), 71 array( 72 'type' => 'format', 73 'title' => 'js', 74 'icon' => '../../plugins/xssnipper/images/code_js.png', 75 'open' => '<code php>\n', 76 'close' => '\n</code>', 77 ), 78 array( 79 'type' => 'format', 80 'title' => 'code', 81 'icon' => '../../plugins/xssnipper/images/code_css.png', 82 'open' => '<code css>\n', 83 'close' => '\n</code>', 84 ), 85 array( 86 'type' => 'format', 87 'title' => 'txt', 88 'icon' => '../../plugins/xssnipper/images/code_txt.png', 89 'open' => '<code txt>\n', 90 'close' => '\n</code>', 91 ), 92 array( 93 'type' => 'format', 94 'title' => 'xml', 95 'icon' => '../../plugins/xssnipper/images/code_xml.png', 96 'open' => '<code xml>\n', 97 'close' => '\n</code>', 98 ), 99 array( 100 'type' => 'format', 101 'title' => 'file', 102 'icon' => '../../plugins/xssnipper/images/code_file.png', 103 'open' => '<file>\n', 104 'close' => '\n</file>', 105 ) 106 ) 107 ); 108 } 109 110} 111