summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Birth <markus@birth-online.de>2013-04-13 01:16:53 +0200
committerMarkus Birth <markus@birth-online.de>2013-04-13 01:16:53 +0200
commit8cd178076ff7ff3f8973b7119a2675a3ec133faa (patch)
tree9ca14bad7d1fa2b027869e3f8e5a6ecf8ed6e0be
parent5a5728ef4d0b0291b039cf1942e87cc8d621d00b (diff)
downloadyafpp-8cd178076ff7ff3f8973b7119a2675a3ec133faa.tar.gz
yafpp-8cd178076ff7ff3f8973b7119a2675a3ec133faa.zip
Fixed PHP warning if JSON configuration is unreadable or empty. Fixes #3
-rw-r--r--README.md2
-rw-r--r--init.php5
2 files changed, 6 insertions, 1 deletions
diff --git a/README.md b/README.md
index d794093..ed7365b 100644
--- a/README.md
+++ b/README.md
@@ -84,7 +84,7 @@ To test your XPath expressions, you can use these Chrome extensions:
Some XPath expressions you could need (the `//` is automatically prepended and must be omitted in the FeedMod configuration):
-##### HTML5 <article> tag
+##### HTML5 &lt;article&gt; tag
```html
<article>…article…</article>
diff --git a/init.php b/init.php
index ddfde29..8922a40 100644
--- a/init.php
+++ b/init.php
@@ -52,6 +52,11 @@ class Af_Feedmod extends Plugin implements IHandler
$owner_uid = $article['owner_uid'];
$data = json_decode($json_conf, true);
+ if (!is_array($data)) {
+ // no valid JSON or no configuration at all
+ return $article;
+ }
+
foreach ($data as $urlpart=>$config) {
if (strpos($article['link'], $urlpart) === false) continue; // skip this config if URL not matching
if (strpos($article['plugin_data'], "feedmod,$owner_uid:") !== false) {