diff --git a/bl-kernel/helpers/text.class.php b/bl-kernel/helpers/text.class.php index fd15d378..fa1b423a 100644 --- a/bl-kernel/helpers/text.class.php +++ b/bl-kernel/helpers/text.class.php @@ -126,6 +126,11 @@ class Text { return preg_replace("/[\/_|+:!@#$%^&*()'\"<>\\\`}{;=,?\[\]~. -]+/", $replace, $string); } + public static function removeLineBreaks($string) + { + return str_replace(array("\r", "\n"), '', $string); + } + // Convert unicode characters to utf-8 characters // Characters that cannot be converted will be removed from the string // This function can return an empty string @@ -137,6 +142,7 @@ class Text { $string = self::lowercase($string); $string = trim($string, $separator); $string = self::removeSpecialCharacters($string, $separator); + $string = self::removeLineBreaks($string); $string = trim($string, $separator); return $string; } diff --git a/bl-kernel/pages.class.php b/bl-kernel/pages.class.php index 7e5a7d3c..f722e3c3 100644 --- a/bl-kernel/pages.class.php +++ b/bl-kernel/pages.class.php @@ -606,8 +606,7 @@ class Pages extends dbJSON { // Returns string without HTML tags and truncated private function generateSlug($text, $truncateLength=60) { $tmpslug = Text::removeHTMLTags($text); - // Remove break lines - $tmpslug = str_replace(array("\r", "\n"), '', $tmpslug); + $tmpslug = Text::removeLineBreaks($tmpslug); return Text::truncate($tmpslug, $truncateLength, ''); }