forked from leftypol/leftypol
use multibyte-aware mb_strlen() instead of strlen(); fixed issue #8)
This commit is contained in:
parent
825317ec38
commit
6a02dfd5aa
4 changed files with 21 additions and 15 deletions
|
@ -72,7 +72,7 @@ function twig_sprintf_filter( $value, $var) {
|
|||
}
|
||||
|
||||
function twig_truncate_filter($value, $length = 30, $preserve = false, $separator = '…') {
|
||||
if (strlen($value) > $length) {
|
||||
if (mb_strlen($value) > $length) {
|
||||
if ($preserve) {
|
||||
if (false !== ($breakpoint = strpos($value, ' ', $length))) {
|
||||
$length = $breakpoint;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue