r39515 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r39514‎ | r39515 | r39516 >
Date:00:39, 17 August 2008
Author:aaron
Status:old
Tags:
Comment:
truncate super long pages (bug 15186)
Modified paths:
  • /trunk/phase3/includes/specials/SpecialAllpages.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialAllpages.php
@@ -48,6 +48,11 @@
4949 * Maximum number of pages to show on single index subpage.
5050 */
5151 protected $maxLineCount = 200;
 52+
 53+ /**
 54+ * Maximum number of chars to show for an entry.
 55+ */
 56+ protected $maxPageLength = 70;
5257
5358 /**
5459 * Name of this special page. Used to make title objects that reference back
@@ -225,12 +230,15 @@
226231 $align = $wgContLang->isRtl() ? 'left' : 'right';
227232 $inpointf = htmlspecialchars( str_replace( '_', ' ', $inpoint ) );
228233 $outpointf = htmlspecialchars( str_replace( '_', ' ', $outpoint ) );
 234+ // Don't let the length runaway
 235+ $inpointf = $wgContLang->truncate( $inpointf, $this->maxPageLength, '...' );
 236+ $outpointf = $wgContLang->truncate( $outpointf, $this->maxPageLength, '...' );
 237+
229238 $queryparams = $namespace ? "namespace=$namespace&" : '';
230239 $special = SpecialPage::getTitleFor( $this->name );
231240 $link = $special->escapeLocalUrl( $queryparams . 'from=' . urlencode($inpoint) . '&to=' . urlencode($outpoint) );
232241
233 - $out = wfMsgHtml(
234 - 'alphaindexline',
 242+ $out = wfMsgHtml( 'alphaindexline',
235243 "<a href=\"$link\">$inpointf</a></td><td>",
236244 "</td><td><a href=\"$link\">$outpointf</a>"
237245 );

Status & tagging log