(bug 7509) Separation strings should be configurable
authorSiebrand Mazeland <siebrand@users.mediawiki.org>
Mon, 9 Feb 2009 17:48:41 +0000 (17:48 +0000)
committerSiebrand Mazeland <siebrand@users.mediawiki.org>
Mon, 9 Feb 2009 17:48:41 +0000 (17:48 +0000)
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.

13 files changed:
RELEASE-NOTES
includes/WatchlistEditor.php
includes/specials/SpecialAllmessages.php
includes/specials/SpecialAllpages.php
includes/specials/SpecialBlockip.php
includes/specials/SpecialContributions.php
includes/specials/SpecialNewpages.php
includes/specials/SpecialPreferences.php
includes/specials/SpecialPrefixindex.php
includes/specials/SpecialRecentchanges.php
includes/specials/SpecialUserlogin.php
includes/specials/SpecialWatchlist.php
includes/specials/SpecialWhatlinkshere.php

index cb58432..84e3753 100644 (file)
@@ -154,6 +154,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 17190) User ID on preference page no longer has delimeters
 * (bug 17341) "Powered by MediaWiki" should be on the left on RTL wikis
 * (bug 17404) "userrights-interwiki" right was missing in User::$mCoreRights
+* (bug 7509) Separation strings should be configurable
 
 == API changes in 1.15 ==
 * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions
index e49851b..82f62f6 100644 (file)
@@ -407,6 +407,8 @@ class WatchlistEditor {
         * @return string
         */
        private function buildRemoveLine( $title, $redirect, $skin ) {
+               global $wgLang;
+
                $link = $skin->makeLinkObj( $title );
                if( $redirect )
                        $link = '<span class="watchlistredir">' . $link . '</span>';
@@ -419,7 +421,7 @@ class WatchlistEditor {
                }
                return "<li>"
                        . Xml::check( 'titles[]', false, array( 'value' => $title->getPrefixedText() ) )
-                       . $link . " (" . implode( ' | ', $tools ) . ")" . "</li>\n";
+                       . $link . " (" . $wgLang->pipeList( $tools ) . ")" . "</li>\n";
                }
 
        /**
@@ -480,11 +482,13 @@ class WatchlistEditor {
         * @return string
         */
        public static function buildTools( $skin ) {
+               global $wgLang;
+
                $tools = array();
                $modes = array( 'view' => false, 'edit' => 'edit', 'raw' => 'raw' );
                foreach( $modes as $mode => $subpage ) {
                        $tools[] = $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Watchlist', $subpage ), wfMsgHtml( "watchlisttools-{$mode}" ) );
                }
-               return implode( ' | ', $tools );
+               return $wgLang->pipeList( $tools );
        }
 }
