Class SGL_Config

Description

Config file parsing and handling, acts as a registry for config data.

Located in /SGL/Config.php (line 49)


	
			
Variable Summary
 mixed $aProps
 mixed $fileName
Method Summary
 static boolean createCachedFile (string $cachedConfigFile)
 static void ensureDirExists (string $dir)
 static string getCachedFileName (string $path)
 static string locateCachedFile (string $path)
 SGL_Config SGL_Config ([ $autoLoad = false])
 mixed ensureModuleConfigLoaded (string $moduleName)
 boolean exists (mixed $key)
 string get (mixed $key)
 array getAll ()
 array getCommandTarget (string $str)
 void getFileName ()
 void getModulesDir ()
 boolean isEmpty ()
 mixed load (string $file, [boolean $force = false])
 void merge ( $aConf)
 mixed remove (array $key)
 void replace ( $aConf)
 void save ([ $file = null])
 boolean set (string $key, mixed $value)
 void &singleton ([ $autoLoad = true])
Variables
mixed $aProps = array() (line 51)
mixed $fileName (line 52)
Methods
static createCachedFile (line 324)
boolean createCachedFile (string $cachedConfigFile)
  • string $cachedConfigFile
static ensureDirExists (line 294)
void ensureDirExists (string $dir)
  • string $dir
static getCachedFileName (line 275)
string getCachedFileName (string $path)
  • string $path
static locateCachedFile (line 255)
string locateCachedFile (string $path)
  • string $path
Constructor SGL_Config (line 54)
SGL_Config SGL_Config ([ $autoLoad = false])
  • $autoLoad
ensureModuleConfigLoaded (line 414)

Ensures the module's config file was loaded and returns an array containing the global and modulde config.

This is required when the homepage is set to custom mod/mgr/params, and the module config file loaded while initialising the request is not the file required for the custom invocation.

  • return: array on success, PEAR_Error on failure
mixed ensureModuleConfigLoaded (string $moduleName)
  • string $moduleName
exists (line 82)

Returns true if config key exists.

boolean exists (mixed $key)
  • mixed $key: string or array
get (line 102)

Returns a config key

  • return: the value of the config key
  • since: Seagull 0.6.3 easier access with static calls, ie $lifetime = SGL_Config::get('cache.lifetime');
string get (mixed $key)
  • mixed $key: array or string
getAll (line 205)

Return an array of all Config properties.

array getAll ()
getCommandTarget (line 453)

Given a string of the format moduleName^managerName^action, returns a hash of the values.

array getCommandTarget (string $str)
  • string $str
getFileName (line 210)
void getFileName ()
getModulesDir (line 303)
void getModulesDir ()
isEmpty (line 398)

Returns true if the current config object contains no data keys.

boolean isEmpty ()
load (line 222)

Reads in data from supplied $file.

  • return: An array of data on success, PEAR error on failure.
mixed load (string $file, [boolean $force = false])
  • string $file
  • boolean $force: If force is true, master config file is read, not cached one
merge (line 388)
void merge ( $aConf)
  • $aConf
remove (line 184)

Remove a config key, save() must be used to persist changes.

To remove the key $conf['site']['blocksEnabled'] = true, you would use $c->remove(array('site', 'blocksEnabled')

  • todo: in 0.7 make this consistent with $c->get()
mixed remove (array $key)
  • array $key: a) A 2 element array: element one for the section, element 2 for the section key b) a key - the whole section will be removed
replace (line 195)
void replace ( $aConf)
  • $aConf
save (line 343)
void save ([ $file = null])
  • $file
set (line 148)

Sets a config property.

Using new shorthand method you can do $ok = SGL_Config::set('river.boat', 'green');

  • todo: define add() and remove() methods, set() should only set existing keys
boolean set (string $key, mixed $value)
  • string $key
  • mixed $value
singleton (line 66)
void &singleton ([ $autoLoad = true])
  • $autoLoad

Documentation generated on Tue, 23 Feb 2010 18:14:28 +0000 by phpDocumentor 1.4.3