The Horde_Prefs:: class provides a common abstracted interface into the
various preferences storage mediums. It also includes all of the
functions for retrieving, storing, and checking preference values.
Copyright 1999-2012 Horde LLC (http://www.horde.org/)
See the enclosed file COPYING for license information (LGPL). If you
did not receive this file, see http://www.horde.org/licenses/lgpl21.
Methods summary
public
|
#
__construct( string $scope, mixed $storage = null, array $opts = array() )
Constructor.
Parameters
- $scope
- The scope for this set of preferences.
- $storage
- <p>The storage object(s) to use. Either a single
Horde_Prefs_Storage object, or an array of
objects.</p>
- $opts
- Additional confguration options:
<pre>cache - (Horde_Prefs_Cache) The cache driver to <span class="php-keyword1">use</span>.
<span class="php-keyword1">DEFAULT</span>: No caching.
logger - (Horde_Log_Logger) Logging object.
<span class="php-keyword1">DEFAULT</span>: NONE
password - (string) The password associated with <span class="php-quote">'user'</span>.
<span class="php-keyword1">DEFAULT</span>: NONE
sizecallback - (callback) <span class="php-keyword1">If</span> set, called when setting a value in the
backend.
<span class="php-keyword1">DEFAULT</span>: NONE
user - (string) The name of the user who owns this set of preferences.
<span class="php-keyword1">DEFAULT</span>: NONE</pre>
|
public
string
|
#
getUser( )
Return the user who owns these preferences.
Return the user who owns these preferences.
Returns
string The user these preferences are for.
|
public
string
|
#
getScope( )
Get the current scope.
Returns
string The current scope (application).
|
public
array
|
#
getStorage( )
Returns the storage drivers.
Returns the storage drivers.
Returns
array The storage drivers.
|
public
|
#
remove( string $pref = null )
Removes a preference entry from the $prefs hash.
Removes a preference entry from the $prefs hash.
Parameters
- $pref
- <p>The name of the preference to remove. If null,
removes all prefs.</p>
|
public
boolean
|
#
setValue( string $pref, string $val, array $opts = array() )
Sets the given preference to the specified value if the preference is
modifiable.
Sets the given preference to the specified value if the preference is
modifiable.
Parameters
- $pref
- The preference name to modify.
- $val
- The preference value (UTF-8).
- $opts
- Additional options:
<pre>nosave - (boolean) <span class="php-keyword1">If</span> <span class="php-keyword1">true</span>, the preference will not be saved to the
storage backend(s).</pre>
Returns
boolean True if the value was successfully set, false on a
failure.
Throws
|
public
|
#
__set( mixed $name, mixed $value )
|
public
string
|
#
getValue( string $pref )
Returns the value of the requested preference.
Returns the value of the requested preference.
Parameters
- $pref
- The preference name.
Returns
string The value of the preference (UTF-8), null if it doesn't
exist.
|
public
|
|
public
|
#
setLocked( string $pref, boolean $bool )
Mark a preference as locked.
Mark a preference as locked.
Parameters
- $pref
- The preference name.
- $bool
- $locked Is the preference locked?
|
public
boolean
|
#
isLocked( string $pref )
Is a preference locked?
Parameters
- $pref
- The preference name.
Returns
boolean Whether the preference is locked.
|
public
boolean
|
#
isDirty( string $pref )
Is a preference marked dirty?
Is a preference marked dirty?
Parameters
- $pref
- The preference name.
Returns
boolean True if the preference is marked dirty.
|
public
string
|
#
getDefault( string $pref )
Returns the default value of the given preference.
Returns the default value of the given preference.
Parameters
- $pref
- The name of the preference to get the default for.
Returns
string The preference's default value.
|
public
boolean
|
#
isDefault( string $pref )
Determines if the current preference value is the default value.
Determines if the current preference value is the default value.
Parameters
- $pref
- The name of the preference to check.
Returns
boolean True if the preference is the application default
value.
|
public
|
#
retrieve( string $scope = null )
Retrieves preferences for the current scope.
Retrieves preferences for the current scope.
Parameters
- $scope
- <p>Optional scope specifier - if not present the
current scope will be used.</p>
|
public
|
#
store( )
This function will be run at the end of every request as a shutdown
function (registered by the constructor). All dirty prefs will be
saved to the storage backend.
This function will be run at the end of every request as a shutdown
function (registered by the constructor). All dirty prefs will be
saved to the storage backend.
|
public
|
#
cleanup( boolean $all = false )
Cleanup (e.g. remove) scope(s).
Cleanup (e.g. remove) scope(s).
Parameters
- $all
- <p>Cleanup all scopes. If false, clean present scope
only.</p>
|
public
|
#
offsetExists( mixed $offset )
Implementation of
ArrayAccess::offsetExists()
|
public
|
#
offsetGet( mixed $offset )
Implementation of
ArrayAccess::offsetGet()
|
public
|
#
offsetSet( mixed $offset, mixed $value )
Implementation of
ArrayAccess::offsetSet()
|
public
|
#
offsetUnset( mixed $offset )
Implementation of
ArrayAccess::offsetUnset()
|