本文整理匯總了PHP中IMP_Mailbox::prefTo方法的典型用法代碼示例。如果您正苦於以下問題:PHP IMP_Mailbox::prefTo方法的具體用法?PHP IMP_Mailbox::prefTo怎麽用?PHP IMP_Mailbox::prefTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IMP_Mailbox
的用法示例。
在下文中一共展示了IMP_Mailbox::prefTo方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setValue
/**
* Sets a property with a specified value.
*
* @see setValue()
*/
public function setValue($key, $val, $identity = null)
{
switch ($key) {
case 'alias_addr':
case 'bcc_addr':
case 'replyto_addr':
case 'tieto_addr':
if (is_string($val) && strpbrk($val, "\r\n") !== false) {
$val = preg_split("/[\r\n]+/", $val);
}
/* Validate Reply-To, Alias, Tie-to, and BCC addresses. */
$val = IMP::parseAddressList($val, array('limit' => $val == 'replyto_addr' ? 1 : 0))->addresses;
break;
case IMP_Mailbox::MBOX_SENT:
$GLOBALS['injector']->getInstance('IMP_Mailbox_SessionCache')->expire(IMP_Mailbox_SessionCache::CACHE_SPECIALMBOXES);
$val = IMP_Mailbox::prefTo($val);
break;
}
return parent::setValue($key, $val, $identity);
}
示例2: setValue
/**
* Sets a property with a specified value.
*
* @see setValue()
*/
public function setValue($key, $val, $identity = null)
{
switch ($key) {
case 'alias_addr':
case 'bcc_addr':
case 'replyto_addr':
case 'tieto_addr':
if (is_string($val) && strpbrk($val, "\r\n") !== false) {
$val = preg_split("/[\r\n]+/", $val);
}
/* Validate Reply-To, Alias, Tie-to, and BCC addresses. */
$ob = IMP::parseAddressList($val, array('limit' => $val == 'replyto_addr' ? 1 : 0));
foreach ($ob as $address) {
try {
IMP::parseAddressList($address, array('validate' => true));
} catch (Horde_Mail_Exception $e) {
throw new Horde_Prefs_Exception(sprintf(_("\"%s\" is not a valid email address.", strval($address))));
}
}
$val = $ob->addresses;
break;
case IMP_Mailbox::MBOX_SENT:
$GLOBALS['injector']->getInstance('IMP_Mailbox_SessionCache')->expire(IMP_Mailbox_SessionCache::CACHE_SPECIALMBOXES);
$val = IMP_Mailbox::prefTo($val);
break;
}
return parent::setValue($key, $val, $identity);
}