diff options
Diffstat (limited to 'includes/specials/SpecialStatistics.php')
-rw-r--r-- | includes/specials/SpecialStatistics.php | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/includes/specials/SpecialStatistics.php b/includes/specials/SpecialStatistics.php index c35de241..8de6f8b8 100644 --- a/includes/specials/SpecialStatistics.php +++ b/includes/specials/SpecialStatistics.php @@ -107,10 +107,11 @@ class SpecialStatistics extends SpecialPage { ) { if ( $descMsg ) { $msg = $this->msg( $descMsg, $descMsgParam ); - if ( $msg->exists() ) { - $descriptionText = $this->msg( 'parentheses' )->rawParams( $msg->parse() )->escaped(); - $text .= "<br />" . Xml::element( 'small', array( 'class' => 'mw-statistic-desc' ), - " $descriptionText" ); + if ( !$msg->isDisabled() ) { + $descriptionHtml = $this->msg( 'parentheses' )->rawParams( $msg->parse() ) + ->escaped(); + $text .= "<br />" . Html::rawElement( 'small', array( 'class' => 'mw-statistic-desc' ), + " $descriptionHtml" ); } } @@ -126,26 +127,36 @@ class SpecialStatistics extends SpecialPage { * @return string */ private function getPageStats() { - return Xml::openElement( 'tr' ) . - Xml::tags( 'th', array( 'colspan' => '2' ), $this->msg( 'statistics-header-pages' )->parse() ) . + $pageStatsHtml = Xml::openElement( 'tr' ) . + Xml::tags( 'th', array( 'colspan' => '2' ), $this->msg( 'statistics-header-pages' ) + ->parse() ) . Xml::closeElement( 'tr' ) . $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' ), - 'statistics-pages-desc' ) . - $this->formatRow( Linker::linkKnown( SpecialPage::getTitleFor( 'MediaStatistics' ), - $this->msg( 'statistics-files' )->parse() ), - $this->getLanguage()->formatNum( $this->images ), - array( 'class' => 'mw-statistics-files' ) ); + 'statistics-pages-desc' ); + + // Show the image row only, when there are files or upload is possible + if ( $this->images !== 0 || $this->getConfig()->get( 'EnableUploads' ) ) { + $pageStatsHtml .= $this->formatRow( + Linker::linkKnown( SpecialPage::getTitleFor( 'MediaStatistics' ), + $this->msg( 'statistics-files' )->parse() ), + $this->getLanguage()->formatNum( $this->images ), + array( 'class' => 'mw-statistics-files' ) ); + } + + return $pageStatsHtml; } private function getEditStats() { return Xml::openElement( 'tr' ) . - Xml::tags( 'th', array( 'colspan' => '2' ), $this->msg( 'statistics-header-edits' )->parse() ) . + Xml::tags( 'th', array( 'colspan' => '2' ), + $this->msg( 'statistics-header-edits' )->parse() ) . Xml::closeElement( 'tr' ) . $this->formatRow( $this->msg( 'statistics-edits' )->parse(), $this->getLanguage()->formatNum( $this->edits ), @@ -160,7 +171,8 @@ class SpecialStatistics extends SpecialPage { private function getUserStats() { return Xml::openElement( 'tr' ) . - Xml::tags( 'th', array( 'colspan' => '2' ), $this->msg( 'statistics-header-users' )->parse() ) . + Xml::tags( 'th', array( 'colspan' => '2' ), + $this->msg( 'statistics-header-users' )->parse() ) . Xml::closeElement( 'tr' ) . $this->formatRow( $this->msg( 'statistics-users' )->parse(), $this->getLanguage()->formatNum( $this->users ), @@ -223,7 +235,8 @@ class SpecialStatistics extends SpecialPage { } $text .= $this->formatRow( $grouppage . ' ' . $grouplink, $this->getLanguage()->formatNum( $countUsers ), - array( 'class' => 'statistics-group-' . Sanitizer::escapeClass( $group ) . $classZero ) ); + array( 'class' => 'statistics-group-' . Sanitizer::escapeClass( $group ) . + $classZero ) ); } return $text; |