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 210)

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 getparameter (string $name, string $pname, [string $ename = ""])
 mixed get_setting (string $name)
 string htmldump ()
 void parse (string $xml)
 void save ()
 void setparameter (mixed $value, string $name, string $pname, [string $ename = ""])
 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 218)

Attributes array for current/last tag

mixed $configpath = "" (line 212)

Path to application configuration file

mixed $definitions = array() (line 223)
mixed $globals = array() (line 224)
mixed $settings = array() (line 225)
mixed $state = "" (line 214)

State of processing

mixed $tag = "" (line 216)

Current/last tag opened

mixed $valid = false (line 220)

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 233)

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 506)

Method invoked when character data is available

void cdata (mixed $parser, mixed $cdata)

Redefinition of:
xmlparser::cdata()
Method invoked when character data is available
getparameter (line 356)

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)
get_setting (line 329)

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 396)

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 549)

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 418)

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 374)

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

void setparameter (mixed $value, string $name, string $pname, [string $ename = ""])
  • mixed $value: Value of the parameter setting
  • 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)
synchronize (line 257)

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 528)

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 482)

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