From 77a89b17ee78a53013cec2c2e611c35ace529b5e Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Thu, 19 Jul 2018 17:50:56 -0400 Subject: [PATCH] Attempt to fix wrong header on redirected page fixes #15 --- HeaderFooter.class.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/HeaderFooter.class.php b/HeaderFooter.class.php index 45bad84..d266cf9 100644 --- a/HeaderFooter.class.php +++ b/HeaderFooter.class.php @@ -14,10 +14,14 @@ public static function hOutputPageParserOutput( &$op, $parserOutput ) { return true; } - global $wgTitle; + $title = $op->getTitle(); + if ( $title->isRedirect() ) { + $article = Article::newFromID( $title->getArticleID() ); + $title = $article->getRedirectTarget(); + } - $ns = $wgTitle->getNsText(); - $name = $wgTitle->getPrefixedDBKey(); + $ns = $title->getNsText(); + $name = $title->getPrefixedDBKey(); $text = $parserOutput->getText(); @@ -69,4 +73,4 @@ static function conditionalInclude( &$text, $disableWord, &$msgId ) { return $msgText; } -} \ No newline at end of file +}