(r54511) Replace global array with hook
This commit is contained in:
parent
fd1f353e05
commit
a9f717e8ed
2 changed files with 10 additions and 7 deletions
|
|
@ -1394,6 +1394,10 @@ $term: string of search term
|
||||||
no matches
|
no matches
|
||||||
$term: string of search term
|
$term: string of search term
|
||||||
|
|
||||||
|
'SpecialStatsAddExtra': add extra statistic at the end of Special:Statistics
|
||||||
|
&$extraStats: Array to save the new stats
|
||||||
|
( $extraStats['<name of statistic>'] => <value>; )
|
||||||
|
|
||||||
'SpecialUploadComplete': Called after successfully uploading a file from
|
'SpecialUploadComplete': Called after successfully uploading a file from
|
||||||
Special:Upload
|
Special:Upload
|
||||||
$form: The UploadForm object
|
$form: The UploadForm object
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,10 @@ class SpecialStatistics extends SpecialPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Statistic - other
|
# Statistic - other
|
||||||
$text .= $this->getOtherStats();
|
$extraStats = array();
|
||||||
|
if( wfRunHooks( 'SpecialStatsAddExtra', array( &$extraStats ) ) ) {
|
||||||
|
$text .= $this->getOtherStats( $extraStats );
|
||||||
|
}
|
||||||
|
|
||||||
$text .= Xml::closeElement( 'table' );
|
$text .= Xml::closeElement( 'table' );
|
||||||
|
|
||||||
|
|
@ -262,18 +265,14 @@ class SpecialStatistics extends SpecialPage {
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getOtherStats() {
|
private function getOtherStats( $stats ) {
|
||||||
global $wgLang, $wgAllowStatsOther, $wgStatsOther;
|
global $wgLang, $wgAllowStatsOther, $wgStatsOther;
|
||||||
|
|
||||||
if( !$wgAllowStatsOther ) return;
|
|
||||||
|
|
||||||
if ( count( $wgStatsOther ) < 1 ) return;
|
|
||||||
|
|
||||||
$return = Xml::openElement( 'tr' ) .
|
$return = Xml::openElement( 'tr' ) .
|
||||||
Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-hooks', array( 'parseinline' ) ) ) .
|
Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-hooks', array( 'parseinline' ) ) ) .
|
||||||
Xml::closeElement( 'tr' );
|
Xml::closeElement( 'tr' );
|
||||||
|
|
||||||
foreach( $wgStatsOther as $name => $number ) {
|
foreach( $stats as $name => $number ) {
|
||||||
$name = htmlspecialchars( $name );
|
$name = htmlspecialchars( $name );
|
||||||
$number = htmlspecialchars( $number );
|
$number = htmlspecialchars( $number );
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue