http://www.mediawiki.org/wiki/Special:Code/MediaWiki/99678

Revision: 99678
Author:   ialex
Date:     2011-10-13 11:46:21 +0000 (Thu, 13 Oct 2011)
Log Message:
-----------
Moved wfSpecialList() to Language::specialList() so that it can be used in the 
context of special pages instead of relying unconditionally of $wgLang. Updated 
all calls in core and added a @deprecated comment to wfSpecialList() but not a 
wfDeprecated() call since it's still used in SiteMatrix and StalePages 
extensions.

Modified Paths:
--------------
    trunk/phase3/includes/GlobalFunctions.php
    trunk/phase3/includes/QueryPage.php
    trunk/phase3/includes/specials/SpecialActiveusers.php
    trunk/phase3/includes/specials/SpecialAncientpages.php
    trunk/phase3/includes/specials/SpecialCategories.php
    trunk/phase3/includes/specials/SpecialFewestrevisions.php
    trunk/phase3/includes/specials/SpecialListusers.php
    trunk/phase3/includes/specials/SpecialMostcategories.php
    trunk/phase3/includes/specials/SpecialMostlinked.php
    trunk/phase3/includes/specials/SpecialMostlinkedcategories.php
    trunk/phase3/includes/specials/SpecialMostlinkedtemplates.php
    trunk/phase3/includes/specials/SpecialPopularpages.php
    trunk/phase3/includes/specials/SpecialProtectedpages.php
    trunk/phase3/includes/specials/SpecialProtectedtitles.php
    trunk/phase3/includes/specials/SpecialUnusedtemplates.php
    trunk/phase3/includes/specials/SpecialUnwatchedpages.php
    trunk/phase3/includes/specials/SpecialWantedcategories.php
    trunk/phase3/languages/Language.php

Modified: trunk/phase3/includes/GlobalFunctions.php
===================================================================
--- trunk/phase3/includes/GlobalFunctions.php   2011-10-13 11:32:15 UTC (rev 
99677)
+++ trunk/phase3/includes/GlobalFunctions.php   2011-10-13 11:46:21 UTC (rev 
99678)
@@ -2619,13 +2619,11 @@
  * @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 );
 }
 
 /**

Modified: trunk/phase3/includes/QueryPage.php
===================================================================
--- trunk/phase3/includes/QueryPage.php 2011-10-13 11:32:15 UTC (rev 99677)
+++ trunk/phase3/includes/QueryPage.php 2011-10-13 11:46:21 UTC (rev 99678)
@@ -777,7 +777,7 @@
                                        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 );

Modified: trunk/phase3/includes/specials/SpecialActiveusers.php
===================================================================
--- trunk/phase3/includes/specials/SpecialActiveusers.php       2011-10-13 
11:32:15 UTC (rev 99677)
+++ trunk/phase3/includes/specials/SpecialActiveusers.php       2011-10-13 
11:46:21 UTC (rev 99678)
@@ -119,6 +119,8 @@
                $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 @@
                        }
                        $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 ) : '';
 

Modified: trunk/phase3/includes/specials/SpecialAncientpages.php
===================================================================
--- trunk/phase3/includes/specials/SpecialAncientpages.php      2011-10-13 
11:32:15 UTC (rev 99677)
+++ trunk/phase3/includes/specials/SpecialAncientpages.php      2011-10-13 
11:46:21 UTC (rev 99678)
@@ -67,6 +67,6 @@
                        $title,
                        htmlspecialchars( $wgContLang->convert( 
$title->getPrefixedText() ) )
                );
-               return wfSpecialList( $link, htmlspecialchars( $d ) );
+               return $this->getLang()->specialList( $link, htmlspecialchars( 
$d ) );
        }
 }

Modified: trunk/phase3/includes/specials/SpecialCategories.php
===================================================================
--- trunk/phase3/includes/specials/SpecialCategories.php        2011-10-13 
11:32:15 UTC (rev 99677)
+++ trunk/phase3/includes/specials/SpecialCategories.php        2011-10-13 
11:46:21 UTC (rev 99678)
@@ -114,9 +114,10 @@
        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 ) {

Modified: trunk/phase3/includes/specials/SpecialFewestrevisions.php
===================================================================
--- trunk/phase3/includes/specials/SpecialFewestrevisions.php   2011-10-13 
11:32:15 UTC (rev 99677)
+++ trunk/phase3/includes/specials/SpecialFewestrevisions.php   2011-10-13 
11:46:21 UTC (rev 99678)
@@ -90,6 +90,6 @@
                        array( 'action' => 'history' )
                ) . $redirect;
 
-               return wfSpecialList( $plink, $nlink );
+               return $this->getLang()->specialList( $plink, $nlink );
        }
 }

Modified: trunk/phase3/includes/specials/SpecialListusers.php
===================================================================
--- trunk/phase3/includes/specials/SpecialListusers.php 2011-10-13 11:32:15 UTC 
(rev 99677)
+++ trunk/phase3/includes/specials/SpecialListusers.php 2011-10-13 11:46:21 UTC 
(rev 99678)
@@ -131,24 +131,26 @@
                $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 @@
                $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 );
                }

Modified: trunk/phase3/includes/specials/SpecialMostcategories.php
===================================================================
--- trunk/phase3/includes/specials/SpecialMostcategories.php    2011-10-13 
11:32:15 UTC (rev 99677)
+++ trunk/phase3/includes/specials/SpecialMostcategories.php    2011-10-13 
11:46:21 UTC (rev 99678)
@@ -62,6 +62,6 @@
 
                $count = $this->msg( 'ncategories' )->numParams( $result->value 
)->escaped();
                $link = Linker::link( $title );
-               return wfSpecialList( $link, $count );
+               return $this->getLang()->specialList( $link, $count );
        }
 }

Modified: trunk/phase3/includes/specials/SpecialMostlinked.php
===================================================================
--- trunk/phase3/includes/specials/SpecialMostlinked.php        2011-10-13 
11:32:15 UTC (rev 99677)
+++ trunk/phase3/includes/specials/SpecialMostlinked.php        2011-10-13 
11:46:21 UTC (rev 99678)
@@ -99,6 +99,6 @@
                $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 );
        }
 }

Modified: trunk/phase3/includes/specials/SpecialMostlinkedcategories.php
===================================================================
--- trunk/phase3/includes/specials/SpecialMostlinkedcategories.php      
2011-10-13 11:32:15 UTC (rev 99677)
+++ trunk/phase3/includes/specials/SpecialMostlinkedcategories.php      
2011-10-13 11:46:21 UTC (rev 99678)
@@ -84,6 +84,6 @@
                $plink = Linker::link( $nt, htmlspecialchars( $text ) );
 
                $nlinks = $this->msg( 'nmembers' )->numParams( $result->value 
)->escaped();
-               return wfSpecialList( $plink, $nlinks );
+               return $this->getLang()->specialList( $plink, $nlinks );
        }
 }

Modified: trunk/phase3/includes/specials/SpecialMostlinkedtemplates.php
===================================================================
--- trunk/phase3/includes/specials/SpecialMostlinkedtemplates.php       
2011-10-13 11:32:15 UTC (rev 99677)
+++ trunk/phase3/includes/specials/SpecialMostlinkedtemplates.php       
2011-10-13 11:46:21 UTC (rev 99678)
@@ -98,7 +98,7 @@
        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 )
                );

Modified: trunk/phase3/includes/specials/SpecialPopularpages.php
===================================================================
--- trunk/phase3/includes/specials/SpecialPopularpages.php      2011-10-13 
11:32:15 UTC (rev 99677)
+++ trunk/phase3/includes/specials/SpecialPopularpages.php      2011-10-13 
11:46:21 UTC (rev 99678)
@@ -62,6 +62,6 @@
                        htmlspecialchars( $wgContLang->convert( 
$title->getPrefixedText() ) )
                );
                $nv = $this->msg( 'nviews' )->numParams( $result->value 
)->escaped();
-               return wfSpecialList($link, $nv );
+               return $this->getLang()->specialList( $link, $nv );
        }
 }

Modified: trunk/phase3/includes/specials/SpecialProtectedpages.php
===================================================================
--- trunk/phase3/includes/specials/SpecialProtectedpages.php    2011-10-13 
11:32:15 UTC (rev 99677)
+++ trunk/phase3/includes/specials/SpecialProtectedpages.php    2011-10-13 
11:46:21 UTC (rev 99678)
@@ -142,7 +142,7 @@
                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";
        }
 
        /**

Modified: trunk/phase3/includes/specials/SpecialProtectedtitles.php
===================================================================
--- trunk/phase3/includes/specials/SpecialProtectedtitles.php   2011-10-13 
11:32:15 UTC (rev 99677)
+++ trunk/phase3/includes/specials/SpecialProtectedtitles.php   2011-10-13 
11:46:21 UTC (rev 99678)
@@ -105,7 +105,7 @@
 
                wfProfileOut( __METHOD__ );
 
-               return '<li>' . wfSpecialList( $link, implode( 
$description_items, ', ' ) ) . "</li>\n";
+               return '<li>' . $lang->specialList( $link, implode( 
$description_items, ', ' ) ) . "</li>\n";
        }
 
        /**

Modified: trunk/phase3/includes/specials/SpecialUnusedtemplates.php
===================================================================
--- trunk/phase3/includes/specials/SpecialUnusedtemplates.php   2011-10-13 
11:32:15 UTC (rev 99677)
+++ trunk/phase3/includes/specials/SpecialUnusedtemplates.php   2011-10-13 
11:46:21 UTC (rev 99678)
@@ -61,19 +61,19 @@
         */
        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() {

Modified: trunk/phase3/includes/specials/SpecialUnwatchedpages.php
===================================================================
--- trunk/phase3/includes/specials/SpecialUnwatchedpages.php    2011-10-13 
11:32:15 UTC (rev 99677)
+++ trunk/phase3/includes/specials/SpecialUnwatchedpages.php    2011-10-13 
11:46:21 UTC (rev 99678)
@@ -83,6 +83,6 @@
                        array( 'action' => 'watch', 'token' => $token )
                );
 
-               return wfSpecialList( $plink, $wlink );
+               return $this->getLang()->specialList( $plink, $wlink );
        }
 }

Modified: trunk/phase3/includes/specials/SpecialWantedcategories.php
===================================================================
--- trunk/phase3/includes/specials/SpecialWantedcategories.php  2011-10-13 
11:32:15 UTC (rev 99677)
+++ trunk/phase3/includes/specials/SpecialWantedcategories.php  2011-10-13 
11:46:21 UTC (rev 99678)
@@ -69,8 +69,9 @@
                                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 );
        }
 }

Modified: trunk/phase3/languages/Language.php
===================================================================
--- trunk/phase3/languages/Language.php 2011-10-13 11:32:15 UTC (rev 99677)
+++ trunk/phase3/languages/Language.php 2011-10-13 11:46:21 UTC (rev 99678)
@@ -3702,6 +3702,22 @@
        }
 
        /**
+        * 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.
         *
         * @return string


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to