From: Brian Wolff Date: Thu, 24 Mar 2011 03:39:21 +0000 (+0000) Subject: (follow-up r84660) Per comments, make truncate return original string instead of... X-Git-Tag: 1.31.0-rc.0~31215 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmes_infos.php?a=commitdiff_plain;h=7eb1053ee4b293804ddda97391183df4a046604c;p=lhc%2Fweb%2Fwiklou.git (follow-up r84660) Per comments, make truncate return original string instead of ellipsis if string is smaller then length and ellipsis is not. --- diff --git a/languages/Language.php b/languages/Language.php index a8b59f5190..4d49c3e996 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -2395,10 +2395,15 @@ class Language { } $eLength = $adjustLength ? strlen( $ellipsis ) : 0; # Check if there is no need to truncate - if ( $length == 0 || strlen( $ellipsis ) >= abs( $length ) ) { + if ( $length == 0 ) { return $ellipsis; } elseif ( strlen( $string ) <= abs( $length ) ) { return $string; + } elseif ( strlen( $ellipsis ) >= abs( $length ) ) { + // Not combined with first (length == 0) if statement, since + // we want to return the string instead of ellipsis if both + // this and the proceeding elseif are true. + return $ellipsis; } $stringOriginal = $string; if ( $length > 0 ) {