PHP Класс Horde_Prefs_Identity, horde

Автор: Jan Schneider ([email protected])
Наследование: implements ArrayAccess, implements Countable, implements IteratorAggregate
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$_default integer This one is used by the methods returning values if no other one is specified.
$_identities array Array containing all the user's identities.
$_prefnames array Preference names.
$_prefs Horde_Prefs The prefs object that this Identity points to.
$_user string The user whose identities these are.

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

Метод Описание
__construct ( array $params = [] ) Constructor.
add ( array $identity = [] ) : integer Adds a new identity to the array of identities.
count ( )
delete ( integer $identity ) : array Removes an identity from the array of identities.
get ( integer $identity = null ) : array Returns a complete identity hash.
getAll ( string $key ) : array Returns an array with the specified property from all existing identities.
getDefault ( ) : integer Returns a pointer to the current default identity.
getDefaultFromAddress ( boolean $fullname = false ) : Horde_Mail_Rfc822_Address Generates the from address to use for the default identity.
getFromAddress ( integer $ident = null ) : Horde_Mail_Rfc822_Address Returns the from address based on the chosen identity.
getIterator ( )
getName ( integer $ident = null ) : string Returns the user's full name.
getValue ( string $key, integer $identity = null ) : mixed Returns a property from one of the identities. If this value doesn't exist or is locked, the property is retrieved from the prefs backend.
hasValue ( string $key, string $value ) : boolean Returns true if the given address belongs to one of the identities.
init ( ) Creates a default identity if none exists yet and sets the preferences up if the identities are locked.
isLocked ( ) : boolean Returns true if all properties are locked and therefore nothing in the identities can be changed.
offsetExists ( $offset )
offsetGet ( $offset )
offsetSet ( $offset, $value )
offsetUnset ( $offset )
save ( ) Saves all identities in the prefs backend.
setDefault ( integer $identity ) : boolean Sets the current default identity.
setValue ( string $key, mixed $val, integer $identity = null ) : boolean Sets a property with a specified value.
verify ( integer $identity = null ) Verifies and sanitizes all identity properties.

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

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

Constructor.
public __construct ( array $params = [] )
$params array Parameters: - default_identity: (string) The preference name for the default identity. DEFAULT: 'default_identity' - from_addr: (string) The preference name for the user's from e-mail address. DEFAULT: 'from_addr' - fullname: (string) The preference name for the user's full name. DEFAULT: 'fullname' - id: (string) The preference name for the identity name. DEFAULT: 'id' - identities: (string) The preference name for the identity store. DEFAULT: 'identities' - prefs: (Horde_Prefs) [REQUIRED] The prefs object to use. - properties: (array) The list of properties for the identity. DEFAULT: array('from_addr', 'fullname', 'id') - user: (string) [REQUIRED] The user whose prefs we are handling.

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

Adds a new identity to the array of identities.
public add ( array $identity = [] ) : integer
$identity array An identity hash to add.
Результат integer The pointer to the created identity

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

С версии: 2.7.0
public count ( )

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

Removes an identity from the array of identities.
public delete ( integer $identity ) : array
$identity integer The pointer to the identity to be removed
Результат array The removed identity.

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

Returns a complete identity hash.
public get ( integer $identity = null ) : array
$identity integer The identity to retrieve.
Результат array An identity hash. Returns null if the identity does not exist.

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

Returns an array with the specified property from all existing identities.
public getAll ( string $key ) : array
$key string The property to retrieve.
Результат array The array with the values from all identities.

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

Returns a pointer to the current default identity.
public getDefault ( ) : integer
Результат integer The pointer to the current default identity.

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

Generates the from address to use for the default identity.
public getDefaultFromAddress ( boolean $fullname = false ) : Horde_Mail_Rfc822_Address
$fullname boolean Include the fullname information.
Результат Horde_Mail_Rfc822_Address The default from address (object returned since 2.2.0).

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

If no address can be found it is built from the current user.
public getFromAddress ( integer $ident = null ) : Horde_Mail_Rfc822_Address
$ident integer The identity to retrieve the address from.
Результат Horde_Mail_Rfc822_Address A valid from address.

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

С версии: 2.7.0
public getIterator ( )

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

Returns the user's full name.
public getName ( integer $ident = null ) : string
$ident integer The identity to retrieve the name from.
Результат string The user's full name, or the user name if it doesn't exist.

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

Returns a property from one of the identities. If this value doesn't exist or is locked, the property is retrieved from the prefs backend.
public getValue ( string $key, integer $identity = null ) : mixed
$key string The property to retrieve.
$identity integer The identity to retrieve the property from.
Результат mixed The value of the property.

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

Returns true if the given address belongs to one of the identities.
public hasValue ( string $key, string $value ) : boolean
$key string The identity key to search.
$value string The value to search for in $key.
Результат boolean True if the $value was found in $key.

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

Creates a default identity if none exists yet and sets the preferences up if the identities are locked.
public init ( )

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

Returns true if all properties are locked and therefore nothing in the identities can be changed.
public isLocked ( ) : boolean
Результат boolean True if all properties are locked, false otherwise.

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

С версии: 2.7.0
public offsetExists ( $offset )

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

С версии: 2.7.0
public offsetGet ( $offset )

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

С версии: 2.7.0
public offsetSet ( $offset, $value )

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

С версии: 2.7.0
public offsetUnset ( $offset )

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

Saves all identities in the prefs backend.
public save ( )

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

If the identity doesn't exist, the old default identity stays the same.
public setDefault ( integer $identity ) : boolean
$identity integer The pointer to the new default identity.
Результат boolean True on success, false on failure.

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

Sets a property with a specified value.
public setValue ( string $key, mixed $val, integer $identity = null ) : boolean
$key string The property to set.
$val mixed The value to which the property should be set.
$identity integer The identity to set the property in.
Результат boolean True on success, false on failure (property was locked).

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

Verifies and sanitizes all identity properties.
public verify ( integer $identity = null )
$identity integer The identity to verify.

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

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

This one is used by the methods returning values if no other one is specified.
protected int $_default
Результат integer

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

Array containing all the user's identities.
protected array $_identities
Результат array

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

Preference names.
protected array $_prefnames
Результат array

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

The prefs object that this Identity points to.
protected Horde_Prefs $_prefs
Результат Horde_Prefs

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

The user whose identities these are.
protected string $_user
Результат string