6 ** This file provides the framework for a plugin architecture.
8 ** Plugins will eventually be a way to provide added functionality
9 ** without having to patch the SquirrelMail source code. Have some
10 ** patience, though, as the these funtions might change in the near
13 ** Documentation on how to write plugins might show up some time.
20 // This function adds a plugin
21 function use_plugin ($name) {
22 if (file_exists('../plugins/'.$name.'/setup.php')) {
23 include ('../plugins/'.$name.'/setup.php');
24 $function = 'squirrelmail_plugin_init_'.$name;
25 if (function_exists($function))
30 // This function executes a hook
31 function do_hook ($name) {
32 global $squirrelmail_plugin_hooks;
33 $Data = func_get_args();
34 if (is_array($squirrelmail_plugin_hooks[$name])) {
35 foreach ($squirrelmail_plugin_hooks[$name] as $id => $function) {
36 // Add something to set correct gettext domain for plugin
37 if (function_exists($function)) {
43 // Variable-length argument lists have a slight problem when
44 // passing values by reference. Pity. This is a workaround.
48 // On startup, register all plugins configured for use
49 if (is_array($plugins))
50 foreach ($plugins as $id => $name)