}
function get_title() {
+ $title = $this->xpath->query("title", $this->elem)->item(0);
+
+ if ($title) {
+ return trim($title->nodeValue);
+ }
+
+ // if the document has a default namespace then querying for
+ // title would fail because of reasons so let's try the old way
$title = $this->elem->getElementsByTagName("title")->item(0);
if ($title) {
$contentB = $this->elem->getElementsByTagName("description")->item(0);
if ($contentA && !$contentB) {
- return $contentA->nodeValue;
+ return $this->subtree_or_text($contentA);
}
if ($contentB && !$contentA) {
- return $contentB->nodeValue;
+ return $this->subtree_or_text($contentB);
}
if ($contentA && $contentB) {
- return mb_strlen($contentA->nodeValue) > mb_strlen($contentB->nodeValue) ?
- $contentA->nodeValue : $contentB->nodeValue;
+ $resultA = $this->subtree_or_text($contentA);
+ $resultB = $this->subtree_or_text($contentB);
+
+ return mb_strlen($resultA) > mb_strlen($resultB) ? $resultA : $resultB;
}
}
return $encs;
}
-}
-?>
+}
\ No newline at end of file