diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-09-29 08:50:53 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-09-29 08:50:53 -0700 |
commit | 89a67dba63f8ac61b90e4c4f1ba1b0cdbdf20b26 (patch) | |
tree | ed84babb850c47dd4bbbb07e802aa5d2d68f1f77 /modules/gallery/helpers/module.php | |
parent | dd5471b8600a9a6efbfbfab81972db59e512493a (diff) |
* Remove the @todo in module event and always try to call gallery_event::$function first
* Refactor gallery.php to move site_menu, admin_menu, and context_menu to gallery_event.php
* Change Theme_View and Admin_view to call module::event("site_menu|admin_menu|context_menu"...)
Diffstat (limited to 'modules/gallery/helpers/module.php')
-rw-r--r-- | modules/gallery/helpers/module.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php index a3088c38..ae8bcc11 100644 --- a/modules/gallery/helpers/module.php +++ b/modules/gallery/helpers/module.php @@ -283,9 +283,28 @@ class module_Core { array_shift($args); $function = str_replace(".", "_", $name); + if (method_exists("gallery_event", $function)) { + switch (count($args)) { + case 0: + gallery_event::$function(); + break; + case 1: + gallery_event::$function($args[0]); + break; + case 2: + gallery_event::$function($args[0], $args[1]); + break; + default: + call_user_func_array(array("gallery_event", $function), $args); + } + } + // @todo: consider calling gallery_event first, since for things menus we need it to do some // setup foreach (self::$active as $module) { + if ($module->name == "gallery") { + continue; + } $class = "{$module->name}_event"; if (method_exists($class, $function)) { call_user_func_array(array($class, $function), $args); |