Class Nexista_Init

Description

This class is reponsible for initializing the runtime process.

It is responsible for loading certain required files, initializing sessions, flow, etc.... and processing the correct files based on request and finally outputting the data.

The default output functionality, Init::display(), can be overriden with a custom function as defined by Init::registerOutputHandler. This function will then call the output command Init::run() itself and perform any desired pre-display processing such as cache the output, etc...

See example site for an example registerOutputHandler.

Located in /kernel/init.php (line 45)


	
			
Variable Summary
 boolean $timer
Method Summary
 static void registerOutputHandler (mixed $handler)
 static object class singleton ()
 Nexista_Init __construct ()
 void display ()
 void getInfo ( $data)
 void initSession ()
 void loadConfig ()
 void loadPrepend (mixed $prepend)
 void process ()
 void run ()
 void start ()
 void stop ()
Variables
boolean $timer = false (line 82)

Execution timer flag

  • access: public
Methods
static registerOutputHandler (line 423)

Registers a function to be called on output

This function can be used to manipulate the final output before it is displayed. It can be used to create a caching system, compress output etc...

The handler should be a callable function or array of object/method as defined in is_callable php function. It should accept 1 arguments:

  1. The reference to the init class instance
Note that the Init::$info property contains the current cache value from the sitemap if set.

This function should call: $output = Init::run(); to get the final output. The function is responsible for displaying it.

  • access: public
void registerOutputHandler (mixed $handler)
  • mixed $handler: a function or an array of class=>method
static singleton (line 438)

Returns a class singleton.

  • return: singleton instance
  • access: public
object class singleton ()
Constructor __construct (line 99)

Constructor - inits config

  • access: public
Nexista_Init __construct ()
display (line 352)

Displays final output

This method is called from the loader file and is responsible for activating the run process and displaying the output. In the event that caching or an other pre-display processing is needed, this method can be overriden using a callback function registered with Init::registerOutputHandler(); This function needs to be a valid php callback (see call_user_func()) It needs to accept one argument, the reference to the Init object. It also needs to call the static Init::run() method and capture/display the returned string.

Here is an example

  • access: public
void display ()
getInfo (line 376)

Returns the gate info in an array consisting only of the params that are specified by the sitemap. Possible items include: uri (always present), cache, and role.

  • access: public
void getInfo ( $data)
  • $data
initSession (line 194)

Init sessions

This method starts up a session and globalizes it.

void initSession ()
loadConfig (line 129)

Loads site configuration info

  • access: public
void loadConfig ()
loadPrepend (line 148)

Loads prepend file

The prepend file is an optional file as defined in config. While it can be used to hold any php code that the user may wish to have processed everytime but is specifically designed to run code before any output. Examples are headers and sessions.

  • access: public
void loadPrepend (mixed $prepend)
  • mixed $prepend: valid php callback
process (line 237)

Reads sitemap for current gate data

This function retrieves the correct gate based on request.

  • access: public
void process ()
run (line 309)

Pocesses final output

This function processes the correct gate based on request. In the event of not finding the correct gate, it will attempt to load the gate defined under build/missing in config. Failure to do so will result in a 404 redirect to be handled by the web server.

  • access: public
void run ()
start (line 116)

Startup functions, init...

This method is responsible for calling all startup functions such as timers, flow init, etc..

  • access: public
void start ()
stop (line 163)

Shutdown and cleanup

This method is responsible for shutting down the current request. It will clean up variables, send ob to ouput, etc..

  • access: public
void stop ()

Documentation generated on Tue, 11 Mar 2008 23:23:04 -0400 for Nexista 0.2.0