Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -1394,6 +1394,10 @@ |
1395 | 1395 | no matches |
1396 | 1396 | $term: string of search term |
1397 | 1397 | |
| 1398 | +'SpecialStatsAddExtra': add extra statistic at the end of Special:Statistics |
| 1399 | +&$extraStats: Array to save the new stats |
| 1400 | + ( $extraStats['<name of statistic>'] => <value>; ) |
| 1401 | + |
1398 | 1402 | 'SpecialUploadComplete': Called after successfully uploading a file from |
1399 | 1403 | Special:Upload |
1400 | 1404 | $form: The UploadForm object |
Index: trunk/phase3/includes/specials/SpecialStatistics.php |
— | — | @@ -78,7 +78,10 @@ |
79 | 79 | } |
80 | 80 | |
81 | 81 | # Statistic - other |
82 | | - $text .= $this->getOtherStats(); |
| 82 | + $extraStats = array(); |
| 83 | + if( wfRunHooks( 'SpecialStatsAddExtra', array( &$extraStats ) ) ) { |
| 84 | + $text .= $this->getOtherStats( $extraStats ); |
| 85 | + } |
83 | 86 | |
84 | 87 | $text .= Xml::closeElement( 'table' ); |
85 | 88 | |
— | — | @@ -262,18 +265,14 @@ |
263 | 266 | return $text; |
264 | 267 | } |
265 | 268 | |
266 | | - private function getOtherStats() { |
| 269 | + private function getOtherStats( $stats ) { |
267 | 270 | global $wgLang, $wgAllowStatsOther, $wgStatsOther; |
268 | 271 | |
269 | | - if( !$wgAllowStatsOther ) return; |
270 | | - |
271 | | - if ( count( $wgStatsOther ) < 1 ) return; |
272 | | - |
273 | 272 | $return = Xml::openElement( 'tr' ) . |
274 | 273 | Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-hooks', array( 'parseinline' ) ) ) . |
275 | 274 | Xml::closeElement( 'tr' ); |
276 | 275 | |
277 | | - foreach( $wgStatsOther as $name => $number ) { |
| 276 | + foreach( $stats as $name => $number ) { |
278 | 277 | $name = htmlspecialchars( $name ); |
279 | 278 | $number = htmlspecialchars( $number ); |
280 | 279 | |