'image' => $pageImage,
];
break;
- case 'as:Link':
- $attachlist[] = [
- 'type' => str_replace('as:', '', JsonLD::fetchElement($attachment, '@type')),
- 'mediaType' => JsonLD::fetchElement($attachment, 'as:mediaType', '@value'),
- 'name' => JsonLD::fetchElement($attachment, 'as:name', '@value'),
- 'url' => JsonLD::fetchElement($attachment, 'as:href', '@id')
- ];
- break;
case 'as:Image':
$mediaType = JsonLD::fetchElement($attachment, 'as:mediaType', '@value');
$imageFullUrl = JsonLD::fetchElement($attachment, 'as:url', '@id');
'type' => str_replace('as:', '', JsonLD::fetchElement($attachment, '@type')),
'mediaType' => JsonLD::fetchElement($attachment, 'as:mediaType', '@value'),
'name' => JsonLD::fetchElement($attachment, 'as:name', '@value'),
- 'url' => JsonLD::fetchElement($attachment, 'as:url', '@id')
+ 'url' => JsonLD::fetchElement($attachment, 'as:url', '@id'),
+ 'height' => JsonLD::fetchElement($attachment, 'as:height', '@value'),
+ 'width' => JsonLD::fetchElement($attachment, 'as:width', '@value'),
+ 'image' => JsonLD::fetchElement($attachment, 'as:image', '@id')
];
}
}
return $success;
}
-
+
/**
* Collects a list of contacts of the given owner
*
}
$data['type'] = ActivityPub::ACCOUNT_TYPES[$user['account-type']];
-
+
if ($uid != 0) {
$data['following'] = DI::baseUrl() . '/following/' . $user['nickname'];
$data['followers'] = DI::baseUrl() . '/followers/' . $user['nickname'];
/**
* Check if a given contact should be delivered via AP
*
- * @param array $contact
- * @param array $networks
- * @return bool
- * @throws Exception
+ * @param array $contact
+ * @param array $networks
+ * @return bool
+ * @throws Exception
*/
private static function isAPContact(array $contact, array $networks)
{
if (!empty($self['uid'])) {
$forum_item = Post::selectFirst(Item::DELIVER_FIELDLIST, ['uri-id' => $item['uri-id'], 'uid' => $self['uid']]);
if (DBA::isResult($forum_item)) {
- $item = $forum_item;
+ $item = $forum_item;
}
}
}
}
$urls[] = $attachment['url'];
- $attachments[] = ['type' => 'Document',
+ $attach = ['type' => 'Document',
'mediaType' => $attachment['mimetype'],
'url' => $attachment['url'],
'name' => $attachment['description']];
+
+ if (!empty($attachment['height'])) {
+ $attach['height'] = $attachment['height'];
+ }
+
+ if (!empty($attachment['width'])) {
+ $attach['width'] = $attachment['width'];
+ }
+
+ if (!empty($attachment['preview'])) {
+ $attach['image'] = $attachment['preview'];
+ }
+
+ $attachments[] = $attach;
}
}
}
$urls[] = $attachment['url'];
- $attachments[] = ['type' => 'Document',
+ $attach = ['type' => 'Document',
'mediaType' => $attachment['mimetype'],
'url' => $attachment['url'],
'name' => $attachment['description']];
+
+ if (!empty($attachment['height'])) {
+ $attach['height'] = $attachment['height'];
+ }
+
+ if (!empty($attachment['width'])) {
+ $attach['width'] = $attachment['width'];
+ }
+
+ if (!empty($attachment['preview'])) {
+ $attach['image'] = $attachment['preview'];
+ }
+
+ $attachments[] = $attach;
}
// Currently deactivated, since it creates side effects on Mastodon and Pleroma.
// It will be activated, once this cleared.
* This part is currently deactivated. The automated summary seems to be more
* confusing than helping. But possibly we will find a better way.
* So the code is left here for now as a reminder
- *
+ *
* } elseif (($type == 'Article') && empty($data['summary'])) {
* $regexp = "/[@!]\[url\=([^\[\]]*)\].*?\[\/url\]/ism";
* $summary = preg_replace_callback($regexp, ['self', 'mentionAddrCallback'], $body);