|
static | isPrintable ($str) |
|
static | encodeQuotedPrintable ( $str, $lineLength=self::LINELENGTH, $lineEnd=self::LINEEND) |
|
static | encodeQuotedPrintableHeader ( $str, $charset, $lineLength=self::LINELENGTH, $lineEnd=self::LINEEND) |
|
static | encodeBase64Header ( $str, $charset, $lineLength=self::LINELENGTH, $lineEnd=self::LINEEND) |
|
static | encodeBase64 ( $str, $lineLength=self::LINELENGTH, $lineEnd=self::LINEEND) |
|
static | encode ($str, $encoding, $EOL=self::LINEEND) |
|
Definition at line 30 of file Mime.php.
◆ __construct()
__construct |
( |
|
$boundary = null | ) |
|
Constructor
- Parameters
-
Definition at line 603 of file Mime.php.
606 if ($boundary ===
null) {
607 $this->_boundary =
'=_' . md5(microtime(1) . self::$makeUnique++);
609 $this->_boundary = $boundary;
◆ boundary()
Return a MIME boundary
@access public
- Returns
- string
Definition at line 644 of file Mime.php.
◆ boundaryLine()
boundaryLine |
( |
|
$EOL = self::LINEEND | ) |
|
Return a MIME boundary line
- Parameters
-
string | $EOL | Line end; defaults to LINEEND |
- Returns
- string
Definition at line 655 of file Mime.php.
657 return $EOL .
'--' . $this->_boundary . $EOL;
◆ encode()
static encode |
( |
|
$str, |
|
|
|
$encoding, |
|
|
|
$EOL = self::LINEEND |
|
) |
| |
|
static |
Encode the given string with the given encoding.
- Parameters
-
- Returns
- string
- Todo:
- 7Bit and 8Bit is currently handled the same way.
Definition at line 621 of file Mime.php.
const ENCODING_QUOTEDPRINTABLE
static encodeBase64( $str, $lineLength=self::LINELENGTH, $lineEnd=self::LINEEND)
static encodeQuotedPrintable( $str, $lineLength=self::LINELENGTH, $lineEnd=self::LINEEND)
◆ encodeBase64()
static encodeBase64 |
( |
|
$str, |
|
|
|
$lineLength = self::LINELENGTH , |
|
|
|
$lineEnd = self::LINEEND |
|
) |
| |
|
static |
Encode a given string in base64 encoding and break lines according to the maximum linelength.
- Parameters
-
string | $str | |
int | $lineLength | Line length; defaults to LINELENGTH |
string | $lineEnd | Line end; defaults to LINEEND |
- Returns
- string
Definition at line 591 of file Mime.php.
595 return rtrim(chunk_split(base64_encode($str), $lineLength, $lineEnd));
◆ encodeBase64Header()
static encodeBase64Header |
( |
|
$str, |
|
|
|
$charset, |
|
|
|
$lineLength = self::LINELENGTH , |
|
|
|
$lineEnd = self::LINEEND |
|
) |
| |
|
static |
Encode a given string in mail header compatible base64 encoding.
- Parameters
-
string | $str | |
string | $charset | |
int | $lineLength | Line length; defaults to LINELENGTH |
string | $lineEnd | Line end; defaults to LINEEND |
- Returns
- string
Definition at line 565 of file Mime.php.
569 $prefix =
'=?' . $charset .
'?B?';
571 $remainingLength = $lineLength - strlen(
$prefix) - strlen(
$suffix);
574 $encodedValue = str_replace(
579 return $encodedValue;
static encodeBase64( $str, $lineLength=self::LINELENGTH, $lineEnd=self::LINEEND)
◆ encodeQuotedPrintable()
static encodeQuotedPrintable |
( |
|
$str, |
|
|
|
$lineLength = self::LINELENGTH , |
|
|
|
$lineEnd = self::LINEEND |
|
) |
| |
|
static |
Encode a given string with the QUOTED_PRINTABLE mechanism and wrap the lines.
- Parameters
-
string | $str | |
int | $lineLength | Line length; defaults to LINELENGTH |
string | $lineEnd | Line end; defaults to LINEEND |
- Returns
- string
Definition at line 423 of file Mime.php.
430 $str = self::_encodeQuotedPrintable($str);
433 while (strlen($str) > 0) {
435 if ($ptr > $lineLength) {
440 $pos = strrpos(substr($str, 0, $ptr),
'=');
441 if (
$pos !==
false &&
$pos >= $ptr - 2) {
446 if ($ptr > 0 && $str[$ptr - 1] ==
' ') {
451 $out .= substr($str, 0, $ptr) .
'=' . $lineEnd;
452 $str = substr($str, $ptr);
455 $out = rtrim($out, $lineEnd);
456 $out = rtrim($out,
'=');
◆ encodeQuotedPrintableHeader()
static encodeQuotedPrintableHeader |
( |
|
$str, |
|
|
|
$charset, |
|
|
|
$lineLength = self::LINELENGTH , |
|
|
|
$lineEnd = self::LINEEND |
|
) |
| |
|
static |
Encode a given string with the QUOTED_PRINTABLE mechanism for Mail Headers.
Mail headers depend on an extended quoted printable algorithm otherwise a range of bugs can occur.
- Parameters
-
string | $str | |
string | $charset | |
int | $lineLength | Line length; defaults to LINELENGTH |
string | $lineEnd | Line end; defaults to LINEEND |
- Returns
- string
Definition at line 488 of file Mime.php.
493 $prefix = sprintf(
'=?%s?Q?', $charset);
494 $lineLength = $lineLength - strlen(
$prefix) - 3;
496 $str = self::_encodeQuotedPrintable($str);
500 array(
'?',
' ',
'_',
','), array(
'=3F',
'=20',
'=5F',
'=2C'), $str
504 $lines = array(0 =>
"");
508 while (strlen($str) > 0) {
509 $currentLine = max(count($lines) - 1, 0);
510 $token = self::getNextQuotedPrintableToken($str);
511 $str = substr($str, strlen(
$token));
517 if (strlen($lines[$currentLine] . $tmp) > $lineLength) {
518 $lines[$currentLine + 1] = $tmp;
520 $lines[$currentLine] .= $tmp;
525 if (strlen($str) == 0) {
526 $lines[$currentLine] .= $tmp;
531 for (
$i = 0;
$i < count($lines);
$i++) {
534 $str = trim(implode($lineEnd, $lines));
◆ isPrintable()
static isPrintable |
( |
|
$str | ) |
|
|
static |
Check if the given string is "printable"
Checks that a string contains no unprintable characters. If this returns false, encode the string for secure delivery.
- Parameters
-
- Returns
- boolean
Definition at line 410 of file Mime.php.
412 return (strcspn($str, self::$qpKeysString) == strlen($str));
◆ mimeEnd()
mimeEnd |
( |
|
$EOL = self::LINEEND | ) |
|
Return MIME ending
- Parameters
-
string | $EOL | Line end; defaults to LINEEND |
- Returns
- string
Definition at line 666 of file Mime.php.
668 return $EOL .
'--' . $this->_boundary .
'--' . $EOL;
◆ $_boundary
◆ $makeUnique
◆ $qpKeys
◆ $qpKeysString
Initial value:=
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\x7F\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"
Definition at line 398 of file Mime.php.
◆ $qpReplaceValues
◆ DISPOSITION_ATTACHMENT
const DISPOSITION_ATTACHMENT = 'attachment' |
◆ DISPOSITION_INLINE
const DISPOSITION_INLINE = 'inline' |
◆ ENCODING_7BIT
const ENCODING_7BIT = '7bit' |
◆ ENCODING_8BIT
const ENCODING_8BIT = '8bit' |
◆ ENCODING_BASE64
const ENCODING_BASE64 = 'base64' |
◆ ENCODING_QUOTEDPRINTABLE
const ENCODING_QUOTEDPRINTABLE = 'quoted-printable' |
◆ LINEEND
◆ LINELENGTH
◆ MULTIPART_ALTERNATIVE
const MULTIPART_ALTERNATIVE = 'multipart/alternative' |
◆ MULTIPART_MIXED
const MULTIPART_MIXED = 'multipart/mixed' |
◆ MULTIPART_RELATED
const MULTIPART_RELATED = 'multipart/related' |
◆ TYPE_HTML
const TYPE_HTML = 'text/html' |
◆ TYPE_OCTETSTREAM
const TYPE_OCTETSTREAM = 'application/octet-stream' |
◆ TYPE_TEXT
const TYPE_TEXT = 'text/plain' |
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Mime.php