check legacy <actor> and <subject> first from feed

This commit is contained in:
Evan Prodromou 2011-02-11 02:59:18 +00:00
parent 8fa44e58f9
commit fc317f8b72

View File

@ -273,14 +273,6 @@ class ActivityUtils
static function getFeedAuthor($feedEl) static function getFeedAuthor($feedEl)
{ {
// Try the feed author
$author = ActivityUtils::child($feedEl, Activity::AUTHOR, Activity::ATOM);
if (!empty($author)) {
return new ActivityObject($author);
}
// Try old and deprecated activity:subject // Try old and deprecated activity:subject
$subject = ActivityUtils::child($feedEl, Activity::SUBJECT, Activity::SPEC); $subject = ActivityUtils::child($feedEl, Activity::SUBJECT, Activity::SPEC);
@ -289,6 +281,14 @@ class ActivityUtils
return new ActivityObject($subject); return new ActivityObject($subject);
} }
// Try the feed author
$author = ActivityUtils::child($feedEl, Activity::AUTHOR, Activity::ATOM);
if (!empty($author)) {
return new ActivityObject($author);
}
// Sheesh. Not a very nice feed! Let's try fingerpoken in the // Sheesh. Not a very nice feed! Let's try fingerpoken in the
// entries. // entries.
@ -298,14 +298,6 @@ class ActivityUtils
$entry = $entries->item(0); $entry = $entries->item(0);
// Try the author
$author = ActivityUtils::child($entry, Activity::AUTHOR, Activity::ATOM);
if (!empty($author)) {
return new ActivityObject($author);
}
// Try the (deprecated) activity:actor // Try the (deprecated) activity:actor
$actor = ActivityUtils::child($entry, Activity::ACTOR, Activity::SPEC); $actor = ActivityUtils::child($entry, Activity::ACTOR, Activity::SPEC);
@ -313,6 +305,14 @@ class ActivityUtils
if (!empty($actor)) { if (!empty($actor)) {
return new ActivityObject($actor); return new ActivityObject($actor);
} }
// Try the author
$author = ActivityUtils::child($entry, Activity::AUTHOR, Activity::ATOM);
if (!empty($author)) {
return new ActivityObject($author);
}
} }
return null; return null;