mirror of
https://github.com/friendica/friendica
synced 2025-04-25 09:50:11 +00:00
The "[attach]" field is replaced by the "post-media" table
This commit is contained in:
parent
6d9e170502
commit
d383f49f1e
7 changed files with 58 additions and 104 deletions
|
@ -1392,25 +1392,19 @@ class OStatus
|
|||
}
|
||||
}
|
||||
|
||||
$arr = explode('[/attach],', $item['attach']);
|
||||
if (count($arr)) {
|
||||
foreach ($arr as $r) {
|
||||
$matches = false;
|
||||
$cnt = preg_match('|\[attach\]href=\"(.*?)\" length=\"(.*?)\" type=\"(.*?)\" title=\"(.*?)\"|', $r, $matches);
|
||||
if ($cnt) {
|
||||
$attributes = ["rel" => "enclosure",
|
||||
"href" => $matches[1],
|
||||
"type" => $matches[3]];
|
||||
foreach (Post\Media::getByURIId($item['uri-id'], [Post\Media::DOCUMENT, Post\Media::TORRENT, Post\Media::UNKNOWN]) as $attachment) {
|
||||
$attributes = ['rel' => 'enclosure',
|
||||
'href' => $attachment['url'],
|
||||
'type' => $attachment['mimetype']];
|
||||
|
||||
if (intval($matches[2])) {
|
||||
$attributes["length"] = intval($matches[2]);
|
||||
}
|
||||
if (trim($matches[4]) != "") {
|
||||
$attributes["title"] = trim($matches[4]);
|
||||
}
|
||||
XML::addElement($doc, $root, "link", "", $attributes);
|
||||
}
|
||||
if (!empty($attachment['size'])) {
|
||||
$attributes['length'] = intval($attachment['size']);
|
||||
}
|
||||
if (!empty($attachment['description'])) {
|
||||
$attributes['title'] = $attachment['description'];
|
||||
}
|
||||
|
||||
XML::addElement($doc, $root, 'link', '', $attributes);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue