r70046 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70045‎ | r70046 | r70047 >
Date:21:11, 27 July 2010
Author:platonides
Status:resolved
Tags:
Comment:
Use the frame and set the two hooks in one function.
Modified paths:
  • /trunk/extensions/WikiTextLoggedInOut/WikiTextLoggedInOut.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiTextLoggedInOut/WikiTextLoggedInOut.php
@@ -19,7 +19,7 @@
2020 $wgExtensionCredits['parserhook'][] = array(
2121 'path' => __FILE__,
2222 'name' => 'WikiTextLoggedInOut',
23 - 'version' => '1.1',
 23+ 'version' => '1.2',
2424 'author' => array( 'Aaron Wright', 'David Pean', 'Jack Phoenix' ),
2525 'url' => 'http://www.mediawiki.org/wiki/Extension:WikiTextLoggedInOut',
2626 'descriptionmsg' => 'wikitextloggedinout-desc'
@@ -28,35 +28,30 @@
2929 $dir = dirname( __FILE__ ) . '/';
3030 $wgExtensionMessagesFiles['WikiTextLoginInOut'] = $dir . 'WikiTextLoggedInOut.i18n.php';
3131
32 -$wgHooks['ParserFirstCallInit'][] = 'wfWikiTextLoggedIn';
33 -function wfWikiTextLoggedIn( &$parser ) {
 32+$wgHooks['ParserFirstCallInit'][] = 'efWikiTextLoggedInOut';
 33+function efWikiTextLoggedIn( &$parser ) {
3434 $parser->setHook( 'loggedin', 'OutputLoggedInText' );
 35+ $parser->setHook( 'loggedout', 'OutputLoggedOutText' );
3536 return true;
3637 }
3738
38 -function OutputLoggedInText( $input, $args, $parser ) {
 39+function OutputLoggedInText( $input, $args, $parser, $frame ) {
3940 global $wgUser;
4041
4142 if( $wgUser->isLoggedIn() ) {
42 - return $parser->recursiveTagParse( $input );
 43+ return $parser->recursiveTagParse( $input, $frame );
4344 }
4445
4546 return '';
4647 }
4748
48 -$wgHooks['ParserFirstCallInit'][] = 'wfWikiTextLoggedOut';
49 -
50 -function wfWikiTextLoggedOut( &$parser ) {
51 - $parser->setHook( 'loggedout', 'OutputLoggedOutText' );
52 - return true;
53 -}
54 -
55 -function OutputLoggedOutText( $input, $args, $parser ) {
 49+function OutputLoggedOutText( $input, $args, $parser, $frame ) {
5650 global $wgUser;
5751
5852 if( !$wgUser->isLoggedIn() ) {
59 - return $parser->recursiveTagParse( $input );
 53+ return $parser->recursiveTagParse( $input, $frame );
6054 }
6155
6256 return '';
6357 }
 58+

Follow-up revisions

RevisionCommit summaryAuthorDate
r71702follow-up to r70046: now the extension works again, was spewing out errors ab...ashley15:33, 26 August 2010

Status & tagging log