當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。