PHPMailer\PHPMailer
PHPMailer::normalizeBreaks
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.
Method of the class: PHPMailer{}
No Hooks.
Returns
String.
Usage
$result = PHPMailer::normalizeBreaks( $text, $breaktype );
- $text(string) (required)
- .
- $breaktype(string)
- What kind of line break to use; defaults to static::$LE.
Default:null
PHPMailer::normalizeBreaks() PHPMailer::normalizeBreaks code WP 7.0
public static function normalizeBreaks($text, $breaktype = null)
{
if (null === $breaktype) {
$breaktype = static::$LE;
}
//Normalise to \n
$text = str_replace([self::CRLF, "\r"], "\n", $text);
//Now convert LE as needed
if ("\n" !== $breaktype) {
$text = str_replace("\n", $breaktype, $text);
}
return $text;
}