diff options
author | Steve Clay <steve@mrclay.org> | 2012-09-17 17:41:15 -0400 |
---|---|---|
committer | Steve Clay <steve@mrclay.org> | 2012-11-14 21:09:42 -0500 |
commit | 3048db0f3f1ade31d6f3a2cdd3268e978a3e3cf3 (patch) | |
tree | 1c21fd8f55bebeeedf4790aaa0e5e2f76e3a93eb /engine/lib/elgglib.php | |
parent | 7c6e3578ca8ab3e703852629e82b478265833d29 (diff) | |
download | elgg-3048db0f3f1ade31d6f3a2cdd3268e978a3e3cf3.tar.gz elgg-3048db0f3f1ade31d6f3a2cdd3268e978a3e3cf3.tar.bz2 |
Fixes #4861: allow lazy-loading for static method callbacks, allow more callables
Diffstat (limited to 'engine/lib/elgglib.php')
-rw-r--r-- | engine/lib/elgglib.php | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 26c1cccfd..85610f0c2 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -684,7 +684,7 @@ function elgg_register_event_handler($event, $object_type, $callback, $priority $CONFIG->events[$event][$object_type] = array(); } - if (!is_callable($callback)) { + if (!is_callable($callback, true)) { return FALSE; } @@ -770,7 +770,7 @@ function elgg_trigger_event($event, $object_type, $object = null) { foreach ($events as $callback_list) { if (is_array($callback_list)) { foreach ($callback_list as $callback) { - if (call_user_func_array($callback, $args) === FALSE) { + if (is_callable($callback) && (call_user_func_array($callback, $args) === FALSE)) { return FALSE; } } @@ -863,7 +863,7 @@ function elgg_register_plugin_hook_handler($hook, $type, $callback, $priority = $CONFIG->hooks[$hook][$type] = array(); } - if (!is_callable($callback)) { + if (!is_callable($callback, true)) { return FALSE; } @@ -970,10 +970,12 @@ function elgg_trigger_plugin_hook($hook, $type, $params = null, $returnvalue = n foreach ($hooks as $callback_list) { if (is_array($callback_list)) { foreach ($callback_list as $hookcallback) { - $args = array($hook, $type, $returnvalue, $params); - $temp_return_value = call_user_func_array($hookcallback, $args); - if (!is_null($temp_return_value)) { - $returnvalue = $temp_return_value; + if (is_callable($hookcallback)) { + $args = array($hook, $type, $returnvalue, $params); + $temp_return_value = call_user_func_array($hookcallback, $args); + if (!is_null($temp_return_value)) { + $returnvalue = $temp_return_value; + } } } } |