eZPublish  4.5
ezpEvent Class Reference

Public Member Functions

 __construct ($loadGlobalEvents=true)
 Constructer In most cases you would want to use {. More...
 
 attach ($name, $listener)
 Attach an event listener at run time on demand. More...
 
 detach ($name, $id)
 Detach an event listener by id given when it was added. More...
 
 filter ($name, $value)
 Notify all listeners on an event but stop if any of them return something else then null. More...
 
 notify ($name, array $params=array())
 Notify all listeners on an event. More...
 

Static Public Member Functions

static getInstance ()
 Gets instance. More...
 
static resetInstance ()
 Resets instance. More...
 

Protected Attributes

 $listeners = array()
 

Static Protected Attributes

static $instance = null
 
static $listenerIdNumber = 0
 

Constructor & Destructor Documentation

ezpEvent::__construct (   $loadGlobalEvents = true)

Constructer In most cases you would want to use {.

See Also
getInstance()} instead
Parameters
bool$loadGlobalEventsLoad global events from ini settings

Member Function Documentation

ezpEvent::attach (   $name,
  $listener 
)

Attach an event listener at run time on demand.

Parameters
string$nameIn the form "content/delete/1" or "content/delete"
array | string$listenerA valid PHP callback {
See Also
http://php.net/manual/en/language.pseudo-types.php#language.types.callback}
Returns
int Listener id, can be used to detach a listener later {
See Also
detach()}

Referenced by __construct().

ezpEvent::detach (   $name,
  $id 
)

Detach an event listener by id given when it was added.

Parameters
string$name
int$idThe unique id given by {
See Also
attach()}
Returns
bool True if the listener has been correctly detached
ezpEvent::filter (   $name,
  $value 
)

Notify all listeners on an event but stop if any of them return something else then null.

Parameters
string$nameIn the form "content/delete/1", "content/delete", "content/read"
array | string | numeric$valueThe value you want to let listeners filter
Returns
mixed $value param after being filtered by filters, or unmodified if no filters
ezpEvent::notify (   $name,
array  $params = array() 
)

Notify all listeners on an event.

Parameters
string$nameIn the form "content/delete/1", "content/delete", "content/read"
array$paramsThe arguments for the specific event as simple array structure (not hash)
Returns
bool True if some listener where called
static ezpEvent::resetInstance ( )
static

Resets instance.

Member Data Documentation

ezpEvent::$instance = null
staticprotected
ezpEvent::$listenerIdNumber = 0
staticprotected
ezpEvent::$listeners = array()
protected

Referenced by __construct().


The documentation for this class was generated from the following file: