From 808bfafbffd63012b6909b846afcfbaa6e957de8 Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Mon, 9 Mar 2009 13:21:14 +0000 Subject: [PATCH] Add $attribs as a param to LinkerMakeExternalLink Hook. --- docs/hooks.txt | 1 + includes/Linker.php | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/hooks.txt b/docs/hooks.txt index 6a4343234d..54b8e4b219 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -831,6 +831,7 @@ $options: the options. Will always include either 'known' or 'broken', and may &$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 diff --git a/includes/Linker.php b/includes/Linker.php index 21fa15b27d..8d3a529fb5 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1010,19 +1010,19 @@ class Linker { /** @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 ''.$text.''; } -- 2.20.1