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


PHP Zend_Mime_Decode::decodeQuotedPrintable方法代码示例

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


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

示例1: checkNewsletterSignOutMail

 /**
  * Wait for newsletter sign out mail
  *
  * @param array $userAccount
  */
 public function checkNewsletterSignOutMail($userAccount)
 {
     /* Check for mail */
     $newsletterUnsubscribeTemplateSubject = $this->__('Newsletter unsubscription success');
     // replace markers with information from $userAccount
     $subject = $newsletterUnsubscribeTemplateSubject;
     foreach ($userAccount as $key => $value) {
         $subject = str_replace('###' . strtoupper($key) . '###', $value, $subject);
     }
     $idx = $this->waitForMailWhoseSubjectContains($subject);
     $message = $this->getStorage()->getMessage($idx);
     $content = Zend_Mime_Decode::decodeQuotedPrintable($message->getContent());
     $this->getStorage()->removeMessage($idx);
     $this->getTest()->assertContains('unsubscription success', $content);
 }
开发者ID:aoepeople,项目名称:menta_magentocomponents,代码行数:20,代码来源:ImapMail.php

示例2: testSendAction

 /**
  * @magentoDataFixture Magento/Wishlist/_files/wishlist.php
  */
 public function testSendAction()
 {
     \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea(\Magento\Framework\App\Area::AREA_FRONTEND);
     $request = ['form_key' => $this->_objectManager->get('Magento\\Framework\\Data\\Form\\FormKey')->getFormKey(), 'emails' => 'test@tosend.com', 'message' => 'message', 'rss_url' => null];
     $this->getRequest()->setPostValue($request);
     $this->_objectManager->get('Magento\\Framework\\Registry')->register('wishlist', $this->_objectManager->get('Magento\\Wishlist\\Model\\Wishlist')->loadByCustomerId(1));
     $this->dispatch('wishlist/index/send');
     /** @var \Magento\TestFramework\Mail\Template\TransportBuilderMock $transportBuilder */
     $transportBuilder = $this->_objectManager->get('Magento\\TestFramework\\Mail\\Template\\TransportBuilderMock');
     $actualResult = \Zend_Mime_Decode::decodeQuotedPrintable($transportBuilder->getSentMessage()->getBodyHtml()->getContent());
     $this->assertStringMatchesFormat('%A' . $this->_customerViewHelper->getCustomerName($this->_customerSession->getCustomerDataObject()) . ' wants to share this Wish List%A', $actualResult);
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:15,代码来源:IndexTest.php

示例3: testDecodeString

 public function testDecodeString()
 {
     $is = Zend_Mime_Decode::decodeQuotedPrintable('=?UTF-8?Q?"Peter M=C3=BCller"?= <peter-mueller@example.com>');
     $should = iconv('UTF-8', iconv_get_encoding('internal_encoding'), '"Peter Müller" <peter-mueller@example.com>');
     $this->assertEquals($is, $should);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:6,代码来源:MessageTest.php

示例4: testDecodeString

 public function testDecodeString()
 {
     $string = '"Peter M=C3=BCller" <peter-mueller@example.com>';
     $is = Zend_Mime_Decode::decodeQuotedPrintable($string);
     $should = quoted_printable_decode($string);
     $this->assertEquals($is, $should);
 }
开发者ID:sasezaki,项目名称:mirror-zf1-tests,代码行数:7,代码来源:MessageTest.php

示例5: decodeZendQuotedPrintableHeader

 /**
  * For mailgun api several additional options for mail sending are available
  *
  * decodes the Zend Zend_Mime::encodeQuotedPrintableHeader
  *
  * @see https://framework.zend.com/apidoc/1.9/Zend_Mime/Zend_Mime.html#methodencodeQuotedPrintable
  *
  * @param $str
  * @param string $charset
  * @return string
  */
 protected function decodeZendQuotedPrintableHeader($str, $charset = 'utf-8')
 {
     $lines = explode(\Zend_Mime::LINEEND, $str);
     $result = '';
     foreach ($lines as $line) {
         // matches lines that begins with "=?utf-8?Q?" and ends with "=?"
         if (preg_match('/^[ ]{0,1}=\\?' . preg_quote($charset) . '\\?Q\\?(.*)\\?=/', $line, $matches)) {
             $result .= \Zend_Mime_Decode::decodeQuotedPrintable($matches[1]);
         } else {
             $result .= \Zend_Mime_Decode::decodeQuotedPrintable($line);
         }
     }
     return $result;
 }
开发者ID:shockwave-design,项目名称:magento2-module-mail-mailgun,代码行数:25,代码来源:MailgunTransport.php

示例6: parseMessage

 public function parseMessage($mail, $message, $i)
 {
     $response = array('message' => array('subject' => null, 'fromEmail' => null, 'message' => null, 'receiveDate' => null), 'attachments' => array());
     // Get the UTC timestamp
     $timezone = date_default_timezone_get();
     date_default_timezone_set('UTC');
     $receiveDate = strtotime($message->date);
     date_default_timezone_set($timezone);
     // Get from
     $from = $message->from;
     $from = str_replace(array('<', '>'), '', $from);
     $from = explode(' ', $from);
     $from = array_pop($from);
     $response['message']['fromEmail'] = $from;
     // Get the message
     $messageBody = '';
     $boundary = $message->getHeaderField('content-type', 'boundary');
     if (stristr($message->contentType, 'text/')) {
         $messageBody = $mail->getRawContent($i);
     } else {
         if (stristr($message->contentType, 'multipart/')) {
             $messageParts = new Zend_Mail_Part(array('handler' => &$mail, 'id' => $i, 'headers' => $message->getHeaders()));
             // Get the messages's contents. When fetched it removes the
             // message
             $messageParts->getContent();
             foreach ($messageParts as $partIndex => $part) {
                 $attachment = array('ticketId' => null, 'replyId' => null, 'filename' => null, 'contentType' => null, 'content' => null);
                 if ($partIndex === 1) {
                     // Decode attachment's data
                     $content = (string) $part;
                     if ($part->headerExists('content-transfer-encoding') and $part->contentTransferEncoding === 'base64') {
                         $content = base64_decode($content);
                     }
                     //-- If an email is set with html + attachment + text alternative, then zend doesn't pickup the sub boundary :(
                     $sub_boundary = preg_match('([a-zA-Z0-9]{28})', $content, $sub_boundaries);
                     if ($sub_boundary > 0) {
                         $subparts = explode('--' . $sub_boundaries[0], $content);
                         foreach ($subparts as $subpart) {
                             if (stristr($subpart, 'text/html')) {
                                 $quoted = false;
                                 if (stristr($subpart, 'quoted-printable')) {
                                     $quoted = true;
                                 }
                                 $content = explode("\n\n", $subpart);
                                 array_shift($content);
                                 $content = implode("\n\n", $content);
                                 if ($quoted) {
                                     $content = Zend_Mime_Decode::decodeQuotedPrintable($content);
                                     // Gay ass word wrapping with hmtl is bad idea.
                                     $content = str_replace(array("=\n", '=3D'), array('', '='), $content);
                                 }
                             }
                         }
                     }
                     $content = nl2br($content);
                     $messageBody = $content;
                 } else {
                     $attachment['contentType'] = $part->contentType;
                     // Grab the filename
                     $attachment['filename'] = $part->getHeaderField('content-type', 'name');
                     // Decode attachment's data
                     $content = (string) $part;
                     // TODO: Need to part before assuming it has a transfer encoding
                     if ($part->contentTransferEncoding === 'base64') {
                         $content = base64_decode($content);
                     }
                     // TODO: other encodings?
                     $attachment['content'] = $content;
                     array_push($response['attachments'], $attachment);
                 }
             }
         }
     }
     $response['message']['subject'] = (string) $message->subject;
     $response['message']['fromDate'] = (string) $message->from;
     $response['message']['message'] = $messageBody;
     $response['message']['receiveDate'] = $receiveDate;
     return $response;
 }
开发者ID:joseph-montanez,项目名称:ZendTickets,代码行数:79,代码来源:TicketController.php

示例7: getMailContent

 /**
  * get content for mail whose content contains the given string and delete the mail then
  *
  * @param string $subjectContains
  * @param bool $useXPath
  * @param int $timeout
  * @param int $sleep
  * @return mixed string|DOMXPath
  */
 public function getMailContent($subjectContains, $useXPath = false, $timeout = 100, $sleep = 10)
 {
     $idx = $this->waitForMailWhoseSubjectContains($subjectContains, $timeout, $sleep);
     $message = $this->getStorage()->getMessage($idx);
     $content = Zend_Mime_Decode::decodeQuotedPrintable($message->getContent());
     $this->getTest()->assertNotEmpty($content);
     $this->getStorage()->removeMessage($idx);
     if ($useXPath) {
         preg_match('/<body.*<\\/body>/misU', $content, $match);
         $html = str_replace(array('&lt;', '&gt;'), array('<', '>'), htmlentities($match[0], ENT_NOQUOTES));
         return new DOMXPath(DOMDocument::loadHTML($html));
     }
     return $content;
 }
开发者ID:aoepeople,项目名称:menta_generalcomponents,代码行数:23,代码来源:ImapMail.php


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