* Add a new hook LinkerMakeExternalLink to allow extensions to modify the output...
authorRyan Schmidt <skizzerz@users.mediawiki.org>
Sun, 8 Jun 2008 21:45:05 +0000 (21:45 +0000)
committerRyan Schmidt <skizzerz@users.mediawiki.org>
Sun, 8 Jun 2008 21:45:05 +0000 (21:45 +0000)
RELEASE-NOTES
includes/Linker.php

index d899572..3b8dca3 100644 (file)
@@ -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
index 29959ca..cdfb6bb 100644 (file)
@@ -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 '<a href="'.$url.'"'.$style.'>'.$text.'</a>';
        }