public static function limitStringLength($string, $length = 100) {
// don't add the ... if the string length is already less than $length
if (strlen($string) < $length) {
return $string;
}
// safer string limiting
if (function_exists('mb_substr')) {
return mb_substr($string, 0, $length, "utf-8") . '...';
}
// fallback
return substr($string, 0, $length) . '...';
}