[FeedExpander] support xhtml content / content with child elements (#3598)

* [core] support xhtml content type in FeedExpander

* [FilterBridge] change defaultValue to exampleValue

* [core] support content with child elements in FeedExpander
This commit is contained in:
User123698745 2023-08-04 22:14:08 +02:00 committed by GitHub
parent d32419ffcf
commit 4976cd227e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View file

@ -12,7 +12,7 @@ class FilterBridge extends FeedExpander
'url' => [
'name' => 'Feed URL',
'type' => 'text',
'defaultValue' => 'https://lorem-rss.herokuapp.com/feed?unit=day',
'exampleValue' => 'https://lorem-rss.herokuapp.com/feed?unit=day',
'required' => true,
],
'filter' => [

View file

@ -308,7 +308,16 @@ abstract class FeedExpander extends BridgeAbstract
$item['author'] = (string)$feedItem->author->name;
}
if (isset($feedItem->content)) {
$item['content'] = (string)$feedItem->content;
$contentChildren = $feedItem->content->children();
if (count($contentChildren) > 0) {
$content = '';
foreach ($contentChildren as $contentChild) {
$content .= $contentChild->asXML();
}
$item['content'] = $content;
} else {
$item['content'] = (string)$feedItem->content;
}
}
//When "link" field is present, URL is more reliable than "id" field