xref: /plugin/davcal/action/jsinfo.php (revision 9f1dab8c22c579ae1903b00ba4d7de46f7cbdea4)
1<?php
2
3/**
4 * DokuWiki DAVCal PlugIn - JSINFO component
5 */
6
7if(!defined('DOKU_INC')) die();
8
9class action_plugin_davcal_jsinfo extends DokuWiki_Action_Plugin {
10
11    function register(Doku_Event_Handler $controller) {
12        $controller->register_hook('DOKUWIKI_STARTED', 'AFTER', $this, 'add_jsinfo_information');
13    }
14
15    /**
16     * Add the language variable to the JSINFO variable
17     */
18    function add_jsinfo_information(&$event, $param) {
19      global $conf;
20      global $JSINFO;
21
22      $lang = $conf['lang'];
23
24      switch($lang)
25      {
26        case 'de':
27        case 'de-informal':
28            $lc = 'de';
29            break;
30        case 'nl':
31            $lc = 'nl';
32            break;
33        case 'fr':
34            $lc = 'fr';
35            break;
36        default:
37            $lc = 'en';
38      }
39
40      $JSINFO['plugin']['davcal']['sectok'] = getSecurityToken();
41      $JSINFO['plugin']['davcal']['language'] = $lc;
42      if(isset($_SERVER['REMOTE_USER']) && !is_null($_SERVER['REMOTE_USER']))
43      {
44        $JSINFO['plugin']['davcal']['disable_sync'] = $this->getConf('disable_sync');
45        $JSINFO['plugin']['davcal']['disable_settings'] = $this->getConf('hide_settings');
46      }
47      else
48      {
49        $JSINFO['plugin']['davcal']['disable_settings'] = 1;
50        $JSINFO['plugin']['davcal']['disable_sync'] = 1;
51      }
52      $JSINFO['plugin']['davcal']['disable_ics'] = $this->getConf('disable_ics');
53    }
54}
55