Definition at line 33 of file Decode.php.
◆ decodeQuotedPrintable()
static decodeQuotedPrintable |
( |
|
$string | ) |
|
|
static |
decode a quoted printable encoded string
The charset of the returned string depends on your iconv settings.
- Parameters
-
string | $string | Encoded string |
- Returns
- string Decoded string
Definition at line 272 of file Decode.php.
274 return quoted_printable_decode($string);
◆ splitContentType()
static splitContentType |
( |
|
$type, |
|
|
|
$wantedPart = null |
|
) |
| |
|
static |
split a content type in its different parts
- Parameters
-
string | $type | content-type |
string | $wantedPart | the wanted part, else an array with all parts is returned |
- Returns
- string|array wanted part or all parts as array('type' => content-type, partname => value)
Definition at line 203 of file Decode.php.
static splitHeaderField( $field, $wantedPart=null, $firstName=0)
◆ splitHeaderField()
static splitHeaderField |
( |
|
$field, |
|
|
|
$wantedPart = null , |
|
|
|
$firstName = 0 |
|
) |
| |
|
static |
split a header field like content type in its different parts
- Parameters
-
string | $field | |
string | $wantedPart | the wanted part, else an array with all parts is returned |
int | string | $firstName | key name for the first part |
- Exceptions
-
- Returns
- string|array wanted part or all parts as array($firstName => firstPart, partname => value)
Definition at line 217 of file Decode.php.
221 $wantedPart = strtolower($wantedPart);
222 $firstName = strtolower($firstName);
225 if ($firstName === $wantedPart) {
226 $field = strtok($field,
';');
228 return $field[0] ==
'"' ? substr($field, 1, -1) : $field;
231 $field = $firstName .
'=' . $field;
232 if (!preg_match_all(
'%([^=\s]+)\s*=\s*("[^"]+"|[^;]+)(;\s*|$)%', $field, $matches)) {
237 foreach ($matches[1] as $key =>
$name) {
238 if (strcasecmp(
$name, $wantedPart)) {
241 if ($matches[2][$key][0] !=
'"') {
242 return $matches[2][$key];
245 return substr($matches[2][$key], 1, -1);
252 foreach ($matches[1] as $key =>
$name) {
254 if ($matches[2][$key][0] ==
'"') {
255 $split[
$name] = substr($matches[2][$key], 1, -1);
257 $split[
$name] = $matches[2][$key];
if(!isset($_GET['name'])) $name
◆ splitMessage()
split a message in header and body part, if no header or an invalid header is found $headers is empty
The charset of the returned headers depend on your iconv settings.
- Parameters
-
string | $message | raw message with header and optional content |
array | $headers | output param, array with headers as array(name => value) |
string | $body | output param, content of message |
string | $EOL | EOL string; defaults to Zend_Mime::LINEEND |
- Returns
- null
Definition at line 123 of file Decode.php.
128 $firstline = strtok(
$message,
"\n");
129 if (!preg_match(
'%^[^\s]+[^:]*:%', $firstline)) {
147 if (strpos(
$message, $EOL . $EOL)) {
148 list($headers, $body) = explode($EOL . $EOL,
$message, 2);
151 if ($EOL !=
"\r\n" && strpos(
$message,
"\r\n\r\n")) {
152 list($headers, $body) = explode(
"\r\n\r\n",
$message, 2);
155 if ($EOL !=
"\n" && strpos(
$message,
"\n\n")) {
156 list($headers, $body) = explode(
"\n\n",
$message, 2);
159 @list($headers, $body) =
160 @preg_split(
"%([\r\n]+)\\1%U",
$message, 2);
165 $headers = iconv_mime_decode_headers(
166 $headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR
169 if ($headers ===
false) {
175 foreach ($headers as
$name => $header) {
176 $lower = strtolower(
$name);
177 if ($lower ==
$name) {
180 unset($headers[
$name]);
181 if (!isset($headers[$lower])) {
182 $headers[$lower] = $header;
185 if (is_array($headers[$lower])) {
186 $headers[$lower][] = $header;
189 $headers[$lower] = array(
if(!isset($_GET['name'])) $name
◆ splitMessageStruct()
decodes a mime encoded String and returns a struct of parts with header and body
- Parameters
-
string | $message | raw message content |
string | $boundary | boundary as found in content-type |
string | $EOL | EOL string; defaults to Zend_Mime::LINEEND |
- Returns
- array|null parts as array('header' => array(name => value), 'body' => content), null if no parts found
- Exceptions
-
Definition at line 91 of file Decode.php.
96 if (count($parts) <= 0) {
100 foreach ($parts as $part) {
103 'header' => $headers,
static splitMessage( $message, &$headers, &$body, $EOL=Zend_Mime::LINEEND)
static splitMime($body, $boundary)
◆ splitMime()
static splitMime |
( |
|
$body, |
|
|
|
$boundary |
|
) |
| |
|
static |
Explode MIME multipart string into seperate parts
Parts consist of the header and the body of each MIME part.
- Parameters
-
string | $body | raw body of message |
string | $boundary | boundary as found in content-type |
- Returns
- array parts with content of each part, empty if no parts found
- Exceptions
-
Definition at line 45 of file Decode.php.
48 $body = str_replace(
"\r",
'', $body);
55 $p = strpos($body,
'--' . $boundary .
"\n",
$start);
62 $start = $p + 3 + strlen($boundary);
64 while (($p = strpos($body,
'--' . $boundary .
"\n",
$start)) !==
false) {
66 $start = $p + 3 + strlen($boundary);
70 $p = strpos($body,
'--' . $boundary .
'--',
$start);
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Mime/Decode.php