r48223 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48222‎ | r48223 | r48224 >
Date:13:21, 9 March 2009
Author:werdna
Status:ok
Tags:
Comment:
Add $attribs as a param to LinkerMakeExternalLink Hook.
Modified paths:
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -831,6 +831,7 @@
832832 &$url: the image url
833833 &$alt: the image's alt text
834834 &$img: the new image HTML (if returning false)
 835+&$attribs: the attributes to be applied.
835836
836837 'LinkerMakeExternalLink': At the end of Linker::makeExternalLink() just before the return
837838 &$url: the link url
Index: trunk/phase3/includes/Linker.php
@@ -1010,19 +1010,19 @@
10111011 /** @todo document */
10121012 function makeExternalLink( $url, $text, $escape = true, $linktype = '', $attribs = array() ) {
10131013 $attribsText = $this->getExternalLinkAttributes( $url, $text, 'external ' . $linktype );
1014 - if ( $attribs ) {
1015 - $attribsText .= Xml::expandAttributes( $attribs );
1016 - }
10171014 $url = htmlspecialchars( $url );
10181015 if( $escape ) {
10191016 $text = htmlspecialchars( $text );
10201017 }
10211018 $link = '';
1022 - $success = wfRunHooks('LinkerMakeExternalLink', array( &$url, &$text, &$link ) );
 1019+ $success = wfRunHooks('LinkerMakeExternalLink', array( &$url, &$text, &$link, &$attribs ) );
10231020 if(!$success) {
10241021 wfDebug("Hook LinkerMakeExternalLink changed the output of link with url {$url} and text {$text} to {$link}\n", true);
10251022 return $link;
10261023 }
 1024+ if ( $attribs ) {
 1025+ $attribsText .= Xml::expandAttributes( $attribs );
 1026+ }
10271027 return '<a href="'.$url.'"'.$attribsText.'>'.$text.'</a>';
10281028 }
10291029

Follow-up revisions

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

Status & tagging log