Browse Source

Allowing event_types to be sent without filter (if filter does not exist) - refs #984

Yannick Warnier 12 years ago
parent
commit
da684f0970
1 changed files with 4 additions and 2 deletions
  1. 4 2
      main/inc/lib/events_dispatcher.class.php

+ 4 - 2
main/inc/lib/events_dispatcher.class.php

@@ -18,15 +18,17 @@ class EventsDispatcher
         // and execute every actions with the values
         
         foreach ($event_config[$event_name]["actions"] as $func) {
+            $execute = true;
             if (!function_exists($func)) // if the function doesn't exist, we log
             {
                 error_log("EventsDispatcher warning : ".$func." does not exist.");
+                $execute = false;
             }
             
             if (function_exists($event_name."_".$func."_filter_func")) // check if the event's got a filter
             {
                 $filter = $event_name."_".$func."_filter_func";
-                $execute = $filter($event_data); // if it does, we execute the filter
+                $event_data = $filter($event_data); // if it does, we execute the filter
             }
             else // if there's no filter
             {
@@ -41,4 +43,4 @@ class EventsDispatcher
             $func($event_name, $event_data);
         }
     }
-}
+}