diff options
Diffstat (limited to 'lib/helper.php')
-rw-r--r-- | lib/helper.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/helper.php b/lib/helper.php index ccceb58cd4c..5a93e6533de 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -712,4 +712,14 @@ class OC_Helper { return false; } + + + public static function ellipsis($str, $maxlen) { + if (strlen($str) > $maxlen) { + $characters = floor($maxlen / 2); + return substr($str, 0, $characters) . '...' . substr($str, -1 * $characters); + } + return $str; + } + } |