API: Improve list=random
[lhc/web/wiklou.git] / includes / specials / SpecialStatistics.php
index 3e3a2ab..8de6f8b 100644 (file)
@@ -78,7 +78,7 @@ class SpecialStatistics extends SpecialPage {
 
                # Statistic - other
                $extraStats = array();
-               if ( Hooks::run( 'SpecialStatsAddExtra', array( &$extraStats ) ) ) {
+               if ( Hooks::run( 'SpecialStatsAddExtra', array( &$extraStats, $this->getContext() ) ) ) {
                        $text .= $this->getOtherStats( $extraStats );
                }
 
@@ -107,11 +107,11 @@ class SpecialStatistics extends SpecialPage {
        ) {
                if ( $descMsg ) {
                        $msg = $this->msg( $descMsg, $descMsgParam );
-                       if ( $msg->exists() ) {
-                               $descriptionText = $this->msg( 'parentheses' )->rawParams( $msg->parse() )
+                       if ( !$msg->isDisabled() ) {
+                               $descriptionHtml = $this->msg( 'parentheses' )->rawParams( $msg->parse() )
                                        ->escaped();
-                               $text .= "<br />" . Xml::element( 'small', array( 'class' => 'mw-statistic-desc' ),
-                                       " $descriptionText" );
+                               $text .= "<br />" . Html::rawElement( 'small', array( 'class' => 'mw-statistic-desc' ),
+                                       " $descriptionHtml" );
                        }
                }
 
@@ -134,7 +134,8 @@ class SpecialStatistics extends SpecialPage {
                                $this->formatRow( Linker::linkKnown( SpecialPage::getTitleFor( 'Allpages' ),
                                        $this->msg( 'statistics-articles' )->parse() ),
                                        $this->getLanguage()->formatNum( $this->good ),
-                                       array( 'class' => 'mw-statistics-articles' ) ) .
+                                       array( 'class' => 'mw-statistics-articles' ),
+                                       'statistics-articles-desc' ) .
                                $this->formatRow( $this->msg( 'statistics-pages' )->parse(),
                                        $this->getLanguage()->formatNum( $this->total ),
                                        array( 'class' => 'mw-statistics-pages' ),
@@ -262,12 +263,17 @@ class SpecialStatistics extends SpecialPage {
 
                                // Collect all items that belong to the same header
                                foreach ( $items as $key => $value ) {
-                                       $name = $this->msg( $key )->parse();
-                                       $number = htmlspecialchars( $value );
+                                       if ( is_array( $value ) ) {
+                                               $name = $value['name'];
+                                               $number = $value['number'];
+                                       } else {
+                                               $name = $this->msg( $key )->parse();
+                                               $number = $value;
+                                       }
 
                                        $return .= $this->formatRow(
                                                $name,
-                                               $this->getLanguage()->formatNum( $number ),
+                                               $this->getLanguage()->formatNum( htmlspecialchars( $number ) ),
                                                array( 'class' => 'mw-statistics-hook', 'id' => 'mw-' . $key )
                                        );
                                }