mirror of
https://github.com/diocloid/LinkTitles.git
synced 2025-07-13 09:49:31 +02:00
Merge branch 'release-4.0.4'
This commit is contained in:
8
NEWS
8
NEWS
@ -1,3 +1,11 @@
|
||||
Version 4.0.4 (2016-11-30)
|
||||
------------------------------------------------------------------------
|
||||
|
||||
- Fix: Do not link titles twice if $wgLinkTitlesFirstOnly and $wgLinkTitlesSmartMode are both true.
|
||||
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
|
||||
|
||||
Version 4.0.3 (2016-11-22)
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
],
|
||||
"type": "parserhook",
|
||||
"url": "https://www.mediawiki.org/wiki/Extension:LinkTitles",
|
||||
"version": "4.0.3",
|
||||
"version": "4.0.4",
|
||||
"license-name": "GPL-2.0+",
|
||||
"descriptionmsg": "linktitles-desc",
|
||||
"requires": {
|
||||
|
@ -123,6 +123,8 @@ class Extension {
|
||||
|
||||
( $wgLinkTitlesPreferShortTitles ) ? $sort_order = 'ASC' : $sort_order = 'DESC';
|
||||
( $wgLinkTitlesFirstOnly ) ? $limit = 1 : $limit = -1;
|
||||
$limitReached = false;
|
||||
error_log($wgLinkTitlesFirstOnly);
|
||||
|
||||
self::$currentTitle = $title;
|
||||
$newText = $text;
|
||||
@ -214,7 +216,8 @@ class Extension {
|
||||
// even indexes will point to text that is not enclosed by brackets
|
||||
$arr[$i] = preg_replace_callback( $regex,
|
||||
'LinkTitles\Extension::simpleModeCallback', $arr[$i], $limit, $count );
|
||||
if (( $limit >= 0 ) && ( $count > 0 )) {
|
||||
if ( $wgLinkTitlesFirstOnly && ( $count > 0 ) ) {
|
||||
$limitReached = true;
|
||||
break;
|
||||
};
|
||||
};
|
||||
@ -223,7 +226,7 @@ class Extension {
|
||||
// If smart mode is turned on, the extension will perform a second
|
||||
// pass on the page and add links with aliases where the case does
|
||||
// not match.
|
||||
if ($wgLinkTitlesSmartMode) {
|
||||
if ( $wgLinkTitlesSmartMode && !$limitReached ) {
|
||||
$arr = preg_split( self::$delimiter, $newText, -1, PREG_SPLIT_DELIM_CAPTURE );
|
||||
|
||||
for ( $i = 0; $i < count( $arr ); $i+=2 ) {
|
||||
@ -232,7 +235,7 @@ class Extension {
|
||||
self::$wordStartDelim . '(' . $quotedTitle . ')' .
|
||||
self::$wordEndDelim . '/iS', 'LinkTitles\Extension::smartModeCallback',
|
||||
$arr[$i], $limit, $count );
|
||||
if (( $limit >= 0 ) && ( $count > 0 )) {
|
||||
if ( $wgLinkTitlesFirstOnly && ( $count > 0 )) {
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user