diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-10 10:12:36 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-10 10:12:36 +0000 |
commit | 43e946d3a68e91627d9f788ee4bbe399f7bb5114 (patch) | |
tree | f8ca95ac659b5d225bbddadae84c8bf3eda50ed8 | |
parent | b0e8618319a0017eb569a2b6a73eaa198d6df8ca (diff) | |
download | elgg-43e946d3a68e91627d9f788ee4bbe399f7bb5114.tar.gz elgg-43e946d3a68e91627d9f788ee4bbe399f7bb5114.tar.bz2 |
Fixes #134: Using else between statements to ensure that they are only ever triggered once. Please confirm that there are no other issues attached.
git-svn-id: https://code.elgg.org/elgg/trunk@1387 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | engine/lib/elgglib.php | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 92fb03c88..404c818a9 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -1187,42 +1187,46 @@ */
function trigger_plugin_hook($hook, $entity_type, $params = null, $returnvalue = null) {
global $CONFIG;
-
+
//if (!isset($CONFIG->hooks) || !isset($CONFIG->hooks[$hook]) || !isset($CONFIG->hooks[$hook][$entity_type]))
// return $returnvalue;
if (!empty($CONFIG->hooks[$hook][$entity_type]) && is_array($CONFIG->hooks[$hook][$entity_type])) {
- foreach($CONFIG->hooks[$hook][$entity_type] as $hookfunction) {
+ foreach($CONFIG->hooks[$hook][$entity_type] as $hookfunction) { +
$temp_return_value = $hookfunction($hook, $entity_type, $returnvalue, $params);
if (!is_null($temp_return_value)) $returnvalue = $temp_return_value;
}
}
-
+ else
//if (!isset($CONFIG->hooks['all'][$entity_type]))
// return $returnvalue;
if (!empty($CONFIG->hooks['all'][$entity_type]) && is_array($CONFIG->hooks['all'][$entity_type])) {
- foreach($CONFIG->hooks['all'][$entity_type] as $hookfunction) {
+ foreach($CONFIG->hooks['all'][$entity_type] as $hookfunction) { +
$temp_return_value = $hookfunction($hook, $entity_type, $returnvalue, $params);
if (!is_null($temp_return_value)) $returnvalue = $temp_return_value;
}
}
-
+ else
//if (!isset($CONFIG->hooks[$hook]['all']))
// return $returnvalue;
if (!empty($CONFIG->hooks[$hook]['all']) && is_array($CONFIG->hooks[$hook]['all'])) {
- foreach($CONFIG->hooks[$hook]['all'] as $hookfunction) {
+ foreach($CONFIG->hooks[$hook]['all'] as $hookfunction) { +
$temp_return_value = $hookfunction($hook, $entity_type, $returnvalue, $params);
if (!is_null($temp_return_value)) $returnvalue = $temp_return_value;
}
}
-
+ else
//if (!isset($CONFIG->hooks['all']['all']))
// return $returnvalue;
if (!empty($CONFIG->hooks['all']['all']) && is_array($CONFIG->hooks['all']['all'])) {
- foreach($CONFIG->hooks['all']['all'] as $hookfunction) {
+ foreach($CONFIG->hooks['all']['all'] as $hookfunction) { +
$temp_return_value = $hookfunction($hook, $entity_type, $returnvalue, $params);
if (!is_null($temp_return_value)) $returnvalue = $temp_return_value;
}
|