From f2883477d14a300b5364f21fc95f5bc871a39d8d Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 23 May 2008 09:45:26 +0000 Subject: trigger_event now passes the actual event details on 'all' git-svn-id: https://code.elgg.org/elgg/trunk@689 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/elgglib.php | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'engine/lib') diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 57b8c71c8..c71d6fb6c 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -649,6 +649,27 @@ } } } + if (!empty($CONFIG->events['all'][$object_type]) && is_array($CONFIG->events[$event][$object_type])) { + foreach($CONFIG->events['all'][$object_type] as $eventfunction) { + if ($eventfunction($event, $object_type, $object) === false) { + return false; + } + } + } + if (!empty($CONFIG->events[$event]['all']) && is_array($CONFIG->events[$event][$object_type])) { + foreach($CONFIG->events[$event]['all'] as $eventfunction) { + if ($eventfunction($event, $object_type, $object) === false) { + return false; + } + } + } + if (!empty($CONFIG->events['all']['all']) && is_array($CONFIG->events[$event][$object_type])) { + foreach($CONFIG->events['all']['all'] as $eventfunction) { + if ($eventfunction($event, $object_type, $object) === false) { + return false; + } + } + } return true; } @@ -678,16 +699,9 @@ * @return true|false Depending on success */ function trigger_event($event, $object_type, $object = null) { - $return = true; $return1 = events($event, $object_type, "", null, true, $object); if (!is_null($return1)) $return = $return1; - $return2 = events('all', $object_type, "", null, true, $object); - if (!is_null($return2)) $return = $return2; - $return3 = events($event, 'all', "", null, true, $object); - if (!is_null($return3)) $return = $return3; - $return4 = events('all', 'all', "", null, true, $object); - if (!is_null($return4)) $return = $return4; return $return; } -- cgit v1.2.3