1<?php
2/**
3 * DokuWiki Plugin shortcutkey (Action Component)
4 *
5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6 * @author  S.C. Yoo <dryoo@live.com>
7 */
8
9// must be run within Dokuwiki
10if(!defined('DOKU_INC')) die();
11
12class action_plugin_shortcutkey extends DokuWiki_Action_Plugin {
13
14    /**
15     * Registers a callback function for a given event
16     */
17    public function register(Doku_Event_Handler $controller) {
18       $controller->register_hook('DOKUWIKI_STARTED', 'AFTER', $this, 'handle_dokuwiki_started');
19    }
20
21    /**
22     * @param Doku_Event $event  event object by reference
23     */
24    public function handle_dokuwiki_started(Doku_Event &$event, $param) {
25        global $JSINFO;
26        $_actions= array('show','edit','backlink','revisions','diff','media','index','recent','search','home','top', 'save');
27        $JSINFO['DOKU_URL']=DOKU_URL;
28
29        foreach ($_actions as $_a) {
30            $JSINFO['key_'.$_a] = (ord($this->getConf('key_'.$_a)));
31        }
32        if(!plugin_isdisabled('randompage')) {
33            $JSINFO['key_random']=ord($this->getConf('key_random'));
34            $JSINFO['key_nsrandom']=ord($this->getConf('key_nsrandom'));
35        }
36    }
37}
38
39// vim:ts=4:sw=4:et:
40