summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--articleenhancer/xpatharticleenhancer.php14
2 files changed, 8 insertions, 7 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0c7cca57c..f40a8081a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@ owncloud-news (4.2.0)
* **Enhancement**: Add admin setting to set a custom explore service URL
* **Enhancement**: Add explore button and show explore button on startup
* **Enhancement**: Show a hint when no articles are available
+* **Enhancement**: Add spiegel.de enhancer
* **Bugfix**: Fix compact view in firefox 34
* **Bugfix**: Show spinner when autopaging
* **Bugfix**: Remove race condition when fetching articles that sometimes shows read articles if the user clicks show on only unread and the article request finishes first before the settings request is finished
diff --git a/articleenhancer/xpatharticleenhancer.php b/articleenhancer/xpatharticleenhancer.php
index dec0fe760..871752856 100644
--- a/articleenhancer/xpatharticleenhancer.php
+++ b/articleenhancer/xpatharticleenhancer.php
@@ -53,19 +53,19 @@ class XPathArticleEnhancer implements ArticleEnhancer {
if(preg_match($regex, $item->getUrl())) {
$body = $this->getFile($item->getUrl());
- // Determine document encoding.
// First check if either <meta charset="..."> or
- // <meta http-equiv="Content-Type" ...> is specified and use that
+ // <meta http-equiv="Content-Type" ...> is specified and use it
// If this fails use mb_detect_encoding()
- // Use UTF-8 if mb_detect_encoding does not return anything (or the HTML page is messed up)
- $encregex = "/<meta\s+[^>]*(?:charset\s*=\s*['\"]([^>'\"]*)['\"]" .
- "|http-equiv\s*=\s*['\"]content-type['\"]\s+[^>]*content\s*=\s*['\"][^>]*charset=([^>]*)['\"])[^>]*>/i";
- if(preg_match($encregex, $body, $matches)) {
+ $regex = '/<meta\s+[^>]*(?:charset\s*=\s*[\'"]([^>\'"]*)[\'"]' .
+ '|http-equiv\s*=\s*[\'"]content-type[\'"]\s+[^>]*' .
+ 'content\s*=\s*[\'"][^>]*charset=([^>]*)[\'"])[^>]*>' .
+ '/i';
+ if(preg_match($regex, $body, $matches)) {
$enc = strtoupper($matches[sizeof($matches) - 1]);
} else {
$enc = mb_detect_encoding($body);
}
- $enc = $enc ? $enc : "UTF-8";
+ $enc = $enc ? $enc : 'UTF-8';
$body = mb_convert_encoding($body, 'HTML-ENTITIES', $enc);
$dom = new DOMDocument();