aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/FeedItem.php9
-rw-r--r--lib/FeedParser.php3
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/FeedItem.php b/lib/FeedItem.php
index fc4549a7..dfb954a0 100644
--- a/lib/FeedItem.php
+++ b/lib/FeedItem.php
@@ -186,21 +186,26 @@ class FeedItem
}
/**
- * @param string|object $content The item content as text or simple_html_dom object.
+ * @param string|array|\simple_html_dom|\simple_html_dom_node $content The item content
*/
public function setContent($content)
{
$this->content = null;
+
if (
$content instanceof simple_html_dom
|| $content instanceof simple_html_dom_node
) {
$content = (string) $content;
+ } elseif (is_array($content)) {
+ // Assuming this is the rss2.0 content module
+ $content = $content['encoded'] ?? '';
}
+
if (is_string($content)) {
$this->content = $content;
} else {
- Debug::log(sprintf('Feed content must be a string but got %s', gettype($content)));
+ Debug::log(sprintf('Unable to convert feed content to string: %s', gettype($content)));
}
}
diff --git a/lib/FeedParser.php b/lib/FeedParser.php
index b774cc14..3a2f15d4 100644
--- a/lib/FeedParser.php
+++ b/lib/FeedParser.php
@@ -167,8 +167,9 @@ final class FeedParser
if (isset($namespaces['media'])) {
$media = $feedItem->children($namespaces['media']);
}
+
foreach ($namespaces as $namespaceName => $namespaceUrl) {
- if (in_array($namespaceName, ['', 'content', 'media'])) {
+ if (in_array($namespaceName, ['', 'media'])) {
continue;
}
$item[$namespaceName] = $this->parseModule($feedItem, $namespaceName, $namespaceUrl);