1<?php
2
3require_once(__DIR__ . '/../ComboStrap/PluginUtility.php');
4
5use ComboStrap\Identity;
6
7
8/**
9 *
10 */
11class action_plugin_combo_identity extends DokuWiki_Action_Plugin
12{
13
14
15    public function register(Doku_Event_Handler $controller)
16    {
17
18        /**
19         * Add logged in indicator for Javascript
20         */
21        $controller->register_hook('DOKUWIKI_STARTED', 'AFTER', $this, 'handleAnonymousJsIndicator');
22
23
24    }
25
26
27
28
29
30    /**
31     * @noinspection SpellCheckingInspection
32     * Adding an information to know if the user is signed or not
33     */
34    function handleAnonymousJsIndicator(&$event, $param)
35    {
36
37        global $JSINFO;
38        if (!Identity::isLoggedIn()) {
39            $navigation = Identity::JS_NAVIGATION_ANONYMOUS_VALUE;
40        } else {
41            $navigation = Identity::JS_NAVIGATION_SIGNED_VALUE;
42        }
43        $JSINFO[Identity::JS_NAVIGATION_INDICATOR] = $navigation;
44
45
46    }
47
48
49}
50