roundcubemail/program/lib/Roundcube/rcube_plugin_api.php
public function exec_hook($hook, $args = array())
    {
        if (!is_array($args)) {
            $args = array('arg' => $args);
        }

        // TODO: avoid recursion by checking in_array($hook, $this->exec_stack) ?

        $args += array('abort' => false);
        array_push($this->exec_stack, $hook);

        // Use for loop here, so handlers added in the hook will be executed too
        if (!empty($this->handlers[$hook])) {
            for ($i = 0; $i < count($this->handlers[$hook]); $i++) {
                $ret = call_user_func($this->handlers[$hook][$i], $args);
                if ($ret && is_array($ret)) {
                    $args = $ret + $args;
                }

                if ($args['break']) {
                    break;
                }
            }
        }

        array_pop($this->exec_stack);
        return $args;
    }
public function exec_hook($hook, $args = array())
    {
        if (!is_array($args)) {
            $args = array('arg' => $args);
        }

        // TODO: avoid recursion by checking in_array($hook, $this->exec_stack) ?

        $args += array('abort' => false);
        array_push($this->exec_stack, $hook);

        // Use for loop here, so handlers added in the hook will be executed too
        if (!empty($this->handlers[$hook])) {
            for ($i = 0; $i < count($this->handlers[$hook]); $i++) {
                $ret = call_user_func($this->handlers[$hook][$i], $args);
                if ($ret && is_array($ret)) {
                    $args = $ret + $args;
                }

                if ($args['break']) {
                    break;
                }
            }
        }

        array_pop($this->exec_stack);
        return $args;
    }
public function exec_hook ( $ hook , $ args = array ( ) ) { if ( ! is_array ( $ args ) ) { $ args = array ( 'arg' => $ args ) ; } // TODO: avoid recursion by checking in_array($hook, $this->exec_stack) ? $ args += array ( 'abort' => false ) ; array_push ( $ this -> exec_stack , $ hook ) ; // Use for loop here, so handlers added in the hook will be executed too if ( ! empty ( $ this -> handlers [ $ hook ] ) ) { for ( $ i = 0 ; $ i < count ( $ this -> handlers [ $ hook ] ) ; $ i ++ ) { $ ret = call_user_func ( $ this -> handlers [ $ hook ] [ $ i ] , $ args ) ; if ( $ ret && is_array ( $ ret ) ) { $ args = $ ret + $ args ; } if ( $ args [ 'break' ] ) { break ; } } } array_pop ( $ this -> exec_stack ) ; return $ args ; }
Triggers a plugin hook.
This is called from the application and executes all registered handlers

@param string $hook Hook name
@param array $args Named arguments (key->value pairs)

@return array The (probably) altered hook arguments
Triggers a plugin hook . This is called from the application and executes all registered handlers