mirror of
https://github.com/diocloid/LinkTitles.git
synced 2025-07-14 02:09:31 +02:00
Fixed Hooks only to process pags in wanted namespaces. Fixes ugly autolinking in Sidebar and breaking imagepages
This commit is contained in:
@ -79,10 +79,16 @@
|
|||||||
|
|
||||||
if ( ! $isMinor ) {
|
if ( ! $isMinor ) {
|
||||||
$title = $wikiPage->getTitle();
|
$title = $wikiPage->getTitle();
|
||||||
|
|
||||||
|
// 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);
|
$text = $content->getContentHandler()->serializeContent($content);
|
||||||
$newText = self::parseContent( $title, $text );
|
$newText = self::parseContent( $title, $text );
|
||||||
if ( $newText != $text ) {
|
if ( $newText != $text ) {
|
||||||
$content = $content->getContentHandler()->unserializeContent( $newText );
|
$content = $content->getContentHandler()->unserializeContent( $newText );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return true;
|
return true;
|
||||||
@ -93,7 +99,13 @@
|
|||||||
/// @param $text Preprocessed text of the page.
|
/// @param $text Preprocessed text of the page.
|
||||||
public static function onInternalParseBeforeLinks( Parser &$parser, &$text ) {
|
public static function onInternalParseBeforeLinks( Parser &$parser, &$text ) {
|
||||||
$title = $parser->getTitle();
|
$title = $parser->getTitle();
|
||||||
|
|
||||||
|
// 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 );
|
$text = self::parseContent( $title, $text );
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user