- if ($xpath->query('/atom:feed/atom:entry')->length > 0) {
- //$self = $xpath->query("/atom:feed/atom:link[@rel='self']")->item(0)->attributes;
- //if (is_object($self))
- // foreach($self AS $attributes)
- // if ($attributes->name == "href")
- // $author["author-link"] = $attributes->textContent;
-
- //if ($author["author-link"] == "") {
- // $alternate = $xpath->query("/atom:feed/atom:link[@rel='alternate']")->item(0)->attributes;
- // if (is_object($alternate))
- // foreach($alternate AS $attributes)
- // if ($attributes->name == "href")
- // $author["author-link"] = $attributes->textContent;
- //}
+ if ($xpath->query('/atom:feed')->length > 0) {
+ $alternate = $xpath->query("atom:link[@rel='alternate']")->item(0)->attributes;
+ if (is_object($alternate)) {
+ foreach ($alternate AS $attributes) {
+ if ($attributes->name == "href") {
+ $author["author-link"] = $attributes->textContent;
+ }
+ }
+ }
+
+ if ($author["author-link"] == "") {
+ $author["author-link"] = $author["author-id"];
+ }
+ if ($author["author-link"] == "") {
+ $self = $xpath->query("atom:link[@rel='self']")->item(0)->attributes;
+ if (is_object($self)) {
+ foreach ($self AS $attributes) {
+ if ($attributes->name == "href") {
+ $author["author-link"] = $attributes->textContent;
+ }
+ }
+ }
+ }
+
+ if ($author["author-link"] == "") {
+ $author["author-link"] = $xpath->evaluate('/atom:feed/atom:id/text()')->item(0)->nodeValue;
+ }
+ $author["author-avatar"] = $xpath->evaluate('/atom:feed/atom:logo/text()')->item(0)->nodeValue;