r48223 - Code Review

From MediaWiki.org

Jump to: navigation, search
Repository:MediaWiki
Revision:r48222 | r48223 (on ViewVC) | r48224 >
Date:13:21, 9 March 2009
Author:werdna
Status:ok
Tags:
Comment:Add $attribs as a param to LinkerMakeExternalLink Hook.
Modified paths:

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
===================================================================
--- trunk/phase3/docs/hooks.txt	(revision 48222)
+++ trunk/phase3/docs/hooks.txt	(revision 48223)
@@ -831,6 +831,7 @@
 &$url: the image url
 &$alt: the image's alt text
 &$img: the new image HTML (if returning false)
+&$attribs: the attributes to be applied.
 
 'LinkerMakeExternalLink': At the end of Linker::makeExternalLink() just before the return
 &$url: the link url
Index: trunk/phase3/includes/Linker.php
===================================================================
--- trunk/phase3/includes/Linker.php	(revision 48222)
+++ trunk/phase3/includes/Linker.php	(revision 48223)
@@ -1010,19 +1010,19 @@
 	/** @todo document */
 	function makeExternalLink( $url, $text, $escape = true, $linktype = '', $attribs = array() ) {
 		$attribsText = $this->getExternalLinkAttributes( $url, $text, 'external ' . $linktype );
-		if ( $attribs ) {
-			$attribsText .= Xml::expandAttributes( $attribs );
-		}
 		$url = htmlspecialchars( $url );
 		if( $escape ) {
 			$text = htmlspecialchars( $text );
 		}
 		$link = '';
-		$success = wfRunHooks('LinkerMakeExternalLink', array( &$url, &$text, &$link ) );
+		$success = wfRunHooks('LinkerMakeExternalLink', array( &$url, &$text, &$link, &$attribs ) );
 		if(!$success) {
 			wfDebug("Hook LinkerMakeExternalLink changed the output of link with url {$url} and text {$text} to {$link}\n", true);
 			return $link;
 		}
+		if ( $attribs ) {
+			$attribsText .= Xml::expandAttributes( $attribs );
+		}
 		return '<a href="'.$url.'"'.$attribsText.'>'.$text.'</a>';
 	}
 

Follow-up revisions

RevisionCommit summaryAuthorDate
r48225RELEASE-NOTES for r48223.demon13:23, 9 March 2009
r48226* Add $linkType param to LinkerMakeExternalLinkdemon13:55, 9 March 2009

Status & tagging log

Views
Toolbox