- * @param string name the name of the hook
- * @param mixed param the parameters to pass to the hook function
- * @return mixed the possibly modified hook parameters
- */
-function filter_hook_function($name,$parm=NULL) {
- global $squirrelmail_plugin_hooks, $currentHookName;
- $currentHookName = $name;
-
- if (isset($squirrelmail_plugin_hooks[$name])
- && is_array($squirrelmail_plugin_hooks[$name])) {
- foreach ($squirrelmail_plugin_hooks[$name] as $plugin_name => $function) {
- use_plugin($plugin_name);
- /* Add something to set correct gettext domain for plugin. */
- if (function_exists($function)) {
- $parm = $function($parm);
- }
- }
- }
-
- $currentHookName = '';
-
- /* Variable-length argument lists have a slight problem when */
- /* passing values by reference. Pity. This is a workaround. */
- return $parm;
-}
-
-/**
- * This function executes a hook and allows for parameters to be passed.
+ * It includes an arbitrary return value that is managed by
+ * all plugins on the same hook and returned to the core hook
+ * location.
+ *
+ * The desired format of the return value should be defined
+ * by the context in which the hook is called.
+ *
+ * Note that the master return value for this hook is passed
+ * to each plugin after the main argument(s) value/array as a
+ * convenience only - to show what the current return value is
+ * even though it is liable to be changed by other plugins.
+ *
+ * If any plugin on this hook wants to modify the $args
+ * plugin parameter, it simply has to use call-by-reference
+ * syntax in the hook function that it has registered for the
+ * current hook. Note that this is in addition to (entirely
+ * independent of) the return value for this hook.
+ *
+ * @param string $name Name of hook being executed
+ * @param mixed $args A single value or an array of arguments
+ * that are to be passed to all plugins
+ * operating off the hook being called.
+ * Note that this argument is passed by
+ * reference thus it is liable to be
+ * changed after the hook completes.
+ *
+ * @return mixed The return value that is managed by the plugins
+ * on the current hook.