parser: fix failing on empty media:group tags
This commit is contained in:
parent
de0d8d1088
commit
2ab7ccb695
|
@ -160,19 +160,21 @@ class FeedItem_Atom extends FeedItem_Common {
|
||||||
|
|
||||||
$content = $this->xpath->query("media:content", $enclosure)->item(0);
|
$content = $this->xpath->query("media:content", $enclosure)->item(0);
|
||||||
|
|
||||||
$enc->type = $content->getAttribute("type");
|
if ($content) {
|
||||||
$enc->link = $content->getAttribute("url");
|
$enc->type = $content->getAttribute("type");
|
||||||
$enc->length = $content->getAttribute("length");
|
$enc->link = $content->getAttribute("url");
|
||||||
|
$enc->length = $content->getAttribute("length");
|
||||||
|
|
||||||
$desc = $this->xpath->query("media:description", $content)->item(0);
|
$desc = $this->xpath->query("media:description", $content)->item(0);
|
||||||
if ($desc) {
|
if ($desc) {
|
||||||
$enc->title = strip_tags($desc->nodeValue);
|
$enc->title = strip_tags($desc->nodeValue);
|
||||||
} else {
|
} else {
|
||||||
$desc = $this->xpath->query("media:description", $enclosure)->item(0);
|
$desc = $this->xpath->query("media:description", $enclosure)->item(0);
|
||||||
if ($desc) $enc->title = strip_tags($desc->nodeValue);
|
if ($desc) $enc->title = strip_tags($desc->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
array_push($encs, $enc);
|
||||||
}
|
}
|
||||||
|
|
||||||
array_push($encs, $enc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$enclosures = $this->xpath->query("media:thumbnail", $this->elem);
|
$enclosures = $this->xpath->query("media:thumbnail", $this->elem);
|
||||||
|
|
|
@ -140,19 +140,21 @@ class FeedItem_RSS extends FeedItem_Common {
|
||||||
|
|
||||||
$content = $this->xpath->query("media:content", $enclosure)->item(0);
|
$content = $this->xpath->query("media:content", $enclosure)->item(0);
|
||||||
|
|
||||||
$enc->type = $content->getAttribute("type");
|
if ($content) {
|
||||||
$enc->link = $content->getAttribute("url");
|
$enc->type = $content->getAttribute("type");
|
||||||
$enc->length = $content->getAttribute("length");
|
$enc->link = $content->getAttribute("url");
|
||||||
|
$enc->length = $content->getAttribute("length");
|
||||||
|
|
||||||
$desc = $this->xpath->query("media:description", $content)->item(0);
|
$desc = $this->xpath->query("media:description", $content)->item(0);
|
||||||
if ($desc) {
|
if ($desc) {
|
||||||
$enc->title = strip_tags($desc->nodeValue);
|
$enc->title = strip_tags($desc->nodeValue);
|
||||||
} else {
|
} else {
|
||||||
$desc = $this->xpath->query("media:description", $enclosure)->item(0);
|
$desc = $this->xpath->query("media:description", $enclosure)->item(0);
|
||||||
if ($desc) $enc->title = strip_tags($desc->nodeValue);
|
if ($desc) $enc->title = strip_tags($desc->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
array_push($encs, $enc);
|
||||||
}
|
}
|
||||||
|
|
||||||
array_push($encs, $enc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$enclosures = $this->xpath->query("media:thumbnail", $this->elem);
|
$enclosures = $this->xpath->query("media:thumbnail", $this->elem);
|
||||||
|
|
Loading…
Reference in New Issue