+ $text .= $this->getGroupStats();
+ $text .= $viewsStats;
+
+ # Statistic - popular pages
+ if( !$wgDisableCounters && !$wgMiserMode ) {
+ $text .= $this->getMostViewedPages();
+ }
+
+ # Statistic - other
+ $extraStats = array();
+ if( wfRunHooks( 'SpecialStatsAddExtra', array( &$extraStats ) ) ) {
+ $text .= $this->getOtherStats( $extraStats );
+ }
+
+ $text .= Xml::closeElement( 'table' );
+
+ # Customizable footer
+ $footer = $this->msg( 'statistics-footer' );
+ if ( !$footer->isBlank() ) {
+ $text .= "\n" . $footer->parse();
+ }
+
+ $this->getOutput()->addHTML( $text );
+ }
+
+ /**
+ * Format a row
+ * @param $text String: description of the row
+ * @param $number Float: a statistical number
+ * @param $trExtraParams Array: params to table row, see Html::elememt
+ * @param $descMsg String: message key
+ * @param $descMsgParam Array: message params
+ * @return string table row in HTML format
+ */
+ private function formatRow( $text, $number, $trExtraParams = array(), $descMsg = '', $descMsgParam = '' ) {
+ if( $descMsg ) {
+ $msg = $this->msg( $descMsg, $descMsgParam );
+ if ( $msg->exists() ) {
+ $descriptionText = $msg->parse();
+ $text .= "<br />" . Xml::element( 'small', array( 'class' => 'mw-statistic-desc'),
+ " ($descriptionText)" );
+ }
+ }
+ return Html::rawElement( 'tr', $trExtraParams,
+ Html::rawElement( 'td', array(), $text ) .
+ Html::rawElement( 'td', array( 'class' => 'mw-statistics-numbers' ), $number )
+ );
+ }
+
+ /**
+ * Each of these methods is pretty self-explanatory, get a particular
+ * row for the table of statistics
+ * @return string
+ */
+ private function getPageStats() {
+ return 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' ) ) .
+ $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( 'Listfiles' ),
+ $this->msg( 'statistics-files' )->parse() ),
+ $this->getLanguage()->formatNum( $this->images ),
+ array( 'class' => 'mw-statistics-files' ) );
+ }
+ private function getEditStats() {
+ return Xml::openElement( 'tr' ) .
+ 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 ),
+ array( 'class' => 'mw-statistics-edits' ) ) .
+ $this->formatRow( $this->msg( 'statistics-edits-average' )->parse(),
+ $this->getLanguage()->formatNum( sprintf( '%.2f', $this->total ? $this->edits / $this->total : 0 ) ),
+ array( 'class' => 'mw-statistics-edits-average' ) );
+ }
+
+ private function getUserStats() {
+ global $wgActiveUserDays;
+ return Xml::openElement( 'tr' ) .
+ 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 ),
+ array( 'class' => 'mw-statistics-users' ) ) .
+ $this->formatRow( $this->msg( 'statistics-users-active' )->parse() . ' ' .
+ Linker::linkKnown(
+ SpecialPage::getTitleFor( 'Activeusers' ),
+ $this->msg( 'listgrouprights-members' )->escaped()
+ ),
+ $this->getLanguage()->formatNum( $this->activeUsers ),
+ array( 'class' => 'mw-statistics-users-active' ),
+ 'statistics-users-active-desc',
+ $this->getLanguage()->formatNum( $wgActiveUserDays ) );
+ }
+
+ private function getGroupStats() {
+ global $wgGroupPermissions, $wgImplicitGroups;
+ $text = '';