Skip to content

Commit

Permalink
refactor: use native json_encode for $JSINFO
Browse files Browse the repository at this point in the history
json_encode is available natively since PHP 5.2
  • Loading branch information
micgro42 committed Mar 29, 2018
1 parent b3054f0 commit 1d739e3
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions inc/template.php
Expand Up @@ -324,14 +324,12 @@ function tpl_metaheaders($alt = true) {
'href'=> DOKU_BASE.'lib/exe/css.php?t='.rawurlencode($conf['template']).'&tseed='.$tseed
);

// make $INFO and other vars available to JavaScripts
$json = new JSON();
$script = "var NS='".$INFO['namespace']."';";
if($conf['useacl'] && $INPUT->server->str('REMOTE_USER')) {
$script .= "var SIG='".toolbar_signature()."';";
}
_tpl_ensureJSINFO();
$script .= 'var JSINFO = '.$json->encode($JSINFO).';';
$script .= 'var JSINFO = ' . json_encode($JSINFO).';';
$head['script'][] = array('type'=> 'text/javascript', '_data'=> $script);

// load jquery
Expand Down

0 comments on commit 1d739e3

Please sign in to comment.