Moved wfSpecialList() to Language::specialList() so that it can be used in the contex...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Thu, 13 Oct 2011 11:46:21 +0000 (11:46 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Thu, 13 Oct 2011 11:46:21 +0000 (11:46 +0000)
18 files changed:
includes/GlobalFunctions.php
includes/QueryPage.php
includes/specials/SpecialActiveusers.php
includes/specials/SpecialAncientpages.php
includes/specials/SpecialCategories.php
includes/specials/SpecialFewestrevisions.php
includes/specials/SpecialListusers.php
includes/specials/SpecialMostcategories.php
includes/specials/SpecialMostlinked.php
includes/specials/SpecialMostlinkedcategories.php
includes/specials/SpecialMostlinkedtemplates.php
includes/specials/SpecialPopularpages.php
includes/specials/SpecialProtectedpages.php
includes/specials/SpecialProtectedtitles.php
includes/specials/SpecialUnusedtemplates.php
includes/specials/SpecialUnwatchedpages.php
includes/specials/SpecialWantedcategories.php
languages/Language.php

index ade1298..d0e381a 100644 (file)
@@ -2619,13 +2619,11 @@ function in_string( $needle, $str, $insensitive = false ) {
  * @param $oppositedm Boolean  Add the direction mark opposite to your
  *                                                             language, to display text properly
  * @return String
+ * @deprecated since 1.19; use Language::specialList() instead
  */
 function wfSpecialList( $page, $details, $oppositedm = true ) {
        global $wgLang;
-       $dirmark = ( $oppositedm ? $wgLang->getDirMark( true ) : '' ) .
-               $wgLang->getDirMark();
-       $details = $details ? $dirmark . " ($details)" : '';
-       return $page . $details;
+       return $wgLang->specialList( $page, $details, $oppositedm );
 }
 
 /**
index 5691881..c3c96dc 100644 (file)
@@ -777,7 +777,7 @@ abstract class WantedQueryPage extends QueryPage {
                                        array( 'broken' )
                                );
                        }
-                       return wfSpecialList( $pageLink, $this->makeWlhLink( $title, $skin, $result ) );
+                       return $this->getLang()->specialList( $pageLink, $this->makeWlhLink( $title, $skin, $result ) );
                } else {
                        $tsafe = htmlspecialchars( $result->title );
                        return wfMsgHtml( 'wantedpages-badtitle', $tsafe );
index 7e33730..17f4a8b 100644 (file)
@@ -119,6 +119,8 @@ class ActiveUsersPager extends UsersPager {
                $ulinks = Linker::userLink( $row->user_id, $userName );
                $ulinks .= Linker::userToolLinks( $row->user_id, $userName );
 
+               $lang = $this->getLang();
+
                $list = array();
                foreach( self::getGroups( $row->user_id ) as $group ) {
                        if ( isset( $this->groups[$group] ) ) {
@@ -126,14 +128,14 @@ class ActiveUsersPager extends UsersPager {
                        }
                        $list[] = self::buildGroupLink( $group, $userName );
                }
-               $groups = $this->getLang()->commaList( $list );
+               $groups = $lang->commaList( $list );
 
-               $item = wfSpecialList( $ulinks, $groups );
+               $item = $lang->specialList( $ulinks, $groups );
                $count = wfMsgExt( 'activeusers-count',
                        array( 'parsemag' ),
-                       $this->getLang()->formatNum( $row->recentedits ),
+                       $lang->formatNum( $row->recentedits ),
                        $userName,
-                       $this->getLang()->formatNum( $this->RCMaxAge )
+                       $lang->formatNum( $this->RCMaxAge )
                );
                $blocked = $row->blocked ? ' ' . wfMsgExt( 'listusers-blocked', array( 'parsemag' ), $userName ) : '';
 
index 680a948..7f037cd 100644 (file)
@@ -67,6 +67,6 @@ class AncientPagesPage extends QueryPage {
                        $title,
                        htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) )
                );
-               return wfSpecialList( $link, htmlspecialchars( $d ) );
+               return $this->getLang()->specialList( $link, htmlspecialchars( $d ) );
        }
 }
index 896f8e7..16ca322 100644 (file)
@@ -114,9 +114,10 @@ class CategoryPager extends AlphabeticPager {
        function formatRow($result) {
                $title = Title::makeTitle( NS_CATEGORY, $result->cat_title );
                $titleText = Linker::link( $title, htmlspecialchars( $title->getText() ) );
+               $lang = $this->getLang();
                $count = wfMsgExt( 'nmembers', array( 'parsemag', 'escape' ),
-                               $this->getLang()->formatNum( $result->cat_pages ) );
-               return Xml::tags('li', null, wfSpecialList( $titleText, $count ) ) . "\n";
+                               $lang->formatNum( $result->cat_pages ) );
+               return Xml::tags('li', null, $lang->specialList( $titleText, $count ) ) . "\n";
        }
 
        public function getStartForm( $from ) {
index bbeceae..a59f78f 100644 (file)
@@ -90,6 +90,6 @@ class FewestrevisionsPage extends QueryPage {
                        array( 'action' => 'history' )
                ) . $redirect;
 
-               return wfSpecialList( $plink, $nlink );
+               return $this->getLang()->specialList( $plink, $nlink );
        }
 }
index 672ac5b..eb3a006 100644 (file)
@@ -131,24 +131,26 @@ class UsersPager extends AlphabeticPager {
                $userPage = Title::makeTitle( NS_USER, $row->user_name );
                $name = Linker::link( $userPage, htmlspecialchars( $userPage->getText() ) );
 
+               $lang = $this->getLang();
+
                $groups_list = self::getGroups( $row->user_id );
                if( count( $groups_list ) > 0 ) {
                        $list = array();
                        foreach( $groups_list as $group )
                                $list[] = self::buildGroupLink( $group, $userPage->getText() );
-                       $groups = $this->getLang()->commaList( $list );
+                       $groups = $lang->commaList( $list );
                } else {
                        $groups = '';
                }
 
-               $item = wfSpecialList( $name, $groups );
+               $item = $lang->specialList( $name, $groups );
                if( $row->ipb_deleted ) {
                        $item = "<span class=\"deleted\">$item</span>";
                }
 
                global $wgEdititis;
                if ( $wgEdititis ) {
-                       $editCount = $this->getLang()->formatNum( $row->edits );
+                       $editCount = $lang->formatNum( $row->edits );
                        $edits = ' [' . wfMsgExt( 'usereditcount', array( 'parsemag', 'escape' ), $editCount ) . ']';
                } else {
                        $edits = '';
@@ -157,8 +159,8 @@ class UsersPager extends AlphabeticPager {
                $created = '';
                # Some rows may be NULL
                if( $row->creation ) {
-                       $d = $this->getLang()->date( wfTimestamp( TS_MW, $row->creation ), true );
-                       $t = $this->getLang()->time( wfTimestamp( TS_MW, $row->creation ), true );
+                       $d = $lang->date( wfTimestamp( TS_MW, $row->creation ), true );
+                       $t = $lang->time( wfTimestamp( TS_MW, $row->creation ), true );
                        $created = ' (' . wfMsg( 'usercreated', $d, $t ) . ')';
                        $created = htmlspecialchars( $created );
                }
index cc8e492..f75b521 100644 (file)
@@ -62,6 +62,6 @@ class MostcategoriesPage extends QueryPage {
 
                $count = $this->msg( 'ncategories' )->numParams( $result->value )->escaped();
                $link = Linker::link( $title );
-               return wfSpecialList( $link, $count );
+               return $this->getLang()->specialList( $link, $count );
        }
 }
index 6707d6a..390049f 100644 (file)
@@ -99,6 +99,6 @@ class MostlinkedPage extends QueryPage {
                $link = Linker::link( $title );
                $wlh = $this->makeWlhLink( $title,
                        $this->msg( 'nlinks' )->numParams( $result->value )->escaped() );
-               return wfSpecialList( $link, $wlh );
+               return $this->getLang()->specialList( $link, $wlh );
        }
 }
index 4cc7c04..6b36d5a 100644 (file)
@@ -84,6 +84,6 @@ class MostlinkedCategoriesPage extends QueryPage {
                $plink = Linker::link( $nt, htmlspecialchars( $text ) );
 
                $nlinks = $this->msg( 'nmembers' )->numParams( $result->value )->escaped();
-               return wfSpecialList( $plink, $nlinks );
+               return $this->getLang()->specialList( $plink, $nlinks );
        }
 }
index 239a2d7..ab9e152 100644 (file)
@@ -98,7 +98,7 @@ class MostlinkedTemplatesPage extends QueryPage {
        public function formatResult( $skin, $result ) {
                $title = Title::makeTitle( $result->namespace, $result->title );
 
-               return wfSpecialList(
+               return $this->getLang()->specialList(
                        Linker::link( $title ),
                        $this->makeWlhLink( $title, $result )
                );
index 74e6268..63a3267 100644 (file)
@@ -62,6 +62,6 @@ class PopularPagesPage extends QueryPage {
                        htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) )
                );
                $nv = $this->msg( 'nviews' )->numParams( $result->value )->escaped();
-               return wfSpecialList($link, $nv );
+               return $this->getLang()->specialList( $link, $nv );
        }
 }
index fd6026a..7c96faa 100644 (file)
@@ -142,7 +142,7 @@ class SpecialProtectedpages extends SpecialPage {
                return Html::rawElement(
                        'li',
                        array(),
-                       wfSpecialList( $link . $stxt, $lang->commaList( $description_items ), false ) . $changeProtection ) . "\n";
+                       $lang->specialList( $link . $stxt, $lang->commaList( $description_items ), false ) . $changeProtection ) . "\n";
        }
 
        /**
index 0b77755..59792dd 100644 (file)
@@ -105,7 +105,7 @@ class SpecialProtectedtitles extends SpecialPage {
 
                wfProfileOut( __METHOD__ );
 
-               return '<li>' . wfSpecialList( $link, implode( $description_items, ', ' ) ) . "</li>\n";
+               return '<li>' . $lang->specialList( $link, implode( $description_items, ', ' ) ) . "</li>\n";
        }
 
        /**
index da50160..de6f6c7 100644 (file)
@@ -61,19 +61,19 @@ class UnusedtemplatesPage extends QueryPage {
         */
        function formatResult( $skin, $result ) {
                $title = Title::makeTitle( NS_TEMPLATE, $result->title );
-               $pageLink = $skin->linkKnown(
+               $pageLink = Linker::linkKnown(
                        $title,
                        null,
                        array(),
                        array( 'redirect' => 'no' )
                );
-               $wlhLink = $skin->linkKnown(
+               $wlhLink = Linker::linkKnown(
                        SpecialPage::getTitleFor( 'Whatlinkshere' ),
                        wfMsgHtml( 'unusedtemplateswlh' ),
                        array(),
                        array( 'target' => $title->getPrefixedText() )
                );
-               return wfSpecialList( $pageLink, $wlhLink );
+               return $this->getLang()->specialList( $pageLink, $wlhLink );
        }
 
        function getPageHeader() {
index 0f11140..9754b75 100644 (file)
@@ -83,6 +83,6 @@ class UnwatchedpagesPage extends QueryPage {
                        array( 'action' => 'watch', 'token' => $token )
                );
 
-               return wfSpecialList( $plink, $wlink );
+               return $this->getLang()->specialList( $plink, $wlink );
        }
 }
index 9a17adc..212bd5b 100644 (file)
@@ -69,8 +69,9 @@ class WantedCategoriesPage extends WantedQueryPage {
                                array( 'broken' )
                        );
 
+               $lang = $this->getLang();
                $nlinks = wfMsgExt( 'nmembers', array( 'parsemag', 'escape' ),
-                       $this->getLang()->formatNum( $result->value ) );
-               return wfSpecialList( $plink, $nlinks );
+                       $lang->formatNum( $result->value ) );
+               return $lang->specialList( $plink, $nlinks );
        }
 }
index 5833f92..1e69eda 100644 (file)
@@ -3701,6 +3701,22 @@ class Language {
                return str_replace( '$1', $this->formatNum( $size ), $text );
        }
 
+       /**
+        * Make a list item, used by various special pages
+        *
+        * @param $page String Page link
+        * @param $details String Text between brackets
+        * @param $oppositedm Boolean Add the direction mark opposite to your
+        *                    language, to display text properly
+        * @return String
+        */
+       function specialList( $page, $details, $oppositedm = true ) {
+               $dirmark = ( $oppositedm ? $this->getDirMark( true ) : '' ) .
+                       $this->getDirMark();
+               $details = $details ? $dirmark . " ($details)" : '';
+               return $page . $details;
+       }
+
        /**
         * Get the conversion rule title, if any.
         *