1<?php
2/**
3 * Action Component for the Webcode Plugin
4 * Add a button in the edit toolbar
5 *
6 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
7 * @author     Nicolas GERARD
8 */
9
10// must be run within Dokuwiki
11if(!defined('DOKU_INC')) die();
12
13if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
14require_once(DOKU_PLUGIN.'action.php');
15
16class action_plugin_webcode extends DokuWiki_Action_Plugin {
17
18    /**
19     * register the event handlers
20     *
21     * @param Doku_Event_Handler $controller
22     * @author Nicolas GERARD
23     */
24    function register(Doku_Event_Handler $controller){
25        $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'handle_toolbar', array ());
26    }
27
28    function handle_toolbar(&$event, $param) {
29        $webCodeShortcutKey = $this->getConf('WebCodeShortCutKey');
30
31        $event->data[] = array(
32            'type'   => 'format',
33            'title'  => $this->getLang('WebCodeButtonTitle').' ('.$this->getLang('AccessKey').': '.$webCodeShortcutKey.')',
34            'icon'   => '../../plugins/webcode/images/webcode.png',
35            'open'   => '<webcode name="Default" frameborder=0 width=100% scrolling=yes '.syntax_plugin_webcode_basis::EXTERNAL_RESOURCES_ATTRIBUTE_DISPLAY.'="," renderingMode=story >\n',
36            'close'  => '\n</webcode>\n',
37            'key'    => $webCodeShortcutKey
38        );
39
40
41    }
42
43}
44
45