3 * FusionForge plugin system
5 * Copyright 2002, Roland Mas
7 * This file is part of FusionForge.
9 * FusionForge is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published
11 * by the Free Software Foundation; either version 2 of the License,
12 * or (at your option) any later version.
14 * FusionForge is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with FusionForge; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
25 class Plugin extends Error {
30 * Plugin() - constructor
36 $this->hooks = array () ;
40 * GetHooks() - get list of hooks to subscribe to
42 * @return List of strings
44 function GetHooks () {
49 * GetName() - get plugin name
51 * @return the plugin name
58 * GetInstallDir() - get installation dir for the plugin
60 * @return the directory where the plugin should be linked.
62 function GetInstallDir () {
63 if (isset($this->installdir) && $this->installdir)
64 return $this->installdir;
66 return 'plugins/'.$this->name ;
70 * CallHook() - call a particular hook
72 * @param hookname - the "handle" of the hook
73 * @param params - array of parameters to pass the hook
75 function CallHook ($hookname, $params) {
80 * getGroups - get a list of all groups using a plugin
82 * @return array array containing group ids
84 function getGroups() {
86 $res = db_query_params ('SELECT group_plugin.group_id
87 FROM group_plugin, plugins
88 WHERE group_plugin.plugin_id=plugins.plugin_id
89 AND plugins.plugin_name=$1
90 ORDER BY group_plugin.group_id ASC',
92 $rows = db_numrows($res);
94 for ($i=0; $i<$rows; $i++) {
95 $group_id = db_result($res,$i,'group_id');
96 $result[] = group_get_object ($group_id) ;
105 // c-file-style: "bsd"