index 0ff94b4..38181c0 100644 (file)
@@ -10,7 +10,7 @@
  */
 function wfSpecialAllmessages() {
        global $wgOut, $wgRequest, $wgMessageCache, $wgTitle;
-       global $wgUseDatabaseMessages;
+       global $wgUseDatabaseMessages, $wgLang;
 
        # The page isn't much use if the MediaWiki namespace is not being used
        if( !$wgUseDatabaseMessages ) {
@@ -49,16 +49,22 @@ function wfSpecialAllmessages() {
        $wgOut->addScriptFile( 'allmessages.js' );
        if ( $ot == 'php' ) {
                $navText .= wfAllMessagesMakePhp( $messages );
-               $wgOut->addHTML( 'PHP | <a href="' . $wgTitle->escapeLocalUrl( 'ot=html' ) . '">HTML</a> | ' .
+               $wgOut->addHTML( $wgLang->pipeList( array(
+                       'PHP',
+                       '<a href="' . $wgTitle->escapeLocalUrl( 'ot=html' ) . '">HTML</a>',
                        '<a href="' . $wgTitle->escapeLocalUrl( 'ot=xml' ) . '">XML</a>' .
-                       '<pre>' . htmlspecialchars( $navText ) . '</pre>' );
+                       '<pre>' . htmlspecialchars( $navText ) . '</pre>'
+               ) ) );
        } else if ( $ot == 'xml' ) {
                $wgOut->disable();
                header( 'Content-type: text/xml' );
                echo wfAllMessagesMakeXml( $messages );
        } else {
-               $wgOut->addHTML( '<a href="' . $wgTitle->escapeLocalUrl( 'ot=php' ) . '">PHP</a> | ' .
-                       'HTML |  <a href="' . $wgTitle->escapeLocalUrl( 'ot=xml' ) . '">XML</a>' );
+               $wgOut->addHTML( $wgLang->pipeList( array(
+                       '<a href="' . $wgTitle->escapeLocalUrl( 'ot=php' ) . '">PHP</a>',
+                       'HTML',
+                       '<a href="' . $wgTitle->escapeLocalUrl( 'ot=xml' ) . '">XML</a>'
+               ) ) );
                $wgOut->addWikiText( $navText );
                $wgOut->addHTML( wfAllMessagesMakeHTMLText( $messages ) );
        }
index 5da23f2..c6c1ca3 100644 (file)
@@ -257,7 +257,7 @@ class SpecialAllpages extends IncludableSpecialPage {
         * @param string $to list all pages to this name (default FALSE)
         */
        function showChunk( $namespace = NS_MAIN, $from = false, $to = false ) {
-               global $wgOut, $wgUser, $wgContLang;
+               global $wgOut, $wgUser, $wgContLang, $wgLang;
 
                $sk = $wgUser->getSkin();
 
@@ -382,7 +382,7 @@ class SpecialAllpages extends IncludableSpecialPage {
                                        . ( $namespace ? '&namespace=' . $namespace : '' );
                                $prevLink = $sk->makeKnownLinkObj( $self,
                                        wfMsgHTML( 'prevpage', htmlspecialchars( $pt ) ), $q );
-                               $out2 .= ' | ' . $prevLink;
+                               $out2 = $wgLang->pipeList( array( $out2, $prevLink ) );
                        }
 
                        if( $n == $this->maxPerPage && $s = $res->fetchObject() ) {
@@ -392,7 +392,7 @@ class SpecialAllpages extends IncludableSpecialPage {
                                        . ( $namespace ? '&namespace=' . $namespace : '' );
                                $nextLink = $sk->makeKnownLinkObj( $self,
                                        wfMsgHtml( 'nextpage', htmlspecialchars( $t->getText() ) ), $q );
-                               $out2 .= ' | ' . $nextLink;
+                               $out2 = $wgLang->pipeList( array( $out2, $nextLink ) );
                        }
                        $out2 .= "</td></tr></table>";
                }
@@ -404,7 +404,7 @@ class SpecialAllpages extends IncludableSpecialPage {
                                $wgOut->addHTML( $prevLink );
                        }
                        if( isset( $prevLink ) && isset( $nextLink ) ) {
-                               $wgOut->addHTML( ' | ' );
+                               $wgOut->addHTML( wfMsgExt( 'pipe-separator' , 'escapenoentities' ) );
                        }
                        if( isset( $nextLink ) ) {
                                $wgOut->addHTML( $nextLink );
index da51d90..5dabd97 100644 (file)
@@ -526,14 +526,14 @@ class IPBlockForm {
         * @return string
         */
        private function getConvenienceLinks() {
-               global $wgUser;
+               global $wgUser, $wgLang;
                $skin = $wgUser->getSkin();
                if( $this->BlockAddress )
                        $links[] = $this->getContribsLink( $skin );
                $links[] = $this->getUnblockLink( $skin );
                $links[] = $this->getBlockListLink( $skin );
                $links[] = $skin->makeLink ( 'MediaWiki:Ipbreason-dropdown', wfMsgHtml( 'ipb-edit-dropdown' ) );
-               return '<p class="mw-ipb-conveniencelinks">' . implode( ' | ', $links ) . '</p>';
+               return '<p class="mw-ipb-conveniencelinks">' . $wgLang->pipeList( $links ) . '</p>';
        }
        
        /**
index 2fb01f5..84ece2a 100644 (file)
@@ -190,7 +190,7 @@ class SpecialContributions extends SpecialPage {
        
                        wfRunHooks( 'ContributionsToolLinks', array( $id, $nt, &$tools ) );
        
-                       $links = implode( ' | ', $tools );
+                       $links = $wgLang->pipeList( $tools );
                }
        
                // Old message 'contribsub' had one parameter, but that doesn't work for
index 597d43a..9cf7177 100644 (file)
@@ -122,7 +122,7 @@ class SpecialNewpages extends SpecialPage {
        }
 
        protected function filterLinks() {
-               global $wgGroupPermissions, $wgUser;
+               global $wgGroupPermissions, $wgUser, $wgLang;
 
                // show/hide links
                $showhide = array( wfMsgHtml( 'show' ), wfMsgHtml( 'hide' ) );
@@ -155,7 +155,7 @@ class SpecialNewpages extends SpecialPage {
                        $links[$key] = wfMsgHtml( $msg, $link );
                }
 
-               return implode( ' | ', $links );
+               return $wgLang->pipeList( $links );
        }
 
        protected function form() {
index b83beb8..5b7e954 100644 (file)
@@ -679,7 +679,7 @@ class PreferencesForm {
                        $this->tableRow(
                                wfMsgExt( 'prefs-memberingroups', array( 'parseinline' ), count( $userEffectiveGroupsArray ) ),
                                $wgLang->commaList( $userEffectiveGroupsArray ) .
-                               '<br />(' . implode( ' | ', $toolLinks ) . ')'
+                               '<br />(' . $wgLang->pipeList( $toolLinks ) . ')'
                        ) .
 
                        $this->tableRow(
index 1572e3f..3ed4d15 100644 (file)
@@ -90,7 +90,7 @@ class SpecialPrefixindex extends SpecialAllpages {
         * @param string $from list all pages from this name (default FALSE)
         */
        function showPrefixChunk( $namespace = NS_MAIN, $prefix, $from = null ) {
-               global $wgOut, $wgUser, $wgContLang;
+               global $wgOut, $wgUser, $wgContLang, $wgLang;
 
                $sk = $wgUser->getSkin();
 
@@ -175,11 +175,14 @@ class SpecialPrefixindex extends SpecialAllpages {
                                                wfMsg ( 'allpages' ) );
                        if( isset( $res ) && $res && ( $n == $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) {
                                $namespaceparam = $namespace ? "&namespace=$namespace" : "";
-                               $out2 .= " | " . $sk->makeKnownLinkObj(
-                                       $self,
-                                       wfMsgHtml( 'nextpage', htmlspecialchars( $s->page_title ) ),
-                                       "from=" . wfUrlEncode( $s->page_title ) .
-                                       "&prefix=" . wfUrlEncode( $prefix ) . $namespaceparam );
+                               $out2 = $wgLang->pipeList( array(
+                                       $out2,
+                                       $sk->makeKnownLinkObj(
+                                               $self,
+                                               wfMsgHtml( 'nextpage', htmlspecialchars( $s->page_title ) ),
+                                               "from=" . wfUrlEncode( $s->page_title ) .
+                                               "&prefix=" . wfUrlEncode( $prefix ) . $namespaceparam )
+                               ) );
                        }
                        $out2 .= "</td></tr></table>";
                }
index 83f6949..2fd7fe4 100644 (file)
@@ -622,14 +622,14 @@ class SpecialRecentChanges extends SpecialPage {
                        $cl[] = $this->makeOptionsLink( $wgLang->formatNum( $value ),
                                array( 'limit' => $value ), $nondefaults, $value == $options['limit'] ) ;
                }
-               $cl = implode( ' | ', $cl );
+               $cl = $wgLang->pipeList( $cl );
 
                // day links, reset 'from' to none
                foreach( $wgRCLinkDays as $value ) {
                        $dl[] = $this->makeOptionsLink( $wgLang->formatNum( $value ),
                                array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] ) ;
                }
-               $dl = implode( ' | ', $dl );
+               $dl = $wgLang->pipeList( $dl );
 
 
                // show/hide links
@@ -654,7 +654,7 @@ class SpecialRecentChanges extends SpecialPage {
                if( $wgUser->useRCPatrol() )
                        $links[] = wfMsgHtml( 'rcshowhidepatr', $patrLink );
                $links[] = wfMsgHtml( 'rcshowhidemine', $myselfLink );
-               $hl = implode( ' | ', $links );
+               $hl = $wgLang->pipeList( $links );
 
                // show from this onward link
                $now = $wgLang->timeanddate( wfTimestampNow(), true );
index 1bb54ed..650654e 100644 (file)
@@ -969,6 +969,8 @@ class LoginForm {
         * @return string
         */
        function makeLanguageSelector() {
+               global $wgLang;
+
                $msg = wfMsgForContent( 'loginlanguagelinks' );
                if( $msg != '' && !wfEmptyMsg( 'loginlanguagelinks', $msg ) ) {
                        $langs = explode( "\n", $msg );
@@ -980,7 +982,7 @@ class LoginForm {
                                        $links[] = $this->makeLanguageSelectorLink( $parts[0], $parts[1] );
                                }
                        }
-                       return count( $links ) > 0 ? wfMsgHtml( 'loginlanguagelabel', implode( ' | ', $links ) ) : '';
+                       return count( $links ) > 0 ? wfMsgHtml( 'loginlanguagelabel', $wgLang->pipeList( $links ) ) : '';
                } else {
                        return '';
                }
index 91ab38e..c62919b 100644 (file)
@@ -286,7 +286,7 @@ function wfSpecialWatchlist( $par ) {
        # Namespace filter and put the whole form together.
        $form .= $wlInfo;
        $form .= $cutofflinks;
-       $form .= implode( ' | ', $links );
+       $form .= $wgLang->pipeList( $links );
        $form .= Xml::openElement( 'form', array( 'method' => 'post', 'action' => $thisTitle->getLocalUrl() ) );
        $form .= '<hr /><p>';
        $form .= Xml::label( wfMsg( 'namespace' ), 'namespace' ) . '&nbsp;';
@@ -389,6 +389,8 @@ function wlDaysLink( $d, $page, $options = array() ) {
  * Returns html
  */
 function wlCutoffLinks( $days, $page = 'Watchlist', $options = array() ) {
+       global $wgLang;
+
        $hours = array( 1, 2, 6, 12 );
        $days = array( 1, 3, 7 );
        $i = 0;
@@ -401,8 +403,8 @@ function wlCutoffLinks( $days, $page = 'Watchlist', $options = array() ) {
        }
        return wfMsgExt('wlshowlast',
                array('parseinline', 'replaceafter'),
-               implode(' | ', $hours),
-               implode(' | ', $days),
+               $wgLang->pipeList( $hours ),
+               $wgLang->pipeList( $days ),
                wlDaysLink( 0, $page, $options ) );
 }
 
index d91b496..0902489 100644 (file)
@@ -340,7 +340,7 @@ class WhatLinksHerePage {
                        $limitLinks[] = $this->makeSelfLink( $prettyLimit, wfArrayToCGI( $overrides, $changed ) );
                }
 
-               $nums = implode ( ' | ', $limitLinks );
+               $nums = $wgLang->pipeList( $limitLinks );
 
                return wfMsgHtml( 'viewprevnext', $prev, $next, $nums );
        }