diff --git a/.gitattributes b/.gitattributes index 8745b4a2..c6d75d73 100644 --- a/.gitattributes +++ b/.gitattributes @@ -309,7 +309,6 @@ bureau/class/config_real.php -text bureau/class/db_mysql.php -text bureau/class/export_account.php -text bureau/class/functions.php -text -bureau/class/hooks.php -text bureau/class/lang_env.php -text bureau/class/local.php -text bureau/class/m_admin.php -text @@ -318,6 +317,7 @@ bureau/class/m_bro.php -text bureau/class/m_dom.php -text bureau/class/m_err.php -text bureau/class/m_ftp.php -text +bureau/class/m_hooks.php -text bureau/class/m_hta.php -text bureau/class/m_mail.php -text bureau/class/m_mem.php -text diff --git a/bureau/class/hooks.php b/bureau/class/hooks.php deleted file mode 100644 index a2e7eba3..00000000 --- a/bureau/class/hooks.php +++ /dev/null @@ -1,96 +0,0 @@ -load_hooks(); - return $this->run_hook($name,$data); - } - /* - * charge l'ensemble des hooks disponibles - * pas de gestion de cache, on charge tout à l'invocation - */ - private function load_hooks() { - $numargs = func_num_args(); - if ($numargs <> 0) - return false; - $args = func_get_args(); - if (!is_dir($this->dir_hook)) - return false; - foreach(scandir($this->dir_hook) as $file) { - if ($file === '.' || $file === '..') - continue; - $this->plugins[] = basename($file,'.php'); - include($this->dir_hook.$file); - - } - } - - /* - * charge l'ensemble des fonctions disponible pour un hook donné - */ - private function run_hook() { - $output = ''; - $numargs = func_num_args(); - if ($numargs <> 2) - return false; - $args = func_get_args(); - $hook = $args[0]; - foreach($this->plugins as $plugin) { - if (function_exists($plugin."_".$hook)) - $output .= call_user_func_array($plugin."_".$hook,array($args[1])); - } - return $output; - } -} /* Class hooks */ - -?> diff --git a/bureau/class/m_hooks.php b/bureau/class/m_hooks.php new file mode 100644 index 00000000..84648a2c --- /dev/null +++ b/bureau/class/m_hooks.php @@ -0,0 +1,69 @@ +