当前位置: 首页>>代码示例>>PHP>>正文


PHP Horde_Mime_Headers::parseHeaders方法代码示例

本文整理汇总了PHP中Horde_Mime_Headers::parseHeaders方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Mime_Headers::parseHeaders方法的具体用法?PHP Horde_Mime_Headers::parseHeaders怎么用?PHP Horde_Mime_Headers::parseHeaders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Horde_Mime_Headers的用法示例。


在下文中一共展示了Horde_Mime_Headers::parseHeaders方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _renderInfo

 /**
  * Return the rendered information about the Horde_Mime_Part object.
  *
  * @return array  See parent::render().
  */
 protected function _renderInfo()
 {
     global $registry;
     if ($registry->getView() == $registry::VIEW_MINIMAL) {
         return array();
     }
     $status = array();
     $mime_id = $this->_mimepart->getMimeId();
     $headers = Horde_Mime_Headers::parseHeaders($this->getConfigParam('imp_contents')->getBodyPart($mime_id, array('length' => 0, 'mimeheaders' => true, 'stream' => true))->data);
     if (($duration = $headers->getValue('content-duration')) !== null) {
         $text = array();
         if ($minutes = floor($duration / 60)) {
             $text[] = sprintf(ngettext(_("%d minute"), _("%d minutes"), $minutes), $minutes);
         }
         if ($seconds = $duration % 60) {
             $text[] = sprintf(ngettext(_("%d second"), _("%d seconds"), $seconds), $seconds);
         }
         $status[] = sprintf(_("This video file is reported to be %s in length."), implode(' ', $text));
     }
     if ($this->_thumbnailBinary()) {
         $status[] = _("This is a thumbnail of a video attachment.");
         $status[] = $this->getConfigParam('imp_contents')->linkViewJS($this->_mimepart, 'view_attach', '<img src="' . $this->getConfigParam('imp_contents')->urlView($this->_mimepart, 'view_attach', array('params' => array('imp_video_view' => 'view_thumbnail'))) . '" />', null, null, null);
     }
     if (empty($status)) {
         return array();
     }
     $s = new IMP_Mime_Status($status);
     $s->icon('mime/video.png');
     return array($this->_mimepart->getMimeId() => array('data' => '', 'status' => $s, 'type' => 'text/html; charset=UTF-8'));
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:35,代码来源:Video.php

示例2: testMIMEEncodingWhenStandardHeadersAreAdded

 /**
  * See Bug #13456  Wnen we add the Message-Id/User-Agent headers, make sure
  * we don't cause the subject header to not be MIME encoded.
  */
 public function testMIMEEncodingWhenStandardHeadersAreAdded()
 {
     $fixture = file_get_contents(__DIR__ . '/fixtures/mime_encoding.eml');
     $rfc822 = new Horde_ActiveSync_Rfc822($fixture, true);
     $hdrs = Horde_Mime_Headers::parseHeaders($rfc822->getString());
     $hdr_array = $hdrs->toArray(array('charset' => 'UTF-8'));
     $this->assertEquals('=?utf-8?b?w4PDhMOjw6s=?=', $hdr_array['Subject']);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:12,代码来源:Rfc822Test.php

示例3: loadFixtures

 /**
  * TODO
  */
 public function loadFixtures($dir)
 {
     $this->_fixtures = array();
     $dh = opendir($dir);
     while (($dent = readdir($dh)) !== false) {
         if (!in_array($dent, array('.', '..'))) {
             $this->_fixtures[$dent] = Horde_Mime_Headers::parseHeaders(file_get_contents($dir . '/' . $dent));
         }
     }
     closedir($dh);
     $i = 0;
     foreach (array_keys($this->_fixtures) as $key) {
         $this->_folders['INBOX'][] = array('uid' => ++$i, 'fixture' => $key, 'deleted' => false);
     }
 }
开发者ID:horde,项目名称:horde,代码行数:18,代码来源:Mock.php

示例4: _renderInfo

 /**
  * Return the rendered information about the Horde_Mime_Part object.
  *
  * @return array  See parent::render().
  */
 protected function _renderInfo()
 {
     $mime_id = $this->_mimepart->getMimeId();
     $headers = Horde_Mime_Headers::parseHeaders($this->getConfigParam('imp_contents')->getBodyPart($mime_id, array('length' => 0, 'mimeheaders' => true, 'stream' => true))->data);
     if (($duration = $headers->getValue('content-duration')) === null) {
         return array();
     }
     $text = array();
     if ($minutes = floor($duration / 60)) {
         $text[] = sprintf(ngettext(_("%d minute"), _("%d minutes"), $minutes), $minutes);
     }
     if ($seconds = $duration % 60) {
         $text[] = sprintf(ngettext(_("%d second"), _("%d seconds"), $seconds), $seconds);
     }
     $status = new IMP_Mime_Status(sprintf(_("This audio file is reported to be %s in length."), implode(' ', $text)));
     $status->icon('mime/audio.png');
     return array($this->_mimepart->getMimeId() => array('data' => '', 'status' => $status, 'type' => 'text/html; charset=UTF-8'));
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:23,代码来源:Audio.php

示例5: _renderInfo

 /**
  * Return the rendered information about the Horde_Mime_Part object.
  *
  * @return array  See parent::render().
  */
 protected function _renderInfo()
 {
     /* Get the text of the part.  Since we need to look for the end of
      * the headers by searching for the CRLFCRLF sequence, use
      * getCanonicalContents() to make sure we are getting the text with
      * CRLF's. */
     $text = $this->_mimepart->getContents(array('canonical' => true));
     if (empty($text)) {
         return array();
     }
     /* Search for the end of the header text (CRLFCRLF). */
     $text = substr($text, 0, strpos($text, "\r\n\r\n"));
     /* Get the list of headers now. */
     $headers = Horde_Mime_Headers::parseHeaders($text);
     $header_array = array('date' => Horde_Mime_Viewer_Translation::t("Date"), 'from' => Horde_Mime_Viewer_Translation::t("From"), 'to' => Horde_Mime_Viewer_Translation::t("To"), 'cc' => Horde_Mime_Viewer_Translation::t("Cc"), 'bcc' => Horde_Mime_Viewer_Translation::t("Bcc"), 'reply-to' => Horde_Mime_Viewer_Translation::t("Reply-To"), 'subject' => Horde_Mime_Viewer_Translation::t("Subject"));
     $header_output = array();
     foreach ($header_array as $key => $val) {
         $hdr = $this->_getHeaderValue($headers, $key);
         if (!empty($hdr)) {
             $header_output[] = '<strong>' . $val . ':</strong> ' . htmlspecialchars($hdr);
         }
     }
     return $this->_renderReturn(empty($header_output) ? '' : '<div class="fixed mimeHeaders">' . $this->_textFilter(implode("<br />\n", $header_output), 'emails') . '</div>', 'text/html; charset=UTF-8');
 }
开发者ID:horde,项目名称:horde,代码行数:29,代码来源:Rfc822.php

示例6: fetchHeaders

 public function fetchHeaders($folder, $uid)
 {
     return Horde_Mime_Headers::parseHeaders($this->messages[$folder][$uid]);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:4,代码来源:Driver.php

示例7: _getHeaders

 /**
  * Return representation of a header field.
  *
  * @param string $id       The header id.
  * @param integer $format  The return format. If self::HEADER_PARSE,
  *                         returns a Horde_Mime_Headers object. If
  *                         self::HEADER_STREAM, returns a stream.
  *                         Otherwise, returns header text.
  * @param integer $key     The array key where the data is stored in the
  *                         internal array.
  *
  * @return mixed  The data in the format specified by $format.
  */
 protected function _getHeaders($id, $format, $key)
 {
     switch ($format) {
         case self::HEADER_STREAM:
             if (!isset($this->_data[$key][$id])) {
                 return $this->_msgText(true, null);
             } elseif (is_object($this->_data[$key][$id])) {
                 return $this->_getHeaders($id, 0, $key);
             }
             return $this->_msgText(true, $this->_data[$key][$id]);
         case self::HEADER_PARSE:
             if (!isset($this->_data[$key][$id])) {
                 return new Horde_Mime_Headers();
             } elseif (is_object($this->_data[$key][$id])) {
                 return clone $this->_data[$key][$id];
             }
             return Horde_Mime_Headers::parseHeaders($this->_getHeaders($id, self::HEADER_STREAM, $key));
     }
     if (!isset($this->_data[$key][$id])) {
         return '';
     }
     return is_object($this->_data[$key][$id]) ? $this->_data[$key][$id]->toString(array('nowrap' => true)) : $this->_msgText(false, $this->_data[$key][$id]);
 }
开发者ID:pzhu2004,项目名称:moodle,代码行数:36,代码来源:Fetch.php

示例8: testInvalidHeaderParsing

 public function testInvalidHeaderParsing()
 {
     $data = file_get_contents(__DIR__ . '/fixtures/invalid_hdr.txt');
     $hdrs = Horde_Mime_Headers::parseHeaders($data);
     $this->assertEquals('foo@example.com', strval($hdrs['to']));
     $this->assertNull($hdrs['From test2@example.com  Sun Apr  5 09']);
 }
开发者ID:horde,项目名称:horde,代码行数:7,代码来源:HeadersTest.php

示例9: testMultiplePriorityHeaders

 public function testMultiplePriorityHeaders()
 {
     $hdrs = Horde_Mime_Headers::parseHeaders("Importance: High\n" . "Importance: Low\n");
     $this->assertInternalType('string', $hdrs->getValue('importance', Horde_Mime_Headers::VALUE_BASE));
     $this->assertEquals('High', $hdrs->getValue('importance'));
     $hdrs = Horde_Mime_Headers::parseHeaders("X-Priority: 1\n" . "X-priority: 5\n");
     $this->assertInternalType('string', $hdrs->getValue('x-priority', Horde_Mime_Headers::VALUE_BASE));
     $this->assertEquals('1', $hdrs->getValue('x-priority'));
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:9,代码来源:HeadersTest.php

示例10: getMessageChanges

 /**
  * Return message changes from the specified mailbox.
  *
  * @param Horde_ActiveSync_Folder_Imap $folder  The folder object.
  * @param array $options                        Additional options:
  *  - sincedate: (integer)  Timestamp of earliest message to retrieve.
  *               DEFAULT: 0 (Don't filter).
  *  - protocolversion: (float)  EAS protocol version to support.
  *                     DEFAULT: none REQUIRED
  *  - softdelete: (boolean)  If true, calculate SOFTDELETE data.
  *                           @since 2.8.0
  *
  * @return Horde_ActiveSync_Folder_Imap  The folder object, containing any
  *                                       change instructions for the device.
  *
  * @throws Horde_ActiveSync_Exception_FolderGone,
  *         Horde_ActiveSync_Exception, Horde_ActiveSync_Exception_StaleState
  */
 public function getMessageChanges(Horde_ActiveSync_Folder_Imap $folder, array $options = array())
 {
     $imap = $this->_getImapOb();
     $mbox = new Horde_Imap_Client_Mailbox($folder->serverid());
     // Note: non-CONDSTORE servers will return a highestmodseq of 0
     $status_flags = Horde_Imap_Client::STATUS_HIGHESTMODSEQ | Horde_Imap_Client::STATUS_UIDVALIDITY | Horde_Imap_Client::STATUS_UIDNEXT_FORCE | Horde_Imap_Client::STATUS_MESSAGES | Horde_Imap_Client::STATUS_FORCE_REFRESH;
     try {
         $status = $imap->status($mbox, $status_flags);
     } catch (Horde_Imap_Client_Exception $e) {
         // If we can't status the mailbox, assume it's gone.
         throw new Horde_ActiveSync_Exception_FolderGone($e);
     }
     $this->_logger->info(sprintf('[%s] IMAP status: %s', $this->_procid, serialize($status)));
     $flags = array();
     $categories = array();
     $modseq = $status[Horde_ActiveSync_Folder_Imap::HIGHESTMODSEQ];
     if ($modseq && $folder->modseq() > 0 && $folder->modseq() < $modseq) {
         $this->_logger->info(sprintf('[%s] CONDSTORE and CHANGES', $this->_procid));
         $folder->checkValidity($status);
         $query = new Horde_Imap_Client_Fetch_Query();
         $query->modseq();
         $query->flags();
         $query->headerText(array('peek' => true));
         try {
             $fetch_ret = $imap->fetch($mbox, $query, array('changedsince' => $folder->modseq()));
         } catch (Horde_Imap_Client_Exception $e) {
             $this->_logger->err($e->getMessage());
             throw new Horde_ActiveSync_Exception($e);
         }
         // Prepare the changes and flags array, ensuring no changes after
         // $modseq sneak in yet (they will be caught on the next PING or
         // SYNC).
         $changes = array();
         // Get custom flags to use as categories.
         $msgFlags = $this->_getMsgFlags();
         foreach ($fetch_ret as $uid => $data) {
             if ($options['sincedate']) {
                 $since = new Horde_Date($options['sincedate']);
                 $headers = Horde_Mime_Headers::parseHeaders($data->getHeaderText());
                 try {
                     $date = new Horde_Date($headers->getValue('Date'));
                     if ($date->compareDate($since) <= -1) {
                         // Ignore, it's out of the FILTERTYPE range.
                         $this->_logger->info(sprintf('[%s] Ignoring UID %s since it is outside of the FILTERTYPE (%s)', $this->_procid, $uid, $headers->getValue('Date')));
                         continue;
                     }
                 } catch (Horde_Date_Exception $e) {
                 }
             }
             if ($data->getModSeq() <= $modseq) {
                 $changes[] = $uid;
                 $flags[$uid] = array('read' => array_search(Horde_Imap_Client::FLAG_SEEN, $data->getFlags()) !== false ? 1 : 0);
                 if ($options['protocolversion'] > Horde_ActiveSync::VERSION_TWOFIVE) {
                     $flags[$uid]['flagged'] = array_search(Horde_Imap_Client::FLAG_FLAGGED, $data->getFlags()) !== false ? 1 : 0;
                 }
                 if ($options['protocolversion'] > Horde_ActiveSync::VERSION_TWELVEONE) {
                     $categories[$uid] = array();
                     foreach ($data->getFlags() as $flag) {
                         if (($key = array_search(strtolower($flag), array_map('strtolower', $msgFlags))) !== false) {
                             $categories[$uid][] = $msgFlags[$key];
                         }
                     }
                 }
             }
         }
         $folder->setChanges($changes, $flags, $categories);
         try {
             $deleted = $imap->vanished($mbox, $folder->modseq(), array('ids' => new Horde_Imap_Client_Ids($folder->messages())));
         } catch (Horde_Imap_Client_Excetion $e) {
             $this->_logger->err($e->getMessage());
             throw new Horde_ActiveSync_Exception($e);
         }
         $folder->setRemoved($deleted->ids);
         if (!empty($options['softdelete']) && !empty($options['sincedate'])) {
             $this->_logger->info(sprintf('[%s] Polling for SOFTDELETE in %s before %d', $this->_procid, $folder->serverid(), $options['sincedate']));
             $query = new Horde_Imap_Client_Search_Query();
             $query->dateSearch(new Horde_Date($options['sincedate']), Horde_Imap_Client_Search_Query::DATE_BEFORE);
             $query->ids(new Horde_Imap_Client_Ids($folder->messages()));
             try {
                 $search_ret = $imap->search($mbox, $query, array('results' => array(Horde_Imap_Client::SEARCH_RESULTS_MATCH)));
             } catch (Horde_Imap_Client_Exception $e) {
                 $this->_logger->err($e->getMessage());
//.........这里部分代码省略.........
开发者ID:jubinpatel,项目名称:horde,代码行数:101,代码来源:Adapter.php

示例11: processMail

 /**
  * Parse a MIME message and create a new ticket.
  *
  * @param string $text       This is the full text of the MIME message.
  * @param array $info        An array of information for the new ticket.
  *                           This should include:
  *                           - 'queue'    => queue id
  *                           - 'type'     => type id
  *                           - 'state'    => state id
  *                           - 'priority' => priority id
  *                           - 'ticket'   => ticket id (prevents creation
  *                                           of new tickets)
  * @param string $auth_user  This will be the Horde user that creates the
  *                           ticket. If null, we will try to deduce from
  *                           the message's From: header. We do NOT default
  *                           to $GLOBALS['registry']->getAuth().
  *
  * @return Whups_Ticket  Ticket.
  */
 public static function processMail($text, array $info, $auth_user = null)
 {
     global $conf;
     $message = Horde_Mime_Part::parseMessage($text);
     if (preg_match("/^(.*?)\r?\n\r?\n/s", $text, $matches)) {
         $hdrText = $matches[1];
     } else {
         $hdrText = $text;
     }
     $headers = Horde_Mime_Headers::parseHeaders($hdrText);
     // If this message was generated by Whups, don't process it.
     if ($headers->getValue('X-Whups-Generated')) {
         return true;
     }
     // Try to avoid bounces, auto-replies, and mailing list responses.
     $from = $headers->getValue('from');
     if (strpos($headers->getValue('Content-Type'), 'multipart/report') !== false || stripos($from, 'mailer-daemon@') !== false || stripos($from, 'postmaster@') !== false || !is_null($headers->getValue('X-Failed-Recipients')) || !is_null($headers->getValue('X-Autoreply-Domain')) || $headers->getValue('Auto-Submitted') == 'auto-replied' || $headers->getValue('Precedence') == 'auto_reply' || $headers->getValue('X-Precedence') == 'auto_reply' || $headers->getValue('X-Auto-Response-Suppress') == 'All' || $headers->getValue('X-List-Administrivia') == 'Yes') {
         return true;
     }
     // Use the message subject as the ticket summary.
     $info['summary'] = trim($headers->getValue('subject'));
     if (empty($info['summary'])) {
         $info['summary'] = _("[No Subject]");
     }
     // Format the message into a comment.
     $comment = _("Received message:") . "\n\n";
     if (!empty($GLOBALS['conf']['mail']['include_headers'])) {
         foreach ($headers->toArray(array('nowrap' => true)) as $name => $vals) {
             if (!in_array(strtolower($name), array('subject', 'from', 'to', 'cc', 'date'))) {
                 if (is_array($vals)) {
                     foreach ($vals as $val) {
                         $comment .= $name . ': ' . $val . "\n";
                     }
                 } else {
                     $comment .= $name . ': ' . $vals . "\n";
                 }
             }
         }
         $comment .= "\n";
     }
     // Look for the body part.
     $body_id = $message->findBody();
     if ($body_id) {
         $part = $message->getPart($body_id);
         $content = Horde_String::convertCharset($part->getContents(), $part->getCharset(), 'UTF-8');
         switch ($part->getType()) {
             case 'text/plain':
                 $comment .= $content;
                 break;
             case 'text/html':
                 $comment .= Horde_Text_Filter::filter($content, array('Html2text'), array(array('width' => 0)));
                 break;
             default:
                 $comment .= _("[ Could not render body of message. ]");
                 break;
         }
     } else {
         $comment .= _("[ Could not render body of message. ]");
     }
     $info['comment'] = $comment . "\n";
     // Try to determine the Horde user for creating the ticket.
     if (empty($auth_user)) {
         $tmp = new Horde_Mail_Rfc822_Address($from);
         $auth_user = self::_findAuthUser($tmp->bare_address);
     }
     $author = $auth_user;
     if (empty($auth_user) && !empty($info['default_auth'])) {
         $auth_user = $info['default_auth'];
         if (!empty($from)) {
             $info['user_email'] = $from;
         }
     }
     if (empty($auth_user) && !empty($conf['mail']['username'])) {
         $auth_user = $conf['mail']['username'];
         if (!empty($from)) {
             $info['user_email'] = $from;
         }
     }
     // Authenticate as the correct Horde user.
     if (!empty($auth_user) && $auth_user != $GLOBALS['registry']->getAuth()) {
         $GLOBALS['registry']->setAuth($auth_user, array());
//.........这里部分代码省略.........
开发者ID:jubinpatel,项目名称:horde,代码行数:101,代码来源:Mail.php

示例12: fetchHeaders

 /**
  * Retrieves the message headers.
  *
  * @param string $folder The folder to fetch the message from.
  * @param array  $uid    The message UID.
  *
  * @return Horde_Mime_Headers The message headers.
  */
 public function fetchHeaders($folder, $uid)
 {
     $query = new Horde_Imap_Client_Fetch_Query();
     $query->headerText();
     try {
         $ret = $this->getBackend()->fetch($folder, $query, array('ids' => new Horde_Imap_Client_Ids($uid)));
         $msg = $ret[$uid]->getHeaderText();
     } catch (Horde_Imap_Client_Exception_ServerResponse $e) {
         throw new Horde_Kolab_Storage_Exception($e->details);
     } catch (Horde_Imap_Client_Exception $e) {
         throw new Horde_Kolab_Storage_Exception($e);
     }
     return Horde_Mime_Headers::parseHeaders($msg);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:22,代码来源:Imap.php

示例13: fetchComplete

 /**
  * Retrieves a complete message.
  *
  * @param string $folder The folder to fetch the messages from.
  * @param array  $uid    The message UID.
  *
  * @return array The message encapsuled as an array that contains a
  *               Horde_Mime_Headers and a Horde_Mime_Part object.
  */
 public function fetchComplete($folder, $uid)
 {
     $this->select($folder);
     return array(Horde_Mime_Headers::parseHeaders(Horde_Kolab_Storage_Exception_Pear::catchError($this->getBackend()->getRawHeaders($uid, '', true))), Horde_Mime_Part::parseMessage(Horde_Kolab_Storage_Exception_Pear::catchError($this->getBackend()->getBody($uid, true))));
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:14,代码来源:Pear.php

示例14: _renderInfo

 /**
  * Return the rendered information about the Horde_Mime_Part object.
  *
  * @return array  See parent::render().
  */
 protected function _renderInfo()
 {
     $imp_contents = $this->getConfigParam('imp_contents');
     $machine = $original = $status = null;
     $mime_id = $this->_mimepart->getMimeId();
     $ret = array();
     switch ($this->_mimepart->getType()) {
         case 'message/delivery-status':
             $machine = $imp_contents->getMimePart($mime_id);
             break;
         case 'multipart/report':
             /* RFC 3464 [2]: There are three parts to a delivery status
              * multipart/report message:
              *   (1) Human readable message
              *   (2) Machine parsable body part (message/delivery-status)
              *   (3) Returned message (optional) */
             $iterator = $this->_mimepart->partIterator(false);
             $iterator->rewind();
             if (!($curr = $iterator->current())) {
                 break;
             }
             $part1_id = $curr->getMimeId();
             $id_ob = new Horde_Mime_Id($part1_id);
             /* Technical details. */
             $id_ob->id = $id_ob->idArithmetic($id_ob::ID_NEXT);
             $ret[$id_ob->id] = null;
             $machine = $imp_contents->getMimePart($id_ob->id);
             /* Returned message. */
             $original = $imp_contents->getMimePart($id_ob->idArithmetic($id_ob::ID_NEXT));
             if ($original) {
                 foreach ($this->_mimepart->partIterator() as $val) {
                     $ret[$val->getMimeId()] = null;
                 }
                 /* Allow the human readable part to be displayed
                  * separately. */
                 unset($ret[$part1_id]);
             }
             break;
     }
     if (!$machine) {
         return array($mime_id => null);
     }
     $parse = Horde_Mime_Headers::parseHeaders(preg_replace('/\\n{2,}/', "\n", strtr($machine->getContents(), "\r", "\n")));
     /* Information on the message status is found in the 'Action'
      * field located in part #2 (RFC 3464 [2.3.3]). */
     if (isset($parse['Action'])) {
         switch (trim($parse['Action']->value_single)) {
             case 'failed':
             case 'delayed':
                 $msg_link = _("View details of the returned message.");
                 $status_action = IMP_Mime_Status::ERROR;
                 $status_msg = _("ERROR: Your message could not be delivered.");
                 break;
             case 'delivered':
             case 'expanded':
             case 'relayed':
                 $msg_link = _("View details of the delivered message.");
                 $status_action = IMP_Mime_Status::SUCCESS;
                 $status_msg = _("Your message was successfully delivered.");
                 break;
         }
         if (isset($msg_link)) {
             $status = new IMP_Mime_Status($this->_mimepart, $status_msg);
             $status->action($status_action);
             if (isset($parse['Final-Recipient'])) {
                 list(, $recip) = explode(';', $parse['Final-Recipient']->value_single);
                 $recip_ob = new Horde_Mail_Rfc822_List($recip);
                 if (count($recip_ob)) {
                     $status->addText(sprintf(_("Recipient: %s"), $recip_ob[0]));
                 }
             }
             /* Display a link to the returned message, if it exists. */
             if ($original) {
                 $status->addText($imp_contents->linkViewJS($original, 'view_attach', $msg_link, array('params' => array('ctype' => 'message/rfc822'))));
             }
         }
     }
     $ret[$mime_id] = array_filter(array('data' => '', 'status' => $status ?: null, 'type' => 'text/html; charset=' . $this->getConfigParam('charset'), 'wrap' => 'mimePartWrap'));
     return $ret;
 }
开发者ID:horde,项目名称:horde,代码行数:85,代码来源:Status.php

示例15: _getHeaders

 /**
  * Return representation of a header field.
  *
  * @param string $id       The header id.
  * @param integer $format  The return format. If self::HEADER_PARSE,
  *                         returns a Horde_Mime_Headers object. If
  *                         self::HEADER_STREAM, returns a stream.
  *                         Otherwise, returns header text.
  * @param integer $key     The array key where the data is stored in the
  *                         internal array.
  *
  * @return mixed  The data in the format specified by $format.
  */
 protected function _getHeaders($id, $format, $key)
 {
     switch ($format) {
         case self::HEADER_STREAM:
             if (!isset($this->_data[$key][$id])) {
                 $data = null;
             } elseif (is_object($this->_data[$key][$id])) {
                 switch ($key) {
                     case Horde_Imap_Client::FETCH_HEADERS:
                         $data = $this->_getHeaders($id, 0, $key);
                         break;
                     case Horde_Imap_Client::FETCH_HEADERTEXT:
                     case Horde_Imap_Client::FETCH_MIMEHEADER:
                         return $this->_data[$key][$id]->stream;
                 }
             } else {
                 $data = $this->_data[$key][$id];
             }
             return $this->_msgText(true, $data);
         case self::HEADER_PARSE:
             if (!isset($this->_data[$key][$id])) {
                 return new Horde_Mime_Headers();
             } elseif (is_object($this->_data[$key][$id])) {
                 switch ($key) {
                     case Horde_Imap_Client::FETCH_HEADERS:
                         return clone $this->_data[$key][$id];
                     case Horde_Imap_Client::FETCH_HEADERTEXT:
                     case Horde_Imap_Client::FETCH_MIMEHEADER:
                         $hdrs = $this->_data[$key][$id];
                         break;
                 }
             } else {
                 $hdrs = $this->_getHeaders($id, self::HEADER_STREAM, $key);
             }
             return Horde_Mime_Headers::parseHeaders($hdrs);
     }
     if (!isset($this->_data[$key][$id])) {
         return '';
     }
     if (is_object($this->_data[$key][$id])) {
         switch ($key) {
             case Horde_Imap_Client::FETCH_HEADERS:
                 return $this->_data[$key][$id]->toString(array('nowrap' => true));
             case Horde_Imap_Client::FETCH_HEADERTEXT:
             case Horde_Imap_Client::FETCH_MIMEHEADER:
                 return strval($this->_data[$key][$id]);
         }
     }
     return $this->_msgText(false, $this->_data[$key][$id]);
 }
开发者ID:Gomez,项目名称:horde,代码行数:63,代码来源:Fetch.php


注:本文中的Horde_Mime_Headers::parseHeaders方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。