Open Journal Systems  2.4.3
 All Classes Namespaces Functions Variables Groups Pages
ConfigParser Class Reference

Public Member Functions

 ConfigParser ()
 
 getFileContents ()
 
readConfig ($file)
 
 updateConfig ($file, $params)
 
 writeConfig ($file)
 

Public Attributes

 $content
 

Detailed Description

Class for parsing and modifying php.ini style configuration files.

Definition at line 17 of file ConfigParser.inc.php.

Member Function Documentation

ConfigParser::ConfigParser ( )

Constructor.

Definition at line 25 of file ConfigParser.inc.php.

ConfigParser::getFileContents ( )

Return the contents of the current config file.

Returns
string

Definition at line 213 of file ConfigParser.inc.php.

References $content.

& ConfigParser::readConfig (   $file)

Read a configuration file into a multidimensional array. This is a replacement for the PHP parse_ini_file function, which does not type setting values.

Parameters
$filestring full path to the config file
Returns
array the configuration data (same format as http://php.net/parse_ini_file)

Definition at line 34 of file ConfigParser.inc.php.

Referenced by Config\reloadData().

ConfigParser::updateConfig (   $file,
  $params 
)

Read a configuration file and update variables. This method stores the updated configuration but does not write it out. Use writeConfig() or getFileContents() afterwards to do something with the new config.

Parameters
$filestring full path to the config file
$paramsarray an associative array of configuration parameters to update. If the value is an associative array (of variable name/value pairs) instead of a scalar, the key is treated as a section instead of a variable. Parameters not in $params remain unchanged
Returns
boolean true if file could be read, false otherwise

Definition at line 131 of file ConfigParser.inc.php.

ConfigParser::writeConfig (   $file)

Write contents of current config file

Parameters
$filestring full path to output file
Returns
boolean file write is successful

Definition at line 192 of file ConfigParser.inc.php.

Member Data Documentation

ConfigParser::$content

Contents of the config file currently being parsed

Definition at line 20 of file ConfigParser.inc.php.

Referenced by getFileContents().


The documentation for this class was generated from the following file: