Page MenuHomePhabricator

target_blank.patch

Authored By
bzimport
Nov 21 2014, 9:34 PM
Size
887 B
Referenced Files
None
Subscribers
None

target_blank.patch

Index: includes/Linker.php
===================================================================
--- includes/Linker.php (revision 1)
+++ includes/Linker.php (working copy)
@@ -741,6 +741,12 @@
/** @todo document */
function makeExternalLink( $url, $text, $escape = true, $linktype = '', $ns = null ) {
+ if (substr($text, 0, 7) === '_blank ')
+ {
+ $newpage = true;
+ $text = substr($text, 7);
+ }
+
$style = $this->getExternalLinkAttributes( $url, $text, 'external ' . $linktype );
global $wgNoFollowLinks, $wgNoFollowNsExceptions;
if( $wgNoFollowLinks && !(isset($ns) && in_array($ns, $wgNoFollowNsExceptions)) ) {
@@ -750,6 +756,8 @@
if( $escape ) {
$text = htmlspecialchars( $text );
}
+ if ($newpage == true)
+ return '<a href="'.$url.'"'.$style.' target="_blank">'.$text.'</a>';
return '<a href="'.$url.'"'.$style.'>'.$text.'</a>';
}

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3224
Default Alt Text
target_blank.patch (887 B)

Event Timeline