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


PHP Zend_Mime_Decode::splitHeaderField方法代码示例

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


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

示例1: testSplitHeaderFieldReturnsArrayWithFirstName

 public function testSplitHeaderFieldReturnsArrayWithFirstName()
 {
     $boundary = "----=_Alternative_1211565553483705f1280701.15526894A";
     $header = "Content-Type: multipart/alternative; " . "boundary=\"{$boundary}\"";
     $split = Zend_Mime_Decode::splitHeaderField($header, null, 'content-type');
     $this->assertEquals(2, count($split));
     $this->assertTrue(isset($split['content-type']), "'content-type' element is set");
     $this->assertEquals($boundary, $split['boundary']);
 }
开发者ID:Tony133,项目名称:zf-web,代码行数:9,代码来源:DecodeTest.php

示例2: getHeaderField

 /**
  * Get a specific field from a header like content type or all fields as array
  *
  * If the header occurs more than once, only the value from the first header
  * is returned.
  *
  * Throws a Zend_Mail_Exception if the requested header does not exist. If
  * the specific header field does not exist, returns null.
  *
  * @param  string $name       name of header, like in getHeader()
  * @param  string $wantedPart the wanted part, default is first, if null an array with all parts is returned
  * @param  string $firstName  key name for the first part
  * @return string|array wanted part or all parts as array($firstName => firstPart, partname => value)
  * @throws Zend_Exception, Zend_Mail_Exception
  */
 public function getHeaderField($name, $wantedPart = 0, $firstName = 0)
 {
     return Zend_Mime_Decode::splitHeaderField(current($this->getHeader($name, 'array')), $wantedPart, $firstName);
 }
开发者ID:bartolomeu,项目名称:estoque_gusella,代码行数:19,代码来源:Part.php

示例3: _getMetaDataFromZMM

 /**
  * get meta data (like contentype, charset, ...) from zmm and set it in zmp
  * 
  * @param Zend_Mail_Message $zmm
  * @param Zend_Mime_Part $zmp
  */
 protected static function _getMetaDataFromZMM(Zend_Mail_Message $zmm, Zend_Mime_Part $zmp)
 {
     if ($zmm->headerExists('content-transfer-encoding')) {
         $zmp->encoding = $zmm->getHeader('content-transfer-encoding');
     } else {
         $zmp->encoding = Zend_Mime::ENCODING_7BIT;
     }
     if ($zmm->headerExists('content-type')) {
         $contentTypeHeader = Zend_Mime_Decode::splitHeaderField($zmm->getHeader('content-type'));
         $zmp->type = $contentTypeHeader[0];
         if (isset($contentTypeHeader['boundary'])) {
             $zmp->boundary = $contentTypeHeader['boundary'];
         }
         if (isset($contentTypeHeader['charset'])) {
             $zmp->charset = $contentTypeHeader['charset'];
         }
     } else {
         $zmp->type = Zend_Mime::TYPE_TEXT;
     }
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Encoding: ' . $zmp->encoding . ' / type: ' . $zmp->type . ' / charset: ' . $zmp->charset);
     }
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:29,代码来源:Mail.php

