aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-11 10:12:38 +0000
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-11 10:12:38 +0000
commitb95f23779af7f11a622a0e978c4a5a0917b8c76e (patch)
treea8c2baafcec05e143ec064fcf56d46aaab9d4e67 /engine
parentf05dc168b5a70eff8453d2736b1b8265d7fd00de (diff)
downloadelgg-b95f23779af7f11a622a0e978c4a5a0917b8c76e.tar.gz
elgg-b95f23779af7f11a622a0e978c4a5a0917b8c76e.tar.bz2
Obliterated C&P in elgg_trigger_plugin_hook
git-svn-id: http://code.elgg.org/elgg/trunk@7298 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/elgglib.php49
1 files changed, 14 insertions, 35 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 63d2e046a..d369f0fdc 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -1028,42 +1028,21 @@ function unregister_plugin_hook($hook, $entity_type, $callback) {
function elgg_trigger_plugin_hook($hook, $type, $params = null, $returnvalue = null) {
global $CONFIG;
- if (!empty($CONFIG->hooks[$hook][$type]) && is_array($CONFIG->hooks[$hook][$type])) {
- foreach ($CONFIG->hooks[$hook][$type] as $hookcallback) {
- $temp_return_value = call_user_func_array($hookcallback,
- array($hook, $type, $returnvalue, $params));
- if (!is_null($temp_return_value)) {
- $returnvalue = $temp_return_value;
- }
- }
- }
-
- if (!empty($CONFIG->hooks['all'][$type]) && is_array($CONFIG->hooks['all'][$type])) {
- foreach ($CONFIG->hooks['all'][$type] as $hookcallback) {
- $temp_return_value = call_user_func_array($hookcallback,
- array($hook, $type, $returnvalue, $params));
- if (!is_null($temp_return_value)) {
- $returnvalue = $temp_return_value;
- }
- }
- }
-
- if (!empty($CONFIG->hooks[$hook]['all']) && is_array($CONFIG->hooks[$hook]['all'])) {
- foreach ($CONFIG->hooks[$hook]['all'] as $hookcallback) {
- $temp_return_value = call_user_func_array($hookcallback,
- array($hook, $type, $returnvalue, $params));
- if (!is_null($temp_return_value)) {
- $returnvalue = $temp_return_value;
- }
- }
- }
+ $hooks = array(
+ $CONFIG->hooks[$hook][$type],
+ $CONFIG->hooks['all'][$type],
+ $CONFIG->hooks[$hook]['all'],
+ $CONFIG->hooks['all']['all'],
+ );
- if (!empty($CONFIG->hooks['all']['all']) && is_array($CONFIG->hooks['all']['all'])) {
- foreach ($CONFIG->hooks['all']['all'] as $hookcallback) {
- $temp_return_value = call_user_func_array($hookcallback,
- array($hook, $type, $returnvalue, $params));
- if (!is_null($temp_return_value)) {
- $returnvalue = $temp_return_value;
+ 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;
+ }
}
}
}