aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/inc/template.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/template.php')
-rw-r--r--inc/template.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/inc/template.php b/inc/template.php
index 7eef41aad..720513b0f 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -330,9 +330,7 @@ function tpl_metaheaders($alt = true) {
if($conf['useacl'] && $INPUT->server->str('REMOTE_USER')) {
$script .= "var SIG='".toolbar_signature()."';";
}
- $JSINFO['ACT'] = act_clean($ACT);
- $JSINFO['DOKU_UHN'] = (int) useHeading('navigation');
- $JSINFO['DOKU_UHC'] = (int) useHeading('content');
+ _tpl_ensureJSINFO();
$script .= 'var JSINFO = '.$json->encode($JSINFO).';';
$head['script'][] = array('type'=> 'text/javascript', '_data'=> $script);
@@ -355,6 +353,20 @@ function tpl_metaheaders($alt = true) {
return true;
}
+function _tpl_ensureJSINFO() {
+ global $JSINFO, $ID, $INFO;
+
+ if (!is_array($JSINFO)) {
+ $JSINFO = [];
+ }
+ //export minimal info to JS, plugins can add more
+ $JSINFO['id'] = $ID;
+ $JSINFO['namespace'] = (string) $INFO['namespace'];
+ $JSINFO['ACT'] = act_clean($ACT);
+ $JSINFO['DOKU_UHN'] = (int) useHeading('navigation');
+ $JSINFO['DOKU_UHC'] = (int) useHeading('content');
+}
+
/**
* prints the array build by tpl_metaheaders
*