This commit is contained in:
bzick 2015-01-31 19:16:43 +03:00
parent e310236745
commit 0339a12b3d

View File

@ -107,9 +107,9 @@ class Modifier
if (preg_match('#^(.{' . $length . '}).*?(.{' . $length . '})?$#usS', $string, $match)) {
if (count($match) == 3) {
if ($by_words) {
return preg_replace('#\s.*$#usS', "", $match[1]) .
return preg_replace('#\s\S*$#usS', "", $match[1]) .
$etc .
preg_replace('#.*\s#usS', "", $match[2]);
preg_replace('#\s\S*$#usS', "", $match[2]);
} else {
return $match[1] . $etc . $match[2];
}
@ -118,7 +118,7 @@ class Modifier
} else {
if (preg_match('#^(.{' . $length . '})#usS', $string, $match)) {
if ($by_words) {
return preg_replace('#\s.*$#usS', "", $match[1]) . $etc;
return preg_replace('#\s\S*$#usS', "", $match[1]) . $etc;
} else {
return $match[1] . $etc;
}