better support for atom content type xhtml

This commit is contained in:
Andrew Dolgov 2013-05-16 09:19:56 +04:00
parent c594eca0de
commit 2700440178
1 changed files with 12 additions and 6 deletions

View File

@ -41,9 +41,8 @@ class FeedItem_Atom extends FeedItem_Common {
$content = $this->elem->getElementsByTagName("content")->item(0); $content = $this->elem->getElementsByTagName("content")->item(0);
if ($content) { if ($content) {
if ($content->hasChildNodes()) { if ($content->hasAttribute('type')) {
if ($content->getAttribute('type') == 'xhtml') {
if ($content->getElementsByTagName("*")->length > 1) {
return $this->doc->saveXML($content->firstChild->nextSibling); return $this->doc->saveXML($content->firstChild->nextSibling);
} }
} }
@ -53,11 +52,18 @@ class FeedItem_Atom extends FeedItem_Common {
} }
function get_description() { function get_description() {
$summary = $this->elem->getElementsByTagName("summary")->item(0); $content = $this->elem->getElementsByTagName("summary")->item(0);
if ($summary) { if ($content) {
return $summary->nodeValue; if ($content->hasAttribute('type')) {
if ($content->getAttribute('type') == 'xhtml') {
return $this->doc->saveXML($content->firstChild->nextSibling);
}
}
return $content->nodeValue;
} }
} }
function get_categories() { function get_categories() {