From: Michael M Slusarz Date: Wed, 15 Sep 2010 22:08:23 +0000 (-0600) Subject: Make sure truncated text isn't split on a space boundary. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=3662a22f1b29792c066c49e88e464be01c764423;p=horde.git Make sure truncated text isn't split on a space boundary. --- diff --git a/framework/Util/lib/Horde/String.php b/framework/Util/lib/Horde/String.php index 0019e4d83..076cdc4a5 100644 --- a/framework/Util/lib/Horde/String.php +++ b/framework/Util/lib/Horde/String.php @@ -606,7 +606,7 @@ class Horde_String static public function truncate($text, $length = 100) { return (self::length($text) > $length) - ? self::substr($text, 0, $length - 3) . ' ...' + ? rtrim(self::substr($text, 0, $length - 3)) . '...' : $text; } @@ -622,7 +622,7 @@ class Horde_String static public function abbreviate($text, $length = 20) { return (self::length($text) > $length) - ? self::substr($text, 0, round(($length - 3) / 2)) . '...' . self::substr($text, (($length - 3) / 2) * -1) + ? rtrim(self::substr($text, 0, round(($length - 3) / 2))) . '...' . ltrim(self::substr($text, (($length - 3) / 2) * -1)) : $text; }