2 /***************************************************************************
3 * Copyright (C) 2003-2006 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 **************************************************************************/
25 * Hooks are used in modules to allow modules that depends upon us to hook
26 * themselves in our core functionnalities.
28 * Every module will use some hools, and define their names.
29 * Pretend « myhook » is one of those names, then :
30 * - hooks/myhook/API has to exists, and will explain the API of the hook
31 * - every module "mod" may have a file hooks/myhook/mod.inc.php that implements
32 * fully or partially the API of the hook.
34 * If the hook's API has to change, the functions that change MUST change their
35 * name to avoid any compatibility problem.
39 * @author Pierre Habouzit <pierre.habouzit@polytechnique.org>
41 * @link http://doc.polytechnique.org/XOrgModule/#hook
42 * @since Classe available since 0.9.3
49 * list of all the modules names that have implemented some reactions to our triggers
57 // {{{ constructor XOrgHook()
60 * Instanciates our Hook.
62 * @param string $name the name of the hook
68 foreach (glob($globals->spoolroot
."/hooks/*.inc.php") as $file) {
69 require_once("$file");
70 $this->_mods
[] = basename($file, '.inc.php');
75 // {{{ function subscribe
77 function subscribe($forlife, $uid, $promo, $pass)
79 foreach ($this->_mods
as $mod) {
80 if (!function_exists($mod.'_subscribe')) continue;
81 call_user_func($mod.'_subscribe', $forlife, $uid, $promo, $pass);
88 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker: