summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-10-04 11:30:09 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-10-04 11:30:09 +0200
commit96c7439c7372d603e36412c39d6b2b8948565199 (patch)
tree8fd7d1bf81b0000538c85a3a5b849eea47f52c00
parent9c5bd1784ccfff00c8031ff03446b4ad7c5131be (diff)
ignore zendxml result
-rw-r--r--articleenhancer/globalarticleenhancer.php2
-rw-r--r--articleenhancer/xpatharticleenhancer.php4
-rw-r--r--tests/unit/articleenhancer/XPathArticleEnhancerTest.php12
-rw-r--r--utility/faviconfetcher.php2
4 files changed, 12 insertions, 8 deletions
diff --git a/articleenhancer/globalarticleenhancer.php b/articleenhancer/globalarticleenhancer.php
index 14f92182d..117c0981c 100644
--- a/articleenhancer/globalarticleenhancer.php
+++ b/articleenhancer/globalarticleenhancer.php
@@ -32,7 +32,7 @@ class GlobalArticleEnhancer implements ArticleEnhancer {
// inside <p> tags
$body = '<div>' . $item->getBody() . '</div>';
- $dom = Security::scan($body, $dom, function ($xml, $dom) {
+ Security::scan($body, $dom, function ($xml, $dom) {
return @$dom->loadHTML($xml, LIBXML_HTML_NOIMPLIED
| LIBXML_HTML_NODEFDTD | LIBXML_NONET);
});
diff --git a/articleenhancer/xpatharticleenhancer.php b/articleenhancer/xpatharticleenhancer.php
index 87c80762b..3edaad695 100644
--- a/articleenhancer/xpatharticleenhancer.php
+++ b/articleenhancer/xpatharticleenhancer.php
@@ -71,7 +71,7 @@ class XPathArticleEnhancer implements ArticleEnhancer {
$dom = new \DOMDocument();
$loadEntities = libxml_disable_entity_loader(true);
- @$dom->loadHTML($body, LIBXML_NONET);
+ @$dom->loadHTML($body);
libxml_disable_entity_loader($loadEntities);
$xpath = new \DOMXpath($dom);
@@ -137,7 +137,7 @@ class XPathArticleEnhancer implements ArticleEnhancer {
// return, if xml is empty or loading the HTML fails
$loadEntities = libxml_disable_entity_loader(true);
- if( trim($xmlString) == "" || !@$dom->loadHTML($xmlString, LIBXML_NONET) ) {
+ if( trim($xmlString) == "" || !@$dom->loadHTML($xmlString) ) {
libxml_disable_entity_loader($loadEntities);
return $xmlString;
}
diff --git a/tests/unit/articleenhancer/XPathArticleEnhancerTest.php b/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
index bc6b737ae..7756c168a 100644
--- a/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
+++ b/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
@@ -60,7 +60,7 @@ class XPathArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
'/explosm.net\/shorts/' => '//*[@id=\'maincontent\']/div/div',
'/explosm.net\/all/' => '//body/*',
'/themerepublic.net/' => '//*[@class=\'post hentry\']'
- ],
+ ],
$this->config
);
$this->redirects = 5;
@@ -120,7 +120,7 @@ class XPathArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
'/explosm.net\/shorts/' => '//*[@id=\'maincontent\']/div/div',
'/explosm.net\/all/' => '//body/*',
'/themerepublic.net/' => '//*[@class=\'post hentry\']'
- ],
+ ],
$this->config
);
@@ -160,7 +160,7 @@ class XPathArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals($item, $this->testEnhancer->enhance($item));
}
-
+
public function testDoesModifiyArticlesThatMatch() {
$file = new \stdClass;
$file->headers = ["content-type"=>"text/html; charset=utf-8"];
@@ -370,7 +370,11 @@ class XPathArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
->will($this->returnValue($file));
$result = $this->testEnhancer->enhance($item);
- $this->assertEquals('<img src="http://www.url.com/absolute/url.png"><a target="_blank" href="mailto:test@testsite.com">mail</a>', $result->getBody());
+ $this->assertEquals(
+ '<img src="http://www.url.com/absolute/url.png">' .
+ '<a target="_blank" href="mailto:test@testsite.com">mail</a>',
+ $result->getBody()
+ );
}
}
diff --git a/utility/faviconfetcher.php b/utility/faviconfetcher.php
index e05a76319..cadc90210 100644
--- a/utility/faviconfetcher.php
+++ b/utility/faviconfetcher.php
@@ -80,7 +80,7 @@ class FaviconFetcher {
if($file->body !== '') {
$dom = new \DOMDocument();
- $dom = Security::scan($file->body, $dom, function ($xml, $dom) {
+ Security::scan($file->body, $dom, function ($xml, $dom) {
return @$dom->loadHTML($xml, LIBXML_NONET);
});