From 3662a22f1b29792c066c49e88e464be01c764423 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 15 Sep 2010 16:08:23 -0600 Subject: [PATCH] Make sure truncated text isn't split on a space boundary. --- framework/Util/lib/Horde/String.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; } -- 2.11.0