From 4ea127ed03feeae1ace8f38b60466bf842528fb1 Mon Sep 17 00:00:00 2001
From: Bernhard Posselt
Date: Tue, 6 Jan 2015 17:06:22 +0100
Subject: set noreferrer tag for links pointing to articles
---
db/item.php | 2 +-
templates/part.content.php | 6 +++++-
tests/unit/articleenhancer/XPathArticleEnhancerTest.php | 6 +++---
tests/unit/db/ItemTest.php | 2 +-
4 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/db/item.php b/db/item.php
index af76002ff..24cc45de1 100644
--- a/db/item.php
+++ b/db/item.php
@@ -208,7 +208,7 @@ class Item extends Entity implements IAPI, \JsonSerializable {
public function setBody($body) {
// FIXME: this should not happen if the target="_blank" is already
// on the link
- parent::setBody(str_replace('
@@ -105,6 +106,7 @@
+ target="_blank"
+ rel="noreferrer"
+ >
t('Download')) ?>
diff --git a/tests/unit/articleenhancer/XPathArticleEnhancerTest.php b/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
index 2d207d177..77c5ef2e7 100644
--- a/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
+++ b/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
@@ -181,10 +181,10 @@ class XPathArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
$result = $this->testEnhancer->enhance($item);
$this->assertEquals('' .
- '
' .
'link' .
- '
' .
'link2' .
'
' .
@@ -230,7 +230,7 @@ class XPathArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals(
'
',
$result->getBody()
);
diff --git a/tests/unit/db/ItemTest.php b/tests/unit/db/ItemTest.php
index 4ced884c8..c937053d1 100644
--- a/tests/unit/db/ItemTest.php
+++ b/tests/unit/db/ItemTest.php
@@ -264,7 +264,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
public function testMakeLinksInBodyOpenNewTab() {
$item = new Item();
$item->setBody("
ha");
- $this->assertEquals("
ha",
+ $this->assertEquals("
ha",
$item->getBody());
}
--
cgit v1.2.3