MediaWiki r14346 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r14345‎ | r14346 (on ViewVC)‎ | 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:

Diff [purge]

Index: trunk/phase3/includes/Linker.php
===================================================================
--- trunk/phase3/includes/Linker.php	(revision 14345)
+++ trunk/phase3/includes/Linker.php	(revision 14346)
@@ -734,10 +734,10 @@
 	}
 
 	/** @todo document */
-	function makeExternalLink( $url, $text, $escape = true, $linktype = '' ) {
+	function makeExternalLink( $url, $text, $escape = true, $linktype = '', $ns = null ) {
 		$style = $this->getExternalLinkAttributes( $url, $text, 'external ' . $linktype );
-		global $wgNoFollowLinks;
-		if( $wgNoFollowLinks ) {
+		global $wgNoFollowLinks, $wgNoFollowNsExceptions;
+		if( $wgNoFollowLinks && !(isset($ns) && in_array($ns, $wgNoFollowNsExceptions)) ) {
 			$style .= ' rel="nofollow"';
 		}
 		$url = htmlspecialchars( $url );
Index: trunk/phase3/includes/Parser.php
===================================================================
--- trunk/phase3/includes/Parser.php	(revision 14345)
+++ trunk/phase3/includes/Parser.php	(revision 14346)
@@ -1190,7 +1190,7 @@
 			# This means that users can paste URLs directly into the text
 			# Funny characters like ö aren't valid in URLs anyway
 			# This was changed in August 2004
-			$s .= $sk->makeExternalLink( $url, $text, false, $linktype ) . $dtrail . $trail;
+			$s .= $sk->makeExternalLink( $url, $text, false, $linktype, $this->mTitle->getNamespace() ) . $dtrail . $trail;
 
 			# Register link in the output object.
 			# Replace unnecessary URL escape codes with the referenced character
@@ -1270,7 +1270,7 @@
 				$text = $this->maybeMakeExternalImage( $url );
 				if ( $text === false ) {
 					# Not an image, make a link
-					$text = $sk->makeExternalLink( $url, $wgContLang->markNoConversion($url), true, 'free' );
+					$text = $sk->makeExternalLink( $url, $wgContLang->markNoConversion($url), true, 'free', $this->mTitle->getNamespace() );
 					# Register it in the output object...
 					# Replace unnecessary URL escape codes with their equivalent characters
 					$pasteurized = Parser::replaceUnusualEscapes( $url );
Index: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php	(revision 14345)
+++ trunk/phase3/includes/DefaultSettings.php	(revision 14346)
@@ -1747,6 +1747,12 @@
 $wgNoFollowLinks = true;
 
 /**
+ * Namespaces in which $wgNoFollowLinks doesn't apply.
+ * See Language.php for a list of namespaces.
+ */
+$wgNoFollowNsExceptions = array();
+
+/**
  * Specifies the minimal length of a user password. If set to
  * 0, empty passwords are allowed.
  */
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 14345)
+++ trunk/phase3/RELEASE-NOTES	(revision 14346)
@@ -313,7 +313,10 @@
   look garbled when tidy isn't on
 * (bug 5511) Fix URL-encoding of usernames in links on Special:Ipblocklist
 * (bug 6046) Update to Indonesian localisation (id) #15
+* (bug 5523) $wgNoFollowNsExceptions to allow disabling rel="nofollow" in
+  specially-selected namespaces.
 
+
 == Compatibility ==
 
 Older PHP 4.2 and 4.1 releases are no longer supported; PHP 4 users must

Status & tagging log

  • 01:58, 13 October 2010 ^demon (Talk | contribs) changed the status of r14346 [removed: new added: old]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox