]> git.wh0rd.org - tt-rss.git/blobdiff - classes/feeditem/common.php
parser: properly support tag subtrees instead of text content for article content
[tt-rss.git] / classes / feeditem / common.php
index 80bebf8fb9db5674d40870e69d227af745af0e3f..070692d7f872c2f32874ef379233ffbc06829294 100644 (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();
+               }
+       }
 
 }
 ?>