LnBlogObject

A base object which is event-aware, i.e. it knows how to create, register, and fire events.  It also has contains other general-purpose methods, such as simple XML serialization.

Summary
LnBlogObjectA base object which is event-aware, i.e.
Functions
createEventCreates an event for the current class.
hasEventDetermine whether the given event exists.
hasHandlersDetermine if thereare any handlers for the given event.
raiseEventRaises the given event name for this class.
registerEventHandlerRegisters a handler for an event of this class.
registerStaticEventHandlerRegisters a static handler for an event of this class.
serializeXMLPerforms a simple XML serialization of the object.
deserializeXMLPopulates the object’s properties from a string of XML data.
serializeJSONWorks like serializeXML, except returns the string in JavaScriptObject Notation instead of XML.

Functions

createEvent

function createEvent($name)

Creates an event for the current class.

Parameters

nameThe name of the event.

Returns

True on success, false on failure.

hasEvent

function hasEvent($name)

Determine whether the given event exists.

Parameters

nameThe name of the event.

Returns

True on success, false on failure.

hasHandlers

function hasHandlers($name)

Determine if thereare any handlers for the given event.

Parameters

nameThe name of the event.

Returns

True on success, false on failure.

raiseEvent

function raiseEvent($name)

Raises the given event name for this class.

Parameters

nameThe name of the event.
paramsAny number of additional parameters may be passed to this method.

Returns

True on success, false on failure.

registerEventHandler

function registerEventHandler($type,
$name,
$func)

Registers a handler for an event of this class.

Parameters

typeThe class of the class that raises the event.
nameThe name of the event.
funcThe name of the function that will handle this event.

Returns

True on success, false on failure.

registerStaticEventHandler

function registerStaticEventHandler($type,
$name,
$func)

Registers a static handler for an event of this class.  Use this if your handler belongs to a class but does not require an instance of it in order to work.

Parameters

typeThe class of the class that raises the event.
nameThe name of the event.
funcThe name of the function that will handle this event.

Returns

True on success, false on failure.

See Also

registerEventHandler

serializeXML

function serializeXML()

Performs a simple XML serialization of the object.  If the object has an exclude_fields which is an array, then the method will NOT include that property in the serialization.  In addition, it will not include any properties whose name matches an item in the exclude_fields array.

Returns

A string containing an XML representation of the object.

deserializeXML

function deserializeXML($xmldata)

Populates the object’s properties from a string of XML data.

Parameters

xmldataThe XML containing a serialized representation of the object.  This is typically the string generated by serializeXML and can be either a string of data or a path to the data file.

serializeJSON

function serializeJSON()

Works like serializeXML, except returns the string in JavaScriptObject Notation instead of XML.

Returns

The JSON representation of the object.

function createEvent($name)
Creates an event for the current class.
function hasEvent($name)
Determine whether the given event exists.
function hasHandlers($name)
Determine if thereare any handlers for the given event.
function raiseEvent($name)
Raises the given event name for this class.
function registerEventHandler($type,
$name,
$func)
Registers a handler for an event of this class.
function registerStaticEventHandler($type,
$name,
$func)
Registers a static handler for an event of this class.
function serializeXML()
Performs a simple XML serialization of the object.
function deserializeXML($xmldata)
Populates the object’s properties from a string of XML data.
function serializeJSON()
Works like serializeXML, except returns the string in JavaScriptObject Notation instead of XML.
Close