phpDocumentor CoreAPI
EventAPI
[ class tree: CoreAPI ] [ index: CoreAPI ] [ all elements ]

Procedural File: event_api.php

Source Location: /core/event_api.php

Page Details

Event API Handles the event system.

Author:  John Reese
Version:  $Id$
Copyright:  Copyright (C) 2002 - 2009 MantisBT Team - mantisbt-dev@lists.sourceforge.net
Link:  http://www.mantisbt.org
Uses:  pluging_api.php
Uses:  error_api.php
Globals
array   $g_event_cache [line 35]
Default value:  array()

[ Top ]


Functions
event_callback  [line 157]

multi event_callback( string $p_event, string $p_callback, string $p_plugin, [multi $p_params = null]  )

Executes a plugin's callback function for a given event.

Parameters:
string   $p_event:  Event name
string   $p_callback:  Callback name
string   $p_plugin:  Plugin basename
multi   $p_params:  Parameters for event callback

API Tags:
Return:  Null if callback not found, value from callback otherwise
Access:  public


[ Top ]
event_declare  [line 44]

void event_declare( string $p_name, [int $p_type = EVENT_TYPE_DEFAULT]  )

Declare an event of a given type.

Will do nothing if event already exists.

Parameters:
string   $p_name:  Event name
int   $p_type:  Event type

API Tags:
Access:  public


[ Top ]
event_declare_many  [line 61]

void event_declare_many( array $p_events  )

Convenience function for decleare multiple events.

Parameters:
array   $p_events:  Events

API Tags:
Access:  public


[ Top ]
event_hook  [line 75]

void event_hook( string $p_name, string $p_callback, [string $p_plugin = 0]  )

Hook a callback function to a given event.

A plugin's basename must be specified for proper handling of plugin callbacks.

Parameters:
string   $p_name:  Event name
string   $p_callback:  Callback function
string   $p_plugin:  Plugin basename

API Tags:
Access:  public


[ Top ]
event_hook_many  [line 93]

void event_hook_many( array $p_hooks, [string $p_plugin = 0]  )

Hook multiple callback functions to multiple events.

Parameters:
array   $p_hooks:  Event name/callback pairs
string   $p_plugin:  Plugin basename

API Tags:
Access:  public


[ Top ]
event_signal  [line 118]

multi event_signal( string $p_name, [multi $p_params = null], [int $p_params_dynamic = null], [ $p_type = null]  )

Signal an event to execute and handle callbacks as necessary.

Parameters:
string   $p_name:  Event name
multi   $p_params:  Event parameters
int   $p_params_dynamic:  Event type override
   $p_type: 

API Tags:
Return:  Null if event undeclared, appropriate return value otherwise
Access:  public


[ Top ]
event_type_chain  [line 251]

string event_type_chain( string $p_event, array $p_callbacks, string $p_input, $p_params  )

Process a chained event type.

The first callback with be called with the given input. All following callbacks will be called with the previous's output as its input. The final callback's return value will be returned to the event origin.

Parameters:
string   $p_event:  Event name
array   $p_callbacks:  Array of callback function/plugin basename key/value pairs
string   $p_input:  Input string
   $p_params: 

API Tags:
Return:  Output string
Access:  public


[ Top ]
event_type_default  [line 312]

array event_type_default( string $p_event, array $p_callbacks, multi $p_data  )

Process a default event type.

All callbacks will be called with the given data parameters. The return value of each callback will be appended to an array with the callback's basename as the key. This array will then be returned to the event origin.

Parameters:
string   $p_event:  Event name
array   $p_callbacks:  Array of callback function/plugin basename key/value pairs
multi   $p_data:  Data

API Tags:
Return:  Array of callback/return key/value pairs
Access:  public


[ Top ]
event_type_execute  [line 193]

void event_type_execute( string $p_event, array $p_callbacks, array $p_params  )

Process an execute event type.

All callbacks will be called with parameters, and their return values will be ignored.

Parameters:
string   $p_event:  Event name
array   $p_callbacks:  Array of callback function/plugin basename key/value pairs
array   $p_params:  Callback parameters

API Tags:
Access:  public


[ Top ]
event_type_first  [line 285]

multi event_type_first( string $p_event, array $p_callbacks, multi $p_params  )

Process a first-return event.

Callbacks will be called with the given parameters until a callback returns a non-null value; at this point, no other callbacks will be processed, and the return value be passed back to the event origin.

Parameters:
string   $p_event:  Event name
array   $p_callbacks:  Array of callback function/plugin basename key/value pairs
multi   $p_params:  Parameters passed to callbacks

API Tags:
Return:  The first non-null callback result, or null otherwise
Access:  public


[ Top ]
event_type_output  [line 211]

void event_type_output( string $p_event, array $p_callbacks, [multi $p_params = null]  )

Process an output event type.

All callbacks will be called with the given parameters, and their return values will be echoed to the client, separated by a given string. If there are no callbacks, then nothing will be sent as output.

Parameters:
string   $p_event:  Event name
array   $p_callbacks:  Array of callback function/plugin basename key/value pairs
multi   $p_params:  Output separator (if single string) or indexed array of pre, mid, and post strings

API Tags:
Access:  public


[ Top ]


Documentation generated on Sun, 05 Apr 2009 23:01:12 +0100 by phpDocumentor 1.4.1