Fix API key passing
This commit is contained in:
20
action.php
20
action.php
@@ -33,6 +33,12 @@ class action_plugin_luxtools extends ActionPlugin
|
||||
$this,
|
||||
"addScripts",
|
||||
);
|
||||
$controller->register_hook(
|
||||
"DOKUWIKI_STARTED",
|
||||
"AFTER",
|
||||
$this,
|
||||
"provideJsInfo",
|
||||
);
|
||||
$controller->register_hook(
|
||||
"RENDERER_CONTENT_POSTPROCESS",
|
||||
"BEFORE",
|
||||
@@ -132,8 +138,20 @@ class action_plugin_luxtools extends ActionPlugin
|
||||
"src" => $base . $script,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Pass OMDb API key to client-side JavaScript.
|
||||
/**
|
||||
* Pass plugin data to client-side JavaScript via JSINFO.
|
||||
*
|
||||
* Must run before TPL_METAHEADER_OUTPUT because JSINFO is serialized
|
||||
* during tpl_metaheaders() before that event fires.
|
||||
*
|
||||
* @param Event $event
|
||||
* @param mixed $param
|
||||
* @return void
|
||||
*/
|
||||
public function provideJsInfo(Event $event, $param)
|
||||
{
|
||||
// Intentional: the key is exposed to the browser for direct OMDb lookups.
|
||||
global $JSINFO;
|
||||
$JSINFO['luxtools_omdb_apikey'] = (string)$this->getConf('omdb_apikey');
|
||||
|
||||
Reference in New Issue
Block a user