r110392 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110391‎ | r110392 | r110393 >
Date:15:27, 31 January 2012
Author:maxsem
Status:ok
Tags:miscextensions 
Comment:
Simplify outputting emblems
Modified paths:
  • /trunk/extensions/ArticleEmblems/ArticleEmblems.hooks.php (modified) (history)
  • /trunk/extensions/ArticleEmblems/ArticleEmblems.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleEmblems/ArticleEmblems.hooks.php
@@ -35,25 +35,6 @@
3636 }
3737
3838 /**
39 - * ParserBeforeTidy tag hook
40 - *
41 - * @param Parser $parser
42 - * @param string $text
43 - * @return Boolean
44 - */
45 - public static function parserBeforeTidy( Parser &$parser, &$text ) {
46 - $out = $parser->getOutput();
47 - if ( isset( $out->articleEmblems ) ) {
48 - $emblems = array();
49 - foreach ( $out->articleEmblems as $emblem ) {
50 - $emblems[] = '<li class="articleEmblem">' . $emblem . '</li>';
51 - }
52 - $text = '<ul id="articleEmblems">' . implode( $emblems ) . '</ul>' . $text;
53 - }
54 - return true;
55 - }
56 -
57 - /**
5839 * OutputPageParserOutput hook handler
5940 * @param OutputPage $out
6041 * @param ParserOutput $parserOutput
@@ -62,6 +43,13 @@
6344 public static function outputPageParserOutput( OutputPage &$out, ParserOutput $parserOutput ) {
6445 $out->addModuleStyles( 'ext.articleEmblems' );
6546
 47+ if ( isset( $parserOutput->articleEmblems ) ) {
 48+ $emblems = array();
 49+ foreach ( $parserOutput->articleEmblems as $emblem ) {
 50+ $emblems[] = '<li class="articleEmblem">' . $emblem . '</li>';
 51+ }
 52+ $parserOutput->setText( '<ul id="articleEmblems">' . implode( $emblems ) . '</ul>' . $parserOutput->getText() );
 53+ }
6654 return true;
6755 }
6856 }
Index: trunk/extensions/ArticleEmblems/ArticleEmblems.php
@@ -25,7 +25,6 @@
2626
2727 $wgHooks['ParserFirstCallInit'][] = 'ArticleEmblemsHooks::parserFirstCallInit';
2828 $wgHooks['OutputPageParserOutput'][] = 'ArticleEmblemsHooks::outputPageParserOutput';
29 -$wgHooks['ParserBeforeTidy'][] = 'ArticleEmblemsHooks::parserBeforeTidy';
3029
3130 $wgResourceModules['ext.articleEmblems'] = array(
3231 'styles' => 'ext.articleEmblems.css',

Status & tagging log