public static function PHPMailer::normalizeBreaks
Search API
5.x PHPMailer.php | public static PHPMailer::normalizeBreaks($text, $breaktype = null) |
Normalize line breaks in a string. Converts UNIX LF, Mac CR and Windows CRLF line breaks into a single line break format. Defaults to CRLF (for message bodies) and preserves consecutive breaks.
Parameters
string $text:
string $breaktype What kind of line break to use; defaults to static::$LE:
Return value
string
8 calls to PHPMailer::normalizeBreaks()
- PHPMailer::DKIM_Add in inc/
PHPMailer/ src/ PHPMailer.php - Create the DKIM header and body in a new message header.
- PHPMailer::DKIM_BodyC in inc/
PHPMailer/ src/ PHPMailer.php - Generate a DKIM canonicalization body. Uses the 'simple' algorithm from RFC6376 section 3.4.3. Canonicalized bodies should *always* use CRLF, regardless of mailer setting.
- PHPMailer::encodeHeader in inc/
PHPMailer/ src/ PHPMailer.php - Encode a header value (not including its label) optimally. Picks shortest of Q, B, or none. Result includes folding if needed. See RFC822 definitions for phrase, comment and text positions.
- PHPMailer::encodeQP in inc/
PHPMailer/ src/ PHPMailer.php - Encode a string in quoted-printable format. According to RFC2045 section 6.7.
- PHPMailer::encodeString in inc/
PHPMailer/ src/ PHPMailer.php - Encode a string in requested format. Returns an empty string on failure.
File
- inc/
PHPMailer/ src/ PHPMailer.php, line 4230
Class
- PHPMailer
- PHPMailer - PHP email creation and transport class.
Namespace
PHPMailer\PHPMailerCode
public static function normalizeBreaks($text, $breaktype = null)
{
if (null === $breaktype) {
$breaktype = static::$LE;
}
// Normalise to \n
$text = str_replace(["\r\n", "\r"], "\n", $text);
// Now convert LE as needed
if ("\n" !== $breaktype) {
$text = str_replace("\n", $breaktype, $text);
}
return $text;
}