Page MenuHomePhabricator

wgNoFollowNsExceptions.diff

Authored By
bzimport
Nov 21 2014, 9:11 PM
Size
2 KB
Referenced Files
None
Subscribers
None

wgNoFollowNsExceptions.diff

Index: mediawiki-svn/phase3/includes/Linker.php
===================================================================
--- mediawiki-svn/phase3/includes/Linker.php (revision 13561)
+++ mediawiki-svn/phase3/includes/Linker.php (working copy)
@@ -732,10 +732,10 @@
}
/** @todo document */
- function makeExternalLink( $url, $text, $escape = true, $linktype = '' ) {
+ function makeExternalLink( $url, $text, $escape = true, $linktype = '', $ns = null ) {
$style = $this->getExternalLinkAttributes( $url, $text, 'external ' . $linktype );
- global $wgNoFollowLinks;
- if( $wgNoFollowLinks ) {
+ global $wgNoFollowLinks, $wgNoFollowNsExceptions;
+ if( $wgNoFollowLinks && !(isset($ns) && in_array($ns, $wgNoFollowNsExceptions)) ) {
$style .= ' rel="nofollow"';
}
$url = htmlspecialchars( $url );
Index: mediawiki-svn/phase3/includes/Parser.php
===================================================================
--- mediawiki-svn/phase3/includes/Parser.php (revision 13561)
+++ mediawiki-svn/phase3/includes/Parser.php (working copy)
@@ -1190,7 +1190,7 @@
# This means that users can paste URLs directly into the text
# Funny characters like ö aren't valid in URLs anyway
# This was changed in August 2004
- $s .= $sk->makeExternalLink( $url, $text, false, $linktype ) . $dtrail . $trail;
+ $s .= $sk->makeExternalLink( $url, $text, false, $linktype, $this->mTitle->getNamespace() ) . $dtrail . $trail;
# Register link in the output object.
# Replace unnecessary URL escape codes with the referenced character
@@ -1270,7 +1270,7 @@
$text = $this->maybeMakeExternalImage( $url );
if ( $text === false ) {
# Not an image, make a link
- $text = $sk->makeExternalLink( $url, $wgContLang->markNoConversion($url), true, 'free' );
+ $text = $sk->makeExternalLink( $url, $wgContLang->markNoConversion($url), true, 'free', $this->mTitle->getNamespace() );
# Register it in the output object...
# Replace unnecessary URL escape codes with their equivalent characters
$pasteurized = Parser::replaceUnusualEscapes( $url );
Index: mediawiki-svn/phase3/includes/DefaultSettings.php
===================================================================
--- mediawiki-svn/phase3/includes/DefaultSettings.php (revision 13561)
+++ mediawiki-svn/phase3/includes/DefaultSettings.php (working copy)
@@ -1719,6 +1719,12 @@
$wgNoFollowLinks = true;
/**
+ * Namespaces in which $wgNoFollowLinks doesn't apply.
+ * See Language.php for a list of namespaces.
+ */
+$wgNoFollowNsExceptions = array();
+
+/**
* Specifies the minimal length of a user password. If set to
* 0, empty passwords are allowed.
*/

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2284
Default Alt Text
wgNoFollowNsExceptions.diff (2 KB)

Event Timeline