Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -831,6 +831,7 @@ |
832 | 832 | &$url: the image url |
833 | 833 | &$alt: the image's alt text |
834 | 834 | &$img: the new image HTML (if returning false) |
| 835 | +&$attribs: the attributes to be applied. |
835 | 836 | |
836 | 837 | 'LinkerMakeExternalLink': At the end of Linker::makeExternalLink() just before the return |
837 | 838 | &$url: the link url |
Index: trunk/phase3/includes/Linker.php |
— | — | @@ -1010,19 +1010,19 @@ |
1011 | 1011 | /** @todo document */ |
1012 | 1012 | function makeExternalLink( $url, $text, $escape = true, $linktype = '', $attribs = array() ) { |
1013 | 1013 | $attribsText = $this->getExternalLinkAttributes( $url, $text, 'external ' . $linktype ); |
1014 | | - if ( $attribs ) { |
1015 | | - $attribsText .= Xml::expandAttributes( $attribs ); |
1016 | | - } |
1017 | 1014 | $url = htmlspecialchars( $url ); |
1018 | 1015 | if( $escape ) { |
1019 | 1016 | $text = htmlspecialchars( $text ); |
1020 | 1017 | } |
1021 | 1018 | $link = ''; |
1022 | | - $success = wfRunHooks('LinkerMakeExternalLink', array( &$url, &$text, &$link ) ); |
| 1019 | + $success = wfRunHooks('LinkerMakeExternalLink', array( &$url, &$text, &$link, &$attribs ) ); |
1023 | 1020 | if(!$success) { |
1024 | 1021 | wfDebug("Hook LinkerMakeExternalLink changed the output of link with url {$url} and text {$text} to {$link}\n", true); |
1025 | 1022 | return $link; |
1026 | 1023 | } |
| 1024 | + if ( $attribs ) { |
| 1025 | + $attribsText .= Xml::expandAttributes( $attribs ); |
| 1026 | + } |
1027 | 1027 | return '<a href="'.$url.'"'.$attribsText.'>'.$text.'</a>'; |
1028 | 1028 | } |
1029 | 1029 | |