X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialStatistics.php;h=f26d1a60f30711369f99a495deb2c8720209652e;hb=654f713af6c58d57b35364f4b10d45b2ba0384ad;hp=199460eef8aa1d5910d2b70cf397e035789d9924;hpb=c1a949d864a55417cabdd35f1f00a179dcbe66e2;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialStatistics.php b/includes/specials/SpecialStatistics.php index 199460eef8..f26d1a60f3 100644 --- a/includes/specials/SpecialStatistics.php +++ b/includes/specials/SpecialStatistics.php @@ -53,18 +53,18 @@ class SpecialStatistics extends SpecialPage { # Staticic - views $viewsStats = ''; - if( !$wgDisableCounters ) { + if ( !$wgDisableCounters ) { $viewsStats = $this->getViewsStats(); } # Set active user count - if( !$wgMiserMode ) { + if ( !$wgMiserMode ) { $key = wfMemcKey( 'sitestats', 'activeusers-updated' ); // Re-calculate the count if the last tally is old... - if( !$wgMemc->get( $key ) ) { + if ( !$wgMemc->get( $key ) ) { $dbw = wfGetDB( DB_MASTER ); SiteStatsUpdate::cacheUpdate( $dbw ); - $wgMemc->set( $key, '1', 24*3600 ); // don't update for 1 day + $wgMemc->set( $key, '1', 24 * 3600 ); // don't update for 1 day } } @@ -84,13 +84,13 @@ class SpecialStatistics extends SpecialPage { $text .= $viewsStats; # Statistic - popular pages - if( !$wgDisableCounters && !$wgMiserMode ) { + if ( !$wgDisableCounters && !$wgMiserMode ) { $text .= $this->getMostViewedPages(); } # Statistic - other $extraStats = array(); - if( wfRunHooks( 'SpecialStatsAddExtra', array( &$extraStats ) ) ) { + if ( wfRunHooks( 'SpecialStatsAddExtra', array( &$extraStats ) ) ) { $text .= $this->getOtherStats( $extraStats ); } @@ -115,11 +115,11 @@ class SpecialStatistics extends SpecialPage { * @return string table row in HTML format */ private function formatRow( $text, $number, $trExtraParams = array(), $descMsg = '', $descMsgParam = '' ) { - if( $descMsg ) { + if ( $descMsg ) { $msg = $this->msg( $descMsg, $descMsgParam ); if ( $msg->exists() ) { $descriptionText = $this->msg( 'parentheses' )->rawParams( $msg->parse() )->escaped(); - $text .= "
" . Xml::element( 'small', array( 'class' => 'mw-statistic-desc'), + $text .= "
" . Xml::element( 'small', array( 'class' => 'mw-statistic-desc' ), " $descriptionText" ); } } @@ -171,7 +171,11 @@ class SpecialStatistics extends SpecialPage { $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(), + $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', @@ -181,7 +185,7 @@ class SpecialStatistics extends SpecialPage { private function getGroupStats() { global $wgGroupPermissions, $wgImplicitGroups; $text = ''; - foreach( $wgGroupPermissions as $group => $permissions ) { + foreach ( $wgGroupPermissions as $group => $permissions ) { # Skip generic * and implicit groups if ( in_array( $group, $wgImplicitGroups ) || $group == '*' ) { continue; @@ -213,7 +217,7 @@ class SpecialStatistics extends SpecialPage { # Add a class when a usergroup contains no members to allow hiding these rows $classZero = ''; $countUsers = SiteStats::numberingroup( $groupname ); - if( $countUsers == 0 ) { + if ( $countUsers == 0 ) { $classZero = ' statistics-group-zero'; } $text .= $this->formatRow( $grouppage . ' ' . $grouplink, @@ -229,11 +233,11 @@ class SpecialStatistics extends SpecialPage { Xml::closeElement( 'tr' ) . $this->formatRow( $this->msg( 'statistics-views-total' )->parse(), $this->getLanguage()->formatNum( $this->views ), - array ( 'class' => 'mw-statistics-views-total' ), 'statistics-views-total-desc' ) . + array( 'class' => 'mw-statistics-views-total' ), 'statistics-views-total-desc' ) . $this->formatRow( $this->msg( 'statistics-views-peredit' )->parse(), $this->getLanguage()->formatNum( sprintf( '%.2f', $this->edits ? $this->views / $this->edits : 0 ) ), - array ( 'class' => 'mw-statistics-views-peredit' ) ); + array( 'class' => 'mw-statistics-views-peredit' ) ); } private function getMostViewedPages() { @@ -256,13 +260,13 @@ class SpecialStatistics extends SpecialPage { 'LIMIT' => 10, ) ); - if( $res->numRows() > 0 ) { + if ( $res->numRows() > 0 ) { $text .= Xml::openElement( 'tr' ); $text .= Xml::tags( 'th', array( 'colspan' => '2' ), $this->msg( 'statistics-mostpopular' )->parse() ); $text .= Xml::closeElement( 'tr' ); foreach ( $res as $row ) { $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title ); - if( $title instanceof Title ) { + if ( $title instanceof Title ) { $text .= $this->formatRow( Linker::link( $title ), $this->getLanguage()->formatNum( $row->page_counter ) ); @@ -283,8 +287,7 @@ class SpecialStatistics extends SpecialPage { private function getOtherStats( array $stats ) { $return = ''; - foreach( $stats as $header => $items ) { - + foreach ( $stats as $header => $items ) { // Identify the structure used if ( is_array( $items ) ) { @@ -294,11 +297,11 @@ class SpecialStatistics extends SpecialPage { } // Collect all items that belong to the same header - foreach( $items as $key => $value ) { - $name = $this->msg( $key )->inContentLanguage()->parse(); + foreach ( $items as $key => $value ) { + $name = $this->msg( $key )->parse(); $number = htmlspecialchars( $value ); - $return .= $this->formatRow( $name, $this->getLanguage()->formatNum( $number ), array( 'class' => 'mw-statistics-hook' ) ); + $return .= $this->formatRow( $name, $this->getLanguage()->formatNum( $number ), array( 'class' => 'mw-statistics-hook', 'id' => 'mw-' . $key ) ); } } else { // Create the legacy header only once