diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-04-19 19:51:24 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-04-19 19:51:24 +0000 |
commit | 78cd8cda097f6c6361090980f0664bbf939dafdd (patch) | |
tree | 14911c9dd00f71437a279989b018d74f73ab257e /includes | |
parent | 11666090206b84e97b0cd822ca1053aa9d7f53b3 (diff) | |
download | brdo-78cd8cda097f6c6361090980f0664bbf939dafdd.tar.gz brdo-78cd8cda097f6c6361090980f0664bbf939dafdd.tar.bz2 |
- Addition: added a new function "module_hook($module, $hook)" to check
wether a module implements a certain hook or not.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/module.inc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/includes/module.inc b/includes/module.inc index e7a513273..6c1ca1c51 100644 --- a/includes/module.inc +++ b/includes/module.inc @@ -1,5 +1,6 @@ <?php +// applies function $function to every known module: function module_iterate($function, $argument = "") { global $repository; foreach ($repository as $name=>$module) { @@ -7,11 +8,19 @@ function module_iterate($function, $argument = "") { } } +// executes hook $hook of module $module with optional arguments: function module_execute($module, $hook, $argument = "") { global $repository; return ($repository[$module][$hook]) ? $repository[$module][$hook]($argument) : ""; } +// returns true if module $module supports hook $hook, and false otherwise: +function module_hook($module, $hook) { + global $repository; + return $repository[$module][$hook]; +} + +// rehashes the crons: function module_rehash_crons($name, $module) { if ($module["cron"]) { if (!db_fetch_object(db_query("SELECT * FROM crons WHERE module = '$name'"))) { @@ -23,6 +32,7 @@ function module_rehash_crons($name, $module) { } } +// rehashes the blocks: function module_rehash_blocks($name, $module) { db_query("UPDATE blocks SET remove = '1' WHERE module = '$name'"); if ($module["block"] && $blocks = $module["block"]()) { @@ -38,6 +48,7 @@ function module_rehash_blocks($name, $module) { db_query("DELETE FROM blocks WHERE module = '$name' AND remove = '1'"); } +// rehashes a module: function module_rehash($name) { global $repository; |