diff options
author | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-03-28 17:20:20 +0000 |
---|---|---|
committer | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-03-28 17:20:20 +0000 |
commit | ad71c8f3e60cddbcdaaf21d15f5b8f3cca4cec15 (patch) | |
tree | a260a4e28f49fc7db570f5be01a8395d74301f26 /engine/lib | |
parent | 9f97c6ca92329489509f86900e735a00bde4e56a (diff) | |
download | elgg-ad71c8f3e60cddbcdaaf21d15f5b8f3cca4cec15.tar.gz elgg-ad71c8f3e60cddbcdaaf21d15f5b8f3cca4cec15.tar.bz2 |
Fix for trigger_plugin_hook
git-svn-id: https://code.elgg.org/elgg/trunk@283 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/elgglib.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 2691eb9bd..6a15f2e9a 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -712,18 +712,36 @@ 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) {
$temp_return_value = $hookfunction($hook, $entity_type, $returnvalue, $params);
if (!is_null($temp_return_value)) $returnvalue = $temp_return_value;
}
}
+
+ 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) {
$temp_return_value = $hookfunction('all', $entity_type, $returnvalue, $params);
if (!is_null($temp_return_value)) $returnvalue = $temp_return_value;
}
}
+
+ 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) {
+ $temp_return_value = $hookfunction($hook, 'all', $returnvalue, $params);
+ if (!is_null($temp_return_value)) $returnvalue = $temp_return_value;
+ }
+ }
+
return $returnvalue;
}
|