parser: properly support tag subtrees instead of text content for article content

This commit is contained in:
Andrew Dolgov
2016-01-23 01:48:32 +03:00
parent d2bb392bae
commit 7d1e15c396
3 changed files with 19 additions and 6 deletions

View File

@@ -70,6 +70,17 @@ abstract class FeedItem_Common extends FeedItem {
}
}
function count_children($node) {
return $node->getElementsByTagName("*")->length;
}
function subtree_or_text($node) {
if ($this->count_children($node) == 0) {
return $node->nodeValue;
} else {
return $node->c14n();
}
}
}
?>