r47046 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47045‎ | r47046 | r47047 >
Date:17:48, 9 February 2009
Author:siebrand
Status:deferred
Tags:
Comment:
(bug 7509) Separation strings should be configurable

Last commit to fix this issue. Related commits are r47028, r47040, r47044. Originally committed as r40953, which was reverted in r40977, because if was too verbose. Language::pipeList, and Language::commaList should have resolved that.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/WatchlistEditor.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialAllmessages.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialAllpages.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialBlockip.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialContributions.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialNewpages.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialPreferences.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialPrefixindex.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialRecentchanges.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUserlogin.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialWatchlist.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialWhatlinkshere.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/WatchlistEditor.php
@@ -407,6 +407,8 @@
408408 * @return string
409409 */
410410 private function buildRemoveLine( $title, $redirect, $skin ) {
 411+ global $wgLang;
 412+
411413 $link = $skin->makeLinkObj( $title );
412414 if( $redirect )
413415 $link = '<span class="watchlistredir">' . $link . '</span>';
@@ -419,7 +421,7 @@
420422 }
421423 return "<li>"
422424 . Xml::check( 'titles[]', false, array( 'value' => $title->getPrefixedText() ) )
423 - . $link . " (" . implode( ' | ', $tools ) . ")" . "</li>\n";
 425+ . $link . " (" . $wgLang->pipeList( $tools ) . ")" . "</li>\n";
