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


PHP iconv_mime_decode函数代码示例

本文整理汇总了PHP中iconv_mime_decode函数的典型用法代码示例。如果您正苦于以下问题:PHP iconv_mime_decode函数的具体用法?PHP iconv_mime_decode怎么用?PHP iconv_mime_decode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: process

 /**
  * Set known sources and parse additional sources from body.
  */
 function process(&$message, $source)
 {
     // Populate $message with all values from 'header' object.
     $parts = (array) $message['header'];
     foreach ($parts as $key => $value) {
         // Some keys are already taken, so do not overwrite them.
         if (!in_array($key, array('header', 'body_text', 'body_html', 'mimeparts', 'mailbox', 'attachments'))) {
             // Some headers are arrays of objects
             if (in_array($key, array('to', 'from', 'reply_to', 'sender', 'cc', 'bcc', 'return_path'))) {
                 $message[$key . '-name'] = array();
                 $message[$key . '-address'] = array();
                 $message[$key . '-mailbox'] = array();
                 $message[$key . '-host'] = array();
                 foreach ($value as $valkey => $val) {
                     $message[$key . '-name'][$valkey] = isset($val->personal) ? iconv_mime_decode($val->personal, 0, "UTF-8") : '';
                     $message[$key . '-address'][$valkey] = isset($val->mailbox) && isset($val->host) ? $val->mailbox . '@' . $val->host : '';
                     $message[$key . '-mailbox'] = isset($val->mailbox) ? $val->mailbox : '';
                     $message[$key . '-host'] = isset($val->host) ? $val->host : '';
                 }
             } else {
                 $message[$key] = iconv_mime_decode($value, 0, "UTF-8");
             }
         }
     }
 }
开发者ID:redponey,项目名称:openatrium-7.x-2.51,代码行数:28,代码来源:MailhandlerCommandsHeaders.class.php

示例2: fromString

 /**
  * Factory to generate a header object from a string
  *
  * @static
  * @param string $headerLine
  * @return GenericHeader
  */
 public static function fromString($headerLine)
 {
     $headerLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR);
     list($fieldName, $fieldValue) = explode(': ', $headerLine, 2);
     $header = new static($fieldName, $fieldValue);
     return $header;
 }
开发者ID:nevvermind,项目名称:zf2,代码行数:14,代码来源:GenericHeader.php

示例3: fromString

 public static function fromString($headerLine)
 {
     $headerLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');
     list($name, $value) = GenericHeader::splitHeaderLine($headerLine);
     // check to ensure proper header type for this factory
     if (strtolower($name) !== 'content-type') {
         throw new Exception\InvalidArgumentException('Invalid header line for Content-Type string');
     }
     $value = str_replace(Headers::FOLDING, " ", $value);
     $values = preg_split('#\\s*;\\s*#', $value);
     $type = array_shift($values);
     //Remove empty values
     $values = array_filter($values);
     $header = new static();
     $header->setType($type);
     $values = array_filter($values);
     if (count($values)) {
         foreach ($values as $keyValuePair) {
             list($key, $value) = explode('=', $keyValuePair, 2);
             $value = trim($value, "'\" \t\n\r\v");
             $header->addParameter($key, $value);
         }
     }
     return $header;
 }
开发者ID:robertboloc,项目名称:zf2,代码行数:25,代码来源:ContentType.php

