Plugins: do not save metadata along plugin parameters

Also prevent the token to be saved.

Fixes 
This commit is contained in:
ArthurHoaro 2020-09-10 14:08:19 +02:00
parent e2dff28b44
commit 4ff703e369
5 changed files with 50 additions and 30 deletions
application/plugin

View file

@ -100,20 +100,17 @@ class PluginManager
*/
public function executeHooks($hook, &$data, $params = array())
{
if (!empty($params['target'])) {
$data['_PAGE_'] = $params['target'];
}
$metadataParameters = [
'target' => '_PAGE_',
'loggedin' => '_LOGGEDIN_',
'basePath' => '_BASE_PATH_',
'bookmarkService' => '_BOOKMARK_SERVICE_',
];
if (isset($params['loggedin'])) {
$data['_LOGGEDIN_'] = $params['loggedin'];
}
if (isset($params['basePath'])) {
$data['_BASE_PATH_'] = $params['basePath'];
}
if (isset($params['bookmarkService'])) {
$data['_BOOKMARK_SERVICE_'] = $params['bookmarkService'];
foreach ($metadataParameters as $parameter => $metaKey) {
if (array_key_exists($parameter, $params)) {
$data[$metaKey] = $params[$parameter];
}
}
foreach ($this->loadedPlugins as $plugin) {
@ -128,6 +125,10 @@ class PluginManager
}
}
}
foreach ($metadataParameters as $metaKey) {
unset($data[$metaKey]);
}
}
/**