424426 }
425427
426428 /**
@@ -480,11 +482,13 @@
481483 * @return string
482484 */
483485 public static function buildTools( $skin ) {
 486+ global $wgLang;
 487+
484488 $tools = array();
485489 $modes = array( 'view' => false, 'edit' => 'edit', 'raw' => 'raw' );
486490 foreach( $modes as $mode => $subpage ) {
487491 $tools[] = $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Watchlist', $subpage ), wfMsgHtml( "watchlisttools-{$mode}" ) );
488492 }
489 - return implode( ' | ', $tools );
 493+ return $wgLang->pipeList( $tools );
490494 }
491495 }
Index: trunk/phase3/includes/specials/SpecialAllpages.php
@@ -257,7 +257,7 @@
258258 * @param string $to list all pages to this name (default FALSE)
259259 */
260260 function showChunk( $namespace = NS_MAIN, $from = false, $to = false ) {
261 - global $wgOut, $wgUser, $wgContLang;
 261+ global $wgOut, $wgUser, $wgContLang, $wgLang;
262262
263263 $sk = $wgUser->getSkin();
264264
@@ -382,7 +382,7 @@
383383 . ( $namespace ? '&namespace=' . $namespace : '' );
384384 $prevLink = $sk->makeKnownLinkObj( $self,
385385 wfMsgHTML( 'prevpage', htmlspecialchars( $pt ) ), $q );
386 - $out2 .= ' | ' . $prevLink;
 386+ $out2 = $wgLang->pipeList( array( $out2, $prevLink ) );
387387 }
388388
389389 if( $n == $this->maxPerPage && $s = $res->fetchObject() ) {
@@ -392,7 +392,7 @@
393393 . ( $namespace ? '&namespace=' . $namespace : '' );
394394 $nextLink = $sk->makeKnownLinkObj( $self,
395395 wfMsgHtml( 'nextpage', htmlspecialchars( $t->getText() ) ), $q );
396 - $out2 .= ' | ' . $nextLink;
 396+ $out2 = $wgLang->pipeList( array( $out2, $nextLink ) );
397397 }
398398 $out2 .= "</td></tr></table>";
399399 }
@@ -404,7 +404,7 @@
405405 $wgOut->addHTML( $prevLink );
406406 }
407407 if( isset( $prevLink ) && isset( $nextLink ) ) {
408 - $wgOut->addHTML( ' | ' );
 408+ $wgOut->addHTML( wfMsgExt( 'pipe-separator' , 'escapenoentities' ) );
409409 }
410410 if( isset( $nextLink ) ) {
411411 $wgOut->addHTML( $nextLink );
Index: trunk/phase3/includes/specials/SpecialAllmessages.php
@@ -10,7 +10,7 @@
1111 */
1212 function wfSpecialAllmessages() {
1313 global $wgOut, $wgRequest, $wgMessageCache, $wgTitle;
14 - global $wgUseDatabaseMessages;
 14+ global $wgUseDatabaseMessages, $wgLang;
1515
1616 # The page isn't much use if the MediaWiki namespace is not being used
1717 if( !$wgUseDatabaseMessages ) {
@@ -49,16 +49,22 @@
5050 $wgOut->addScriptFile( 'allmessages.js' );
5151 if ( $ot == 'php' ) {
5252 $navText .= wfAllMessagesMakePhp( $messages );
53 - $wgOut->addHTML( 'PHP | <a href="' . $wgTitle->escapeLocalUrl( 'ot=html' ) . '">HTML</a> | ' .
 53+ $wgOut->addHTML( $wgLang->pipeList( array(
 54+ 'PHP',
 55+ '<a href="' . $wgTitle->escapeLocalUrl( 'ot=html' ) . '">HTML</a>',
5456 '<a href="' . $wgTitle->escapeLocalUrl( 'ot=xml' ) . '">XML</a>' .
55 - '<pre>' . htmlspecialchars( $navText ) . '</pre>' );
 57+ '<pre>' . htmlspecialchars( $navText ) . '</pre>'
 58+ ) ) );
5659 } else if ( $ot == 'xml' ) {
5760 $wgOut->disable();
5861 header( 'Content-type: text/xml' );
5962 echo wfAllMessagesMakeXml( $messages );
6063 } else {
61 - $wgOut->addHTML( '<a href="' . $wgTitle->escapeLocalUrl( 'ot=php' ) . '">PHP</a> | ' .
62 - 'HTML | <a href="' . $wgTitle->escapeLocalUrl( 'ot=xml' ) . '">XML</a>' );
 64+ $wgOut->addHTML( $wgLang->pipeList( array(
 65+ '<a href="' . $wgTitle->escapeLocalUrl( 'ot=php' ) . '">PHP</a>',
 66+ 'HTML',
 67+ '<a href="' . $wgTitle->escapeLocalUrl( 'ot=xml' ) . '">XML</a>'
 68+ ) ) );
6369 $wgOut->addWikiText( $navText );
6470 $wgOut->addHTML( wfAllMessagesMakeHTMLText( $messages ) );
6571 }
Index: trunk/phase3/includes/specials/SpecialNewpages.php
@@ -122,7 +122,7 @@
123123 }
124124
125125 protected function filterLinks() {
126 - global $wgGroupPermissions, $wgUser;
 126+ global $wgGroupPermissions, $wgUser, $wgLang;
127127
128128 // show/hide links
129129 $showhide = array( wfMsgHtml( 'show' ), wfMsgHtml( 'hide' ) );
@@ -155,7 +155,7 @@
156156 $links[$key] = wfMsgHtml( $msg, $link );
157157 }
158158
159 - return implode( ' | ', $links );
 159+ return $wgLang->pipeList( $links );
160160 }
161161
162162 protected function form() {
Index: trunk/phase3/includes/specials/SpecialPreferences.php
@@ -679,7 +679,7 @@
680680 $this->tableRow(
681681 wfMsgExt( 'prefs-memberingroups', array( 'parseinline' ), count( $userEffectiveGroupsArray ) ),
682682 $wgLang->commaList( $userEffectiveGroupsArray ) .
683 - '<br />(' . implode( ' | ', $toolLinks ) . ')'
 683+ '<br />(' . $wgLang->pipeList( $toolLinks ) . ')'
684684 ) .
685685
686686 $this->tableRow(
Index: trunk/phase3/includes/specials/SpecialUserlogin.php
@@ -969,6 +969,8 @@
970970 * @return string
971971 */
972972 function makeLanguageSelector() {
 973+ global $wgLang;
 974+
973975 $msg = wfMsgForContent( 'loginlanguagelinks' );
974976 if( $msg != '' && !wfEmptyMsg( 'loginlanguagelinks', $msg ) ) {
975977 $langs = explode( "\n", $msg );
@@ -980,7 +982,7 @@
981983 $links[] = $this->makeLanguageSelectorLink( $parts[0], $parts[1] );
982984 }
983985 }
984 - return count( $links ) > 0 ? wfMsgHtml( 'loginlanguagelabel', implode( ' | ', $links ) ) : '';
 986+ return count( $links ) > 0 ? wfMsgHtml( 'loginlanguagelabel', $wgLang->pipeList( $links ) ) : '';
985987 } else {
986988 return '';
987989 }
Index: trunk/phase3/includes/specials/SpecialWhatlinkshere.php
@@ -340,7 +340,7 @@
341341 $limitLinks[] = $this->makeSelfLink( $prettyLimit, wfArrayToCGI( $overrides, $changed ) );
342342 }
343343
344 - $nums = implode ( ' | ', $limitLinks );
 344+ $nums = $wgLang->pipeList( $limitLinks );
345345
346346 return wfMsgHtml( 'viewprevnext', $prev, $next, $nums );
347347 }
Index: trunk/phase3/includes/specials/SpecialRecentchanges.php
@@ -622,14 +622,14 @@
623623 $cl[] = $this->makeOptionsLink( $wgLang->formatNum( $value ),
624624 array( 'limit' => $value ), $nondefaults, $value == $options['limit'] ) ;
625625 }
626 - $cl = implode( ' | ', $cl );
 626+ $cl = $wgLang->pipeList( $cl );
