diff options
Diffstat (limited to 'lib/FeedItem.php')
-rw-r--r-- | lib/FeedItem.php | 9 |
1 files changed, 7 insertions, 2 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))); } } |