From: Jan Luca Naumann Date: Thu, 6 Aug 2009 13:40:13 +0000 (+0000) Subject: (r54511) Replace global array with hook X-Git-Tag: 1.31.0-rc.0~40463 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_aide%28?a=commitdiff_plain;h=a9f717e8ed9e50db68c5257037a0b039db8fa765;p=lhc%2Fweb%2Fwiklou.git (r54511) Replace global array with hook --- diff --git a/docs/hooks.txt b/docs/hooks.txt index 7ab916da8a..5ec31d9717 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1394,6 +1394,10 @@ $term: string of search term no matches $term: string of search term +'SpecialStatsAddExtra': add extra statistic at the end of Special:Statistics +&$extraStats: Array to save the new stats + ( $extraStats[''] => ; ) + 'SpecialUploadComplete': Called after successfully uploading a file from Special:Upload $form: The UploadForm object diff --git a/includes/specials/SpecialStatistics.php b/includes/specials/SpecialStatistics.php index 81542b3e83..66f31dc49f 100644 --- a/includes/specials/SpecialStatistics.php +++ b/includes/specials/SpecialStatistics.php @@ -78,7 +78,10 @@ class SpecialStatistics extends SpecialPage { } # Statistic - other - $text .= $this->getOtherStats(); + $extraStats = array(); + if( wfRunHooks( 'SpecialStatsAddExtra', array( &$extraStats ) ) ) { + $text .= $this->getOtherStats( $extraStats ); + } $text .= Xml::closeElement( 'table' ); @@ -262,18 +265,14 @@ class SpecialStatistics extends SpecialPage { return $text; } - private function getOtherStats() { + private function getOtherStats( $stats ) { global $wgLang, $wgAllowStatsOther, $wgStatsOther; - if( !$wgAllowStatsOther ) return; - - if ( count( $wgStatsOther ) < 1 ) return; - $return = Xml::openElement( 'tr' ) . Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-hooks', array( 'parseinline' ) ) ) . Xml::closeElement( 'tr' ); - foreach( $wgStatsOther as $name => $number ) { + foreach( $stats as $name => $number ) { $name = htmlspecialchars( $name ); $number = htmlspecialchars( $number );