Skip to content
Snippets Groups Projects
Commit 83a482b6 authored by Andreas Gohr's avatar Andreas Gohr
Browse files

make $INFO available to JavaScripts

Ignore-this: 372ed5dafd33b16d910edc164dc69fb9

$INFO is now exported as JavaScript variable INFO in the HTML
meta headers. This makes it easier for plugin authors to access
important info about the current page and user from JavaScript.

darcs-hash:20091026114046-6e07b-340f009428322105a5dda72933a66a3719de544d.gz
parent 72856829
No related branches found
No related tags found
No related merge requests found
...@@ -352,6 +352,14 @@ function tpl_metaheaders($alt=true){ ...@@ -352,6 +352,14 @@ function tpl_metaheaders($alt=true){
$head['script'][] = array( 'type'=>'text/javascript', 'charset'=>'utf-8', '_data'=>'', $head['script'][] = array( 'type'=>'text/javascript', 'charset'=>'utf-8', '_data'=>'',
'src'=>DOKU_BASE.'lib/exe/js.php?edit='.$js_edit.'&write='.$js_write); 'src'=>DOKU_BASE.'lib/exe/js.php?edit='.$js_edit.'&write='.$js_write);
// make $INFO available to JavaScripts
require_once(DOKU_INC.'inc/JSON.php');
$json = new JSON();
$infocpy = $INFO;
$infocpy['userinfo']['pass'] = '';
$head['script'][] = array( 'type'=>'text/javascript', 'charset'=>'utf-8', '_data'=> 'var INFO = '.$json->encode($infocpy).';');
// trigger event here // trigger event here
trigger_event('TPL_METAHEADER_OUTPUT',$head,'_tpl_metaheaders_action',true); trigger_event('TPL_METAHEADER_OUTPUT',$head,'_tpl_metaheaders_action',true);
return true; return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment