From b5643d960e0e853b1a9132371f7a05a7b88d3852 Mon Sep 17 00:00:00 2001 From: Ryan Schmidt Date: Sun, 8 Jun 2008 21:45:05 +0000 Subject: [PATCH] * Add a new hook LinkerMakeExternalLink to allow extensions to modify the output of external links. --- RELEASE-NOTES | 4 +++- includes/Linker.php | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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.''; } -- 2.20.1