aboutsummaryrefslogtreecommitdiffhomepage
path: root/application
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-09-12 21:41:24 +0200
committerGitHub <noreply@github.com>2020-09-12 21:41:24 +0200
commit4af591ff3c5db4dea5b6c437527f6f9b12917570 (patch)
tree924ab153d4ae4609e0c073775874f9f11d84d0dc /application
parente809908f9e593b2cec11f72849caa1dae6394451 (diff)
parent4ff703e3691e6cb398e8d208c1f54ed61315e0e8 (diff)
downloadShaarli-4af591ff3c5db4dea5b6c437527f6f9b12917570.tar.gz
Shaarli-4af591ff3c5db4dea5b6c437527f6f9b12917570.tar.zst
Shaarli-4af591ff3c5db4dea5b6c437527f6f9b12917570.zip
Merge pull request #1551 from ArthurHoaro/fix/plugin-save-metadata
Plugins: do not save metadata along plugin parameters
Diffstat (limited to 'application')
-rw-r--r--application/front/controller/admin/PluginsController.php1
-rw-r--r--application/plugin/PluginManager.php29
2 files changed, 16 insertions, 14 deletions
diff --git a/application/front/controller/admin/PluginsController.php b/application/front/controller/admin/PluginsController.php
index 0e09116e..8e059681 100644
--- a/application/front/controller/admin/PluginsController.php
+++ b/application/front/controller/admin/PluginsController.php
@@ -62,6 +62,7 @@ class PluginsController extends ShaarliAdminController
62 62
63 if (isset($parameters['parameters_form'])) { 63 if (isset($parameters['parameters_form'])) {
64 unset($parameters['parameters_form']); 64 unset($parameters['parameters_form']);
65 unset($parameters['token']);
65 foreach ($parameters as $param => $value) { 66 foreach ($parameters as $param => $value) {
66 $this->container->conf->set('plugins.'. $param, escape($value)); 67 $this->container->conf->set('plugins.'. $param, escape($value));
67 } 68 }
diff --git a/application/plugin/PluginManager.php b/application/plugin/PluginManager.php
index 7881e3be..1b2197c9 100644
--- a/application/plugin/PluginManager.php
+++ b/application/plugin/PluginManager.php
@@ -100,20 +100,17 @@ class PluginManager
100 */ 100 */
101 public function executeHooks($hook, &$data, $params = array()) 101 public function executeHooks($hook, &$data, $params = array())
102 { 102 {
103 if (!empty($params['target'])) { 103 $metadataParameters = [
104 $data['_PAGE_'] = $params['target']; 104 'target' => '_PAGE_',
105 } 105 'loggedin' => '_LOGGEDIN_',
106 106 'basePath' => '_BASE_PATH_',
107 if (isset($params['loggedin'])) { 107 'bookmarkService' => '_BOOKMARK_SERVICE_',
108 $data['_LOGGEDIN_'] = $params['loggedin']; 108 ];
109 } 109
110 110 foreach ($metadataParameters as $parameter => $metaKey) {
111 if (isset($params['basePath'])) { 111 if (array_key_exists($parameter, $params)) {
112 $data['_BASE_PATH_'] = $params['basePath']; 112 $data[$metaKey] = $params[$parameter];
113 } 113 }
114
115 if (isset($params['bookmarkService'])) {
116 $data['_BOOKMARK_SERVICE_'] = $params['bookmarkService'];
117 } 114 }
118 115
119 foreach ($this->loadedPlugins as $plugin) { 116 foreach ($this->loadedPlugins as $plugin) {
@@ -128,6 +125,10 @@ class PluginManager
128 } 125 }
129 } 126 }
130 } 127 }
128
129 foreach ($metadataParameters as $metaKey) {
130 unset($data[$metaKey]);
131 }
131 } 132 }
132 133
133 /** 134 /**