b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (Version 1.8) [ class tree: evocore ] [ index: evocore ] [ all elements ]

Class: AbstractSettings

Source Location: /blogs/inc/MODEL/settings/_abstractsettings.class.php

Class AbstractSettings

Direct descendents
Child Class Description
UserSettings Class to handle the settings for users
CollectionSettings Class to handle the settings for collections
PluginSettings Class to handle settings for plugins
GeneralSettings Class to handle the global settings.
PluginUserSettings Class to handle settings for plugins

[ Top ]
Property Summary
boolean   $allLoaded   Do we have loaded everything?
array|NULL|false   $cache   The internal cache.
integer   $cacheByColKeys   The number of column keys to cache by. This are the first x keys of $colKeyNames. 0 means 'load all'.
array   $colKeyNames   Array with DB column key names.
string   $colValueName   DB column name for the value.
string   $dbTableName   The DB table which stores the settings.
array   $_defaults   Default settings.
array   $_defaults_to_be_serialized   A list of last colkeyname which are meant to be serialized (array or object).

[ Top ]
Method Summary
AbstractSettings   AbstractSettings()   Constructor.
boolean   dbupdate()   Commit changed settings to DB.
void   delete()   Remove a setting.
void   delete_array()   Delete an array of values.
string|false|NULL   get()   Get a setting from the DB settings table.
boolean   get_cond()   Only set the first variable (passed by reference) if we could retrieve a setting.
NULL|mixed   get_default()   Get the default for the last key of $colKeyNames
void   load_all()   Load all settings, disregarding the derived classes setting of $cacheByColKeys
  • useful if you know that you want to get
all user settings for example.
void   reset()   Reset cache (includes settings to be written to DB).
boolean   restore_defaults()   Delete values for $_defaults in DB.
boolean   set()   Temporarily sets a setting (dbupdate() writes it to DB).
void   set_array()   Set an array of values.
boolean   _load()   Loads the settings. Not meant to be called directly, but gets called when needed.

[ Top ]
Properties
boolean   $allLoaded = false [line 94]

Do we have loaded everything?


[ Top ]
array|NULL|false   $cache = NULL [line 86]

The internal cache.

API Tags:
Access:  protected


[ Top ]
integer   $cacheByColKeys [line 76]

The number of column keys to cache by. This are the first x keys of $colKeyNames. 0 means 'load all'.


[ Top ]
array   $colKeyNames = array() [line 59]

Array with DB column key names.

API Tags:
Access:  protected


[ Top ]
string   $colValueName [line 67]

DB column name for the value.

API Tags:
Access:  protected


[ Top ]
string   $dbTableName [line 51]

The DB table which stores the settings.

API Tags:
Access:  protected


[ Top ]
array   $_defaults = array() [line 105]

Default settings.

Maps last colkeyname to some default setting that will be used by get() if no value was defined (and it is set as a default).


Redefined in descendants as:

[ Top ]
array   $_defaults_to_be_serialized = array() [line 115]

A list of last colkeyname which are meant to be serialized (array or object).

They are unserialized once with get() and serialized with dbupdate().


[ Top ]
Methods
Constructor AbstractSettings  [line 125]

  AbstractSettings AbstractSettings( string $dbTableName, array $colKeyNames, string $colValueName, [integer $cacheByColKeys = 0]  )

Constructor.

Parameters:
string   $dbTableName:  The name of the DB table with the settings stored.
array   $colKeyNames:  List of names for the DB columns keys that reference a value.
string   $colValueName:  The name of the DB column that holds the value.
integer   $cacheByColKeys:  The number of column keys to cache by. This are the first x keys of $colKeyNames. 0 means 'load all'.


[ Top ]
dbupdate  [line 533]

  boolean dbupdate( )

Commit changed settings to DB.


API Tags:
Return:  true, if settings have been updated; false otherwise


[ Top ]
delete  [line 470]

  void delete( array $args  )

Remove a setting.

Parameters:
array   $args:  List of $colKeyNames


Redefined in descendants as:

[ Top ]
delete_array  [line 503]

  void delete_array( array $array  )

Delete an array of values.

Parameters:
array   $array:  Array of parameters for delete()


[ Top ]
get  [line 270]

  string|false|NULL get( string $args,...  )

Get a setting from the DB settings table.

Parameters:
string   $args,...:  the values for the column keys (depends on $this->colKeyNames and must match its count and order)

API Tags:
Return:  value as string on success; NULL if not found; false in case of error
Uses:  AbstractSettings::get_default()


Redefined in descendants as:

[ Top ]
get_cond  [line 375]

  boolean get_cond( mixed &$toset, string 1  )

Only set the first variable (passed by reference) if we could retrieve a setting.

Parameters:
string   1:  the values for the column keys (depends on $this->colKeyNames and must match its count and order)
mixed   &$toset:  variable to set maybe (by reference)

API Tags:
Return:  true on success (variable was set), false if not


[ Top ]
get_default  [line 355]

  NULL|mixed get_default( string $last_key  )

Get the default for the last key of $colKeyNames

Parameters:
string   $last_key:  The last column key

API Tags:
Return:  NULL if no default is set, otherwise the value (should be string).
Usedby:  AbstractSettings::get()


[ Top ]
load_all  [line 150]

  void load_all( )

Load all settings, disregarding the derived classes setting of $cacheByColKeys

  • useful if you know that you want to get
all user settings for example.



[ Top ]
reset  [line 661]

  void reset( )

Reset cache (includes settings to be written to DB).

This is useful, to rollback settings that have been made, e.g. when a Plugin decides that his settings should not get updated.



[ Top ]
restore_defaults  [line 520]

  boolean restore_defaults( )

Delete values for $_defaults in DB.

This will use the default settings on the next get() again.


API Tags:
Return:  true, if settings have been updated; false otherwise


[ Top ]
set  [line 401]

  boolean set( string $args,...  )

Temporarily sets a setting (dbupdate() writes it to DB).

Parameters:
string   $args,...:  the values for the column keys and column value. Must match order and count!

API Tags:
Return:  true, if the value has been set, false if it has not changed.


Redefined in descendants as:

[ Top ]
set_array  [line 456]

  void set_array( array $array  )

Set an array of values.

Parameters:
array   $array:  Array of parameters for set()


[ Top ]
_load  [line 164]

  boolean _load( [array|NULL $getArgs = NULL]  )

Loads the settings. Not meant to be called directly, but gets called when needed.

Parameters:
array|NULL   $getArgs:  list of key values, used for caching by keys.

API Tags:
Return:  always true
Access:  protected


[ Top ]

Documentation generated on Tue, 18 Dec 2007 23:08:46 +0100 by phpDocumentor 1.4.0