roundcubemail/program/lib/Roundcube/rcube_plugin_api.php
public function register_hook($hook, $callback)
    {
        if (is_callable($callback)) {
            if (isset($this->deprecated_hooks[$hook])) {
                rcube::raise_error(array('code' => 522, 'type' => 'php',
                    'file' => __FILE__, 'line' => __LINE__,
                    'message' => "Deprecated hook name. "
                        . $hook . ' -> ' . $this->deprecated_hooks[$hook]), true, false);
                $hook = $this->deprecated_hooks[$hook];
            }
            $this->handlers[$hook][] = $callback;
        }
        else {
            rcube::raise_error(array('code' => 521, 'type' => 'php',
                'file' => __FILE__, 'line' => __LINE__,
                'message' => "Invalid callback function for $hook"), true, false);
        }
    }
public function register_hook($hook, $callback)
    {
        if (is_callable($callback)) {
            if (isset($this->deprecated_hooks[$hook])) {
                rcube::raise_error(array('code' => 522, 'type' => 'php',
                    'file' => __FILE__, 'line' => __LINE__,
                    'message' => "Deprecated hook name. "
                        . $hook . ' -> ' . $this->deprecated_hooks[$hook]), true, false);
                $hook = $this->deprecated_hooks[$hook];
            }
            $this->handlers[$hook][] = $callback;
        }
        else {
            rcube::raise_error(array('code' => 521, 'type' => 'php',
                'file' => __FILE__, 'line' => __LINE__,
                'message' => "Invalid callback function for $hook"), true, false);
        }
    }
public function register_hook ( $ hook , $ callback ) { if ( is_callable ( $ callback ) ) { if ( isset ( $ this -> deprecated_hooks [ $ hook ] ) ) { rcube :: raise_error ( array ( 'code' => 522 , 'type' => 'php' , 'file' => __FILE__ , 'line' => __LINE__ , 'message' => "Deprecated hook name. " . $ hook . ' -> ' . $ this -> deprecated_hooks [ $ hook ] ) , true , false ) ; $ hook = $ this -> deprecated_hooks [ $ hook ] ; } $ this -> handlers [ $ hook ] [ ] = $ callback ; } else { rcube :: raise_error ( array ( 'code' => 521 , 'type' => 'php' , 'file' => __FILE__ , 'line' => __LINE__ , 'message' => "Invalid callback function for $hook" ) , true , false ) ; } }
Allows a plugin object to register a callback for a certain hook

@param string $hook Hook name
@param mixed  $callback String with global function name or array($obj, 'methodname')
Allows a plugin object to register a callback for a certain hook