Skip to content

Commit acf9797

Browse files
committed
Update class_event.php
1 parent 64acb27 commit acf9797

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

class_event.php

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function doDispatch($name, $arguments = "")
9696
return $arguments;
9797
}
9898

99-
// Set the current running event Listener to this
99+
// Set the current running event Listener
100100
self::$current_event = $name;
101101

102102
ksort(self::$events[$name]);
@@ -108,20 +108,28 @@ public function doDispatch($name, $arguments = "")
108108
foreach ( $actions AS $action )
109109
{
110110
// run Listener and store the value returned by registered functions
111-
$return_arguments = call_user_func_array($action['function'], array(&$arguments));
112-
113-
if ( $return_arguments )
111+
if ( function_exists($action['function']) )
114112
{
115-
$arguments = $return_arguments;
113+
114+
$return_arguments = call_user_func_array($action['function'], array(&$arguments));
115+
116+
if ( $return_arguments )
117+
{
118+
$arguments = $return_arguments;
119+
}
120+
121+
// Store called Listeners
122+
self::$happened_events[$name][$priority] = $action['function'];
123+
}
124+
else {
125+
126+
//die('Function ' . $action['function'] . ' not found');
116127
}
117-
118-
// Store called Listeners
119-
self::$happened_events[$name][$priority] = $action['function'];
120128
}
121129
}
122130
}
123131

124-
// No hook is running any more
132+
// This listener is finished its job
125133
self::$current_event = '';
126134

127135
return $arguments;
@@ -274,6 +282,7 @@ function isListening($name, $priority = 10)
274282
return EventDispatcher::instance()->isListening($name, $priority);
275283
}
276284

285+
277286
function nowListener()
278287
{
279288
return EventDispatcher::instance()->nowListener();

0 commit comments

Comments
 (0)