Update of picoFeed

This commit is contained in:
Frederic Guillot 2013-03-21 19:58:52 -04:00
parent 7a29e07ba0
commit 55457b0e53
2 changed files with 19 additions and 2 deletions

View File

@ -167,13 +167,25 @@ class Rss20 extends Parser
$content = (string) $entry->description;
}
if ($author === '') {
if (isset($entry->author)) {
$author = (string) $entry->author;
}
else if (isset($xml->channel->webMaster)) {
$author = (string) $xml->channel->webMaster;
}
}
$item = new \StdClass;
$item->id = (string) $entry->guid;
$item->title = (string) $entry->title;
$item->url = $link ?: (string) $entry->link;
$item->id = isset($entry->guid) ? (string) $entry->guid : $item->url;
$item->updated = strtotime($pubdate ?: (string) $entry->pubDate) ?: $this->updated;
$item->content = $this->filterHtml($content, $item->url);
$item->author = $author ?: (string) $xml->channel->webMaster;
$item->author = $author;
$this->items[] = $item;
}

View File

@ -44,10 +44,15 @@ class Reader
public function getFirstTag($data)
{
// Strip HTML comments
$data = preg_replace('/<!--(.*)-->/Uis', '', $data);
// Find <?xml version....
if (strpos($data, '<?xml') !== false) {
$data = substr($data, strrpos($data, '?>') + 2);
// Find the first tag
$open_tag = strpos($data, '<');
$close_tag = strpos($data, '>');