Add support for RSS 0.91 and 0.92

This commit is contained in:
Frederic Guillot 2013-03-25 21:29:55 -04:00
parent 2925001dcb
commit b3ea83fe96
2 changed files with 23 additions and 1 deletions

View File

@ -134,7 +134,15 @@ class Rss20 extends Parser
$this->url = (string) $xml->channel->link;
$this->id = $this->url;
$this->updated = isset($xml->channel->pubDate) ? (string) $xml->channel->pubDate : (string) $xml->channel->lastBuildDate;
if ($this->updated) {
$this->updated = strtotime($this->updated);
}
else {
$this->updated = time();
}
foreach ($xml->channel->item as $entry) {
@ -273,3 +281,9 @@ class Rss10 extends Parser
return $this;
}
}
class Rss92 extends Rss20 {}
class Rss91 extends Rss20 {}

View File

@ -75,6 +75,14 @@ class Reader
return new Rss20($this->content);
}
else if (strpos($first_tag, '<rss ') !== false && strpos($first_tag, 'version="0.92"') !== false) {
return new Rss92($this->content);
}
else if (strpos($first_tag, '<rss ') !== false && strpos($first_tag, 'version="0.91"') !== false) {
return new Rss91($this->content);
}
else if (strpos($first_tag, '<rdf:') !== false && strpos($first_tag, 'xmlns="http://purl.org/rss/1.0/"') !== false) {
return new Rss10($this->content);