From 7d1e15c396f36c261d0c8067fc316f6c3e8e1948 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 23 Jan 2016 01:48:32 +0300 Subject: parser: properly support tag subtrees instead of text content for article content --- classes/feeditem/common.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'classes/feeditem/common.php') diff --git a/classes/feeditem/common.php b/classes/feeditem/common.php index 80bebf8fb..070692d7f 100644 --- a/classes/feeditem/common.php +++ b/classes/feeditem/common.php @@ -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(); + } + } } ?> -- cgit v1.2.3-54-g00ecf