Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -140,8 +140,6 @@ |
141 | 141 | restriction types on the protection form. |
142 | 142 | * (bug 8440) Allow preventing blocked users from editing their talk pages |
143 | 143 | * Improved upload file type detection for OpenDocument formats |
144 | | -* Added the ability to set the target attribute on external links with |
145 | | - $wgExternalLinkTarget |
146 | 144 | * (bug 368) Don't use caption for alt attribute; allow manual specification |
147 | 145 | using new "alt=" parameter for images |
148 | 146 | |
Index: trunk/phase3/includes/Linker.php |
— | — | @@ -990,10 +990,11 @@ |
991 | 991 | } |
992 | 992 | |
993 | 993 | /** @todo document */ |
994 | | - function makeExternalLink( $url, $text, $escape = true, $linktype = '', $attribs = array() ) { |
995 | | - $attribsText = $this->getExternalLinkAttributes( $url, $text, 'external ' . $linktype ); |
996 | | - if ( $attribs ) { |
997 | | - $attribsText .= ' ' . Xml::expandAttributes( $attribs ); |
| 994 | + function makeExternalLink( $url, $text, $escape = true, $linktype = '', $ns = null ) { |
| 995 | + $style = $this->getExternalLinkAttributes( $url, $text, 'external ' . $linktype ); |
| 996 | + global $wgNoFollowLinks, $wgNoFollowNsExceptions; |
| 997 | + if( $wgNoFollowLinks && !(isset($ns) && in_array($ns, $wgNoFollowNsExceptions)) ) { |
| 998 | + $style .= ' rel="nofollow"'; |
998 | 999 | } |
999 | 1000 | $url = htmlspecialchars( $url ); |
1000 | 1001 | if( $escape ) { |
— | — | @@ -1005,7 +1006,7 @@ |
1006 | 1007 | wfDebug("Hook LinkerMakeExternalLink changed the output of link with url {$url} and text {$text} to {$link}", true); |
1007 | 1008 | return $link; |
1008 | 1009 | } |
1009 | | - return '<a href="'.$url.'"'.$attribsText.'>'.$text.'</a>'; |
| 1010 | + return '<a href="'.$url.'"'.$style.'>'.$text.'</a>'; |
1010 | 1011 | } |
1011 | 1012 | |
1012 | 1013 | /** |
Index: trunk/phase3/includes/parser/ParserOptions.php |
— | — | @@ -30,7 +30,6 @@ |
31 | 31 | var $mTemplateCallback; # Callback for template fetching |
32 | 32 | var $mEnableLimitReport; # Enable limit report in an HTML comment on output |
33 | 33 | var $mTimestamp; # Timestamp used for {{CURRENTDAY}} etc. |
34 | | - var $mExternalLinkTarget; # Target attribute for external links |
35 | 34 | |
36 | 35 | var $mUser; # Stored user object, just used to initialise the skin |
37 | 36 | |
— | — | @@ -53,7 +52,6 @@ |
54 | 53 | function getTemplateCallback() { return $this->mTemplateCallback; } |
55 | 54 | function getEnableLimitReport() { return $this->mEnableLimitReport; } |
56 | 55 | function getCleanSignatures() { return $this->mCleanSignatures; } |
57 | | - function getExternalLinkTarget() { return $this->mExternalLinkTarget; } |
58 | 56 | |
59 | 57 | function getSkin() { |
60 | 58 | if ( !isset( $this->mSkin ) ) { |
— | — | @@ -98,7 +96,6 @@ |
99 | 97 | function enableLimitReport( $x = true ) { return wfSetVar( $this->mEnableLimitReport, $x ); } |
100 | 98 | function setTimestamp( $x ) { return wfSetVar( $this->mTimestamp, $x ); } |
101 | 99 | function setCleanSignatures( $x ) { return wfSetVar( $this->mCleanSignatures, $x ); } |
102 | | - function setExternalLinkTarget( $x ) { return wfSetVar( $this->mExternalLinkTarget, $x ); } |
103 | 100 | |
104 | 101 | function __construct( $user = null ) { |
105 | 102 | $this->initialiseFromUser( $user ); |
— | — | @@ -117,7 +114,6 @@ |
118 | 115 | global $wgUseTeX, $wgUseDynamicDates, $wgInterwikiMagic, $wgAllowExternalImages; |
119 | 116 | global $wgAllowExternalImagesFrom, $wgEnableImageWhitelist, $wgAllowSpecialInclusion, $wgMaxArticleSize; |
120 | 117 | global $wgMaxPPNodeCount, $wgMaxTemplateDepth, $wgMaxPPExpandDepth, $wgCleanSignatures; |
121 | | - global $wgExternalLinkTarget; |
122 | 118 | $fname = 'ParserOptions::initialiseFromUser'; |
123 | 119 | wfProfileIn( $fname ); |
124 | 120 | if ( !$userInput ) { |
— | — | @@ -155,7 +151,6 @@ |
156 | 152 | $this->mTemplateCallback = array( 'Parser', 'statelessFetchTemplate' ); |
157 | 153 | $this->mEnableLimitReport = false; |
158 | 154 | $this->mCleanSignatures = $wgCleanSignatures; |
159 | | - $this->mExternalLinkTarget = $wgExternalLinkTarget; |
160 | 155 | wfProfileOut( $fname ); |
161 | 156 | } |
162 | 157 | } |
Index: trunk/phase3/includes/parser/Parser_OldPP.php |
— | — | @@ -1353,7 +1353,7 @@ |
1354 | 1354 | # This means that users can paste URLs directly into the text |
1355 | 1355 | # Funny characters like ö aren't valid in URLs anyway |
1356 | 1356 | # This was changed in August 2004 |
1357 | | - $s .= $sk->makeExternalLink( $url, $text, false, $linktype, $this->getExternalLinkAttribs() ) . $dtrail . $trail; |
| 1357 | + $s .= $sk->makeExternalLink( $url, $text, false, $linktype, $this->mTitle->getNamespace() ) . $dtrail . $trail; |
1358 | 1358 | |
1359 | 1359 | # Register link in the output object. |
1360 | 1360 | # Replace unnecessary URL escape codes with the referenced character |
— | — | @@ -1366,19 +1366,6 @@ |
1367 | 1367 | return $s; |
1368 | 1368 | } |
1369 | 1369 | |
1370 | | - function getExternalLinkAttribs() { |
1371 | | - $attribs = array(); |
1372 | | - global $wgNoFollowLinks, $wgNoFollowNsExceptions; |
1373 | | - $ns = $this->mTitle->getNamespace(); |
1374 | | - if( $wgNoFollowLinks && !in_array($ns, $wgNoFollowNsExceptions) ) { |
1375 | | - $attribs['rel'] = 'nofollow'; |
1376 | | - } |
1377 | | - if ( $this->mOptions->getExternalLinkTarget() ) { |
1378 | | - $attribs['target'] = $this->mOptions->getExternalLinkTarget(); |
1379 | | - } |
1380 | | - return $attribs; |
1381 | | - } |
1382 | | - |
1383 | 1370 | /** |
1384 | 1371 | * Replace anything that looks like a URL with a link |
1385 | 1372 | * @private |
— | — | @@ -1445,8 +1432,7 @@ |
1446 | 1433 | $text = $this->maybeMakeExternalImage( $url ); |
1447 | 1434 | if ( $text === false ) { |
1448 | 1435 | # Not an image, make a link |
1449 | | - $text = $sk->makeExternalLink( $url, $wgContLang->markNoConversion($url), true, 'free', |
1450 | | - $this->getExternalLinkAttribs() ); |
| 1436 | + $text = $sk->makeExternalLink( $url, $wgContLang->markNoConversion($url), true, 'free', $this->mTitle->getNamespace() ); |
1451 | 1437 | # Register it in the output object... |
1452 | 1438 | # Replace unnecessary URL escape codes with their equivalent characters |
1453 | 1439 | $pasteurized = self::replaceUnusualEscapes( $url ); |
Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -1118,8 +1118,7 @@ |
1119 | 1119 | $text = $this->maybeMakeExternalImage( $url ); |
1120 | 1120 | if ( $text === false ) { |
1121 | 1121 | # Not an image, make a link |
1122 | | - $text = $sk->makeExternalLink( $url, $wgContLang->markNoConversion($url), true, 'free', |
1123 | | - $this->getExternalLinkAttribs() ); |
| 1122 | + $text = $sk->makeExternalLink( $url, $wgContLang->markNoConversion($url), true, 'free', $this->mTitle->getNamespace() ); |
1124 | 1123 | # Register it in the output object... |
1125 | 1124 | # Replace unnecessary URL escape codes with their equivalent characters |
1126 | 1125 | $pasteurized = self::replaceUnusualEscapes( $url ); |
— | — | @@ -1395,18 +1394,11 @@ |
1396 | 1395 | |
1397 | 1396 | $url = Sanitizer::cleanUrl( $url ); |
1398 | 1397 | |
1399 | | - if ( $this->mOptions->mExternalLinkTarget ) { |
1400 | | - $attribs = array( 'target' => $this->mOptions->mExternalLinkTarget ); |
1401 | | - } else { |
1402 | | - $attribs = array(); |
1403 | | - } |
1404 | | - |
1405 | 1398 | # Use the encoded URL |
1406 | 1399 | # This means that users can paste URLs directly into the text |
1407 | 1400 | # Funny characters like ö aren't valid in URLs anyway |
1408 | 1401 | # This was changed in August 2004 |
1409 | | - $s .= $sk->makeExternalLink( $url, $text, false, $linktype, $this->getExternalLinkAttribs() ) |
1410 | | - . $dtrail . $trail; |
| 1402 | + $s .= $sk->makeExternalLink( $url, $text, false, $linktype, $this->mTitle->getNamespace() ) . $dtrail . $trail; |
1411 | 1403 | |
1412 | 1404 | # Register link in the output object. |
1413 | 1405 | # Replace unnecessary URL escape codes with the referenced character |
— | — | @@ -1419,20 +1411,6 @@ |
1420 | 1412 | return $s; |
1421 | 1413 | } |
1422 | 1414 | |
1423 | | - function getExternalLinkAttribs() { |
1424 | | - $attribs = array(); |
1425 | | - global $wgNoFollowLinks, $wgNoFollowNsExceptions; |
1426 | | - $ns = $this->mTitle->getNamespace(); |
1427 | | - if( $wgNoFollowLinks && !in_array($ns, $wgNoFollowNsExceptions) ) { |
1428 | | - $attribs['rel'] = 'nofollow'; |
1429 | | - } |
1430 | | - if ( $this->mOptions->getExternalLinkTarget() ) { |
1431 | | - $attribs['target'] = $this->mOptions->getExternalLinkTarget(); |
1432 | | - } |
1433 | | - return $attribs; |
1434 | | - } |
1435 | | - |
1436 | | - |
1437 | 1415 | /** |
1438 | 1416 | * Replace unusual URL escape codes with their equivalent characters |
1439 | 1417 | * @param string |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -2891,11 +2891,6 @@ |
2892 | 2892 | $wgSearchForwardUrl = null; |
2893 | 2893 | |
2894 | 2894 | /** |
2895 | | - * Set a default target for external links, e.g. _blank to pop up a new window |
2896 | | - */ |
2897 | | -$wgExternalLinkTarget = false; |
2898 | | - |
2899 | | -/** |
2900 | 2895 | * If true, external URL links in wiki text will be given the |
2901 | 2896 | * rel="nofollow" attribute as a hint to search engines that |
2902 | 2897 | * they should not be followed for ranking purposes as they |