http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84662
Revision: 84662
Author: bawolff
Date: 2011-03-24 03:39:21 +0000 (Thu, 24 Mar 2011)
Log Message:
-----------
(follow-up r84660) Per comments, make truncate return original string instead
of ellipsis if string is smaller then length and ellipsis is not.
Modified Paths:
--------------
trunk/phase3/languages/Language.php
Modified: trunk/phase3/languages/Language.php
===================================================================
--- trunk/phase3/languages/Language.php 2011-03-24 03:00:31 UTC (rev 84661)
+++ trunk/phase3/languages/Language.php 2011-03-24 03:39:21 UTC (rev 84662)
@@ -2395,10 +2395,15 @@
}
$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 ) {
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs