phpLDAPadmin

# Procedural File: hooks.php

Source Location: /templates/3rdParty/pla/lib/hooks.php

## Page Details:

Functions related to hooks management.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

#### Tags:

author: | Benjamin Drieu <benjamin.drieu@fr.alcove.com> and Alc�?ve

#### Includes:

require_once($script) [line 196]

### add_hook [line 119]

`void add_hook( hook_name $hook_name, hook_function $hook_function, [priority $priority = 0], [rollback_function $rollback_function = null])`

Adds a procedure to a hook for later execution.

#### Parameters

hook_name | $hook_name | Name of the hook.
hook_function | $hook_function | Name of the php function called upon hook trigger.
priority | $priority | Numeric priority. Lowest means procedure will be executed before.
rollback_function | $rollback_function | Name of the php rollback function called upon failure.

[ Top ]

### clear_hooks [line 178]

`void clear_hooks( hook_name $hook_name)`

Removes all procedures from a hook.

#### Parameters

hook_name | $hook_name | Name of hook to clear.

[ Top ]

### remove_hook [line 155]

`void remove_hook( hook_name $hook_name, priority $hook_function, hook_function $priority, rollback_function $rollback_function)`

Removes a procedure from a hook, based on a filter.

#### Parameters

hook_name | $hook_name | Name of the hook.
priority | $hook_function | Numeric priority. If set, all procedures of that priority will be removed.
hook_function | $priority | Name of the procedure function. If set, all procedures that call this function will be removed.
rollback_function | $rollback_function | Name of the php rollback function called upon failure. If set, all procedures that call this function as a rollback will be removed.

[ Top ]

### run_hook [line 52]

`true run_hook( hook_name $hook_name, args $args)`

Runs procedures attached to a hook.

#### Tags:

return: | if all procedures returned true, false otherwise.

#### Parameters

hook_name | $hook_name | Name of hook to run.

args

$args

Array of optional arguments set by phpldapadmin. It is normally in a form known by call_user_func_array() :

    [ 'server_id' => 0,
     'dn' => 'uid=epoussa,ou=tech,o=corp,o=fr' ]

[ Top ]

### sort_array_by_priority [line 34]

`-1 sort_array_by_priority( a $a, b $b)`

Compares two arrays by numerically comparing their 'prority' value. Standard `cmp-like' function.

#### Tags:

return: | if priority of first element is smaller than second element priority. 1 otherwise.

#### Parameters

a | $a | First element to compare.
b | $b | Second element to compare.

[ Top ]

Documentation generated on Tue, 22 Nov 2011 16:29:45 +0100 by phpDocumentor 1.4.1