Configuration Class

From GeeklogWiki
Revision as of 16:10, 17 August 2007 by Ablankstein (talk | contribs) (Function Reference)

Jump to: navigation, search

Function Reference

public add()

This function will add a variable to the database

Parameters:

string $param_name
  name of the parameter to add
mixed  $default_value    
  the default value of the parameter (also will be the initial value)
string $display_name     
  name that will be displayed on the user interface
string $type             
  This is the type of the configuration variable
  If the configuration variable is an array, prefix this string with
      '@' if the administrator should NOT be able to add or remove keys
      '*' if the administrator should be able to add named keys
      '%' if the administrator should be able to add numbered keys
  These symbols can be repeated like such: @@text if the configuration variable is an array of arrays of text.
  The base variable types are:
      'text'    textbox displayed     string  value stored
      'select'  selectbox displayed   string  value stored
      'hidden'  no display            string  value stored
string $subgroup
  subgroup of the variable
string $fieldset
  the fieldset to display the variable under
array  $selection_array
  These are the possible selections for the 'select' type. This MUST be passed if you use the 'select' type - otherwise it will just display a textbox (defaults to NULL)
int    $sort
  sort rank on the user interface (ascending, defaults to 0)
boolean $set            
  Whether or not this parameter is set (defaults to TRUE)

public static create()

This function will return an instance of the config class. If an instance with the given group/reference name does not exist, then it will create a new one. This function insures that there is only one instance for a given group name.

Parameters:

string group_name
   This is simply the group name that this config object will control - for the main gl settings this is 'Core'

public set()

This function sets a configuration variable to a value in the database and in the current array. If the variable does not already exist, nothing will happen.

Parameters:

string variable_name
   This is the name of the variable to change
mixed value
   This is the new value for the variable.

public &init_config()

This function returns a reference to the configuration variables array (e.g. $_CONF)

public set_configfile()

This function sets the secure configuration file (database related settings) for the configuration class to read. This should only need to be called for the 'Core' group. It also must be called before load_baseconfig()

Parameters:

string $sf
   This is the path and name of the secure configuration file.

public load_baseconfig()

This function reads the secure configuration file and loads lib-database.php. This needs to be called in the 'Core' group before &init_config() can be used. It only needs to be called once.