summaryrefslogtreecommitdiff
path: root/includes/module.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2002-08-14 17:59:43 +0000
committerDries Buytaert <dries@buytaert.net>2002-08-14 17:59:43 +0000
commit343437e75050c84dcaf6f980dac8c35203344bb1 (patch)
tree35a6bee87469d05691e19c24d126451c9a851336 /includes/module.inc
parentcc0980ec6b51713c654451a86b2608449af86cc9 (diff)
downloadbrdo-343437e75050c84dcaf6f980dac8c35203344bb1.tar.gz
brdo-343437e75050c84dcaf6f980dac8c35203344bb1.tar.bz2
- "module_invoke()" and "module_invoke_all()" can now be called with any
number of arguments. Patch by Gerhard.
Diffstat (limited to 'includes/module.inc')
-rw-r--r--includes/module.inc16
1 files changed, 10 insertions, 6 deletions
diff --git a/includes/module.inc b/includes/module.inc
index b5453b800..0f75ed3c8 100644
--- a/includes/module.inc
+++ b/includes/module.inc
@@ -15,19 +15,23 @@ function module_iterate($function, $argument = "") {
}
// invoke hook $hook of module $name with optional arguments:
-function module_invoke($name, $hook, $a1 = NULL, $a2 = NULL, $a3 = NULL, $a4 = NULL) {
- $function = $name ."_". $hook;
+function module_invoke(){
+ $args = func_get_args();
+ $function = array_shift($args);
+ $function .= "_". array_shift($args);
+
if (function_exists($function)) {
- return $function($a1, $a2, $a3, $a4);
+ return $function(implode(",", $args));
}
}
// invoke $hook for all appropriate modules:
-function module_invoke_all($hook, $a1 = NULL, $a2 = NULL, $a3 = NULL, $a4 = NULL) {
+function module_invoke_all() {
$return = array();
+ $args = func_get_args();
foreach (module_list() as $name) {
- if (module_hook($name, $hook)) {
- if ($result = module_invoke($name, $hook, $a1, $a2, $a3, $a4)) {
+ if (module_hook($name, $args[0])) {
+ if ($result = module_invoke($name, implode(",", $args))) {
$return = array_merge($return, $result);
}
}