From dca10de21f00c563de49f4b256dc8d56d1950c92 Mon Sep 17 00:00:00 2001 From: c0nnex Date: Fri, 2 Oct 2015 02:44:42 +0200 Subject: [PATCH] Fixed Hooks only to process pags in wanted namespaces. Fixes ugly autolinking in Sidebar and breaking imagepages --- LinkTitles.body.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/LinkTitles.body.php b/LinkTitles.body.php index c01748c..f448f4f 100755 --- a/LinkTitles.body.php +++ b/LinkTitles.body.php @@ -79,11 +79,17 @@ if ( ! $isMinor ) { $title = $wikiPage->getTitle(); - $text = $content->getContentHandler()->serializeContent($content); - $newText = self::parseContent( $title, $text ); - if ( $newText != $text ) { - $content = $content->getContentHandler()->unserializeContent( $newText ); - } + + // Only process if page is in one of our namespaces we want to link + // Fixes ugly autolinking of sidebar pages + if (in_array($title->getNamespace(),$wgLinkTitlesNamespaces)) + { + $text = $content->getContentHandler()->serializeContent($content); + $newText = self::parseContent( $title, $text ); + if ( $newText != $text ) { + $content = $content->getContentHandler()->unserializeContent( $newText ); + } + } }; return true; } @@ -93,7 +99,13 @@ /// @param $text Preprocessed text of the page. public static function onInternalParseBeforeLinks( Parser &$parser, &$text ) { $title = $parser->getTitle(); - $text = self::parseContent( $title, $text ); + + // Only process if page is in one of our namespaces we want to link + // Fixes ugly autolinking of sidebar pages + if (in_array($title->getNamespace(),$wgLinkTitlesNamespaces)) + { + $text = self::parseContent( $title, $text ); + } return true; }