From f665564a79ab4a421861ce0f0584a63068c21a9e Mon Sep 17 00:00:00 2001 From: Benedict Etzel Date: Mon, 21 Oct 2013 13:04:02 +0200 Subject: [PATCH] only append ellipsis in limit_words when string was actually limited --- lib/pico.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pico.php b/lib/pico.php index 259c05a..94f1144 100644 --- a/lib/pico.php +++ b/lib/pico.php @@ -342,7 +342,9 @@ class Pico { private function limit_words($string, $word_limit) { $words = explode(' ',$string); - return trim(implode(' ', array_splice($words, 0, $word_limit))) .'...'; + $excerpt = trim(implode(' ', array_splice($words, 0, $word_limit))); + if(count($words) > $word_limit) $excerpt .= '…'; + return $excerpt; } }