1<?php
2/**
3 * DokuWiki Plugin dropfiles (Action Component)
4 *
5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6 * @author  Michael Große <dokuwiki@cosmocode.de>
7 */
8
9// must be run within Dokuwiki
10if (!defined('DOKU_INC')) {
11    die();
12}
13
14class action_plugin_dropfiles_jsinfoconfig extends DokuWiki_Action_Plugin
15{
16
17
18    /**
19     * Registers a callback function for a given event
20     *
21     * @param Doku_Event_Handler $controller DokuWiki's event controller object
22     *
23     * @return void
24     */
25    public function register(Doku_Event_Handler $controller)
26    {
27        $controller->register_hook('DOKUWIKI_STARTED', 'BEFORE', $this, 'addDataToJSINFO');
28    }
29
30    /**
31     * Make config settings available to javascript
32     *
33     * @param Doku_Event $event
34     * @param $param
35     */
36    public function addDataToJSINFO(Doku_Event $event, $param) {
37        global $JSINFO;
38
39        if (!isset($JSINFO['plugins'])) {
40            $JSINFO['plugins'] = [];
41        }
42        $JSINFO['plugins']['dropfiles'] = ['insertFileLink' => $this->getConf('insertFileLink')];
43    }
44
45}
46