summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-01-31 12:42:04 +0100
committeremkael <emkael@tlen.pl>2019-01-31 19:41:51 +0100
commitb3e13ba28bc9ac57d9f6f9f5cf369814766670fc (patch)
tree36596bacafba8ae8bc4ef413593d5844f4725fdf
parenta9aae4076e0068eaa3dd74b3577f0e528b3104a5 (diff)
Sanitizing RSS proxy
-rw-r--r--providers/Rss.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/providers/Rss.php b/providers/Rss.php
index f2fc015..4937f57 100644
--- a/providers/Rss.php
+++ b/providers/Rss.php
@@ -37,14 +37,16 @@ class Rss extends \Providers\Provider {
protected function _mapItems($content) {
$items = [];
foreach ($content as $contentString) {
- $item = new \SimpleXMLElement(str_replace(['content:encoded>', '<media:', '</media:'], ['content>', '<', '</'], $contentString));
+ $itemString = str_replace(['content:encoded>', '<dc:', '</dc:', '<media:', '</media:'], ['content>', '<', '</', '<', '</'], $contentString);
+ //var_dump($itemString);
+ $item = new \SimpleXMLElement($itemString);
$itemObject = new Item();
$itemObject->ID = strval($item->id ?: $item->guid);
$itemObject->Title = strval($item->title);
$itemObject->Time = strval($item->published ?: $item->pubDate);
$itemObject->Text = strval($item->summary ?: $item->description ?: $item->content);
$itemObject->Link = strval(isset($item->link['href']) ? $item->link->attributes()['href'] : $item->link);
- $itemObject->Author = strval(is_string($item->author) ? $item->author : $item->author->name);
+ $itemObject->Author = strval($item->creator ? $item->creator : (is_string($item->author) ? $item->author : $item->author->name));
$items[] = $itemObject;
}
return $items;