X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fplugin.php;h=2d9083fbed8fdd89f7cb220df1e1cc033b391580;hb=d8a8203ae65c8a1a1ff4740bee41053f565a0a15;hp=9ef6d7f5e5c5994b9a5c0166be3df4bfc43b2897;hpb=2586d588585b8f4a346b38dc3d42567e15fb6cc2;p=squirrelmail.git diff --git a/functions/plugin.php b/functions/plugin.php index 9ef6d7f5..2d9083fb 100644 --- a/functions/plugin.php +++ b/functions/plugin.php @@ -28,7 +28,7 @@ function use_plugin ($name) { } /* This function executes a hook. */ -function do_hook ($name,$parm=NULL) { +function do_hook ($name) { global $squirrelmail_plugin_hooks; $data = func_get_args(); $ret = ''; @@ -38,7 +38,27 @@ function do_hook ($name,$parm=NULL) { foreach ($squirrelmail_plugin_hooks[$name] as $function) { /* Add something to set correct gettext domain for plugin. */ if (function_exists($function)) { - $ret = $function($data,$parm); + $function($data); + } + } + } + + /* Variable-length argument lists have a slight problem when */ + /* passing values by reference. Pity. This is a workaround. */ + return $data; +} + +/* This function executes a hook. */ +function do_hook_function($name,$parm=NULL) { + global $squirrelmail_plugin_hooks; + $ret = ''; + + if (isset($squirrelmail_plugin_hooks[$name]) + && is_array($squirrelmail_plugin_hooks[$name])) { + foreach ($squirrelmail_plugin_hooks[$name] as $function) { + /* Add something to set correct gettext domain for plugin. */ + if (function_exists($function)) { + $ret = $function($parm); } } } @@ -48,6 +68,7 @@ function do_hook ($name,$parm=NULL) { return $ret; } + /*************************************/ /*** MAIN PLUGIN LOADING CODE HERE ***/ /*************************************/