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


PHP Horde_Mime_Part::contentTypeMap方法代码示例

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


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

示例1: __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

示例2: hasiCalendar

 /**
  * Return the MIME part of the iCalendar attachment, if available.
  *
  * @return mixed  The mime id of an iCalendar part, if present. Otherwise
  *                false.
  */
 public function hasiCalendar()
 {
     if (!$this->hasAttachments()) {
         return false;
     }
     foreach ($this->_base->contentTypeMap() as $id => $type) {
         if ($type == 'text/calendar' || $type == 'application/ics') {
             return $id;
         }
     }
     return false;
 }
开发者ID:horde,项目名称:horde,代码行数:18,代码来源:Mime.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: signMIMEPart

 /**
  * Signs a MIME part using PGP.
  *
  * @param Horde_Mime_Part $mime_part  The object to sign.
  * @param array $params               The parameters required for signing.
  *                                    ({@see _encryptSignature()}).
  *
  * @return mixed  A Horde_Mime_Part object that is signed according to RFC
  *                3156.
  * @throws Horde_Crypt_Exception
  */
 public function signMIMEPart($mime_part, $params = array())
 {
     $params = array_merge($params, array('sigtype' => 'detach', 'type' => 'signature'));
     /* RFC 3156 Requirements for a PGP signed message:
      * + Content-Type params 'micalg' & 'protocol' are REQUIRED.
      * + The digitally signed message MUST be constrained to 7 bits.
      * + The MIME headers MUST be a part of the signed data.
      * + Ensure there are no trailing spaces in encoded data by forcing
      *   text to be Q-P encoded (see, e.g., RFC 3676 [4.6]). */
     /* Ensure that all text parts are Q-P encoded. */
     foreach ($mime_part->contentTypeMap(false) as $key => $val) {
         if (strpos($val, 'text/') === 0) {
             $mime_part[$key]->setTransferEncoding('quoted-printable', array('send' => true));
         }
     }
     /* Get the signature. */
     $msg_sign = $this->encrypt($mime_part->toString(array('canonical' => true, 'headers' => true)), $params);
     /* Add the PGP signature. */
     $pgp_sign = new Horde_Mime_Part();
     $pgp_sign->setType('application/pgp-signature');
     $pgp_sign->setHeaderCharset('UTF-8');
     $pgp_sign->setDisposition('inline');
     $pgp_sign->setDescription(Horde_Crypt_Translation::t("PGP Digital Signature"));
     $pgp_sign->setContents($msg_sign, array('encoding' => '7bit'));
     /* Get the algorithim information from the signature. Since we are
      * analyzing a signature packet, we need to use the special keyword
      * '_SIGNATURE' - see Horde_Crypt_Pgp. */
     $sig_info = $this->pgpPacketSignature($msg_sign, '_SIGNATURE');
     /* Setup the multipart MIME Part. */
     $part = new Horde_Mime_Part();
     $part->setType('multipart/signed');
     $part->setContents("This message is in MIME format and has been PGP signed.\n");
     $part->addPart($mime_part);
     $part->addPart($pgp_sign);
     $part->setContentTypeParameter('protocol', 'application/pgp-signature');
     $part->setContentTypeParameter('micalg', $sig_info['micalg']);
     return $part;
 }
开发者ID:horde,项目名称:horde,代码行数:49,代码来源:Pgp.php

示例5: testIdSortingInMessageRfc822Part

 public function testIdSortingInMessageRfc822Part()
 {
     $part = new Horde_Mime_Part();
     $part->setType('message/rfc822');
     $part1 = new Horde_Mime_Part();
     $part1->setType('multipart/alternative');
     $part[] = $part1;
     $part2 = new Horde_Mime_Part();
     $part2->setType('text/plain');
     $part1[] = $part2;
     $part3 = new Horde_Mime_Part();
     $part3->setType('text/html');
     $part1[] = $part3;
     $part->buildMimeIds();
     $this->assertEquals(array('1.0', '1', '1.1', '1.2'), array_keys($part->contentTypeMap(true)));
 }
开发者ID:x59,项目名称:horde-mime,代码行数:16,代码来源:PartTest.php

示例6: matchMimePartToHeaderType

 /**
  * Try to determine the MIME part that carries an object matching based on the message headers.
  *
  * @param Horde_Mime_Part $structure A structural representation of the mime message.
  * @param Horde_Mime_Headers $headers The message headers.
  *
  * @return string|boolean The MIME ID of the message part carrying an object matching the message headers or false if such a part was not identified within the message.
  */
 public static function matchMimePartToHeaderType(Horde_Mime_Part $structure, Horde_Mime_Headers $headers)
 {
     $mime_type = $headers->getValue('X-Kolab-Type');
     if ($mime_type === null) {
         return false;
     }
     return array(array_search($mime_type, $structure->contentTypeMap()), self::getObjectTypeFromMimeType($mime_type));
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:16,代码来源:MimeType.php

示例7: getContentTypeMap

 /**
  * Returns the Content-Type map for the entire message, regenerating
  * embedded parts if needed.
  *
  * @return array  See Horde_Mime_Part::contentTypeMap().
  */
 public function getContentTypeMap()
 {
     $this->_buildMessage();
     return $this->_message->contentTypeMap();
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:11,代码来源:Contents.php


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