diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-01-08 02:46:09 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-01-08 02:46:09 +0000 |
commit | 58c8b3b0315405094c448da6486354250914ea6f (patch) | |
tree | 6613a4a6a03ddadc287a6c8cc4d78dc6240c5dd9 /core/helpers | |
parent | 8620c3fa01cb37506976a944f151d3058b587062 (diff) |
module::event now takes an unlimited number of args
added module::incr_var() ftw.
Diffstat (limited to 'core/helpers')
-rw-r--r-- | core/helpers/module.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/core/helpers/module.php b/core/helpers/module.php index 498bf865..9bce7a44 100644 --- a/core/helpers/module.php +++ b/core/helpers/module.php @@ -204,7 +204,9 @@ class module_Core { $class = "{$module->name}_event"; $function = str_replace(".", "_", $name); if (method_exists($class, $function)) { - call_user_func_array(array($class, $function), array(&$data)); + $args = func_get_args(); + array_shift($args); + call_user_func_array(array($class, $function), $args); } } } @@ -245,6 +247,19 @@ class module_Core { } /** + * Increment the value of a variable for this module + * @param string $module_name + * @param string $name + * @param string $increment (optional, default is 1) + */ + public function incr_var($module_name, $name, $increment=1) { + Database::instance()->query( + "UPDATE `vars` SET `value` = `value` + $increment " . + "WHERE `module_name` = '$module_name' " . + "AND `name` = '$name'"); + } + + /** * Remove a variable for this module. * @param string $module_name * @param string $name |