本文整理汇总了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);
}