PHP 클래스 Horde_Prefs, horde

It also includes all of the functions for retrieving, storing, and checking preference values.
저자: Jon Parise ([email protected])
상속: implements ArrayAccess
파일 보기 프로젝트 열기: horde/horde 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_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