Class application

Description

Class comprising the functionality of an application. This is used to contain and manage the basic configuration properties of an application. This class knows how to read the configuration in, store the values, and write it out again.

Located in /application-defs.php (line 247)

xmlparser
   |
   --application
Variable Summary
 mixed $attr
 mixed $configpath
 mixed $definitions
 mixed $globals
 mixed $settings
 mixed $state
 mixed $tag
 mixed $valid
Method Summary
 application application ([string $configpath = "application.xml"])
 void cdata (mixed $parser, mixed $cdata)
 void delparameter (string $sname, string $pname, string $ename)
 void getparameter (string $name, string $pname, [string $ename = ""])
 integer getsettingix (string $sname)
 mixed get_setting (string $name)
 string htmldump ()
 void parse (string $xml)
 void save ()
 void setparameter (mixed $value, string $sname, string $pname, [string $ename = ""], [string $type = ""])
 boolean synchronize (object $refapp)
 void tag_close (mixed $parser, mixed $tag)
 void tag_open (mixed $parser, mixed $tag, mixed $attributes)
Variables
mixed $attr = array() (line 255)

Attributes array for current/last tag

mixed $configpath = "" (line 249)

Path to application configuration file

mixed $definitions = array() (line 260)
mixed $globals = array() (line 261)
mixed $settings = array() (line 262)
mixed $state = "" (line 251)

State of processing

mixed $tag = "" (line 253)

Current/last tag opened

mixed $valid = false (line 257)

True if response was valid, ie. no errors

Inherited Variables

Inherited from xmlparser

xmlparser::$error_message
xmlparser::$parser
xmlparser::$valid_xml
Methods
Constructor application (line 270)

Construct a new application. Creating the application will also attempt to read in the XML configuration file as specified (or defaulted). If the file is read successfully, then the valid flag is set true.

application application ([string $configpath = "application.xml"])
  • string $configpath: Path to XML configuration file for application
cdata (line 607)

Method invoked when character data is available

void cdata (mixed $parser, mixed $cdata)

Redefinition of:
xmlparser::cdata()
Method invoked when character data is available
delparameter (line 485)

Get the value of a named parameter from a named setting. This only works for settings which are unique - ie. it won't work well for parms which can occur multiple times, eg: 'database'. Option to specify the element name for arrayed parameters.

void delparameter (string $sname, string $pname, string $ename)
  • string $sname: Name of the setting which contains the parameter
  • string $pname: Name of the parameter to get value of
  • string $ename: Name of element (arrayed parameters only)
getparameter (line 431)

Get the value of a named parameter from a named setting. This only works for settings which are unique - ie. it won't work well for parms which can occur multiple times, eg: 'database'. Option to specify the element name for arrayed parameters.

void getparameter (string $name, string $pname, [string $ename = ""])
  • string $name: Name of the setting which contains the parameter
  • string $pname: Name of the parameter to get value of
  • string $ename: Name of element (arrayed parameters only)
getsettingix (line 447)

Return the index number of the named setting.

  • return: Index of the named setting or -1 if not found.
integer getsettingix (string $sname)
  • string $sname: Name of the setting which contains the parameter
get_setting (line 404)

Return setting by name. NB: some settings can have multiple entries under the same name, eg. 'database'. In this case we return an array of setting objects, otherwise the single setting object.

We return false if not found.

  • return: Single setting object, array of settings, or false
mixed get_setting (string $name)
  • string $name: Name of the setting(s) to return
htmldump (line 497)

Return dump of the application content as a string. Useful for diagnostics mainly.

  • return: Dump of the application content as html string.
string htmldump ()
parse (line 650)

Parse the application XML which is provided.

void parse (string $xml)
  • string $xml: The XML content to parse for the application.

Redefinition of:
xmlparser::parse()
Parse the given XML document.
save (line 519)

Save the application as XML file back to the same filename it was read in from, ie. after changes have been made. This generates the whole file as fresh XML, and writes it out.

void save ()
setparameter (line 469)

Set the value of a named parameter for a named setting. Optionally provide the element name for arrayed parameters.

void setparameter (mixed $value, string $sname, string $pname, [string $ename = ""], [string $type = ""])
  • mixed $value: Value of the parameter setting
  • string $sname: Name of the setting which contains the parameter
  • string $pname: Name of the parameter to get value of
  • string $ename: Name of element (arrayed parameters only)
  • string $type: If supplied will auto-create missing parameter
synchronize (line 294)

Make this current application object the same structure as the

given application. This process checks that the definitions, globals, and settings of this application match those of the given one. If a given item is missing, it is created. If an item is not present in the given application, it is deleted in this one. Existing items retain their current values - only structure is checked.

  • return: True if changes were made, else false.
boolean synchronize (object $refapp)
  • object $refapp: The reference application to synchronize to
tag_close (line 629)

Method invoked when a tag is closed

void tag_close (mixed $parser, mixed $tag)

Redefinition of:
xmlparser::tag_close()
Method invoked when a tag is closed
tag_open (line 583)

Method invoked when a tag is opened

void tag_open (mixed $parser, mixed $tag, mixed $attributes)

Redefinition of:
xmlparser::tag_open()
Method invoked when a tag is opened

Inherited Methods

Inherited From xmlparser

 xmlparser::xmlparser()
 xmlparser::cdata()
 xmlparser::parse()
 xmlparser::tag_close()
 xmlparser::tag_open()

Documentation generated by phpDocumentor 1.3.0RC3