app 
[ doc home ] [ class tree: app ] [ index: app ] [ all elements ]

Class: IsterAppMain

Source Location: /IsterAppMain.php

Class Overview

IsterObject
   |
   --IsterAppMain

This class represents an application.


Author(s): Ingo Schramm   

Copyright: Copyright (c) 2005 Ister.ORG Ingo Schramm

Methods


Inherited Constants

Inherited Variables

Inherited Methods

Class: IsterObject

IsterObject::IsterObject()
Constructor
IsterObject::abstractMethodError()
Report attempt to call an abstract method.
IsterObject::addLogger()
Add an IsterLogger to process log messages.
IsterObject::deleteLogger()
Delete an already registered IsterLogger.
IsterObject::getLoggerNames()
Fetch the names of all currently registered IsterLoggers.
IsterObject::getMem()
Return maximum amount of memory an application has allocated at this point.
IsterObject::log()
Trigger a log message.
IsterObject::passPHPmessage()
Catch PHP E_WARNING and E_NOTICE messages.
IsterObject::serialize()
Serialize the object.
IsterObject::setLogLocal()
Set logging local for the current object.
IsterObject::setupLogger()
Setup a logger.
IsterObject::triggerError()
Alias for log();
IsterObject::unserialize()
Unserialize the object.
IsterObject::__sleep()
Executed prior to serialize().
IsterObject::__wakeup()
Executed prior to unserialize().

Class Details

This class represents an application.

This class maintains configuration, request and session handling automatically. Methods can be added to the run queue and will be executed in FIFO order.

  1. require_once('IsterAppMain.php');
  2. require_once('Runner.php');
  3.  
  4. $main = new IsterAppMain;
  5. $runner = new Runner;
  6. $main->addToQueue($runner, 'init');
  7. $main->addToQueue($runner, 'run');
  8. $main->main();


copyright:  Copyright (c) 2005 Ister.ORG Ingo Schramm
author:  Ingo Schramm


[ Top ]


Class Methods


constructor IsterAppMain

IsterAppMain IsterAppMain( [boolean $phperr = true], [boolean $slashes = true])

Constructor

The request objects will be initialized by the constructor. Also slashes will be added to all incoming data even if 'magic_quotes_gpc' has been accidentally turned off in php.ini.


Parameters:

boolean   $phperr   whether to catch E_WARNING and E_NOTICE messages or not
boolean   $slashes   whether to invoke ensureSlashes() or not (leave it true!)

[ Top ]

method addToQueue

boolean addToQueue( object &$object, string $method)

Add a method to the run queue.

The object will be stored by reference. The method should expect no parameters and return a boolean value.


Parameters:

object   &$object  
string   $method   name of method on $object

[ Top ]

method close

boolean close( )

[ Top ]

method destroy

boolean destroy( )

Clean this object.

[ Top ]

method ensureSlashes

boolean ensureSlashes( )

Ensure, all incoming data has slashes added.

This method performs addslashes() to $_GET, $_POST, $_COOKIE and $_FILES even if 'magic_quotes_gpc' has been turned off in php.ini. Use it!

Important warning: This does not work for uploaded files stored in temporary directory!


[ Top ]

method getConfigureCollection

object IsterAppConfigureCollection &getConfigureCollection( )

Get the configuration collection by reference.

depricated


[ Top ]

method getOptValue

mixed getOptValue( mixed $set, mixed $section, mixed $name)

Get the value of a configuration option.

depricated


[ Top ]

method getPathInfo

object IsterHttpRequestPathinfo &getPathInfo( )

Get the pathinfo object of the request.

Note: A reference is returned.


[ Top ]

method getProperty

mixed getProperty( mixed $name)

Get the value of a configuration option.

[ Top ]

method getPropertyCollection

object IsterAppConfigureCollection &getPropertyCollection( )

Get the configuration collection by reference.

[ Top ]

method getRequest

object IsterHttpRequest &getRequest( )

Get the request object.

Dependant on the request method this will return an IsterHttpRequestGET or an IsterHttpRequestPOST. You can use both objects in the same manner. The objects have already parsed headers stored and the request parameters are also already parsed to attributes.

Note: A reference is returned.


[ Top ]

method getSession

mixed &getSession( [mixed $name = 'ISESSION'], [mixed $timeout = 0])

Return the session object by reference.

If no session is active, a new session will be created.


return:  IsterSession, false on error, null if session timed out
[ Top ]

method getSessionObject

object IsterSessionObject &getSessionObject( string $name, string $class, [string $args = null])

Get a session object.

This method checks if an object with the given name already exists in the current session. If not, a new instance of the given class will be created and registered to the session with the given name. The method returns the specified object.

Always get the object by reference:

  1. $app->getSession();
  2. $object =& $app->getSessionObject('test', 'IsterSessionObject');

To prevent errors, $class must be a subclass of IsterSessionObject.

The session must already exist.


Parameters:

string   $name  
string   $class  
string   $args  

[ Top ]

method main

boolean main( )

Execute the application.

The run queue will be executed. If no method is left in the queue, first the configuration will be written if present and changed, then the session will be saved.


[ Top ]

method setConfigureCollection

boolean setConfigureCollection( mixed &$object)

Set the configuration collection by reference.

depricated


[ Top ]

method setOptValue

boolean setOptValue( mixed $set, mixed $section, mixed $name, mixed $value)

Set the value of a configuration option.

depricated


[ Top ]

method setProperty

boolean setProperty( mixed $name, mixed $value)

Set the value of a configuration option.

[ Top ]

method setPropertyCollection

boolean setPropertyCollection( mixed $coll)

Set the property collection.

[ Top ]

method writeConfigureCollection

boolean writeConfigureCollection( )

Write the current configure collection.

depricated


[ Top ]

method writePropertyCollection

boolean writePropertyCollection( )

Write the current configure collection.

[ Top ]


Documentation generated on Tue, 20 Dec 2005 11:20:31 +0100 by phpDocumentor 1.3.0RC4