diff options
author | Brion Vibber <brion@pobox.com> | 2010-12-22 15:25:38 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-12-22 15:25:38 -0800 |
commit | 26baad63f2e7d5cd0f783aacdb9eb2a65a638656 (patch) | |
tree | 35c39658aeb23ced8104177adadbc63560cda62e /plugins/OStatus | |
parent | 1513b8eeb921538e4e342c2c6d64b2c0d1aed2dd (diff) | |
parent | e0606d3eca761bda5fb804f6522028280d3396e8 (diff) |
Merge branch '0.9.x' into 1.0.x
Diffstat (limited to 'plugins/OStatus')
-rw-r--r-- | plugins/OStatus/classes/Ostatus_profile.php | 51 |
1 files changed, 8 insertions, 43 deletions
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index 1089f6a21..c975cdf89 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -897,54 +897,19 @@ class Ostatus_profile extends Managed_DataObject * @return Ostatus_profile * @throws Exception */ + public static function ensureAtomFeed($feedEl, $hints) { - // Try to get a profile from the feed activity:subject - - $subject = ActivityUtils::child($feedEl, Activity::SUBJECT, Activity::SPEC); - - if (!empty($subject)) { - $subjObject = new ActivityObject($subject); - return self::ensureActivityObjectProfile($subjObject, $hints); - } - - // Otherwise, try the feed author - - $author = ActivityUtils::child($feedEl, Activity::AUTHOR, Activity::ATOM); - - if (!empty($author)) { - $authorObject = new ActivityObject($author); - return self::ensureActivityObjectProfile($authorObject, $hints); - } - - // Sheesh. Not a very nice feed! Let's try fingerpoken in the - // entries. + $author = ActivityUtils::getFeedAuthor($feedEl); - $entries = $feedEl->getElementsByTagNameNS(Activity::ATOM, 'entry'); - - if (!empty($entries) && $entries->length > 0) { - - $entry = $entries->item(0); - - $actor = ActivityUtils::child($entry, Activity::ACTOR, Activity::SPEC); - - if (!empty($actor)) { - $actorObject = new ActivityObject($actor); - return self::ensureActivityObjectProfile($actorObject, $hints); - - } - - $author = ActivityUtils::child($entry, Activity::AUTHOR, Activity::ATOM); - - if (!empty($author)) { - $authorObject = new ActivityObject($author); - return self::ensureActivityObjectProfile($authorObject, $hints); - } + if (empty($author)) { + // XXX: make some educated guesses here + // TRANS: Feed sub exception. + throw new FeedSubException(_m('Can\'t find enough profile '. + 'information to make a feed.')); } - // XXX: make some educated guesses here - // TRANS: Feed sub exception. - throw new FeedSubException(_m('Can\'t find enough profile information to make a feed.')); + return self::ensureActivityObjectProfile($author, $hints); } /** |