OpenBroadcaster Documentation
classes / obfcallbacks.php

OBFCallbacks

Class

Manages callbacks. Returns an OBFCallbackReturn when firing, which is also defined in the same file.

public  &get_instance ( )

Create an instance of OBFCallbacks or return the already created instance.

Returns instance
private  callbacks_sort ( a, b )

Sort two callbacks by their weight. Returns -1 if a takes priority, 1 if b takes priority.

Parameters
a Callback 1.
b Callback 2.
Returns -1 | 1
public  fire ( hook, position, &$args = null, &$data = null )

Fire a callback. Returns a new instance of OBFCallbackReturn.

Parameters
hook Hook string in Class.method format.
position Position in the method the callback is run, e.g. 'return'.
args Reference to arguments. NULL by default.
data Reference to data. NULL by default.
Returns obfcallback_return
public  get_retvals ( hook )

Get the return values from a hook.

Parameters
hook Hook string in Class.method format.
Returns retvals
public  register_callback ( callback, hook, position, weight = 0 )

Register callback hooks.

Available positions: init (run before the controller); return (run after the controller).

Parameters
callback Callback string in Class.method format.
hook Hook string in Class.method format.
position Position in the method the callback is run, e.g. 'return'.
weight Lower numbers are run first. Can be negative. Default 0.
public  reset_retvals ( hook )

Reset the return values for the associated hook.

Parameters
hook Hook string in Class.method format.
public  store_retval ( hook, callback, value )

Store the return values for the associated hook from the provided callback and value.

Parameters
hook Hook string in Class.method format.
callback Callback string in Class.method format.
value Return values to store.