remove line breaks method
This commit is contained in:
parent
41fae2f808
commit
e4a08873ac
@ -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;
|
||||
}
|
||||
|
@ -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, '');
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user