Per Brion's suggestion in http://lists.wikimedia.org/pipermail/wikitech-l/2008-December/040796.html
the active users data from site_stats.
* (bug 13040) Gender-aware user namespace aliases
* Add a <link rel="canonical"> tag on redirected page views
+* Replace hardcoded '...' as indication of a truncation with the
+ 'ellipsis' message
=== Bug fixes in 1.15 ===
* (bug 16968) Special:Upload no longer throws useless warnings.
// Calculate the maximum amount of chars to get
// Max content length = max comment length - length of the comment (excl. $1) - '...'
$maxLength = 255 - (strlen( $reason ) - 2) - 3;
- $contents = $wgContLang->truncate( $contents, $maxLength, '...' );
+ $contents = $wgContLang->truncate( $contents, $maxLength );
// Remove possible unfinished links
$contents = preg_replace( '/\[\[([^\]]*)\]?$/', '$1', $contents );
// Now replace the '$1' placeholder
global $wgContLang;
$truncatedtext = $wgContLang->truncate(
str_replace("\n", ' ', $newtext),
- max( 0, 200 - strlen( wfMsgForContent( 'autosumm-new' ) ) ),
- '...' );
+ max( 0, 200 - strlen( wfMsgForContent( 'autosumm-new' ) ) ) );
return wfMsgForContent( 'autosumm-new', $truncatedtext );
}
global $wgContLang;
$truncatedtext = $wgContLang->truncate(
$newtext,
- max( 0, 200 - strlen( wfMsgForContent( 'autosumm-replace' ) ) ),
- '...'
- );
+ max( 0, 200 - strlen( wfMsgForContent( 'autosumm-replace' ) ) ) );
return wfMsgForContent( 'autosumm-replace', $truncatedtext );
}
$this->textbox2 = $this->safeUnicodeInput( $request, 'wpTextbox2' );
$this->mMetaData = rtrim( $request->getText( 'metadata' ) );
# Truncate for whole multibyte characters. +5 bytes for ellipsis
- $this->summary = $wgLang->truncate( $request->getText( 'wpSummary' ), 250 );
+ $this->summary = $wgLang->truncate( $request->getText( 'wpSummary' ), 250, '' );
# Remove extra headings from summaries and new sections.
$this->summary = preg_replace('/^\s*=+\s*(.*?)\s*=+\s*$/', '$1', $this->summary);
}
$textlink = $this->mShowFilename ?
- $sk->makeKnownLinkObj( $nt, htmlspecialchars( $wgLang->truncate( $nt->getText(), 20, '...' ) ) ) . "<br />\n" :
+ $sk->makeKnownLinkObj( $nt, htmlspecialchars( $wgLang->truncate( $nt->getText(), 20 ) ) ) . "<br />\n" :
'' ;
# ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltidy which
continue;
}
--$contextlines;
- $pre = $wgContLang->truncate( $m[1], -$contextchars, ' ... ' );
+ $pre = $wgContLang->truncate( $m[1], -$contextchars );
if ( count( $m ) < 3 ) {
$post = '';
} else {
- $post = $wgContLang->truncate( $m[3], $contextchars, ' ... ' );
+ $post = $wgContLang->truncate( $m[3], $contextchars );
}
$found = $m[2];
$inpointf = htmlspecialchars( str_replace( '_', ' ', $inpoint ) );
$outpointf = htmlspecialchars( str_replace( '_', ' ', $outpoint ) );
// Don't let the length runaway
- $inpointf = $wgContLang->truncate( $inpointf, $this->maxPageLength, '...' );
- $outpointf = $wgContLang->truncate( $outpointf, $this->maxPageLength, '...' );
+ $inpointf = $wgContLang->truncate( $inpointf, $this->maxPageLength );
+ $outpointf = $wgContLang->truncate( $outpointf, $this->maxPageLength );
$queryparams = $namespace ? "namespace=$namespace&" : '';
$special = $this->getTitle();
* @param $ellipsis String to append to the truncated text
* @return string
*/
- function truncate( $string, $length, $ellipsis = "" ) {
+ function truncate( $string, $length, $ellipsis = '...' ) {
+ # Use the localized ellipsis character
+ if( $ellipsis == '...' ) {
+ $ellipsis = wfMsgExt( 'ellipsis', array( 'escapenoentities', 'language' => $this ) );
+ }
+
if( $length == 0 ) {
return $ellipsis;
}
} elseif( $char >= 0x80 &&
preg_match( '/^(.*)(?:[\xe0-\xef][\x80-\xbf]|' .
'[\xf0-\xf7][\x80-\xbf]{1,2})$/', $string, $m ) ) {
- # We chopped in the middle of a character; remove it
+ # We chopped in the middle of a character; remove it
$string = $m[1];
}
return $string . $ellipsis;
while( $row = $dbw->fetchObject( $result ) ) {
$comment = ( $row->rev_comment == '' )
? ''
- : '(' . $wgContLang->truncate( $row->rev_comment, 40, '...' ) . ')';
+ : '(' . $wgContLang->truncate( $row->rev_comment, 40 ) . ')';
printf( "%10d %10d %14s %20s %s\n",
$row->rev_id,
$row->rev_page,
$row->rev_timestamp,
- $wgContLang->truncate( $row->rev_user_text, 17, '...' ),
+ $wgContLang->truncate( $row->rev_user_text, 17 ),
$comment );
if( $fix ) {
$dbw->delete( 'revision', array( 'rev_id' => $row->rev_id ) );