From b1c513b35f26be135b7a1ce673e4979e3951a557 Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Sat, 20 Nov 2004 22:32:01 +0000 Subject: [PATCH] hook class --- include/xorg.hook.inc.php | 72 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 include/xorg.hook.inc.php diff --git a/include/xorg.hook.inc.php b/include/xorg.hook.inc.php new file mode 100644 index 0000000..612cb3c --- /dev/null +++ b/include/xorg.hook.inc.php @@ -0,0 +1,72 @@ +PEAR(); + + if (!file_exists($globals->root."/hooks/$name/API")) { + $this->raiseError("The hook $name do not exists, or is undocumented",1,PEAR_ERROR_DIE); + } + foreach (glob($globals->root."/hooks/$name/*.inc.php") as $file) { + require_once("$file"); + $this->_mods[] = str_replace('.inc.php', '', $file); + } + } + + function __call($function, $arguments, &$return) + { + foreach ($this->_mods as $mod) { + if (!function_exists($mod.'_'.$function)) continue; + call_user_func_array($mod.'_'.$function,$argument); + } + + return ($return=true); + } +} + +overload('XOrgHook'); + +?> -- 2.1.4