FIX: Личные сообщения
This commit is contained in:
parent
182bf08f96
commit
df5fec9192
|
@ -24,17 +24,17 @@ class Filter
|
|||
return self::fragment($str, $lenght);
|
||||
}
|
||||
|
||||
// https://github.com/paragonie/constant_time_encoding/issues/26
|
||||
// https://bugs.php.net/bug.php?id=80363
|
||||
public static function fragment(string $text, int $lenght = 150, string $charset = 'UTF-8')
|
||||
{
|
||||
if (mb_strlen($text, $charset) >= $lenght) {
|
||||
$wrap = wordwrap($text, $lenght, '~');
|
||||
return mb_substr($wrap, 0, mb_strpos($wrap, '~', 0, $charset), $charset) . '...';
|
||||
$ret = mb_strpos($wrap, '~', 0, $charset);
|
||||
|
||||
return mb_substr($wrap, 0, (int)$ret, $charset) . '...';
|
||||
}
|
||||
|
||||
if (empty($text)) $text = '...';
|
||||
|
||||
return $text;
|
||||
return $text ?? false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue