1<?php 2/** 3 * AcMenu plugin: an accordion menu for namespaces and relative pages. 4 * 5 * action.php: methods used by AcMenu plugin who interact with DokuWiki's events. 6 * 7 * @author Torpedo <dcstoyanov@gmail.com> 8 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 9 * @package action 10 */ 11 12if (!defined('DOKU_INC')) die(); // the plugin must be run within Dokuwiki 13 14/** 15 * Defines the methods used by AcMenu plugin to interact with DokuWiki's events. 16 * 17 * @package action_pycode 18 */ 19class action_plugin_acmenu extends DokuWiki_Action_Plugin 20{ 21 22 /** 23 * Register the event handlers 24 */ 25 function register(Doku_Event_Handler $controller) 26 { 27 $controller->register_hook("DOKUWIKI_STARTED", "AFTER", $this, "_add_user_conf", array()); 28 } 29 30 /** 31 * Add some user's configuration to the $JSINFO variable. 32 * 33 * @param object $event 34 * the event object 35 * @param array $param 36 * data passed when this handler was registered 37 */ 38 function _add_user_conf(Doku_Event $event, $param) 39 { 40 global $conf; 41 global $INFO; 42 global $JSINFO; 43 $JSINFO["plugin_acmenu"]["doku_base"] = DOKU_BASE; 44 $JSINFO["plugin_acmenu"]["doku_url"] = DOKU_URL; 45 $JSINFO["plugin_acmenu"]["doku_script"] = DOKU_SCRIPT; 46 $JSINFO["plugin_acmenu"]["start"] = $conf["start"]; 47 $JSINFO["plugin_acmenu"]["useslash"] = $conf["useslash"]; 48 $JSINFO["plugin_acmenu"]["canonical"] = $conf["canonical"]; 49 $JSINFO["plugin_acmenu"]["userewrite"] = $conf["userewrite"]; 50 // namespace genealogy doesn't exist for an id deleated 51 if(isset($INFO["meta"]["plugin"]["plugin_acmenu"]["sub_ns"])) { 52 $JSINFO["plugin_acmenu"]["sub_ns"] = $INFO["meta"]["plugin"]["plugin_acmenu"]["sub_ns"]; 53 } 54 } 55} 56