r82013 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82012‎ | r82013 | r82014 >
Date:12:55, 12 February 2011
Author:ialex
Status:ok
Tags:
Comment:
The first parameter passed on a OutputPageBeforeHTML hook in an OutputPage object and not a ParserOutput, so use it to get the Title object instead of $wgTitle
Modified paths:
  • /trunk/extensions/DoubleWiki/DoubleWiki_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DoubleWiki/DoubleWiki_body.php
@@ -42,21 +42,21 @@
4343 }
4444 }
4545
46 - static function OutputPageBeforeHTML( &$parserOutput , &$text ) {
 46+ static function OutputPageBeforeHTML( &$out, &$text ) {
4747 $dw = new self();
48 - $dw->addMatchedText( $parserOutput, $text );
 48+ $dw->addMatchedText( $out, $text );
4949 return true;
5050 }
5151
5252 /**
5353 * Hook function called with &match=lang
5454 * Transform $text into a bilingual version
55 - * @param $parserOutput ParserOutput
 55+ * @param $out OutputPage
5656 * @param $text
5757 */
58 - function addMatchedText ( &$parserOutput , &$text ) {
 58+ function addMatchedText( &$out, &$text ) {
5959
60 - global $wgContLang, $wgRequest, $wgLang, $wgContLanguageCode, $wgTitle;
 60+ global $wgContLang, $wgRequest, $wgLang, $wgContLanguageCode;
6161
6262 $match_request = $wgRequest->getText( 'match' );
6363 if ( $match_request === '' ) {
@@ -64,12 +64,12 @@
6565 }
6666 $this->addMatchingTags ( $text, $match_request );
6767
68 - foreach( $parserOutput->mLanguageLinks as $l ) {
 68+ foreach( $out->mLanguageLinks as $l ) {
6969 $nt = Title::newFromText( $l );
7070 $iw = $nt->getInterwiki();
7171 if( $iw === $match_request ){
7272 $url = $nt->getFullURL();
73 - $myURL = $wgTitle -> getLocalURL() ;
 73+ $myURL = $out->getTitle()->getLocalURL();
7474 $languageName = $wgContLang->getLanguageName( $nt->getInterwiki() );
7575 $myLanguage = $wgLang->getLanguageName( $wgContLanguageCode );
7676

Status & tagging log