Packageindex Classtrees Modulegroups Elementlist Report XML Files

pxdb_prefs

pxdb_prefs

private class pxdb_prefs

 

Public Method Summary

void pxdb_prefs()
Constructor does nothing but set the database.
object pxdb_prefs &singleton()
Attempts to return a reference to an already-instantiated prefs class.
mixed get_pref(string $pname, [ mixed $pkey ])
Looks up a preference in the db.
void clear_cache()
Clears the preferences cached in memory.
array get_array(string $pname, [ string $pkey ])
Always returns an array of preferences desired.
array get_hash(string $pname, [ string $pkey ])
Returns a hash/associative array for a pref_name, and/or key
string get_list(string $pname, [ string $pkey, string $delim ])
Returns a list of values for a given preference.
void del_pref(string $pname, [ string $pkey, string $pval ])
Removes a preferences from the database.
void set_pref(string $pname)
Sets (overwrites) a preference in the database.
void add_pref(string $pname)
Adds a preference to the database.
void set_default_pref(string $pname)
This function sets default preferences.

Private Method Summary

void _cache(string $pname, string $pkey, mixed $pval)
Save pref looked up in db -- to speed up searches later.
mixed _cached(string $pname, string $pkey)
Get a matching cached pref (if any).
string _normalize(string $value)
Returns a lowercase value unless $case_sensitive is true.

Public Field Summary

boolean $case_sensitive
Whether preferences are case sensitive.
object [unknown] $db
ADOdb Connection.
array $cache
Cache of preferences we lookup.

Private Field Summary

boolean $checked
Whether or not environment (table existence) has been verified.
boolean $disable_cache
Whether to disable caching.

Public Method Details

pxdb_prefs

public void pxdb_prefs()

 

Returns void


&singleton

public object pxdb_prefs &singleton()

  Will create a new prefs class only if one does not already exist.

Returns object pxdb_prefs

or false on error.


get_pref

public mixed get_pref(string $pname, [ mixed $pkey ])

  Will look for a lowercase version of pref_name and pref_key unless $case_sensitive is true. (note: pref_name and pref_key will also have been made lowercase by set_pref() method)

Parameter
string $pname
The name of the preference to retrieve
mixed $pkey = >>null<<
The [optional] key of the preference to retrieve
Returns mixed

Contents of the pref


clear_cache

public void clear_cache()

  Useful if you want to update & retrieve [updated] prefs in the same page. In that case you may also just want to disable caching -- depending on how many times you are going to access the same preferences.

Returns void


get_array

public array get_array(string $pname, [ string $pkey ])

  get_pref() method will only return an array if there is more than one matching preference. This method will always return an array -- even if there is only one matching pref.

Parameter
string $pname
The name of the preference to retrieve
string $pkey = >>null<<
The [optional] key of the preference to retrieve
Returns array

The matching preference(s)


get_hash

public array get_hash(string $pname, [ string $pkey ])

  Get_array returns only the values in an array. preference. This method will always return an array -- even if there is only one matching pref.

Parameter
string $pname
The name of the preference to retrieve
string $pkey = >>null<<
The [optional] key of the preference to retrieve
Returns array

The matching preference(s)


get_list

public string get_list(string $pname, [ string $pkey, string $delim ])

 

Parameter
string $pname
The name of preference
string $pkey = >>null<<
The preference key.
string $delim = >>','<<
the delimter with which to separate multiple preferences.
Returns string $delim

The -separated string of preferences.


del_pref

public void del_pref(string $pname, [ string $pkey, string $pval ])

  Matches on normalized pref_name and pref_key, unless pref_key is null in which case it removes all prefs that match pref_name.

Parameter
string $pname
Name of pref to delete.
string $pkey = >>null<<
Key of pref to delete.
string $pval = >>null<<
Value of pref to delete (in cases where there is more than one name/key match to a preference).
Returns void


set_pref

public void set_pref(string $pname)

  This method calls the del_pref() and add_pref() methods.

Parameter
string $pname
The name of preference to set.
Returns void


add_pref

public void add_pref(string $pname)

  Will automatically lowercase the pref_name and pref_key unless $case_sensitive is true.

Parameter
string $pname
Name of preference to add.
Returns void


set_default_pref

public void set_default_pref(string $pname)

  It first checks to make sure there isn't a preference already loaded, if not, it writes it to the database.

Parameter
string $pname
Name of preference to add.
Returns void


Private Method Details

_cache

private void _cache(string $pname, string $pkey, mixed $pval)

 

Parameter
string $pname
Name of pref.
string $pkey
Key of pref.
mixed $pval
Value of pref (may be an array).
Returns void


_cached

private mixed _cached(string $pname, string $pkey)

 

Parameter
string $pname
Name of pref.
string $pkey
Key of pref.
Returns mixed

preferece found or false if there is no cached pref.


_normalize

private string _normalize(string $value)

 

Parameter
string $value
The value that should be normalized.
Returns string


Public Field Details

$case_sensitive

public boolean $case_sensitive

>>false<<


$db

public object [unknown] $db

>><<


$cache

public array $cache

>><<


Private Field Details

$checked

private boolean $checked

>>false<<


$disable_cache

private boolean $disable_cache

>>false<<

This may be necessary if you are writing pages that are modifying and retrieving [modified] preferences in the same page.



Packageindex Classtrees Modulegroups Elementlist Report XML Files
Generated on Fri, 28 Apr 2006 19:07:22 -0400 by PHPDoc v1.5 www.phpdoc.de