示例4: testSplitInvalidHeader

 public function testSplitInvalidHeader()
 {
     $header = '';
     try {
         Zend_Mime_Decode::splitHeaderField($header);
     } catch (Zend_Exception $e) {
         return;
         // ok
     }
     $this->fail('no exception raised while decoding invalid header field');
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:11,代码来源:MessageTest.php

示例5: testSpaceInFieldName

 public function testSpaceInFieldName()
 {
     $header = 'test; foo =bar; baz      =42';
     $this->assertEquals(Zend_Mime_Decode::splitHeaderField($header, 'foo'), 'bar');
     $this->assertEquals(Zend_Mime_Decode::splitHeaderField($header, 'baz'), 42);
 }
开发者ID:sasezaki,项目名称:mirror-zf1-tests,代码行数:6,代码来源:MessageTest.php

示例6: testCaseInsensitiveField

 public function testCaseInsensitiveField()
 {
     $header = 'test; fOO="this is a test"';
     $this->assertEquals(Zend_Mime_Decode::splitHeaderField($header, 'Foo'), 'this is a test');
     $this->assertEquals(Zend_Mime_Decode::splitHeaderField($header, 'bar'), null);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:6,代码来源:MessageTest.php

示例7: createFromZMM

 /**
  * create Tinebase_Mail from Zend_Mail_Message
  * 
  * @param  Zend_Mail_Message  $_zmm
  * @param  string             $_replyBody
  * @return Tinebase_Mail
  */
 public static function createFromZMM(Zend_Mail_Message $_zmm, $_replyBody = null)
 {
     $contentStream = fopen("php://temp", 'r+');
     if (preg_match('/application\\/(x\\-){0,1}pkcs7-mime/i', $_zmm->getHeader('content-type')) > 0) {
         $mp = new Zend_Mime_Part($_zmm->getContent());
     } else {
         fputs($contentStream, $_zmm->getContent());
         rewind($contentStream);
         $mp = new Zend_Mime_Part($contentStream);
     }
     if ($_zmm->headerExists('content-transfer-encoding')) {
         $mp->encoding = $_zmm->getHeader('content-transfer-encoding');
         $mp->decodeContent();
     } else {
         $mp->encoding = Zend_Mime::ENCODING_7BIT;
     }
     // append old body when no multipart/mixed
     if ($_replyBody !== null && $_zmm->headerExists('content-transfer-encoding')) {
         $mp = self::_appendReplyBody($mp, $_replyBody);
         $mp->encoding = $_zmm->getHeader('content-transfer-encoding');
     }
     if ($_zmm->headerExists('content-type')) {
         $contentTypeHeader = Zend_Mime_Decode::splitHeaderField($_zmm->getHeader('content-type'));
         if ($mp->type = strtolower($contentTypeHeader[0]) === 'application/pkcs7-mime') {
             $mp->type = $_zmm->getHeader('content-type');
         } else {
             $mp->type = $contentTypeHeader[0];
         }
         if (isset($contentTypeHeader['boundary'])) {
             $mp->boundary = $contentTypeHeader['boundary'];
         }
         if (isset($contentTypeHeader['charset'])) {
             $mp->charset = $contentTypeHeader['charset'];
         }
     } else {
         $mp->type = Zend_Mime::TYPE_TEXT;
     }
     $result = new Expressomail_Mail('utf-8');
     $result->setBodyText($mp);
     foreach ($_zmm->getHeaders() as $header => $values) {
         foreach ((array) $values as $value) {
             switch ($header) {
                 case 'content-transfer-encoding':
                     // these are implicitly set by Zend_Mail_Transport_Abstract::_getHeaders()
                 // these are implicitly set by Zend_Mail_Transport_Abstract::_getHeaders()
                 case 'content-type':
                 case 'mime-version':
                     // do nothing
                     break;
                 case 'bcc':
                     $addresses = Expressomail_Message::parseAdresslist($value);
                     foreach ($addresses as $address) {
                         $result->addBcc($address['address'], $address['name']);
                     }
                     break;
                 case 'cc':
                     $addresses = Expressomail_Message::parseAdresslist($value);
                     foreach ($addresses as $address) {
                         $result->addCc($address['address'], $address['name']);
                     }
                     break;
                 case 'date':
                     try {
                         $result->setDate($value);
                     } catch (Zend_Mail_Exception $zme) {
                         if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) {
                             Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ . " Could not set date: " . $value);
                         }
                         if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) {
                             Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ . " " . $zme);
                         }
                         $result->setDate();
                     }
                     break;
                 case 'from':
                     $addresses = Expressomail_Message::parseAdresslist($value);
                     foreach ($addresses as $address) {
                         $result->setFrom($address['address'], $address['name']);
                     }
                     break;
                 case 'message-id':
                     $result->setMessageId($value);
                     break;
                 case 'return-path':
                     $result->setReturnPath($value);
                     break;
                 case 'subject':
                     $result->setSubject($value);
                     break;
                 case 'to':
                     $addresses = Expressomail_Message::parseAdresslist($value);
                     foreach ($addresses as $address) {
                         $result->addTo($address['address'], $address['name']);
//.........这里部分代码省略.........
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:101,代码来源:Mail.php


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