[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/config/ -> configfilestorage.class.php (sommaire)

(pas de description)

Poids: 317 lignes (11 kb)
Inclus ou requis:0 fois
Référencé: 3 fois
Nécessite: 0 fichiers

Définit 1 class

ConfigFileStorage:: (13 méthodes):
  ConfigFileStorage()
  reload()
  getConfigFileName()
  createConfigFile()
  _getDataString()
  saveValue()
  getValue()
  setValue()
  getKeys()
  getValues()
  getAsArray()
  save()
  getTempFolder()


Classe: ConfigFileStorage  - X-Ref

\ingroup Config

Implements a file-based configuration backend. The data in the file has to be arranged
in a php array called $config, in the same way the file config/config.properties.php is arranged.

The backend will use the array keys as its own keys and the values as its own values, and will take
care of serializing and unserializing data as needed (so that we can for example save Objects and
Arrays to the config file)
ConfigFileStorage( $params = null )   X-Ref
Opens the configuration file. By default it is config/config.properties.php
if no parameter is specified. If there is a parameter specified, that
is the file the constructor will try to open.
If no file name is specified, it defaults to config/config.properties.php.

param: configFile The name of the file we would like to use.

reload()   X-Ref
Reloads the contents from the configuration file.

return: Returns true if successul or false otherwise

getConfigFileName()   X-Ref
Returns the name of the configuration file being used.

return: The name of the configuration file being used.

createConfigFile( $configFileName = null )   X-Ref
Create a new config file from scratch.

$return true if config file could be created, false otherwise

_getDataString( $data )   X-Ref
Private function that given a piece of PHP data, will return an string representing
it, literally. Examples:

data is a boolean type. Result --> the string 'true'
data is string type. Result --> string "value_of_the_string"
data is an array. Result --> string containing "Array( "..", "...", "..") "

Objects are saved serialized and since there is no way to detect if it's an object
or not, it will be up to the user of the class to de-serialize it.

<b>:TODO:</b> This function does not handle very well sparse arrays, but it does
handles arrays within arrays.

param: data The data we'd like to get the string representation
return: An string representing the data, so that eval'ing it would yield

saveValue( $name, $value )   X-Ref
Saves a setting to the configuration file. If the setting already exists, the current
value is overwritten. Otherwise, it will be appended in the end of the file.
<b>NOTE:</b> This method is highly unoptimized because every time that we call saveValue,
we are writing the whole file to disk... Bad ;) But it works, so we'll leave it as it
is for the time being...

param: name Name of the setting.
param: value Value of the setting.
return: True if success or false otherwise.

getValue( $key, $defaultValue = null )   X-Ref
Pas de description

setValue( $key, $value )   X-Ref


getKeys()   X-Ref


getValues()   X-Ref


getAsArray()   X-Ref


save()   X-Ref


getTempFolder()   X-Ref
shortcut for one of the most sought after config keys: temp_folder

not really needed, but it makes my life easier since I never remember
whether it is tmp_folder, temp_folder, temp_dir, or whatever :)

return: The name of the folder used for temporary storage



Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics