diff options
author | Marcos SF Filho <sffmarcos142009z@gmail.com> | 2014-01-08 12:48:09 +0100 |
---|---|---|
committer | Marcos SF Filho <sffmarcos142009z@gmail.com> | 2014-01-08 12:48:09 +0100 |
commit | bdfef073585d5267f2d568be6de3ffcde773e13b (patch) | |
tree | eb78f02d7945e036e219b90673374f937fe8555b /system/core/Hooks.php | |
parent | 0f667c9d1c23fae0966c7da24b193d1728bf8b54 (diff) |
Update the CI_Hooks class
Diffstat (limited to 'system/core/Hooks.php')
-rw-r--r-- | system/core/Hooks.php | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/system/core/Hooks.php b/system/core/Hooks.php index aa62e680b..9bcc23a65 100644 --- a/system/core/Hooks.php +++ b/system/core/Hooks.php @@ -58,7 +58,7 @@ class CI_Hooks { * * @var array */ - public $class = array(); + protected $_objects = array(); /** * In progress flag @@ -203,31 +203,29 @@ class CI_Hooks { if ($class !== FALSE) { // The object is stored? - if (isset($this->class[$class]) && method_exists($this->class[$class], $function)) + if (isset($this->_objects[$class])) { - $this->class[$class]->$function($params); + if (method_exists($this->_objects[$class], $function)) + { + $this->_objects[$class]->$function($params); + } + else + { + return $this->_in_progress = FALSE; + } } else - { + { class_exists($class, FALSE) OR require_once($filepath); if ( ! class_exists($class, FALSE) OR ! method_exists($class, $function)) { return $this->_in_progress = FALSE; } - - // If the developer wants the object to be stored - if (isset($data['store_object']) && $data['store_object'] === TRUE) - { - $this->class[$class] = new $class(); - $HOOK =& $this->class[$class]; - } - else - { - $HOOK = new $class(); - } - - $HOOK->$function($params); + + // Store the object and execute the method + $this->_objects[$class] = new $class(); + $this->_objects[$class]->$function($params); } } else @@ -249,4 +247,4 @@ class CI_Hooks { } /* End of file Hooks.php */ -/* Location: ./system/core/Hooks.php */ +/* Location: ./system/core/Hooks.php */
\ No newline at end of file |