kopia lustrzana https://github.com/friendica/friendica
Simplified share element
rodzic
8e9acfe210
commit
d7a9745ffd
|
@ -44,7 +44,7 @@ function share_init(App $a) {
|
|||
$pos = strpos($item['body'], "[share");
|
||||
$o = substr($item['body'], $pos);
|
||||
} else {
|
||||
$o = "[share message_id='" . $item['uri'] . "'][/share]";
|
||||
$o = "[share]" . $item['uri'] . "[/share]";
|
||||
}
|
||||
|
||||
echo $o;
|
||||
|
|
|
@ -3666,10 +3666,19 @@ class Item
|
|||
*/
|
||||
public static function improveSharedDataInBody(array $item): string
|
||||
{
|
||||
if (preg_match('#\[share](.*)\[/share]#', $item['body'], $matches)) {
|
||||
$shared = [
|
||||
'message_id' => $matches[1],
|
||||
'link' => '',
|
||||
'guid' => '',
|
||||
'profile' => '',
|
||||
];
|
||||
} else {
|
||||
$shared = BBCode::fetchShareAttributes($item['body']);
|
||||
if (empty($shared['link']) && empty($shared['message_id'])) {
|
||||
return $item['body'];
|
||||
}
|
||||
}
|
||||
|
||||
$id = self::fetchByLink($shared['link'] ?: $shared['message_id']);
|
||||
Logger::debug('Fetched shared post', ['uri-id' => $item['uri-id'], 'id' => $id, 'author' => $shared['profile'], 'url' => $shared['link'], 'guid' => $shared['guid'], 'uri' => $shared['message_id'], 'callstack' => System::callstack()]);
|
||||
|
|
Ładowanie…
Reference in New Issue