627627
628628 // day links, reset 'from' to none
629629 foreach( $wgRCLinkDays as $value ) {
630630 $dl[] = $this->makeOptionsLink( $wgLang->formatNum( $value ),
631631 array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] ) ;
632632 }
633 - $dl = implode( ' | ', $dl );
 633+ $dl = $wgLang->pipeList( $dl );
634634
635635
636636 // show/hide links
@@ -654,7 +654,7 @@
655655 if( $wgUser->useRCPatrol() )
656656 $links[] = wfMsgHtml( 'rcshowhidepatr', $patrLink );
657657 $links[] = wfMsgHtml( 'rcshowhidemine', $myselfLink );
658 - $hl = implode( ' | ', $links );
 658+ $hl = $wgLang->pipeList( $links );
659659
660660 // show from this onward link
661661 $now = $wgLang->timeanddate( wfTimestampNow(), true );
Index: trunk/phase3/includes/specials/SpecialPrefixindex.php
@@ -90,7 +90,7 @@
9191 * @param string $from list all pages from this name (default FALSE)
9292 */
9393 function showPrefixChunk( $namespace = NS_MAIN, $prefix, $from = null ) {
94 - global $wgOut, $wgUser, $wgContLang;
 94+ global $wgOut, $wgUser, $wgContLang, $wgLang;
9595
9696 $sk = $wgUser->getSkin();
9797
@@ -175,11 +175,14 @@
176176 wfMsg ( 'allpages' ) );
177177 if( isset( $res ) && $res && ( $n == $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) {
178178 $namespaceparam = $namespace ? "&namespace=$namespace" : "";
179 - $out2 .= " | " . $sk->makeKnownLinkObj(
180 - $self,
181 - wfMsgHtml( 'nextpage', htmlspecialchars( $s->page_title ) ),
182 - "from=" . wfUrlEncode( $s->page_title ) .
183 - "&prefix=" . wfUrlEncode( $prefix ) . $namespaceparam );
 179+ $out2 = $wgLang->pipeList( array(
 180+ $out2,
 181+ $sk->makeKnownLinkObj(
 182+ $self,
 183+ wfMsgHtml( 'nextpage', htmlspecialchars( $s->page_title ) ),
 184+ "from=" . wfUrlEncode( $s->page_title ) .
 185+ "&prefix=" . wfUrlEncode( $prefix ) . $namespaceparam )
 186+ ) );
184187 }
185188 $out2 .= "</td></tr></table>";
186189 }
Index: trunk/phase3/includes/specials/SpecialContributions.php
@@ -190,7 +190,7 @@
191191
192192 wfRunHooks( 'ContributionsToolLinks', array( $id, $nt, &$tools ) );
193193
194 - $links = implode( ' | ', $tools );
 194+ $links = $wgLang->pipeList( $tools );
