logo, improved listing, some helpers, mail confirms table, confirmed flag, user title column..
This commit is contained in:
@@ -654,11 +654,18 @@ class Str extends \Illuminate\Support\Str
|
||||
return preg_replace('/,\s*([}\]])/s','\1', $str);
|
||||
}
|
||||
|
||||
public static function ellipsis($str, $maxlen)
|
||||
public static function ellipsis($str, $maxlen, $margin=10)
|
||||
{
|
||||
$len = mb_strlen($str);
|
||||
if ($len > $maxlen) {
|
||||
return mb_substr($str, 0, $maxlen) . '…';
|
||||
$hard = mb_substr($str, 0, $maxlen);
|
||||
|
||||
$lastspace = mb_strrpos($hard, ' ');
|
||||
if ($lastspace > $maxlen - $margin) {
|
||||
$hard = mb_substr($hard, 0, $lastspace);
|
||||
}
|
||||
|
||||
return $hard . '…';
|
||||
}
|
||||
|
||||
return $str;
|
||||
|
||||
Reference in New Issue
Block a user