From: Ryan Schmidt Date: Sun, 8 Jun 2008 21:45:05 +0000 (+0000) Subject: * Add a new hook LinkerMakeExternalLink to allow extensions to modify the output... X-Git-Tag: 1.31.0-rc.0~47109 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=b5643d960e0e853b1a9132371f7a05a7b88d3852;p=lhc%2Fweb%2Fwiklou.git * Add a new hook LinkerMakeExternalLink to allow extensions to modify the output of external links. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index d899572a7f..3b8dca3984 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -147,7 +147,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN edits in the last $wgActiveUserDays days. * SpecialSearchResults hook now passes results by reference, so they can be changed by extensions. - +* Add a new hook LinkerMakeExternalLink to allow extensions to modify the output of + external links. + === Bug fixes in 1.13 === * (bug 10677) Add link to the file description page on the shared repository diff --git a/includes/Linker.php b/includes/Linker.php index 29959ca199..cdfb6bbdaa 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -820,6 +820,12 @@ class Linker { if( $escape ) { $text = htmlspecialchars( $text ); } + $link = ''; + $success = wfRunHooks('LinkerMakeExternalLink', array( &$url, &$text, &link ) ); + if(!$success) { + wfDebug("Hook LinkerMakeExternalLink changed the output of link with url {$url} and text {$text} to {$link}", true); + return $link; + } return ''.$text.''; }