|
|
@ -51,24 +51,28 @@ class FeedParser {
|
|
|
|
|
|
|
|
|
|
|
|
$this->xpath = $xpath;
|
|
|
|
$this->xpath = $xpath;
|
|
|
|
|
|
|
|
|
|
|
|
$root = $xpath->query("(//atom03:feed|//atom:feed|//channel|//rdf:rdf|//rdf:RDF)")->item(0);
|
|
|
|
$root = $xpath->query("(//atom03:feed|//atom:feed|//channel|//rdf:rdf|//rdf:RDF)");
|
|
|
|
|
|
|
|
|
|
|
|
if ($root) {
|
|
|
|
if ($root) {
|
|
|
|
switch (mb_strtolower($root->tagName)) {
|
|
|
|
$root = $root->item(0);
|
|
|
|
case "rdf:rdf":
|
|
|
|
|
|
|
|
$this->type = $this::FEED_RDF;
|
|
|
|
if ($root) {
|
|
|
|
break;
|
|
|
|
switch (mb_strtolower($root->tagName)) {
|
|
|
|
case "channel":
|
|
|
|
case "rdf:rdf":
|
|
|
|
$this->type = $this::FEED_RSS;
|
|
|
|
$this->type = $this::FEED_RDF;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case "feed":
|
|
|
|
case "channel":
|
|
|
|
$this->type = $this::FEED_ATOM;
|
|
|
|
$this->type = $this::FEED_RSS;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
case "feed":
|
|
|
|
if( !isset($this->error) ){
|
|
|
|
$this->type = $this::FEED_ATOM;
|
|
|
|
$this->error = "Unknown/unsupported feed type";
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
if( !isset($this->error) ){
|
|
|
|
|
|
|
|
$this->error = "Unknown/unsupported feed type";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch ($this->type) {
|
|
|
|
switch ($this->type) {
|
|
|
|