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


PHP Horde_Mime_Part::getPart方法代码示例

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


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

示例1: isAttachment

 /**
  * Determines if a MIME type is an attachment.
  * For our purposes, an attachment is any MIME part that can be
  * downloaded by itself (i.e. all the data needed to view the part is
  * contained within the download data).
  *
  * @param string $id         The MIME Id for the part we are checking.
  * @param string $mime_type  The MIME type.
  *
  * @return boolean  True if an attachment.
  * @todo Pass a single mime part as parameter.
  */
 public function isAttachment($id, $mime_type)
 {
     switch ($mime_type) {
         case 'text/plain':
             if (!($this->_base->findBody('plain') == $id)) {
                 return true;
             }
             return false;
         case 'text/html':
             if (!($this->_base->findBody('html') == $id)) {
                 return true;
             }
             return false;
         case 'application/pkcs7-signature':
         case 'application/x-pkcs7-signature':
             return false;
     }
     if ($this->_base->getPart($id)->getDisposition() == 'attachment') {
         return true;
     }
     list($ptype, ) = explode('/', $mime_type, 2);
     switch ($ptype) {
         case 'message':
             return in_array($mime_type, array('message/rfc822', 'message/disposition-notification'));
         case 'multipart':
             return false;
         default:
             return true;
     }
 }
开发者ID:horde,项目名称:horde,代码行数:42,代码来源:Mime.php

示例2: __construct

 /**
  * Constructor.
  *
  * @param Horde_Mime_Part $mime_part  A MIME part object. Must be of
  *                                    type multipart/related.
  */
 public function __construct(Horde_Mime_Part $mime_part)
 {
     if ($mime_part->getType() != 'multipart/related') {
         throw new InvalidArgumentException('MIME part must be of type multipart/related');
     }
     $ids = array_keys($mime_part->contentTypeMap());
     $related_id = $mime_part->getMimeId();
     $id = null;
     /* Build a list of parts -> CIDs. */
     foreach ($ids as $val) {
         if (strcmp($related_id, $val) !== 0 && ($cid = $mime_part->getPart($val)->getContentId())) {
             $this->_cids[$val] = $cid;
         }
     }
     /* Look at the 'start' parameter to determine which part to start
      * with. If no 'start' parameter, use the first part (RFC 2387
      * [3.1]). */
     $start = $mime_part->getContentTypeParameter('start');
     if (!empty($start)) {
         $id = $this->cidSearch($start);
     }
     if (empty($id)) {
         reset($ids);
         $id = next($ids);
     }
     $this->_start = $id;
 }
开发者ID:netcon-source,项目名称:apps,代码行数:33,代码来源:Related.php

示例3: hasiCalendar

 /**
  * Return the MIME part of the iCalendar attachment, if available.
  *
  * @return mixed  The mime part, if present, false otherwise.
  */
 public function hasiCalendar()
 {
     if (!$this->hasAttachments()) {
         return false;
     }
     foreach ($this->_base->contentTypeMap() as $id => $type) {
         if ($type == 'text/calendar') {
             return $this->_base->getPart($id);
         }
     }
     return false;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:17,代码来源:Mime.php

示例4: getMIMEPart

 /**
  * Fetch a part of a MIME message.
  *
  * @param integer $id     The MIME index of the part requested.
  * @param array $options  Additional options:
  *   - length: (integer) If set, only download this many bytes of the
  *             bodypart from the server.
  *             DEFAULT: All data is retrieved.
  *   - nocontents: (boolean) If true, don't add the contents to the part
  *                 DEFAULT: Contents are added to the part
  *
  * @return Horde_Mime_Part  The raw MIME part asked for (reference).
  */
 public function getMIMEPart($id, $options = array())
 {
     $this->_buildMessage();
     $part = $this->_message->getPart($id);
     /* Ticket #9201: Treat 'ISO-8859-1' as 'windows-1252'. 1252 has some
      * characters (e.g. euro sign, back quote) not in 8859-1. There
      * shouldn't be any issue doing this since the additional code points
      * in 1252 don't map to anything in 8859-1. */
     if ($part && strcasecmp($part->getCharset(), 'ISO-8859-1') === 0) {
         $part->setCharset('windows-1252');
     }
     /* Don't download contents of entire body if ID == 0 (indicating the
      * body of the main multipart message).  I'm pretty sure we never
      * want to download the body of that part here. */
     if (!empty($id) && !is_null($part) && substr($id, -2) != '.0' && empty($options['nocontents']) && $this->_indices && !$part->getContents(array('stream' => true))) {
         $body = $this->getBodyPart($id, array('decode' => true, 'length' => empty($options['length']) ? null : $options['length'], 'stream' => true));
         $part->setContents($body->data, array('encoding' => $body->decode, 'usestream' => true));
     }
     return $part;
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:33,代码来源:Contents.php

示例5: _getHtmlPart

 /**
  * Build the HTML part of a SMARTREPLY or SMARTFORWARD
  *
  * @param string $html_id                The MIME part id of the html part of
  *                                       $base_part.
  * @param Horde_Mime_Part $mime_message  The MIME part of the email to be
  *                                       sent.
  * @param array $body_data @see Horde_ActiveSync_Imap_Message::getMessageBodyData()
  * @param Horde_Mime_Part $base_part     The base MIME part of the source
  *                                       message for a SMART request.
  *
  * @return string  The plaintext part of the email message that is being sent.
  */
 protected function _getHtmlPart($html_id, $mime_message, $body_data, $base_part)
 {
     if (!($id = $mime_message->findBody('html'))) {
         $smart_text = self::text2html(Horde_ActiveSync_Utils::ensureUtf8($mime_message->getPart($mime_message->findBody('plain'))->getContents(), $mime_message->getCharset()));
     } else {
         $smart_text = Horde_ActiveSync_Utils::ensureUtf8($mime_message->getPart($id)->getContents(), $mime_message->getCharset());
     }
     if ($this->_forward) {
         return $smart_text . $this->_forwardText($body_data, $base_part->getPart($html_id), true);
     }
     return $smart_text . $this->_replyText($body_data, $base_part->getPart($html_id), true);
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:25,代码来源:Mail.php

示例6: getObjectTypeFromMimePart

 /**
  * Determine the object type based on a specific MIME part that carries a Kolab object.
  *
  * @param Horde_Mime_Part $structure A structural representation of the mime message.
  * @param string $id The MIME part carrying the Kolab object.
  *
  * @return string|boolean The object type or false if no matching object type was found.
  */
 public static function getObjectTypeFromMimePart(Horde_Mime_Part $structure, $id)
 {
     return self::getObjectTypeFromMimeType($structure->getPart($id)->getType());
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:12,代码来源:MimeType.php


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