From: YuviPanda Date: Tue, 20 Jan 2015 23:41:41 +0000 (-0800) Subject: Add option to output referrer policy meta tag X-Git-Tag: 1.31.0-rc.0~12640^2 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28?a=commitdiff_plain;h=4a9840e271eb6f4c713e6a4991571db390ea3d2b;p=lhc%2Fweb%2Fwiklou.git Add option to output referrer policy meta tag Bug: T87276 Change-Id: I9ea4797c4d292cd4565f47b88e605b4e7afdb1d1 --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index ee462d84ad..66f695c8d3 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -270,6 +270,16 @@ $wgFavicon = '/favicon.ico'; */ $wgAppleTouchIcon = false; +/** + * Value for the referrer policy meta tag. + * One of 'never', 'default', 'origin', 'always'. Setting it to false just + * prevents the meta tag from being output. + * See http://www.w3.org/TR/referrer-policy/ for details. + * + * @since 1.25 + */ +$wgReferrerPolicy = false; + /** * The local filesystem path to a temporary directory. This is not required to * be web accessible. diff --git a/includes/OutputPage.php b/includes/OutputPage.php index a10946a4d1..4101d099f3 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -3284,6 +3284,13 @@ class OutputPage extends ContextSource { 'content' => "MediaWiki $wgVersion", ) ); + if ( $config->get( 'ReferrerPolicy' ) !== false ) { + $tags['meta-referrer'] = Html::element( 'meta', array( + 'name' => 'referrer', + 'content' => $config->get( 'ReferrerPolicy' ) + ) ); + } + $p = "{$this->mIndexPolicy},{$this->mFollowPolicy}"; if ( $p !== 'index,follow' ) { // http://www.robotstxt.org/wc/meta-user.html