summaryrefslogtreecommitdiff
path: root/classes/pluginhost.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-03-07 15:21:31 +0300
committerAndrew Dolgov <[email protected]>2021-03-07 15:21:31 +0300
commitf4d0e7bb6d080b8dc25090b1aa7b21be70c6ec22 (patch)
treecd4c65c81d84141f81bf2bb1178bd27834ec6429 /classes/pluginhost.php
parent72c04123d4bc4a585b96ff3db07fbc84c70fadbb (diff)
* af_redditimgur: optionally import score
* add pluginhost->set_array() to set many plugin settings at once
Diffstat (limited to 'classes/pluginhost.php')
-rwxr-xr-xclasses/pluginhost.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/classes/pluginhost.php b/classes/pluginhost.php
index 366e2b2d3..17d1e0c5f 100755
--- a/classes/pluginhost.php
+++ b/classes/pluginhost.php
@@ -469,7 +469,7 @@ class PluginHost {
}
}
- function set(Plugin $sender, string $name, $value, bool $sync = true) {
+ function set(Plugin $sender, string $name, $value) {
$idx = get_class($sender);
if (!isset($this->storage[$idx]))
@@ -477,7 +477,19 @@ class PluginHost {
$this->storage[$idx][$name] = $value;
- if ($sync) $this->save_data(get_class($sender));
+ $this->save_data(get_class($sender));
+ }
+
+ function set_array(Plugin $sender, array $params) {
+ $idx = get_class($sender);
+
+ if (!isset($this->storage[$idx]))
+ $this->storage[$idx] = array();
+
+ foreach ($params as $name => $value)
+ $this->storage[$idx][$name] = $value;
+
+ $this->save_data(get_class($sender));
}
function get(Plugin $sender, string $name, $default_value = false) {