Zoekfunctie, links gefixt

This commit is contained in:
2020-02-04 20:22:40 +01:00
parent a32f4b7476
commit d1210e1441
11 changed files with 354 additions and 382 deletions

View File

@@ -61,6 +61,7 @@ class FormatterHelper
public static function excerpt($text, $maxLength)
{
$allowed = '<mark>';
if(strlen($text) < $maxLength)
{
return $text;
@@ -69,10 +70,10 @@ class FormatterHelper
$matches = [];
if(preg_match('/\W/', $text, $matches, PREG_OFFSET_CAPTURE, $maxLength))
{
return substr(strip_tags($text), 0, $matches[0][1]) . "...";
return substr(strip_tags($text, $allowed), 0, $matches[0][1]) . "...";
}
return substr(strip_tags($text), $maxLength) . "...";
return substr(strip_tags($text, $allowed), $maxLength) . "...";
}
}
/*