fix removing of last tag in short messages

This commit is contained in:
Denis Ryabov 2014-03-17 15:05:15 +04:00
parent f84b99c862
commit e314117563

View File

@ -138,9 +138,11 @@ class TwisterPost
$text .= ' #' . $tagText;
}
}
$text = mb_substr($text, 0, $maxLen + 1);
$pos = mb_strrpos($text, ' ');
$text = mb_substr($text, 0, $pos);
if(mb_strlen($text) > $maxLen) {
$text = mb_substr($text, 0, $maxLen + 1);
$pos = mb_strrpos($text, ' ');
$text = mb_substr($text, 0, $pos);
}
}
return $text;