• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP iconv_mime_decode函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: fromString

 public static function fromString($headerLine)
 {
     $decodedLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');
     // split into name/value
     list($fieldName, $fieldValue) = explode(':', $decodedLine, 2);
     $fieldName = trim($fieldName);
     $fieldValue = trim($fieldValue);
     if (strtolower($fieldName) !== static::$type) {
         throw new Exception\InvalidArgumentException(sprintf('Invalid header line for "%s" string', __CLASS__));
     }
     $header = new static();
     if ($decodedLine != $headerLine) {
         $header->setEncoding('UTF-8');
     }
     // split value on ","
     $fieldValue = str_replace(Headers::FOLDING, ' ', $fieldValue);
     $values = explode(',', $fieldValue);
     array_walk($values, 'trim');
     $addressList = $header->getAddressList();
     foreach ($values as $address) {
         // split values into name/email
         if (!preg_match('/^((?P<name>.*?)<(?P<namedEmail>[^>]+)>|(?P<email>.+))$/', $address, $matches)) {
             // Should we raise an exception here?
             continue;
         }
         $name = null;
         if (isset($matches['name'])) {
             $name = trim($matches['name']);
         }
         if (empty($name)) {
             $name = null;
         }
         if (isset($matches['namedEmail'])) {
             $email = $matches['namedEmail'];
         }
         if (isset($matches['email'])) {
             $email = $matches['email'];
         }
         $email = trim($email);
         // we may have leading whitespace
         // populate address list
         $addressList->add($email, $name);
     }
     return $header;
 }
开发者ID:razvansividra,项目名称:pnlzf2-1,代码行数:45,代码来源:AbstractAddressList.php


示例17: fromString

 public static function fromString($headerLine)
 {
     $decodedLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');
     list($fieldName, $fieldValue) = GenericHeader::splitHeaderLine($decodedLine);
     if (strpos($fieldValue, ',')) {
         $headers = array();
         $encoding = $decodedLine != $headerLine ? 'UTF-8' : 'ASCII';
         foreach (explode(',', $fieldValue) as $multiValue) {
             $header = new static($fieldName, $multiValue);
             $headers[] = $header->setEncoding($encoding);
         }
         return $headers;
     } else {
         $header = new static($fieldName, $fieldValue);
         if ($decodedLine != $headerLine) {
             $header->setEncoding('UTF-8');
         }
         return $header;
     }
 }
开发者ID:tillk,项目名称:vufind,代码行数:20,代码来源:GenericMultiHeader.php


示例18: head_parser

 function head_parser()
 {
     $head = preg_replace("/(\n{1})(\\s{1})/", "-r-n", utf8_encode($this->head));
     preg_match_all("/([\\S].*?)[:{1}](.*)/", $head, $headers[]);
     foreach ($headers[0][1] as $i => $dilimler) {
         $headers[0][2][$i] = preg_replace("/(-r-n)/", "\n\t", utf8_encode($headers[0][2][$i]));
         if ($headerarray[strtolower(trim($dilimler))]) {
             $headerarray[] = array_push($headerarray[strtolower(trim($dilimler))], $headers[0][2][$i]);
         } else {
             $yeni = array(strtolower(trim($dilimler)) => array(trim($headers[0][2][$i])));
             $headerarray = array_merge($headerarray, $yeni);
         }
         unset($headerarray[0]);
         $boundary_parcala = explode(";", $headerarray["content-type"][1]);
         $headerarray["content-type"][0] = $boundary_parcala[0];
         preg_match("#([a-zA-Z]+[^-])[=](.*)#", $boundary_parcala[1], $cikan);
         if (preg_match('#"(.*)"#', $cikan[2], $cikans)) {
             $cikan[2] = $cikans[1];
         }
         $yeni_boundray = array($cikan[1] => array($cikan[2]));
         $headerarray = array_merge($headerarray, $yeni_boundray);
         unset($headerarray[""]);
     }
     if ($headerarray["from"]) {
         preg_match('#^(.*?)([\\w\\+\\-a-z]+[@]+[\\w\\-a-z].*[^<>])#', $headerarray["from"][0], $froms);
         $headerarray["from"]["adress"] = $froms[2];
         preg_match('#[\\w/?\\-\\=\\s\\.*]+[^"<>]#', $froms[1], $name);
         $headerarray["from"]["name"] = iconv_mime_decode($name[0], 0, "UTF-8");
     }
     $headerarray["subject"][0] = iconv_mime_decode($headerarray["subject"][0], 0, "UTF-8");
     if ($headerarray["to"]) {
         preg_match('#^(.*?)([\\w\\+\\-a-z]+[@]+[\\w\\-a-z].*[^<>])#', $headerarray["to"][0], $froms);
         $headerarray["to"]["adress"] = $froms[2];
         preg_match('#[\\w/?\\-\\=\\s\\.*]+[^"<>]#', $froms[1], $name);
         $headerarray["to"]["name"] = $name[0];
     }
     $this->headerarray = $headerarray;
 }
开发者ID:aaress,项目名称:phpmailparser-php-mail-mime-parser,代码行数:38,代码来源:parser.php


示例19: fromString

 public static function fromString($headerLine)
 {
     $decodedLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');
     // split into name/value
     list($fieldName, $fieldValue) = GenericHeader::splitHeaderLine($decodedLine);
     if (strtolower($fieldName) !== static::$type) {
         throw new Exception\InvalidArgumentException(sprintf('Invalid header line for "%s" string', __CLASS__));
     }
     $header = new static();
     if ($decodedLine != $headerLine) {
         $header->setEncoding('UTF-8');
     }
     // split value on ","
     $fieldValue = str_replace(Headers::FOLDING, ' ', $fieldValue);
     $values = str_getcsv($fieldValue, ',');
     array_walk($values, function (&$value) {
         $value = trim($value);
     });
     $addressList = $header->getAddressList();
     foreach ($values as $address) {
         $addressList->addFromString($address);
     }
     return $header;
 }
开发者ID:robertboloc,项目名称:zf2,代码行数:24,代码来源:AbstractAddressList.php


示例20: decodeQuotedPrintable

 /**
  * decode a quoted printable encoded string
  *
  * The charset of the returned string depends on your iconv settings.
  *
  * @param  string encoded string
  * @return string decoded string
  */
 public static function decodeQuotedPrintable($string)
 {
     return iconv_mime_decode($string, ICONV_MIME_DECODE_CONTINUE_ON_ERROR);
 }
开发者ID:Sywooch,项目名称:forums,代码行数:12,代码来源:Decode.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP iconv_mime_decode_headers函数代码示例发布时间:2022-05-15
下一篇:
PHP iconv_get_encoding函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap