User:Lysander/Noreferrer hack

From BoyWiki
Revision as of 19:58, 13 April 2015 by Lysander (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This is a proposed hack to make it so that external links will have rel=noreferrer applied to them. This function is found in Parser.php:

	public static function getExternalLinkRel( $url = false, $title = null ) {
		global $wgNoFollowLinks, $wgNoFollowNsExceptions, $wgNoFollowDomainExceptions;
		$ns = $title ? $title->getNamespace() : false;
		if ( $wgNoFollowLinks && !in_array( $ns, $wgNoFollowNsExceptions )
			&& !wfMatchesDomainList( $url, $wgNoFollowDomainExceptions )
		) {
			return 'nofollow';
		}
		return null;
	}

It should be changed to:

	public static function getExternalLinkRel( $url = false, $title = null ) {
		global $wgNoFollowLinks, $wgNoFollowNsExceptions, $wgNoFollowDomainExceptions;
		$ns = $title ? $title->getNamespace() : false;
		if ( $wgNoFollowLinks && !in_array( $ns, $wgNoFollowNsExceptions )
			&& !wfMatchesDomainList( $url, $wgNoFollowDomainExceptions )
		) {
			return 'nofollow noreferrer';
		}
		return 'noreferrer';
	}