From f66a0b97b00ae9f4883748d72d06502e141f5840 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 8 Mar 2009 19:40:09 +0000 Subject: [PATCH] * Use $wgLang->commaList( array ) instead of implode( ', ', array ) where possible * remove a piece of commented out code in SpecialSearch.php --- includes/LogPage.php | 4 +++- includes/OutputPage.php | 4 ++-- includes/specials/SpecialLinkSearch.php | 4 ++-- includes/specials/SpecialListusers.php | 2 +- includes/specials/SpecialSearch.php | 20 ++++---------------- 5 files changed, 12 insertions(+), 22 deletions(-) diff --git a/includes/LogPage.php b/includes/LogPage.php index 89fa1c587d..e4c1aa1902 100644 --- a/includes/LogPage.php +++ b/includes/LogPage.php @@ -374,11 +374,13 @@ class LogPage { * @return string */ public static function formatBlockFlags( $flags, $forContent = false ) { + global $wgLang; + $flags = explode( ',', trim( $flags ) ); if( count( $flags ) > 0 ) { for( $i = 0; $i < count( $flags ); $i++ ) $flags[$i] = self::formatBlockFlag( $flags[$i], $forContent ); - return '(' . implode( ', ', $flags ) . ')'; + return '(' . $wgLang->commaList( $flags ) . ')'; } else { return ''; } diff --git a/includes/OutputPage.php b/includes/OutputPage.php index a05fdbeeb8..7f8583a956 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1153,7 +1153,7 @@ class OutputPage { * @param string $permission key required */ public function permissionRequired( $permission ) { - global $wgUser; + global $wgUser, $wgLang; $this->setPageTitle( wfMsg( 'badaccess' ) ); $this->setHTMLTitle( wfMsg( 'errorpagetitle' ) ); @@ -1165,7 +1165,7 @@ class OutputPage { User::getGroupsWithPermission( $permission ) ); if( $groups ) { $this->addWikiMsg( 'badaccess-groups', - implode( ', ', $groups ), + $wgLang->commaList( $groups ), count( $groups) ); } else { $this->addWikiMsg( 'badaccess-group0' ); diff --git a/includes/specials/SpecialLinkSearch.php b/includes/specials/SpecialLinkSearch.php index 6b9df58f0c..267ef690d3 100644 --- a/includes/specials/SpecialLinkSearch.php +++ b/includes/specials/SpecialLinkSearch.php @@ -15,7 +15,7 @@ function wfSpecialLinkSearch( $par ) { list( $limit, $offset ) = wfCheckLimits(); - global $wgOut, $wgRequest, $wgUrlProtocols, $wgMiserMode; + global $wgOut, $wgRequest, $wgUrlProtocols, $wgMiserMode, $wgLang; $target = $GLOBALS['wgRequest']->getVal( 'target', $par ); $namespace = $GLOBALS['wgRequest']->getIntorNull( 'namespace', null ); @@ -48,7 +48,7 @@ function wfSpecialLinkSearch( $par ) { $self = Title::makeTitle( NS_SPECIAL, 'Linksearch' ); - $wgOut->addWikiText( wfMsg( 'linksearch-text', '' . implode( ', ', $wgUrlProtocols) . '' ) ); + $wgOut->addWikiText( wfMsg( 'linksearch-text', '' . $wgLang->commaList( $wgUrlProtocols) . '' ) ); $s = Xml::openElement( 'form', array( 'id' => 'mw-linksearch-form', 'method' => 'get', 'action' => $GLOBALS['wgScript'] ) ) . Xml::hidden( 'title', $self->getPrefixedDbKey() ) . '
' . diff --git a/includes/specials/SpecialListusers.php b/includes/specials/SpecialListusers.php index 418b9eb85d..aa0578015f 100644 --- a/includes/specials/SpecialListusers.php +++ b/includes/specials/SpecialListusers.php @@ -123,7 +123,7 @@ class UsersPager extends AlphabeticPager { $list = array(); foreach( self::getGroups( $row->user_id ) as $group ) $list[] = self::buildGroupLink( $group ); - $groups = implode( ', ', $list ); + $groups = $wgLang->commaList( $list ); } elseif( $row->numgroups == 1 ) { $groups = self::buildGroupLink( $row->singlegroup ); } else { diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index f71f678c69..694ab64dfb 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -666,7 +666,7 @@ class SpecialSearch { } protected function formHeader( $term ) { - global $wgContLang, $wgCanonicalNamespaceNames; + global $wgContLang, $wgCanonicalNamespaceNames, $wgLang; $sep = '   '; $out = Xml::openElement('div', array( 'style' => 'padding-bottom:0.5em;' ) ); @@ -680,7 +680,7 @@ class SpecialSearch { // search profiles headers $m = wfMsg( 'searchprofile-articles' ); $tt = wfMsg( 'searchprofile-articles-tooltip', - implode( ', ', SearchEngine::namespacesAsText( SearchEngine::defaultNamespaces() ) ) ); + $wgLang->commaList( SearchEngine::namespacesAsText( SearchEngine::defaultNamespaces() ) ) ); if( $this->active == 'default' ) { $out .= Xml::element( 'strong', array( 'title'=>$tt ), $m ); } else { @@ -697,22 +697,10 @@ class SpecialSearch { $out .= $this->makeSearchLink( $imageTextForm, array( NS_FILE ) , $m, $tt ); } $out .= $sep; - - /* - $m = wfMsg( 'searchprofile-articles-and-proj' ); - $tt = wfMsg( 'searchprofile-project-tooltip', - implode( ', ', SearchEngine::namespacesAsText( SearchEngine::defaultAndProjectNamespaces() ) ) ); - if( $this->active == 'withproject' ) { - $out .= Xml::element( 'strong', array( 'title'=>$tt ), $m ); - } else { - $out .= $this->makeSearchLink( $bareterm, SearchEngine::defaultAndProjectNamespaces(), $m, $tt ); - } - $out .= $sep; - */ - + $m = wfMsg( 'searchprofile-project' ); $tt = wfMsg( 'searchprofile-project-tooltip', - implode( ', ', SearchEngine::namespacesAsText( SearchEngine::projectNamespaces() ) ) ); + $wgLang->commaList( SearchEngine::namespacesAsText( SearchEngine::projectNamespaces() ) ) ); if( $this->active == 'project' ) { $out .= Xml::element( 'strong', array( 'title'=>$tt ), $m ); } else { -- 2.20.1