For MediaWiki (recent comments | status changes | tags | authors | states | release notes)
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>'; }