PHP Класс Horde_Prefs, horde

It also includes all of the functions for retrieving, storing, and checking preference values.
Автор: Jon Parise ([email protected])
Наследование: implements ArrayAccess
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_cache Horde_Prefs_Cache Caching object.
$_opts array General library options.
$_scope string String containing the name of the current scope. This is used to differentiate between sets of preferences. By default, preferences belong to this scope.
$_scopes array Scope list. Keys are scope names, values are Horde_Prefs_Scope objects.
$_storage array The storage driver(s).

Открытые методы

Метод Описание
__construct ( string $scope, mixed $storage = null, array $opts = [] ) Constructor.
__get ( $name ) Shortcut to getValue().
__set ( $name, $value ) Shortcut to setValue().
changeScope ( string $scope ) Changes the current preference scope.
cleanup ( boolean $all = false ) Cleanup (e.g. remove) scope(s).
getCache ( ) : Horde_Prefs_Cache_Base Return the cache object.
getDefault ( string $pref ) : string Returns the default value of the given preference.
getScope ( ) : string Get the current scope.
getStorage ( ) : array Returns the storage drivers.
getUser ( ) : string Return the user who owns these preferences.
getValue ( string $pref ) : string Returns the value of the requested preference.
isDefault ( string $pref ) : boolean Determines if the current preference value is the default value.
isDirty ( string $pref ) : boolean Is a preference marked dirty?
isLocked ( string $pref ) : boolean Is a preference locked?
offsetExists ( $offset ) * ArrayAccess methods.
offsetGet ( $offset )
offsetSet ( $offset, $value )
offsetUnset ( $offset )
remove ( string $pref = null ) Removes a preference entry from the $prefs hash.
removeAll ( ) Removes all preference entries for the current user from the $prefs hash and the backends.
retrieve ( string $scope = null ) Retrieves preferences for the current scope.
setLocked ( string $pref, $bool ) Mark a preference as locked.
setValue ( string $pref, string $val, array $opts = [] ) : boolean Sets the given preference to the specified value if the preference is modifiable.
store ( boolean $throw = true ) Save all dirty prefs to the storage backend.

Защищенные методы

Метод Описание
_getScope ( string $pref ) : mixed Returns the scope of a preference.
_loadScope ( string $scope ) Load a specific preference scope.

Описание методов

__construct() публичный Метод

Constructor.
public __construct ( string $scope, mixed $storage = null, array $opts = [] )
$scope string The scope for this set of preferences.
$storage mixed The storage object(s) to use. Either a single Horde_Prefs_Storage object, or an array of objects.
$opts array Additional confguration options:
cache - (Horde_Prefs_Cache) The cache driver to use.
        DEFAULT: No caching.
logger - (Horde_Log_Logger) Logging object.
         DEFAULT: NONE
sizecallback - (callback) If set, called when setting a value in the
               backend.
               DEFAULT: NONE
user - (string) The name of the user who owns this set of preferences.
       DEFAULT: NONE

__get() публичный Метод

Shortcut to getValue().
public __get ( $name )

__set() публичный Метод

Shortcut to setValue().
public __set ( $name, $value )

_getScope() защищенный Метод

Returns the scope of a preference.
protected _getScope ( string $pref ) : mixed
$pref string The preference name.
Результат mixed The scope of the preference, or null if it doesn't exist.

_loadScope() защищенный Метод

Load a specific preference scope.
protected _loadScope ( string $scope )
$scope string The scope to load.

changeScope() публичный Метод

Changes the current preference scope.
С версии: 2.6.0
public changeScope ( string $scope )
$scope string Scope specifier.

cleanup() публичный Метод

Cleanup (e.g. remove) scope(s).
public cleanup ( boolean $all = false )
$all boolean Cleanup all scopes. If false, clean present scope only.

getCache() публичный Метод

Return the cache object.
С версии: 2.6.0
public getCache ( ) : Horde_Prefs_Cache_Base
Результат Horde_Prefs_Cache_Base Cache object.

getDefault() публичный Метод

Returns the default value of the given preference.
public getDefault ( string $pref ) : string
$pref string The name of the preference to get the default for.
Результат string The preference's default value.

getScope() публичный Метод

Get the current scope.
public getScope ( ) : string
Результат string The current scope (application).

getStorage() публичный Метод

Returns the storage drivers.
public getStorage ( ) : array
Результат array The storage drivers.

getUser() публичный Метод

Return the user who owns these preferences.
public getUser ( ) : string
Результат string The user these preferences are for.

getValue() публичный Метод

Returns the value of the requested preference.
public getValue ( string $pref ) : string
$pref string The preference name.
Результат string The value of the preference (UTF-8), null if it doesn't exist.

isDefault() публичный Метод

Determines if the current preference value is the default value.
public isDefault ( string $pref ) : boolean
$pref string The name of the preference to check.
Результат boolean True if the preference is the application default value.

isDirty() публичный Метод

Is a preference marked dirty?
public isDirty ( string $pref ) : boolean
$pref string The preference name.
Результат boolean True if the preference is marked dirty.

isLocked() публичный Метод

Is a preference locked?
public isLocked ( string $pref ) : boolean
$pref string The preference name.
Результат boolean Whether the preference is locked.

offsetExists() публичный Метод

* ArrayAccess methods.
public offsetExists ( $offset )

offsetGet() публичный Метод

public offsetGet ( $offset )

offsetSet() публичный Метод

public offsetSet ( $offset, $value )

offsetUnset() публичный Метод

public offsetUnset ( $offset )

remove() публичный Метод

Removes a preference entry from the $prefs hash.
public remove ( string $pref = null )
$pref string The name of the preference to remove. If null, removes all preferences from the current scope.

removeAll() публичный Метод

Removes all preference entries for the current user from the $prefs hash and the backends.
public removeAll ( )

retrieve() публичный Метод

Retrieves preferences for the current scope.
public retrieve ( string $scope = null )
$scope string Optional scope specifier - if not present the current scope will be used.

setLocked() публичный Метод

Mark a preference as locked.
public setLocked ( string $pref, $bool )
$pref string The preference name.

setValue() публичный Метод

Sets the given preference to the specified value if the preference is modifiable.
public setValue ( string $pref, string $val, array $opts = [] ) : boolean
$pref string The preference name to modify.
$val string The preference value (UTF-8).
$opts array Additional options:
  - force: (boolean) If true, will set the value disregarding the
           current locked status of the pref. (@since 2.5.0)
           DEFAULT: false
  - nosave: (boolean) If true, the preference will not be saved to the
            storage backend(s).
            DEFAULT: false
Результат boolean True if the value was successfully set, false on a failure.

store() публичный Метод

Save all dirty prefs to the storage backend.
public store ( boolean $throw = true )
$throw boolean Throw exception on error? If false, ignores errors. (Since 2.1.0)

Описание свойств

$_cache защищенное свойство

Caching object.
protected Horde_Prefs_Cache $_cache
Результат Horde_Prefs_Cache

$_opts защищенное свойство

General library options.
protected array $_opts
Результат array

$_scope защищенное свойство

String containing the name of the current scope. This is used to differentiate between sets of preferences. By default, preferences belong to this scope.
protected string $_scope
Результат string

$_scopes защищенное свойство

Scope list. Keys are scope names, values are Horde_Prefs_Scope objects.
protected array $_scopes
Результат array

$_storage защищенное свойство

The storage driver(s).
protected array $_storage
Результат array