mirror of
https://github.com/friendica/friendica
synced 2025-04-26 13:50:11 +00:00
AP: Remove the link description from the "rich html" and adds it to the attachment
This commit is contained in:
parent
19bbae21de
commit
28ca0d6fab
2 changed files with 51 additions and 1 deletions
|
@ -1020,6 +1020,34 @@ class Transmitter
|
|||
{
|
||||
$attachments = [];
|
||||
|
||||
$attach_data = BBCode::getAttachmentData($item['body']);
|
||||
if (!empty($attach_data['url'])) {
|
||||
$attachment = ['type' => 'Page',
|
||||
'mediaType' => 'text/html',
|
||||
'url' => $attach_data['url']];
|
||||
|
||||
if (!empty($attach_data['title'])) {
|
||||
$attachment['name'] = $attach_data['title'];
|
||||
}
|
||||
|
||||
if (!empty($attach_data['description'])) {
|
||||
$attachment['summary'] = $attach_data['description'];
|
||||
}
|
||||
|
||||
if (!empty($attach_data['image'])) {
|
||||
$imgdata = Images::getInfoFromURLCached($attach_data['image']);
|
||||
if ($imgdata) {
|
||||
$attachment['icon'] = ['type' => 'Image',
|
||||
'mediaType' => $imgdata['mime'],
|
||||
'width' => $imgdata[0],
|
||||
'height' => $imgdata[1],
|
||||
'url' => $attach_data['image']];
|
||||
}
|
||||
}
|
||||
|
||||
$attachments[] = $attachment;
|
||||
}
|
||||
|
||||
$arr = explode('[/attach],', $item['attach']);
|
||||
if (count($arr)) {
|
||||
foreach ($arr as $r) {
|
||||
|
@ -1266,12 +1294,12 @@ class Transmitter
|
|||
} else {
|
||||
$regexp = "/[@!]\[url\=([^\[\]]*)\].*?\[\/url\]/ism";
|
||||
$body = preg_replace_callback($regexp, ['self', 'mentionCallback'], $body);
|
||||
|
||||
$data['content'] = BBCode::convert($body, false, 9);
|
||||
}
|
||||
|
||||
$regexp = "/[@!]\[url\=([^\[\]]*)\].*?\[\/url\]/ism";
|
||||
$richbody = preg_replace_callback($regexp, ['self', 'mentionCallback'], $item['body']);
|
||||
$richbody = BBCode::removeAttachment($richbody);
|
||||
|
||||
$data['contentMap']['text/html'] = BBCode::convert($richbody, false);
|
||||
$data['contentMap']['text/markdown'] = BBCode::toMarkdown($item["body"]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue