change ereg to preg

This commit is contained in:
monte.ohrt
2010-02-16 15:20:47 +00:00
parent 239462fde4
commit c188b50ecc

View File

@@ -34,7 +34,7 @@ function smarty_modifier_truncate($string, $length = 80, $etc = '...',
if (mb_strlen($string) > $length) {
$length -= min($length, mb_strlen($etc));
if (!$break_words && !$middle) {
$string = mb_ereg_replace('/\s+?(\S+)?$/', '', mb_substr($string, 0, $length + 1), 'p');
$string = preg_replace('/\s+?(\S+)?$/u', '', mb_substr($string, 0, $length + 1), 'p');
}
if (!$middle) {
return mb_substr($string, 0, $length) . $etc;