[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/phpgwapi/inc/ -> class.hooks.inc.php (sommaire)

(pas de description)

Poids: 286 lignes (10 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

hooks:: (7 méthodes):
  hooks()
  process()
  single()
  count()
  read()
  register_hooks()
  register_all_hooks()


Classe: hooks  - X-Ref

class which gives ability for applications to set and use hooks to communicate with each other

Hooks need to be declared in the app's setup.inc.php file and they have to be registered
(copied into the database) by
- installing or updating the app via setup or
- running Admin >> register all hooks
As the hooks-class can get cached in the session (session-type PHP_RESTORE), you also have to log
out and in again, that your changes take effect.

Hooks can either have two formats
- new method hooks (prefered), which are methods of a class. You can pass parameters to the call and
they can return values. They get declared in setup.inc.php as:
$setup_info['appname']['hooks']['location'] = 'app.class.method';
- old type, which are included files. Values can only be passed by global values and they cant return anything.
Old declaration in setup.inc.php:
$setup_info['appname']['hooks'][] = 'location';

hooks($db=null)   X-Ref
constructor, reads and caches the complete hooks table

param: object $db=null database class, if null we use $GLOBALS['egw']->db

process($args, $order = '', $no_permission_check = False)   X-Ref
executes all the hooks (the user has rights to) for a given location

param: string/array $args location-name as string or array with keys location, order and
param: array $order appnames (as value), which should be executes first
param: boolean $no_permission_check if True execute all hooks, not only the ones a user has rights to
return: array with results of each hook call (with appname as key) and value:

single($args, $appname = '', $no_permission_check = False,$try_unregistered = False)   X-Ref
executes a single hook of a given location and application

param: string/array $args location-name as string or array with keys location, appname and
param: string $appname name of the app, which's hook to execute, if empty the current app is used
param: boolean $no_permission_check if True execute all hooks, not only the ones a user has rights to
param: boolean $try_unregisterd If true, try to include old file-hook anyway (for setup)
return: mixed False if no hook exists, True if old hook exists and whatever the new method-hook returns (can be True or False too!).

count($location)   X-Ref
loop through the applications and count the hooks

param: string $location location-name
return: int the number of found hooks

read()   X-Ref


register_hooks($appname,$hooks=null)   X-Ref
Register and/or de-register an application's hooks

First all existing hooks of $appname get deleted in the db and then the given ones get registered.

param: string $appname Application 'name'
param: array $hooks=null hooks to register, eg $setup_info[$app]['hooks'] or not used for only deregister the hooks
return: boolean false on error, true otherwise

register_all_hooks()   X-Ref
Register the hooks of all applications (used by admin)




Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7