- $actor = defaults($object, 'actor', null);
- }
-
- $object_data['diaspora:guid'] = defaults($object, 'diaspora:guid', null);
- $object_data['owner'] = $object_data['author'] = $actor;
- $object_data['context'] = defaults($object, 'context', null);
- $object_data['conversation'] = defaults($object, 'conversation', null);
- $object_data['sensitive'] = defaults($object, 'sensitive', null);
- $object_data['name'] = defaults($object, 'title', null);
- $object_data['name'] = defaults($object, 'name', $object_data['name']);
- $object_data['summary'] = defaults($object, 'summary', null);
- $object_data['content'] = defaults($object, 'content', null);
- $object_data['source'] = defaults($object, 'source', null);
- $object_data['location'] = JsonLD::fetchElement($object, 'location', 'name', 'type', 'Place');
- $object_data['attachments'] = defaults($object, 'attachment', null);
- $object_data['tags'] = defaults($object, 'tag', null);
- $object_data['service'] = JsonLD::fetchElement($object, 'instrument', 'name', 'type', 'Service');
- $object_data['alternate-url'] = JsonLD::fetchElement($object, 'url', 'href');
- $object_data['receiver'] = self::getReceivers($object, $object_data['owner']);
+ $actor = JsonLD::fetchElement($object, 'as:actor');
+ }
+
+ $object_data['diaspora:guid'] = JsonLD::fetchElement($object, 'diaspora:guid');
+ $object_data['diaspora:comment'] = JsonLD::fetchElement($object, 'diaspora:comment');
+ $object_data['diaspora:like'] = JsonLD::fetchElement($object, 'diaspora:like');
+ $object_data['actor'] = $object_data['author'] = $actor;
+ $object_data['context'] = JsonLD::fetchElement($object, 'as:context');
+ $object_data['conversation'] = JsonLD::fetchElement($object, 'ostatus:conversation');
+ $object_data['sensitive'] = JsonLD::fetchElement($object, 'as:sensitive');
+ $object_data['name'] = JsonLD::fetchElement($object, 'as:name');
+ $object_data['summary'] = JsonLD::fetchElement($object, 'as:summary');
+ $object_data['content'] = JsonLD::fetchElement($object, 'as:content');
+ $object_data['source'] = JsonLD::fetchElement($object, 'as:source', 'as:content', 'as:mediaType', 'text/bbcode');
+ $object_data['start-time'] = JsonLD::fetchElement($object, 'as:startTime', '@value');
+ $object_data['end-time'] = JsonLD::fetchElement($object, 'as:endTime', '@value');
+ $object_data['location'] = JsonLD::fetchElement($object, 'as:location', 'as:name', '@type', 'as:Place');
+ $object_data['latitude'] = JsonLD::fetchElement($object, 'as:location', 'as:latitude', '@type', 'as:Place');
+ $object_data['latitude'] = JsonLD::fetchElement($object_data, 'latitude', '@value');
+ $object_data['longitude'] = JsonLD::fetchElement($object, 'as:location', 'as:longitude', '@type', 'as:Place');
+ $object_data['longitude'] = JsonLD::fetchElement($object_data, 'longitude', '@value');
+ $object_data['attachments'] = self::processAttachments(JsonLD::fetchElementArray($object, 'as:attachment'));
+ $object_data['tags'] = self::processTags(JsonLD::fetchElementArray($object, 'as:tag'));
+ $object_data['emojis'] = self::processEmojis(JsonLD::fetchElementArray($object, 'as:tag', 'toot:Emoji'));
+ $object_data['generator'] = JsonLD::fetchElement($object, 'as:generator', 'as:name', '@type', 'as:Application');
+ $object_data['alternate-url'] = JsonLD::fetchElement($object, 'as:url');
+
+ // Special treatment for Hubzilla links
+ if (is_array($object_data['alternate-url'])) {
+ $object_data['alternate-url'] = JsonLD::fetchElement($object_data['alternate-url'], 'as:href');
+
+ if (!is_string($object_data['alternate-url'])) {
+ $object_data['alternate-url'] = JsonLD::fetchElement($object['as:url'], 'as:href');
+ }
+ }
+
+ $object_data['receiver'] = self::getReceivers($object, $object_data['actor'], $object_data['tags']);