r14346 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r14345‎ | r14346 | r14347 >
Date:21:17, 22 May 2006
Author:brion
Status:old
Tags:
Comment:
* (bug 5523) $wgNoFollowNsExceptions to allow disabling rel="nofollow" in specially-selected namespaces.
Patch by Ilmari Karonen, http://bugzilla.wikimedia.org/attachment.cgi?id=1789&action=view
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Linker.php
@@ -734,10 +734,10 @@
735735 }
736736
737737 /** @todo document */
738 - function makeExternalLink( $url, $text, $escape = true, $linktype = '' ) {
 738+ function makeExternalLink( $url, $text, $escape = true, $linktype = '', $ns = null ) {
739739 $style = $this->getExternalLinkAttributes( $url, $text, 'external ' . $linktype );
740 - global $wgNoFollowLinks;
741 - if( $wgNoFollowLinks ) {
 740+ global $wgNoFollowLinks, $wgNoFollowNsExceptions;
 741+ if( $wgNoFollowLinks && !(isset($ns) && in_array($ns, $wgNoFollowNsExceptions)) ) {
742742 $style .= ' rel="nofollow"';
743743 }
744744 $url = htmlspecialchars( $url );
Index: trunk/phase3/includes/Parser.php
@@ -1190,7 +1190,7 @@
11911191 # This means that users can paste URLs directly into the text
11921192 # Funny characters like ö aren't valid in URLs anyway
11931193 # This was changed in August 2004
1194 - $s .= $sk->makeExternalLink( $url, $text, false, $linktype ) . $dtrail . $trail;
 1194+ $s .= $sk->makeExternalLink( $url, $text, false, $linktype, $this->mTitle->getNamespace() ) . $dtrail . $trail;
11951195
11961196 # Register link in the output object.
11971197 # Replace unnecessary URL escape codes with the referenced character
@@ -1270,7 +1270,7 @@
12711271 $text = $this->maybeMakeExternalImage( $url );
12721272 if ( $text === false ) {
12731273 # Not an image, make a link
1274 - $text = $sk->makeExternalLink( $url, $wgContLang->markNoConversion($url), true, 'free' );
 1274+ $text = $sk->makeExternalLink( $url, $wgContLang->markNoConversion($url), true, 'free', $this->mTitle->getNamespace() );
12751275 # Register it in the output object...
12761276 # Replace unnecessary URL escape codes with their equivalent characters
12771277 $pasteurized = Parser::replaceUnusualEscapes( $url );
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1747,6 +1747,12 @@
17481748 $wgNoFollowLinks = true;
17491749
17501750 /**
 1751+ * Namespaces in which $wgNoFollowLinks doesn't apply.
 1752+ * See Language.php for a list of namespaces.
 1753+ */
 1754+$wgNoFollowNsExceptions = array();
 1755+
 1756+/**
17511757 * Specifies the minimal length of a user password. If set to
17521758 * 0, empty passwords are allowed.
17531759 */
Index: trunk/phase3/RELEASE-NOTES
@@ -313,7 +313,10 @@
314314 look garbled when tidy isn't on
315315 * (bug 5511) Fix URL-encoding of usernames in links on Special:Ipblocklist
316316 * (bug 6046) Update to Indonesian localisation (id) #15
 317+* (bug 5523) $wgNoFollowNsExceptions to allow disabling rel="nofollow" in
 318+ specially-selected namespaces.
317319
 320+
318321 == Compatibility ==
319322
320323 Older PHP 4.2 and 4.1 releases are no longer supported; PHP 4 users must

Status & tagging log