示例4: testMimeEncoding

 /**
  * @group ZF2-359
  */
 public function testMimeEncoding()
 {
     $string = 'Umlauts: ä';
     $expected = '=?UTF-8?Q?Umlauts:=20=C3=A4?=';
     $test = HeaderWrap::mimeEncodeValue($string, 'UTF-8', 78);
     $this->assertEquals($expected, $test);
     $this->assertEquals($string, iconv_mime_decode($test, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8'));
 }
开发者ID:razvansividra,项目名称:pnlzf2-1,代码行数:11,代码来源:HeaderWrapTest.php

示例5: fromString

 public static function fromString($headerLine)
 {
     $decodedLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');
     list($name, $value) = GenericHeader::splitHeaderLine($decodedLine);
     $header = new static($name, $value);
     if ($decodedLine != $headerLine) {
         $header->setEncoding('UTF-8');
     }
     return $header;
 }
开发者ID:tejdeeps,项目名称:tejcs.com,代码行数:10,代码来源:GenericHeader.php

示例6: fromString

 public static function fromString($headerLine)
 {
     $headerLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');
     list($name, $value) = GenericHeader::splitHeaderLine($headerLine);
     // check to ensure proper header type for this factory
     if (strtolower($name) !== 'content-transfer-encoding') {
         throw new Exception\InvalidArgumentException('Invalid header line for Content-Transfer-Encoding string');
     }
     $header = new static();
     $header->setTransferEncoding($value);
     return $header;
 }
开发者ID:idwsdta,项目名称:INIT-frame,代码行数:12,代码来源:ContentTransferEncoding.php

示例7: fromString

 /**
  * Factory from header line
  * 
  * @param  string $headerLine 
  * @return Subject
  */
 public static function fromString($headerLine)
 {
     $headerLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR);
     list($name, $value) = preg_split('#: #', $headerLine, 2);
     // check to ensure proper header type for this factory
     if (strtolower($name) !== 'subject') {
         throw new Exception\InvalidArgumentException('Invalid header line for Subject string');
     }
     $header = new static();
     $header->setSubject($value);
     return $header;
 }
开发者ID:nevvermind,项目名称:zf2,代码行数:18,代码来源:Subject.php

示例8: fromString

 /**
  * Deserialize from a string
  * 
  * @param  string $headerLine 
  * @return GenericMultiHeader
  */
 public static function fromString($headerLine)
 {
     $headerLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR);
     list($fieldName, $fieldValue) = explode(': ', $headerLine, 2);
     if (strpos($fieldValue, ',')) {
         $headers = array();
         foreach (explode(',', $fieldValue) as $multiValue) {
             $headers[] = new static($fieldName, $multiValue);
         }
         return $headers;
     } else {
         $header = new static($fieldName, $fieldValue);
         return $header;
     }
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:21,代码来源:GenericMultiHeader.php

示例9: decodeMime

 /**
  * Finds and replaces mime parts with their values.
  * 
  * The method splits the token value into an array on mime-part-patterns,
  * either replacing a mime part with its value by calling iconv_mime_decode
  * or converts the encoding on the text part by calling convertEncoding.
  * 
  * @param string $value
  * @return string
  */
 protected function decodeMime($value)
 {
     $pattern = $this->mimePartPattern;
     $value = preg_replace("/({$pattern})\\s+(?={$pattern})/", '$1', $value);
     $aMimeParts = preg_split("/({$pattern})/", $value, -1, PREG_SPLIT_DELIM_CAPTURE);
     $ret = '';
     foreach ($aMimeParts as $part) {
         if (preg_match("/^{$pattern}\$/", $part)) {
             $ret .= iconv_mime_decode($part, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');
         } else {
             $ret .= $this->convertEncoding($part);
         }
     }
     return $ret;
 }
开发者ID:surebert,项目名称:MailMimeParser,代码行数:25,代码来源:MimeLiteralPart.php

示例10: process

 /**
  * Set known sources and parse additional sources from body.
  */
 function process(&$message, $source)
 {
     // Populate $message with all values from 'header' object.
     $parts = (array) $message['header'];
     foreach ($parts as $key => $value) {
         // Some keys are already taken, so do not overwrite them.
         if (!in_array($key, array('header', 'body_text', 'body_html', 'mimeparts', 'mailbox', 'attachments'))) {
             if (in_array($key, array('Subject', 'subject'))) {
                 $message[$key] = iconv_mime_decode($value, 0, "UTF-8");
             } else {
                 $message[$key] = $value;
             }
         }
     }
 }
开发者ID:morest,项目名称:ictfax,代码行数:18,代码来源:MailhandlerCommandsHeaders.class.php

示例11: mimedecode

 function mimedecode($text, $encoding = 'UTF-8')
 {
     if (function_exists('imap_mime_header_decode') && ($parts = imap_mime_header_decode($text))) {
         $str = '';
         foreach ($parts as $part) {
             $str .= Charset::transcode($part->text, $part->charset, $encoding);
         }
         $text = $str;
     } elseif ($text[0] == '=' && function_exists('iconv_mime_decode')) {
         $text = iconv_mime_decode($text, 0, $encoding);
     } elseif (!strcasecmp($encoding, 'utf-8') && function_exists('imap_utf8')) {
         $text = imap_utf8($text);
     }
     return $text;
 }
开发者ID:gizur,项目名称:osticket,代码行数:15,代码来源:class.format.php

示例12: decode

 function decode($what, $errors = false)
 {
     if (function_exists('imap_mime_header_decode') && ($parts = imap_mime_header_decode($text))) {
         $str = '';
         foreach ($parts as $part) {
             $str .= Format::encode($part->text, $part->charset, $encoding);
         }
         return $str;
     } elseif ($text[0] == '=' && function_exists('iconv_mime_decode')) {
         return iconv_mime_decode($text, 0, $encoding);
         // TODO: Use a pure-PHP version to perform the decoding
     } elseif (!strcasecmp($encoding, 'utf-8') && function_exists('imap_utf8')) {
         return imap_utf8($text);
     }
     return $text;
 }
开发者ID:iHunt101,项目名称:phlite,代码行数:16,代码来源:Mail.php

示例13: fromString

 public static function fromString($headerLine)
 {
     $decodedLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');
     list($name, $value) = explode(':', $decodedLine, 2);
     $value = ltrim($value);
     // check to ensure proper header type for this factory
     if (strtolower($name) !== 'subject') {
         throw new Exception\InvalidArgumentException('Invalid header line for Subject string');
     }
     $header = new static();
     if ($decodedLine != $headerLine) {
         $header->setEncoding('UTF-8');
     }
     $header->setSubject($value);
     return $header;
 }
开发者ID:leonardovn86,项目名称:zf2_basic2013,代码行数:16,代码来源:Subject.php

示例14: convertText

 /**
  * convert text
  *
  * @param string $_string
  * @param boolean $_isHeader (if not, use base64 decode)
  * @param integer $_ellipsis use substring (0 ... value) if value is > 0
  * @return string
  * 
  * @todo make it work for message body (use table for quoted printables?)
  */
 public static function convertText($_string, $_isHeader = TRUE, $_ellipsis = 0)
 {
     $string = $_string;
     if (preg_match('/=?[\\d,\\w,-]*?[q,Q,b,B]?.*?=/', $string)) {
         $string = preg_replace_callback('/(=[1-9,a-f]{2})/', function ($matches) {
             return strtoupper($matches[1]);
         }, $string);
         if ($_isHeader) {
             $string = iconv_mime_decode($string, 2);
         }
     }
     if ($_ellipsis > 0 && strlen($string) > $_ellipsis) {
         Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' String to long, cutting it to ' . $_ellipsis . ' chars.');
         $string = substr($string, 0, $_ellipsis);
     }
     return $string;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:27,代码来源:Message.php

示例15: getSubject

 /**
  *
  * @return string (in UTF-8 format)
  * @throws Exception if a subject header is not found
  */
 public function getSubject()
 {
     if (!isset($this->rawFields['subject'])) {
         throw new Exception("Couldn't find the subject of the email");
     }
     $ret = '';
     if ($this->isImapExtensionAvailable) {
         foreach (imap_mime_header_decode($this->rawFields['subject']) as $h) {
             // subject can span into several lines
             $charset = $h->charset == 'default' ? 'US-ASCII' : $h->charset;
             $ret .= iconv($charset, "UTF-8//TRANSLIT", $h->text);
         }
     } else {
         $ret = utf8_encode(iconv_mime_decode($this->rawFields['subject']));
     }
     return $ret;
 }
开发者ID:gmathis96,项目名称:MailDud,代码行数:22,代码来源:mailparse.php


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