r51712 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51711‎ | r51712 | r51713 >
Date:22:12, 10 June 2009
Author:demon
Status:deferred
Tags:
Comment:
Followup to r51699: Actually parse the message, wfMsgExt() by itself doesn't do anything :) Also, refactor this to use the hook directly, rather than calling the function and making an object on every request.
Modified paths:
  • /trunk/extensions/Contributionseditcount/Contributionseditcount.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Contributionseditcount/Contributionseditcount.php
@@ -8,44 +8,29 @@
99 * @bug 1725
1010 *
1111 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
 12+ * @author Chad Horohoe <chad@anyonecanedit.org>
1213 * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
1314 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
1415 */
1516
16 -$wgExtensionFunctions[] = 'wfContributionseditcount';
1717 $wgExtensionCredits['other'][] = array(
1818 'path' => __FILE__,
1919 'name' => 'Contributionseditcount',
2020 'description' => 'Displays an edit count on Special:Contributions',
2121 'descriptionmsg' => 'contributionseditcount-desc',
22 - 'author' => 'Ævar Arnfjörð Bjarmason',
 22+ 'author' => array( 'Ævar Arnfjörð Bjarmason', 'Chad Horohoe' ),
2323 'url' => 'http://www.mediawiki.org/wiki/Extension:Contributionseditcount',
2424 );
25 -
2625 $wgExtensionMessagesFiles['Contributionseditcount'] = dirname( __FILE__ ) . '/Contributionseditcount.i18n.php';
 26+$wgHooks['SpecialContributionsBeforeMainOutput'][] = 'wfContributionseditcount';
2727
28 -function wfContributionseditcount() {
29 -
30 - wfUsePHP( 5.0 );
31 - wfUseMW( '1.6alpha' );
32 -
33 - class Contributionseditcount {
34 -
35 - public function __construct() {
36 - global $wgHooks;
37 - $wgHooks['SpecialContributionsBeforeMainOutput'][] = array( &$this, 'hook' );
38 - }
39 -
40 - public function hook( $uid ) {
41 - global $wgOut, $wgLang;
42 - if ( $uid != 0 )
43 - wfLoadExtensionMessages( 'Contributionseditcount' );
44 - $wgOut->addWikiText( wfMsgExt( 'contributionseditcount', array(),
 28+function wfContributionseditcount( $uid ) {
 29+ if ( $uid != 0 )
 30+ global $wgOut, $wgLang;
 31+ wfLoadExtensionMessages( 'Contributionseditcount' );
 32+ $wgOut->addWikiText( wfMsgExt( 'contributionseditcount', array( 'parsemag' ),
4533 $wgLang->formatNum( User::edits( $uid ) ),
4634 User::whoIs( $uid ) ) );
47 - return true;
48 - }
 35+ return true;
4936 }
50 -
51 - new Contributionseditcount();
5237 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r51732Fix syntax error introduced in r51712...purodha07:03, 11 June 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r51699Adding GENDER and PLURAL capability to message, following request of EugeneZe...purodha18:04, 10 June 2009

Status & tagging log