toArray() public method

Output the address list.
public toArray ( integer $limit = null ) : object
$limit integer Limit display to this many addresses. If null, shows all addresses.
return object Object with the following properties: - addr: (array) Array of objects with 2 possible formats: - Address keys: 'b' (bare address); 'p' (personal part) - Group keys: 'a' (list of addresses); 'g' (group name) - Both: 'v' (full value of address) - limit: (boolean) True if limit was reached. - total: (integer) Total address count.
コード例 #1
0
ファイル: ShowMessage.php プロジェクト: jubinpatel/horde
 /**
  * Return data to build an address header.
  *
  * @param string $header  The address header.
  * @param integer $limit  Limit display to this many addresses. If null,
  *                        shows all addresses.
  *
  * @return array  An array with the following entries:
  *   - addr: (array) List of addresses/groups.
  *           Group keys: 'a' (list of addresses); 'g' (group name)
  *           Address keys: 'b' (bare address); 'p' (personal part)
  *   - limit: (integer) If limit was reached, the number of total
  *            addresses.
  *   - raw: (string) A raw string to display instead of addresses.
  */
 public function getAddressHeader($header, $limit = 50)
 {
     $addrlist = $header == 'reply-to' ? $this->_envelope->reply_to : $this->_envelope->{$header};
     $addrlist->unique();
     $addr_ob = new IMP_Ajax_Addresses($addrlist);
     $addr_array = $addr_ob->toArray($limit);
     $out = array();
     if ($addr_array->limit) {
         $out['limit'] = $addr_array->total;
     }
     if (!empty($addr_array->addr)) {
         $out['addr'] = $addr_array->addr;
     } elseif ($header == 'to') {
         $out['raw'] = _("Undisclosed Recipients");
     }
     return $out;
 }
コード例 #2
0
ファイル: Message.php プロジェクト: raz0rsdge/horde
 /**
  * Return data to build an address header.
  *
  * @param mixed $header   The address header name (string) or a
  *                        Horde_Mime_Rfc822_List object.
  * @param integer $limit  Limit display to this many addresses. If null,
  *                        shows all addresses.
  *
  * @return array  An array with the following entries:
  *   - addr: (array) List of addresses/groups.
  *           Group keys: 'a' (list of addresses); 'g' (group name)
  *           Address keys: 'b' (bare address); 'p' (personal part)
  *           Both: 'v' (full value)
  *   - limit: (integer) If limit was reached, the number of total
  *            addresses.
  *   - raw: (string) A raw string to display instead of addresses.
  */
 public function getAddressHeader($header, $limit = 50)
 {
     if ($header instanceof Horde_Mail_Rfc822_List) {
         $addrlist = $header;
     } else {
         $addrlist = $this->_envelope->{strval($header)};
     }
     $addrlist->unique();
     $addr_ob = new IMP_Ajax_Addresses($addrlist);
     $addr_array = $addr_ob->toArray($limit);
     $out = array();
     if ($addr_array->limit) {
         $out['limit'] = $addr_array->total;
     }
     if (!empty($addr_array->addr)) {
         $out['addr'] = $addr_array->addr;
     } elseif ($header == 'to') {
         $out['raw'] = _("Undisclosed Recipients");
     }
     return $out;
 }
コード例 #3
0
ファイル: ListMessages.php プロジェクト: horde/horde
 /**
  * Obtains IMAP overview data for a given set of message UIDs.
  *
  * @param IMP_Mailbox $mbox  The current mailbox.
  * @param array $msglist     The list of message sequence numbers to
  *                           process.
  *
  * @return array  TODO
  * @throws Horde_Exception
  */
 private function _getOverviewData($mbox, $msglist)
 {
     global $injector;
     $msgs = array();
     if (empty($msglist)) {
         return $msgs;
     }
     /* Get mailbox information. */
     $flags = $mbox->access_flags;
     $imp_flags = $injector->getInstance('IMP_Flags');
     $imp_ui = new IMP_Mailbox_Ui($mbox);
     $list_ob = $mbox->list_ob;
     $overview = $list_ob->getMailboxArray($msglist);
     /* Display message information. */
     reset($overview['overview']);
     while (list(, $ob) = each($overview['overview'])) {
         /* Get all the flag information. */
         $msg = array('flag' => $flags ? array_map('strval', $imp_flags->parse(array('flags' => $ob['flags'], 'headers' => $ob['headers'], 'personal' => $ob['envelope']->to, 'runhook' => $ob, 'structure' => $ob['structure']))) : array());
         /* Format size information. */
         $msg['size'] = IMP::sizeFormat($ob['size']);
         /* Format the Date: Header. */
         $msg['date'] = strval(new IMP_Message_Date(isset($ob['envelope']->date) ? $ob['envelope']->date : null));
         /* Format the From: Header. */
         $getfrom = $imp_ui->getFrom($ob['envelope']);
         if (count($getfrom['from_list'])) {
             $from_ob = new IMP_Ajax_Addresses($getfrom['from_list']);
             $msg['from'] = $from_ob->toArray()->addr;
             if (isset($getfrom['from_label'])) {
                 $msg['fromlabel'] = $getfrom['from_label'];
             }
         } else {
             $msg['from'] = array();
             $msg['fromlabel'] = $getfrom['from'];
         }
         /* Format the Subject: Header. */
         $msg['subject'] = $imp_ui->getSubject($ob['envelope']->subject);
         /* Check to see if this is a list message. Namely, we want to
          * check for 'List-Post' information because that is the header
          * that gives the e-mail address to reply to, which is all we
          * care about. */
         if (isset($ob['headers']['List-Post'])) {
             $msg['listmsg'] = 1;
         }
         $msgs[$list_ob->getBuid($ob['mailbox'], $ob['uid'])] = $msg;
     }
     return $msgs;
 }