@@ -96,7 +96,7 @@ public function doDispatch($name, $arguments = "")
96
96
return $ arguments ;
97
97
}
98
98
99
- // Set the current running event Listener to this
99
+ // Set the current running event Listener
100
100
self ::$ current_event = $ name ;
101
101
102
102
ksort (self ::$ events [$ name ]);
@@ -108,20 +108,28 @@ public function doDispatch($name, $arguments = "")
108
108
foreach ( $ actions AS $ action )
109
109
{
110
110
// 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 ' ]) )
114
112
{
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');
116
127
}
117
-
118
- // Store called Listeners
119
- self ::$ happened_events [$ name ][$ priority ] = $ action ['function ' ];
120
128
}
121
129
}
122
130
}
123
131
124
- // No hook is running any more
132
+ // This listener is finished its job
125
133
self ::$ current_event = '' ;
126
134
127
135
return $ arguments ;
@@ -274,6 +282,7 @@ function isListening($name, $priority = 10)
274
282
return EventDispatcher::instance ()->isListening ($ name , $ priority );
275
283
}
276
284
285
+
277
286
function nowListener ()
278
287
{
279
288
return EventDispatcher::instance ()->nowListener ();
0 commit comments