From 80a8e6d9b2e1ed1e46323512f6837b090335bd46 Mon Sep 17 00:00:00 2001 From: Sam Mousa Date: Fri, 25 Oct 2013 12:42:25 +0200 Subject: [PATCH] Dev Used Hash helper in PluginEvent for more reliable parameter merging. --- .../libraries/PluginManager/PluginEvent.php | 53 ++----------------- 1 file changed, 5 insertions(+), 48 deletions(-) diff --git a/application/libraries/PluginManager/PluginEvent.php b/application/libraries/PluginManager/PluginEvent.php index 48d6b7221b7..91fa22d3610 100644 --- a/application/libraries/PluginManager/PluginEvent.php +++ b/application/libraries/PluginManager/PluginEvent.php @@ -1,4 +1,7 @@ _parameters; - - // Retrieve using dot notation. - while (count($keys) > 1) - { - $first = array_shift($keys); - if (isset($array[$first])) - { - $array = $array[$first]; - } - else - { - return $default; - } - } - - if (isset($array[$keys[0]])) - { - return $array[$keys[0]]; - } - else - { - return $default; - } - } - else - { - return $this->_parameters; - } + return Hash::get($this->_parameters, $key); } /** @@ -188,22 +160,7 @@ public function isStopped() */ public function set($key, $value) { - // Split by . to allow for arrays using dotnotation. - $keys = explode('.', $key); - while (count($keys) > 0) - { - $key = array_pop($keys); - if ($key == '') - { - $value = array($value); - } - else - { - $value = array($key => $value); - } - - } - $this->_parameters = array_merge_recursive($this->_parameters, $value); + $this->_parameters = Hash::insert($this->_parameters, $key, $value); return $this; }