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,
|
$this,
|
||||||
"addScripts",
|
"addScripts",
|
||||||
);
|
);
|
||||||
|
$controller->register_hook(
|
||||||
|
"DOKUWIKI_STARTED",
|
||||||
|
"AFTER",
|
||||||
|
$this,
|
||||||
|
"provideJsInfo",
|
||||||
|
);
|
||||||
$controller->register_hook(
|
$controller->register_hook(
|
||||||
"RENDERER_CONTENT_POSTPROCESS",
|
"RENDERER_CONTENT_POSTPROCESS",
|
||||||
"BEFORE",
|
"BEFORE",
|
||||||
@@ -132,8 +138,20 @@ class action_plugin_luxtools extends ActionPlugin
|
|||||||
"src" => $base . $script,
|
"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.
|
// Intentional: the key is exposed to the browser for direct OMDb lookups.
|
||||||
global $JSINFO;
|
global $JSINFO;
|
||||||
$JSINFO['luxtools_omdb_apikey'] = (string)$this->getConf('omdb_apikey');
|
$JSINFO['luxtools_omdb_apikey'] = (string)$this->getConf('omdb_apikey');
|
||||||
|
|||||||
Reference in New Issue
Block a user