- throw new ClientException(_m('Expected exactly 1 link '.
- 'rel=related in a Bookmark.'));
- }
-
- if (count($relLinkEls) > 1) {
- common_log(LOG_WARNING,
- "Got too many link rel=related in a Bookmark.");
- }
-
- $linkEl = $relLinkEls[0];
-
- $url = $linkEl->getAttribute('href');
-
- $tags = array();
-
- foreach ($activity->categories as $category) {
- $tags[] = common_canonical_tag($category->term);
- }
-
- if (!empty($activity->time)) {
- $options['created'] = common_sql_date($activity->time);
- }
-
- // Fill in location if available
-
- $location = $activity->context->location;
-
- if ($location) {
- $options['lat'] = $location->lat;
- $options['lon'] = $location->lon;
- if ($location->location_id) {
- $options['location_ns'] = $location->location_ns;
- $options['location_id'] = $location->location_id;
- }
- }
-
- $options['groups'] = array();
- $options['replies'] = array(); // TODO: context->attention
-
- foreach ($activity->context->attention as $attnUrl=>$type) {
- try {
- $other = Profile::fromUri($attnUrl);
- if ($other->isGroup()) {
- $options['groups'][] = $other->id;
- } else {
- $options['replies'][] = $attnUrl;
- }
- } catch (UnknownUriException $e) {
- // We simply don't know this URI, despite lookup attempts.
- }
- }
-
- // Maintain direct reply associations
- // @fixme what about conversation ID?
-
- if (!empty($activity->context->replyToID)) {
- $orig = Notice::getKV('uri',
- $activity->context->replyToID);
- if (!empty($orig)) {
- $options['reply_to'] = $orig->id;
- }