ConfigMagik

Description

ConfigMagik - Ini-File Reader and Writer (ConfigKeeper)

This class is meant to read and write configuration files in the .ini format.

    It provides features like:
  • - Load and save ini style configuration files
  • - Optional automatic synchronization by updating the file after each change of a key value
  • - Protected mode for securing your sensitive data from being accessed directly from the Web
  • - Supports for sections
  • - Add and remove key value pairs
  • - Add and remove sections
  • - Easy and well documented API

Located in /class.ConfigMagik.php (line 7)


	
			
Variable Summary
mixed $ERRORS
mixed $PATH
mixed $SYNCHRONIZE
mixed $VARS
Method Summary
void ConfigMagik ([string $path = null], [bool $synchronize = false], [bool $process_sections = false])
mixed get ([string $key = null], [string $section = null])
bool load ([string $path = null])
bool removeKey (string $key, [string $section = null])
bool removeSection (string $section)
bool save ([string $path = null])
bool set (string $key, mixed $value, [string $section = null])
Variables
mixed $ERRORS = array() (line 13)
mixed $PATH = null (line 8)
mixed $PROCESS_SECTIONS = false (line 10)
mixed $PROTECTED_MODE = true (line 11)
mixed $SYNCHRONIZE = false (line 9)
mixed $VARS = array() (line 12)
Methods
Constructor ConfigMagik (line 25)

Constructor of this class.

  • return: Returns nothing, like any other constructor-method ;) .
void ConfigMagik ([string $path = null], [bool $synchronize = false], [bool $process_sections = false])
  • string $path: Path to ini-file to load at startup.
    NOTE: If the ini-file can not be found it will try to generate one there. By not specifing an ini-file the configuration will be kept in-memory till you call save().
  • bool $synchronize: TRUE for constant synchronisation of memory and file (default is disabled).
  • bool $process_sections: TRUE to enable sections in your ini-file (default is disabled).
get (line 52)

Get value of given key from given section (if any used).

  • return: Returns the value or NULL on failure.
    NOTE: An empty directive will always return an empty string. Only when directive can not be found, NULL is returned.
mixed get ([string $key = null], [string $section = null])
  • string $key: Key or name of directive to set in current config.
  • string $section: Name of section to set key/value-pair therein.
    NOTE: Section must only be specified when sections are enabled in your ini-file.
load (line 163)

Loads and parses ini-file from filesystem.

  • return: Returns TRUE on success, FALSE on failure.
bool load ([string $path = null])
  • string $path: Optional path to ini-file to load.
    NOTE: When not provided, path passed to constructor will be used.
removeKey (line 100)

Remove a directive (key and it's value) from current config.

  • return: Returns TRUE on success, FALSE on failure.
bool removeKey (string $key, [string $section = null])
  • string $key: Name of key to remove form current config.
  • string $section: Optional name of section (if used).
removeSection (line 140)

Remove entire section from current config.

  • return: Returns TRUE on success, FALSE on failure.
bool removeSection (string $section)
  • string $section: Name of section to remove.
save (line 188)

Writes ini-file to filesystem as file.

  • return: Returns TRUE on success, FALSE on failure.
bool save ([string $path = null])
  • string $path: Optional path to write ini-file to.
    NOTE: When not provided, path passed to constructor will be used.
set (line 71)

Sets a given value (in given section, if any specified) in current configuration.

  • return: Returns TRUE on success, FALSE on failure.
bool set (string $key, mixed $value, [string $section = null])
  • string $key: Key or name of directive to set in current config.
  • mixed $value: Value of directive to set in current config.
  • string $section: Name of section to set key/value-pair therein. NOTE: Section must only be specified when sections are enabled in your ini-file.

Documentation generated on Thu, 15 Jul 2004 11:04:14 +0200 by BennyZaminga using parts of phpDocumentor 1.3.0RC3