1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- class EventsDispatcher
- {
-
- public static function events($event_name, $event_data = array())
- {
- global $event_config;
-
-
- foreach ($event_config[$event_name]["actions"] as $func) {
- $execute = true;
-
- if (!function_exists($func)) {
- error_log("EventsDispatcher warning : ".$func." does not exist.");
- $execute = false;
- }
-
- if (function_exists($event_name."_".$func."_filter_func")) {
- $filter = $event_name."_".$func."_filter_func";
-
-
- $execute = $filter($event_data);
- } else {
-
- error_log("EventsDispatcher warning : ".$event_name."_".$func."_filter_func does not exist.");
- }
- if (!$execute) {
-
- return false;
- }
-
-
-
- $func($event_name, $event_data);
- }
- }
- }
|