195195 }
196196
197197 // Old message 'contribsub' had one parameter, but that doesn't work for
Index: trunk/phase3/includes/specials/SpecialBlockip.php
@@ -526,14 +526,14 @@
527527 * @return string
528528 */
529529 private function getConvenienceLinks() {
530 - global $wgUser;
 530+ global $wgUser, $wgLang;
531531 $skin = $wgUser->getSkin();
532532 if( $this->BlockAddress )
533533 $links[] = $this->getContribsLink( $skin );
534534 $links[] = $this->getUnblockLink( $skin );
535535 $links[] = $this->getBlockListLink( $skin );
536536 $links[] = $skin->makeLink ( 'MediaWiki:Ipbreason-dropdown', wfMsgHtml( 'ipb-edit-dropdown' ) );
537 - return '<p class="mw-ipb-conveniencelinks">' . implode( ' | ', $links ) . '</p>';
 537+ return '<p class="mw-ipb-conveniencelinks">' . $wgLang->pipeList( $links ) . '</p>';
538538 }
539539
540540 /**
Index: trunk/phase3/includes/specials/SpecialWatchlist.php
@@ -286,7 +286,7 @@
287287 # Namespace filter and put the whole form together.
288288 $form .= $wlInfo;
289289 $form .= $cutofflinks;
290 - $form .= implode( ' | ', $links );
 290+ $form .= $wgLang->pipeList( $links );
291291 $form .= Xml::openElement( 'form', array( 'method' => 'post', 'action' => $thisTitle->getLocalUrl() ) );
292292 $form .= '<hr /><p>';
293293 $form .= Xml::label( wfMsg( 'namespace' ), 'namespace' ) . '&nbsp;';
@@ -389,6 +389,8 @@
390390 * Returns html
391391 */
392392 function wlCutoffLinks( $days, $page = 'Watchlist', $options = array() ) {
 393+ global $wgLang;
 394+
393395 $hours = array( 1, 2, 6, 12 );
394396 $days = array( 1, 3, 7 );
395397 $i = 0;
@@ -401,8 +403,8 @@
402404 }
403405 return wfMsgExt('wlshowlast',
404406 array('parseinline', 'replaceafter'),
405 - implode(' | ', $hours),
406 - implode(' | ', $days),
 407+ $wgLang->pipeList( $hours ),
 408+ $wgLang->pipeList( $days ),
407409 wlDaysLink( 0, $page, $options ) );
408410 }
409411
Index: trunk/phase3/RELEASE-NOTES
@@ -154,6 +154,7 @@
155155 * (bug 17190) User ID on preference page no longer has delimeters
156156 * (bug 17341) "Powered by MediaWiki" should be on the left on RTL wikis
157157 * (bug 17404) "userrights-interwiki" right was missing in User::$mCoreRights
 158+* (bug 7509) Separation strings should be configurable
158159
159160 == API changes in 1.15 ==
160161 * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r16824(bug 7509) Make back arrow in Special:Whatlinkshere editable through Mediawik...collinj23:13, 6 October 2006
r40953(bug 7509) Don't hardcode separation strings, make them configurable...siebrand09:41, 17 September 2008
r40977Add rangeblocks, a bit of a nuclear option for the abuse filter. Not intended...werdna13:01, 18 September 2008
r40997Revert r40953 '(bug 7509) Don't hardcode separation strings, make them config...brion17:11, 18 September 2008
r47028* Update message 'pipe-separator' to have leading and trailing space for Engl...siebrand09:13, 9 February 2009
r47040* remove forgotten case of hard coded pipe separator in Pager...siebrand14:31, 9 February 2009
r47044Remove hard coding of pipe separators in skins. Use Language::pipeList as muc...siebrand16:24, 9 February 2009

Status & tagging log