mirror of
https://github.com/diocloid/LinkTitles.git
synced 2025-07-13 17:59:29 +02:00
Respect $wgLinkTitlesParseOnEdit and $wgLinkTitlesParseOnRender.
This commit is contained in:
@ -61,6 +61,8 @@ class Extension {
|
|||||||
/// Event handler that is hooked to the PageContentSave event.
|
/// Event handler that is hooked to the PageContentSave event.
|
||||||
public static function onPageContentSave( &$wikiPage, &$user, &$content, &$summary,
|
public static function onPageContentSave( &$wikiPage, &$user, &$content, &$summary,
|
||||||
$isMinor, $isWatch, $section, &$flags, &$status ) {
|
$isMinor, $isWatch, $section, &$flags, &$status ) {
|
||||||
|
global $wgLinkTitlesParseOnEdit;
|
||||||
|
if (!$wgLinkTitlesParseOnEdit) return true;
|
||||||
|
|
||||||
if ( !$isMinor && !\MagicWord::get('MAG_LINKTITLES_NOAUTOLINKS')->match( $text ) ) {
|
if ( !$isMinor && !\MagicWord::get('MAG_LINKTITLES_NOAUTOLINKS')->match( $text ) ) {
|
||||||
$title = $wikiPage->getTitle();
|
$title = $wikiPage->getTitle();
|
||||||
@ -77,6 +79,9 @@ class Extension {
|
|||||||
/// @param Parser $parser Parser that raised the event.
|
/// @param Parser $parser Parser that raised the event.
|
||||||
/// @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 ) {
|
||||||
|
global $wgLinkTitlesParseOnRender;
|
||||||
|
if (!$wgLinkTitlesParseOnRender) return true;
|
||||||
|
|
||||||
// If the page contains the magic word '__NOAUTOLINKS__', do not parse it.
|
// If the page contains the magic word '__NOAUTOLINKS__', do not parse it.
|
||||||
if ( !isset($parser->mDoubleUnderScores[$text] )) {
|
if ( !isset($parser->mDoubleUnderScores[$text] )) {
|
||||||
$text = self::parseContent( $parser->getTitle(), $text );
|
$text = self::parseContent( $parser->getTitle(), $text );
|
||||||
|
Reference in New Issue
Block a user