Index: NEWS.txt =================================================================== --- NEWS.txt (revision 7247) +++ NEWS.txt (working copy) @@ -39,7 +39,7 @@ Development =========== - * ... + * t3lib_div now provides the constants LF, CR, CRLF and TAB which can be used to improve code readability. TypoScript changes Index: t3lib/class.t3lib_div.php =================================================================== --- t3lib/class.t3lib_div.php (revision 7247) +++ t3lib/class.t3lib_div.php (working copy) @@ -58,8 +58,8 @@ * 499: function fixed_lgd($string,$origChars,$preStr='...') * 524: function fixed_lgd_pre($string,$chars) * 538: function fixed_lgd_cs($string,$chars) - * 555: function breakTextForEmail($str,$implChar="\n",$charWidth=76) - * 574: function breakLinesForEmail($str,$implChar="\n",$charWidth=76) + * 555: function breakTextForEmail($str,$implChar=LF,$charWidth=76) + * 574: function breakLinesForEmail($str,$implChar=LF,$charWidth=76) * 610: function cmpIP($baseIP, $list) * 626: function cmpIPv4($baseIP, $list) * 668: function cmpIPv6($baseIP, $list) @@ -202,16 +202,14 @@ * */ - - - - - - - - - - + // a tabulator +define('TAB', chr(9)); + // a linefeed +define('LF', chr(10)); + // a carriage return +define('CR', chr(13)); + // a CR-LF combination +define('CRLF', CR . LF); /** * The legendary "t3lib_div" class - Miscellaneous functions for general purpose. @@ -625,15 +623,15 @@ * @deprecated since TYPO3 4.1 - Use PHP function wordwrap() * @return string */ - public static function breakTextForEmail($str,$implChar="\n",$charWidth=76) { + public static function breakTextForEmail($str,$implChar=LF,$charWidth=76) { self::logDeprecatedFunction(); - $lines = explode(chr(10),$str); + $lines = explode(LF,$str); $outArr=array(); foreach ($lines as $lStr) { $outArr[] = self::breakLinesForEmail($lStr,$implChar,$charWidth); } - return implode(chr(10),$outArr); + return implode(LF,$outArr); } /** @@ -646,7 +644,7 @@ * @return string * @see breakTextForEmail() */ - public static function breakLinesForEmail($str,$implChar="\n",$charWidth=76) { + public static function breakLinesForEmail($str,$implChar=LF,$charWidth=76) { $lines=array(); $l=$charWidth; $p=0; @@ -1500,7 +1498,7 @@ * @return string Formatted for