$this->activeUsers = SiteStats::activeUsers();
$this->admins = SiteStats::numberingroup('sysop');
$this->numJobs = SiteStats::jobs();
+ $this->hook = '';
# Staticic - views
$viewsStats = '';
$this->doRawOutput();
}
- $text = Xml::openElement( 'table', array( 'class' => 'mw-statistics-table' ) );
+ $text = Xml::openElement( 'table', array( 'class' => 'wikitable mw-statistics-table' ) );
# Statistic - pages
$text .= $this->getPageStats();
if( !$wgDisableCounters && !$wgMiserMode ) {
$text .= $this->getMostViewedPages();
}
+
+ # Statistic - other
+ $extraStats = array();
+ if( wfRunHooks( 'SpecialStatsAddExtra', array( &$extraStats ) ) ) {
+ $text .= $this->getOtherStats( $extraStats );
+ }
$text .= Xml::closeElement( 'table' );
* Format a row
* @param string $text description of the row
* @param float $number a number
+ * @param array $trExtraParams
+ * @param string $descMsg
+ * @param string $descMsgParam
* @return string table row in HTML format
*/
- private function formatRow( $text, $number, $trExtraParams = array(), $descMsg = '' ) {
+ private function formatRow( $text, $number, $trExtraParams = array(), $descMsg = '', $descMsgParam = '' ) {
global $wgStylePath;
-
if( $descMsg ) {
- $descriptionText = wfMsg( $descMsg );
+ $descriptionText = wfMsgExt( $descMsg, array( 'parseinline' ), $descMsgParam );
if ( !wfEmptyMsg( $descMsg, $descriptionText ) ) {
$descriptionText = " ($descriptionText)";
- $text = $text . "<br />" . Xml::element( 'small', array( 'class' => 'mw-statistic-desc'), $descriptionText );
+ $text .= "<br />" . Xml::element( 'small', array( 'class' => 'mw-statistic-desc'),
+ $descriptionText );
}
}
-
return Xml::openElement( 'tr', $trExtraParams ) .
- Xml::openElement( 'td' ) . $text . Xml::closeElement( 'td' ) .
- Xml::openElement( 'td' ) . $number . Xml::closeElement( 'td' ) .
- Xml::closeElement( 'tr' );
+ Xml::openElement( 'td' ) . $text . Xml::closeElement( 'td' ) .
+ Xml::openElement( 'td', array( 'class' => 'mw-statistics-numbers' ) ) . $number . Xml::closeElement( 'td' ) .
+ Xml::closeElement( 'tr' );
}
/**
*/
private function getPageStats() {
global $wgLang;
- return Xml::tags( 'th', array( 'colspan' => '2' ), wfMsg( 'statistics-header-pages' ) ) .
+ return Xml::openElement( 'tr' ) .
+ Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-pages', array( 'parseinline' ) ) ) .
+ Xml::closeElement( 'tr' ) .
$this->formatRow( wfMsgExt( 'statistics-articles', array( 'parseinline' ) ),
$wgLang->formatNum( $this->good ),
array( 'class' => 'mw-statistics-articles' ) ) .
}
private function getEditStats() {
global $wgLang;
- return Xml::tags( 'th', array( 'colspan' => '2' ), wfMsg( 'statistics-header-edits' ) ) .
+ return Xml::openElement( 'tr' ) .
+ Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-edits', array( 'parseinline' ) ) ) .
+ Xml::closeElement( 'tr' ) .
$this->formatRow( wfMsgExt( 'statistics-edits', array( 'parseinline' ) ),
$wgLang->formatNum( $this->edits ),
array( 'class' => 'mw-statistics-edits' ) ) .
array( 'class' => 'mw-statistics-jobqueue' ) );
}
private function getUserStats() {
- global $wgLang;
- return Xml::tags( 'th', array( 'colspan' => '2' ), wfMsg( 'statistics-header-users' ) ) .
+ global $wgLang, $wgRCMaxAge;
+ return Xml::openElement( 'tr' ) .
+ Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-users', array( 'parseinline' ) ) ) .
+ Xml::closeElement( 'tr' ) .
$this->formatRow( wfMsgExt( 'statistics-users', array( 'parseinline' ) ),
$wgLang->formatNum( $this->users ),
array( 'class' => 'mw-statistics-users' ) ) .
$this->formatRow( wfMsgExt( 'statistics-users-active', array( 'parseinline' ) ),
$wgLang->formatNum( $this->activeUsers ),
array( 'class' => 'mw-statistics-users-active' ),
- 'statistics-users-active-desc' );
+ 'statistics-users-active-desc',
+ $wgLang->formatNum( ceil( $wgRCMaxAge / ( 3600 * 24 ) ) ) );
}
private function getGroupStats() {
global $wgGroupPermissions, $wgImplicitGroups, $wgLang, $wgUser;
} else {
$grouppageLocalized = $msg;
}
- $grouppage = $sk->makeLink( $grouppageLocalized, $groupnameLocalized );
- $grouplink = $sk->link( SpecialPage::getTitleFor( 'Listusers' ),
+ $linkTarget = Title::newFromText( $grouppageLocalized );
+ $grouppage = $sk->link(
+ $linkTarget,
+ htmlspecialchars( $groupnameLocalized )
+ );
+ $grouplink = $sk->link(
+ SpecialPage::getTitleFor( 'Listusers' ),
wfMsgHtml( 'listgrouprights-members' ),
array(),
array( 'group' => $group ),
- 'known' );
- # Add a class when a usergroup contains no members to allow hiding these rows
+ 'known'
+ );
+ # Add a class when a usergroup contains no members to allow hiding these rows
$classZero = '';
$countUsers = SiteStats::numberingroup( $groupname );
if( $countUsers == 0 ) {
}
private function getViewsStats() {
global $wgLang;
- return Xml::tags( 'th', array( 'colspan' => '2' ), wfMsg( 'statistics-header-views' ) ) .
- $this->formatRow( wfMsgExt( 'statistics-views-total', array( 'parseinline' ) ),
- $wgLang->formatNum( $this->views ),
- array ( 'class' => 'mw-statistics-views-total' ) ) .
- $this->formatRow( wfMsgExt( 'statistics-views-peredit', array( 'parseinline' ) ),
- $wgLang->formatNum( sprintf( '%.2f', $this->edits ?
- $this->views / $this->edits : 0 ) ),
- array ( 'class' => 'mw-statistics-views-peredit' ) );
+ return Xml::openElement( 'tr' ) .
+ Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-views', array( 'parseinline' ) ) ) .
+ Xml::closeElement( 'tr' ) .
+ $this->formatRow( wfMsgExt( 'statistics-views-total', array( 'parseinline' ) ),
+ $wgLang->formatNum( $this->views ),
+ array ( 'class' => 'mw-statistics-views-total' ) ) .
+ $this->formatRow( wfMsgExt( 'statistics-views-peredit', array( 'parseinline' ) ),
+ $wgLang->formatNum( sprintf( '%.2f', $this->edits ?
+ $this->views / $this->edits : 0 ) ),
+ array ( 'class' => 'mw-statistics-views-peredit' ) );
}
private function getMostViewedPages() {
global $wgLang, $wgUser;
)
);
if( $res->numRows() > 0 ) {
- $text .= Xml::tags( 'th', array( 'colspan' => '2' ), wfMsg( 'statistics-mostpopular' ) );
+ $text .= Xml::openElement( 'tr' );
+ $text .= Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-mostpopular', array( 'parseinline' ) ) );
+ $text .= Xml::closeElement( 'tr' );
while( $row = $res->fetchObject() ) {
$title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
if( $title instanceof Title ) {
return $text;
}
+ private function getOtherStats( $stats ) {
+ global $wgLang;
+
+ $return = Xml::openElement( 'tr' ) .
+ Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-hooks', array( 'parseinline' ) ) ) .
+ Xml::closeElement( 'tr' );
+
+ foreach( $stats as $name => $number ) {
+ $name = htmlspecialchars( $name );
+ $number = htmlspecialchars( $number );
+
+ $return .= $this->formatRow( $name, $wgLang->formatNum( $number ), array( 'class' => 'mw-statistics-hook' ) );
+ }
+
+ return $return;
+ }
+
/**
* Do the action=raw output for this page. Legacy, but we support
* it for backwards compatibility