diff options
author | Andrew Dolgov <[email protected]> | 2021-02-26 15:33:59 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-02-26 15:33:59 +0300 |
commit | c01b6e43fd5236ab8fe504bf355184bf6dd4734b (patch) | |
tree | 35262e7b3f14f49831d42a611b963cb85f4da187 /classes | |
parent | bf9033beb6770688c05046e8999735205b439df8 (diff) |
add pluginhost->get_array() shorthand
Diffstat (limited to 'classes')
-rwxr-xr-x | classes/pluginhost.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/classes/pluginhost.php b/classes/pluginhost.php index b6f645a9c..348c67bab 100755 --- a/classes/pluginhost.php +++ b/classes/pluginhost.php @@ -514,6 +514,14 @@ class PluginHost { } } + function get_array(Plugin $sender, string $name, array $default_value = []) { + $tmp = $this->get($sender, $name); + + if (!is_array($tmp)) $tmp = $default_value; + + return $tmp; + } + function get_all($sender) { $idx = get_class($sender); |