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


PHP Horde_Imap_Client_Fetch_Query::fullText方法代码示例

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


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

示例1: fetchFromUrl

 /**
  * Given an IMAP URL, fetches the corresponding part.
  *
  * @param Horde_Imap_Client_Url_Imap $url  An IMAP URL.
  *
  * @return resource  The section contents in a stream. Returns null if
  *                   the part could not be found.
  *
  * @throws Horde_Imap_Client_Exception
  */
 public function fetchFromUrl(Horde_Imap_Client_Url_Imap $url)
 {
     $ids_ob = $this->_socket->getIdsOb($url->uid);
     // BODY[]
     if (is_null($url->section)) {
         $query = new Horde_Imap_Client_Fetch_Query();
         $query->fullText(array('peek' => true));
         $fetch = $this->_socket->fetch($url->mailbox, $query, array('ids' => $ids_ob));
         return $fetch[$url->uid]->getFullMsg(true);
     }
     $section = trim($url->section);
     // BODY[<#.>HEADER.FIELDS<.NOT>()]
     if (($pos = stripos($section, 'HEADER.FIELDS')) !== false) {
         $hdr_pos = strpos($section, '(');
         $cmd = substr($section, 0, $hdr_pos);
         $query = new Horde_Imap_Client_Fetch_Query();
         $query->headers('section', explode(' ', substr($section, $hdr_pos + 1, strrpos($section, ')') - $hdr_pos)), array('id' => $pos ? substr($section, 0, $pos - 1) : 0, 'notsearch' => stripos($cmd, '.NOT') !== false, 'peek' => true));
         $fetch = $this->_socket->fetch($url->mailbox, $query, array('ids' => $ids_ob));
         return $fetch[$url->uid]->getHeaders('section', Horde_Imap_Client_Data_Fetch::HEADER_STREAM);
     }
     // BODY[#]
     if (is_numeric(substr($section, -1))) {
         $query = new Horde_Imap_Client_Fetch_Query();
         $query->bodyPart($section, array('peek' => true));
         $fetch = $this->_socket->fetch($url->mailbox, $query, array('ids' => $ids_ob));
         return $fetch[$url->uid]->getBodyPart($section, true);
     }
     // BODY[<#.>HEADER]
     if (($pos = stripos($section, 'HEADER')) !== false) {
         $id = $pos ? substr($section, 0, $pos - 1) : 0;
         $query = new Horde_Imap_Client_Fetch_Query();
         $query->headerText(array('id' => $id, 'peek' => true));
         $fetch = $this->_socket->fetch($url->mailbox, $query, array('ids' => $ids_ob));
         return $fetch[$url->uid]->getHeaderText($id, Horde_Imap_Client_Data_Fetch::HEADER_STREAM);
     }
     // BODY[<#.>TEXT]
     if (($pos = stripos($section, 'TEXT')) !== false) {
         $id = $pos ? substr($section, 0, $pos - 1) : 0;
         $query = new Horde_Imap_Client_Fetch_Query();
         $query->bodyText(array('id' => $id, 'peek' => true));
         $fetch = $this->_socket->fetch($url->mailbox, $query, array('ids' => $ids_ob));
         return $fetch[$url->uid]->getBodyText($id, true);
     }
     // BODY[<#.>MIMEHEADER]
     if (($pos = stripos($section, 'MIME')) !== false) {
         $id = $pos ? substr($section, 0, $pos - 1) : 0;
         $query = new Horde_Imap_Client_Fetch_Query();
         $query->mimeHeader($id, array('peek' => true));
         $fetch = $this->_socket->fetch($url->mailbox, $query, array('ids' => $ids_ob));
         return $fetch[$url->uid]->getMimeHeader($id, Horde_Imap_Client_Data_Fetch::HEADER_STREAM);
     }
     return null;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:63,代码来源:Catenate.php

示例2: 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)
 {
     $query = new Horde_Imap_Client_Fetch_Query();
     $query->fullText();
     try {
         $ret = $this->getBackend()->fetch($folder, $query, array('ids' => new Horde_Imap_Client_Ids($uid)));
         if (!isset($ret[$uid])) {
             throw new Horde_Kolab_Storage_Exception(sprintf(Horde_Kolab_Storage_Translation::t("Failed fetching message %s in folder %s."), $uid, $folder));
         }
         $msg = $ret[$uid]->getFullMsg();
     } 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 array(Horde_Mime_Headers::parseHeaders($msg), Horde_Mime_Part::parseMessage($msg));
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:26,代码来源:Imap.php

示例3: process_message_data_body

 /**
  * Process a message again to add body and attachment data.
  *
  * @param \Horde_Imap_Client_Data_Fetch $basemessagedata The structure and part of the message body
  * @param string|\Horde_Imap_Client_Ids $messageid The Hore message Uid
  * @return \stdClass The current value of the messagedata
  */
 private function process_message_data_body(\Horde_Imap_Client_Data_Fetch $basemessagedata, $messageid)
 {
     global $CFG;
     // Get the current mailbox.
     $mailbox = $this->get_mailbox();
     // We need the structure at various points below.
     $structure = $basemessagedata->getStructure();
     // Now fetch the rest of the message content.
     $query = new \Horde_Imap_Client_Fetch_Query();
     $query->fullText();
     // Fetch all of the message parts too.
     $typemap = $structure->contentTypeMap();
     foreach ($typemap as $part => $type) {
         // The body of the part - attempt to decode it on the server.
         $query->bodyPart($part, array('decode' => true, 'peek' => true));
         $query->bodyPartSize($part);
     }
     $messagedata = $this->client->fetch($mailbox, $query, array('ids' => $messageid))->first();
     // Store the data for this message.
     $contentplain = '';
     $contenthtml = '';
     $attachments = array('inline' => array(), 'attachment' => array());
     $plainpartid = $structure->findBody('plain');
     $htmlpartid = $structure->findBody('html');
     foreach ($typemap as $part => $type) {
         // Get the message data from the body part, and combine it with the structure to give a fully-formed output.
         $stream = $messagedata->getBodyPart($part, true);
         $partdata = $structure->getPart($part);
         $partdata->setContents($stream, array('usestream' => true));
         if ($part === $plainpartid) {
             $contentplain = $this->process_message_part_body($messagedata, $partdata, $part);
         } else {
             if ($part === $htmlpartid) {
                 $contenthtml = $this->process_message_part_body($messagedata, $partdata, $part);
             } else {
                 if ($filename = $partdata->getName($part)) {
                     if ($attachment = $this->process_message_part_attachment($messagedata, $partdata, $part, $filename)) {
                         // The disposition should be one of 'attachment', 'inline'.
                         // If an empty string is provided, default to 'attachment'.
                         $disposition = $partdata->getDisposition();
                         $disposition = $disposition == 'inline' ? 'inline' : 'attachment';
                         $attachments[$disposition][] = $attachment;
                     }
                 }
             }
         }
         // We don't handle any of the other MIME content at this stage.
     }
     // The message ID should always be in the first part.
     $this->currentmessagedata->plain = $contentplain;
     $this->currentmessagedata->html = $contenthtml;
     $this->currentmessagedata->attachments = $attachments;
     return $this->currentmessagedata;
 }
开发者ID:Chocolate-lightning,项目名称:moodle,代码行数:61,代码来源:manager.php

示例4: getFullMsg

 /**
  * Return the full message text.
  *
  * @param boolean $stream  Return data as a stream?
  *
  * @return mixed  A string or stream resource.
  * @throws Horde_ActiveSync_Exception
  */
 public function getFullMsg($stream = false)
 {
     // First see if we already have it.
     if ($stream) {
         $full = new Horde_Stream_Existing(array('stream' => $this->_data->getFullMsg($stream)));
         $length = $full->length();
         if (!$length) {
             $full->close();
         }
     } else {
         $full = $this->_data->getFullMsg(false);
         $length = strlen($full);
     }
     if (!$length) {
         $query = new Horde_Imap_Client_Fetch_Query();
         $query->fullText(array('peek' => true));
         try {
             $fetch_ret = $this->_imap->fetch($this->_mbox, $query, array('ids' => new Horde_Imap_Client_Ids(array($this->uid))));
         } catch (Horde_Imap_Exception $e) {
             throw new Horde_ActiveSync_Exception($e);
         }
         $data = $fetch_ret[$this->uid];
         $full = $data->getFullMsg($stream);
     }
     return $full;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:34,代码来源:Message.php

示例5: fetchbody

 public function fetchbody($message_no, $partno)
 {
     $file = $this->getCacheFileName(__FUNCTION__, $message_no, $partno);
     if ($this->cacheEnabled && file_exists($file)) {
         return json_decode(file_get_contents($file));
     } else {
         $oQuery = new Horde_Imap_Client_Fetch_Query();
         $oQuery->structure();
         $oQuery->bodyPart($partno, array('decode' => true, 'peek' => true));
         $oQuery->fullText(array('peek' => true));
         $message = $this->imap_imp->fetch($this->currentFolder, $oQuery, array('ids' => new Horde_Imap_Client_Ids($message_no)));
         $message = $message[$message_no];
         $part = $message->getStructure();
         $body = $part->getPart($partno);
         $tmp = $message->getBodyPart($partno);
         if (!$message->getBodyPartDecode($partno)) {
             $body->setContents($tmp);
             $tmp = $body->getContents();
         }
         if ($tmp) {
             file_put_contents($file, json_encode($tmp));
         }
         return $tmp;
     }
 }
开发者ID:micoli,项目名称:qd_mail,代码行数:25,代码来源:QDImapHORDE.php

示例6: testComplexFetch

 /**
  * @depends testOptimizedSearches
  */
 public function testComplexFetch()
 {
     // Fetching message information from complex MIME message.
     $complex_fetch = new Horde_Imap_Client_Fetch_Query();
     $complex_fetch->fullText(array('length' => 100, 'peek' => true));
     // Header of entire message
     $complex_fetch->headerText(array('length' => 100, 'peek' => true));
     // Header of message/rfc822 part
     $complex_fetch->headerText(array('id' => 2, 'length' => 100, 'peek' => true));
     // Body text of entire message
     $complex_fetch->bodyText(array('length' => 100, 'peek' => true));
     // Body text of message/rfc822 part
     $complex_fetch->bodyText(array('id' => 2, 'length' => 100, 'peek' => true));
     // MIME Header of multipart/alternative part
     $complex_fetch->mimeHeader('1', array('length' => 100, 'peek' => true));
     // MIME Header of text/plain part embedded in message/rfc822 part
     $complex_fetch->mimeHeader('2.1', array('length' => 100, 'peek' => true));
     // Body text of multipart/alternative part
     $complex_fetch->bodyPart('1', array('length' => 100, 'peek' => true));
     // Body text of image/png part embedded in message/rfc822 part
     // Try to do server-side decoding, if available
     $complex_fetch->mimeHeader('2.2', array('decode' => true, 'length' => 100, 'peek' => true));
     // If supported, return decoded body part size
     $complex_fetch->bodyPartSize('2.2');
     // Select message-id header from base message header
     $complex_fetch->headers('headersearch1', array('message-id'), array('length' => 100, 'peek' => true));
     // Select everything but message-id header from message/rfc822 header
     $complex_fetch->headers('headersearch2', array('message-id'), array('id' => '2', 'length' => 100, 'notsearch' => true, 'peek' => true));
     $complex_fetch->structure();
     $complex_fetch->flags();
     $complex_fetch->imapDate();
     $complex_fetch->size();
     $complex_fetch->uid();
     if (self::$live->capability->query('CONDSTORE')) {
         $complex_fetch->modseq();
     }
     try {
         $res = self::$live->fetch(self::$test_mbox, $complex_fetch, array('ids' => new Horde_Imap_Client_Ids(3, true)));
     } catch (Horde_Imap_Client_Exception $e) {
         if ($e->getCode() === $e::MBOXNOMODSEQ) {
             $this->markTestSkipped('Mailbox does not support MODSEQ.');
         }
         throw $e;
     }
     $this->assertInstanceOf('Horde_Imap_Client_Fetch_Results', $res);
     $this->assertEquals(1, count($res));
     $this->assertEquals('Message-ID: <2008yhnujm@foo.example.com>', trim($res[3]->getHeaders('headersearch1')));
     /* Return stream instead. */
     $this->assertInternalType('resource', $res[3]->getHeaders('headersearch1', Horde_Imap_Client_Data_Fetch::HEADER_STREAM));
     /* Parse headers instead. */
     $this->assertInstanceOf('Horde_Mime_Headers', $res[3]->getHeaders('headersearch1', Horde_Imap_Client_Data_Fetch::HEADER_PARSE));
 }
开发者ID:horde,项目名称:horde,代码行数:55,代码来源:Imap.php

示例7: _copy

 /**
  * Handle copy() calls that hit multiple servers.
  *
  * @see Horde_Imap_Client_Base#copy()
  */
 protected function _copy()
 {
     global $injector;
     $args = func_get_args();
     $imap_factory = $injector->getInstance('IMP_Factory_Imap');
     $source_imap = $imap_factory->create($args[0]);
     $dest_imap = $imap_factory->create($args[1]);
     $create = !empty($args[2]['create']);
     $ids = isset($args[2]['ids']) ? $args[2]['ids'] : $source_imap->getIdsOb(Horde_Imap_Client_Ids::ALL);
     $move = !empty($args[2]['move']);
     $retval = true;
     $query = new Horde_Imap_Client_Fetch_Query();
     $query->fullText(array('peek' => true));
     foreach ($this->getSlices($args[0], $ids) as $val) {
         try {
             $res = $source_imap->fetch($args[0], $query, array('ids' => $val, 'nocache' => true));
             $append = array();
             foreach ($res as $msg) {
                 $append[] = array('data' => $msg->getFullMsg(true));
             }
             $dest_imap->append($args[1], $append, array('create' => $create));
             if ($move) {
                 $source_imap->expunge($args[0], array('delete' => true, 'ids' => $val));
             }
         } catch (IMP_Imap_Exception $e) {
             $retval = false;
         }
     }
     return $retval;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:35,代码来源:Imap.php

示例8: getFullMsg

 /**
  * Return the full message text.
  *
  * @param boolean $stream  Return data as a stream?
  *
  * @return mixed  A string or stream resource.
  * @throws Horde_ActiveSync_Exception
  */
 public function getFullMsg($stream = false)
 {
     // First see if we already have it.
     if (!($full = $this->_data->getFullMsg())) {
         $query = new Horde_Imap_Client_Fetch_Query();
         $query->fullText(array('peek' => true));
         try {
             $fetch_ret = $this->_imap->fetch($this->_mbox, $query, array('ids' => new Horde_Imap_Client_Ids(array($this->_uid))));
         } catch (Horde_Imap_Exception $e) {
             throw new Horde_ActiveSync_Exception($e);
         }
         $data = $fetch_ret[$this->_uid];
         $full = $data->getFullMsg($stream);
     }
     return $full;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:24,代码来源:Message.php


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