IMP_Prefs_Identity
extends Horde_Core_Prefs_Identity
in package
This class provides an IMP-specific interface to all identities a user might have. Its methods take care of any site-specific restrictions configured in prefs.php and conf.php.
Tags
Table of Contents
Properties
- $_cached : array<string|int, mixed>
- Cached data.
- $_impPrefs : array<string|int, mixed>
- Identity preferences added by IMP.
Methods
- __construct() : mixed
- Reads all the user's identities from the prefs object or builds a new identity from the standard values given in prefs.php.
- getAliasAddress() : Horde_Mail_Rfc822_List
- Returns all aliases based on the chosen identity.
- getAllFromAddresses() : Horde_Mail_Rfc822_List
- Returns all identities' From addresses.
- getAllIdentityAddresses() : Horde_Mail_Rfc822_List
- Returns a list of all e-mail addresses from all identities, including both from addresses and tie addreses.
- getAllSentmail() : array<string|int, mixed>
- Returns an array with the sent-mail mailboxes from all identities.
- getAllSignatures() : array<string|int, mixed>
- Returns an array with the signatures from all identities
- getAllTieAddresses() : Horde_Mail_Rfc822_List
- Get all 'tie to' address/identity pairs.
- getBccAddresses() : Horde_Mail_Rfc822_List
- Returns the BCC addresses for a given identity.
- getFromAddress() : Horde_Mail_Rfc822_Address
- Returns the from address based on the chosen identity. If no address can be found it is built from the current user name and the specified maildomain.
- getFromAddresses() : Horde_Mail_Rfc822_List
- Returns all From addresses for one identity.
- getFromLine() : Horde_Mail_Rfc822_Address
- Returns a complete From: header based on all relevant factors (fullname, from address, input fields, locks etc.)
- getFullname() : string
- Returns the user's full name.
- getMatchingIdentity() : int
- Returns the identity's id that matches the passed addresses.
- getSelectList() : array<string|int, mixed>
- Returns an array with the necessary values for the identity select box in the IMP compose window.
- getSignature() : string
- Returns the full signature based on the current settings for the signature itself, the dashes and the position.
- getTieAddresses() : Horde_Mail_Rfc822_List
- Get tie-to addresses.
- getValue() : mixed
- Returns a property from one of the identities.
- hasAddress() : bool
- Returns true if the given address belongs to one of the identities.
- hasSignature() : bool
- Does the user have any signatures (either text or HTML)?
- save() : mixed
- saveSentmail() : bool
- Returns true if the mail should be saved and the user is allowed to.
- setValue() : mixed
- Sets a property with a specified value.
- verify() : mixed
- Verifies and sanitizes all identity properties.
- _identitiesWithDefaultFirst() : array<string|int, mixed>
- Returns the list of identities with the default identity positioned first.
Properties
$_cached
Cached data.
protected
array<string|int, mixed>
$_cached
= array('aliases' => array(), 'from' => array(), 'names' => array(), 'signatures' => array())
$_impPrefs
Identity preferences added by IMP.
protected
array<string|int, mixed>
$_impPrefs
= array('replyto_addr', 'alias_addr', 'tieto_addr', 'bcc_addr', 'signature', 'signature_html', 'save_sent_mail', \IMP_Mailbox::MBOX_SENT)
Methods
__construct()
Reads all the user's identities from the prefs object or builds a new identity from the standard values given in prefs.php.
public
__construct(mixed $params) : mixed
Parameters
- $params : mixed
Tags
getAliasAddress()
Returns all aliases based on the chosen identity.
public
getAliasAddress([int $ident = null ]) : Horde_Mail_Rfc822_List
Parameters
- $ident : int = null
-
The identity to retrieve the aliases from.
Return values
Horde_Mail_Rfc822_List —Aliases for the identity.
getAllFromAddresses()
Returns all identities' From addresses.
public
getAllFromAddresses() : Horde_Mail_Rfc822_List
Return values
Horde_Mail_Rfc822_List —Address list.
getAllIdentityAddresses()
Returns a list of all e-mail addresses from all identities, including both from addresses and tie addreses.
public
getAllIdentityAddresses() : Horde_Mail_Rfc822_List
Return values
Horde_Mail_Rfc822_List —A list of e-mail addresses.
getAllSentmail()
Returns an array with the sent-mail mailboxes from all identities.
public
getAllSentmail([bool $unique = true ]) : array<string|int, mixed>
Parameters
- $unique : bool = true
-
If true, return the unique list of sent-mail mailboxes. If false, returns list of sent-mail mailboxes, with the key corresponding to the identity.
Return values
array<string|int, mixed> —The array with the sent-mail IMP_Mailbox objects.
getAllSignatures()
Returns an array with the signatures from all identities
public
getAllSignatures([string $type = 'text' ]) : array<string|int, mixed>
Parameters
- $type : string = 'text'
-
Either 'text' or 'html'.
Return values
array<string|int, mixed> —The array with all the signatures.
getAllTieAddresses()
Get all 'tie to' address/identity pairs.
public
getAllTieAddresses() : Horde_Mail_Rfc822_List
Return values
Horde_Mail_Rfc822_List —A list of e-mail addresses.
getBccAddresses()
Returns the BCC addresses for a given identity.
public
getBccAddresses([int $ident = null ]) : Horde_Mail_Rfc822_List
Parameters
- $ident : int = null
-
The identity to retrieve the Bcc addresses from.
Return values
Horde_Mail_Rfc822_List —BCC addresses.
getFromAddress()
Returns the from address based on the chosen identity. If no address can be found it is built from the current user name and the specified maildomain.
public
getFromAddress([int $ident = null ]) : Horde_Mail_Rfc822_Address
Parameters
- $ident : int = null
-
The identity to retrieve the address from.
Return values
Horde_Mail_Rfc822_Address —A valid from address.
getFromAddresses()
Returns all From addresses for one identity.
public
getFromAddresses([int $ident = null ]) : Horde_Mail_Rfc822_List
Parameters
- $ident : int = null
-
The identity to retrieve the from addresses from.
Return values
Horde_Mail_Rfc822_List —Address list.
getFromLine()
Returns a complete From: header based on all relevant factors (fullname, from address, input fields, locks etc.)
public
getFromLine([int $ident = null ][, string $from_address = '' ]) : Horde_Mail_Rfc822_Address
Parameters
- $ident : int = null
-
The identity to retrieve the values from.
- $from_address : string = ''
-
A default from address to use if no identity is selected and the from_addr preference is locked.
Tags
Return values
Horde_Mail_Rfc822_Address —The address to use for From header.
getFullname()
Returns the user's full name.
public
getFullname([int $ident = null ]) : string
Parameters
- $ident : int = null
-
The identity to retrieve the name from.
Return values
string —The user's full name.
getMatchingIdentity()
Returns the identity's id that matches the passed addresses.
public
getMatchingIdentity(mixed $addresses[, bool $search_own = true ]) : int
Parameters
- $addresses : mixed
-
Either an array or a single string or a comma-separated list of email addresses.
- $search_own : bool = true
-
Search for a matching identity in own addresses also?
Return values
int —The id of the first identity that from or alias addresses match (one of) the passed addresses or null if none matches.
getSelectList()
Returns an array with the necessary values for the identity select box in the IMP compose window.
public
getSelectList() : array<string|int, mixed>
Return values
array<string|int, mixed> —The array with the necessary strings
getSignature()
Returns the full signature based on the current settings for the signature itself, the dashes and the position.
public
getSignature([string $type = 'text' ][, int $ident = null ]) : string
Parameters
- $type : string = 'text'
-
Either 'text' or 'html'.
- $ident : int = null
-
The identity to retrieve the signature from.
Tags
Return values
string —The full signature.
getTieAddresses()
Get tie-to addresses.
public
getTieAddresses([int $ident = null ]) : Horde_Mail_Rfc822_List
Parameters
- $ident : int = null
-
The identity to retrieve the tie-to addresses from.
Return values
Horde_Mail_Rfc822_List —A list of tie-to e-mail addresses.
getValue()
Returns a property from one of the identities.
public
getValue(mixed $key[, mixed $identity = null ]) : mixed
Parameters
- $key : mixed
- $identity : mixed = null
Tags
hasAddress()
Returns true if the given address belongs to one of the identities.
public
hasAddress(mixed $address) : bool
This function will search aliases for an identity automatically.
Parameters
- $address : mixed
-
The address(es) to search for in the identities.
Return values
bool —True if the address was found.
hasSignature()
Does the user have any signatures (either text or HTML)?
public
hasSignature([bool $compose_page = false ]) : bool
Parameters
- $compose_page : bool = false
-
If true, checks for signatures as used on the compose pages.
Return values
bool —True if the user has at least one signature.
save()
public
save() : mixed
saveSentmail()
Returns true if the mail should be saved and the user is allowed to.
public
saveSentmail([int $ident = null ]) : bool
Parameters
- $ident : int = null
-
The identity to retrieve the setting from.
Return values
bool —True if the sent mail should be saved.
setValue()
Sets a property with a specified value.
public
setValue(mixed $key, mixed $val[, mixed $identity = null ]) : mixed
Parameters
- $key : mixed
- $val : mixed
- $identity : mixed = null
Tags
verify()
Verifies and sanitizes all identity properties.
public
verify([int $identity = null ]) : mixed
Parameters
- $identity : int = null
-
The identity to verify.
Tags
_identitiesWithDefaultFirst()
Returns the list of identities with the default identity positioned first.
protected
_identitiesWithDefaultFirst() : array<string|int, mixed>
Return values
array<string|int, mixed> —The identity keys with the default identity first.