summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-03-03 18:57:16 +0000
committerTim Almdal <tnalmdal@shaw.ca>2009-03-03 18:57:16 +0000
commitacf28e47cb7336b3f6878fb0df9d1a5c1dacd489 (patch)
treeb90c40ec2559932c6214213fa904fab19c97f090
parent9b68fd46b224cb26e592fc977b0019b01bee3d23 (diff)
Create a proxy event (gallery_event) which is called when the request
is completing.
-rw-r--r--core/helpers/module.php25
-rw-r--r--core/hooks/init_gallery.php1
2 files changed, 12 insertions, 14 deletions
diff --git a/core/helpers/module.php b/core/helpers/module.php
index 49f0fdea..0d43c248 100644
--- a/core/helpers/module.php
+++ b/core/helpers/module.php
@@ -165,27 +165,13 @@ class module_Core {
}
try {
- $hooks = array();
foreach ($modules as $module) {
self::$module_names[$module->name] = $module->name;
self::$modules[$module->name] = $module;
$kohana_modules[] = MODPATH . $module->name;
- $module_path = MODPATH . $module->name;
- $kohana_modules[] = $module_path;
- if (file_exists("$module_path/hooks") &&
- ($hook_files = glob("$module_path/hooks/*.php")) !== false) {
- $hooks = array_merge($hooks, $hook_files);
- }
}
Kohana::config_set("core.modules", $kohana_modules);
- /*
- * Kohana loads the hooks before all the installed module paths are defined, so lets call
- * any module hooks now
- */
- foreach($hooks as $hook) {
- include($hook);
- }
} catch (Exception $e) {
self::$module_names = array();
self::$modules = array();
@@ -213,6 +199,17 @@ class module_Core {
}
/**
+ * Kohana shutdown event handler
+ * @param string $module_name
+ * @param string $name
+ * @param string $default_value
+ * @return the value
+ */
+ static function shutdown() {
+ self::event("gallery_shutdown");
+ }
+
+ /**
* Get a variable from this module
* @param string $module_name
* @param string $name
diff --git a/core/hooks/init_gallery.php b/core/hooks/init_gallery.php
index 89f97ef9..014c29ea 100644
--- a/core/hooks/init_gallery.php
+++ b/core/hooks/init_gallery.php
@@ -21,6 +21,7 @@ Event::add("system.ready", array("I18n", "instance"));
Event::add("system.post_routing", array("theme", "load_themes"));
Event::add("system.ready", array("module", "load_modules"));
Event::add("system.post_routing", array("url", "parse_url"));
+Event::add("system.shutdown", array("module", "shutdown"));
// Override the cookie if we have a session id in the URL.
// @todo This should probably be an event callback