mirror of
https://github.com/friendica/friendica
synced 2024-11-14 03:42:53 +00:00
Simplified share element
This commit is contained in:
parent
8e9acfe210
commit
d7a9745ffd
2 changed files with 13 additions and 4 deletions
|
@ -44,7 +44,7 @@ function share_init(App $a) {
|
||||||
$pos = strpos($item['body'], "[share");
|
$pos = strpos($item['body'], "[share");
|
||||||
$o = substr($item['body'], $pos);
|
$o = substr($item['body'], $pos);
|
||||||
} else {
|
} else {
|
||||||
$o = "[share message_id='" . $item['uri'] . "'][/share]";
|
$o = "[share]" . $item['uri'] . "[/share]";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $o;
|
echo $o;
|
||||||
|
|
|
@ -3666,9 +3666,18 @@ class Item
|
||||||
*/
|
*/
|
||||||
public static function improveSharedDataInBody(array $item): string
|
public static function improveSharedDataInBody(array $item): string
|
||||||
{
|
{
|
||||||
$shared = BBCode::fetchShareAttributes($item['body']);
|
if (preg_match('#\[share](.*)\[/share]#', $item['body'], $matches)) {
|
||||||
if (empty($shared['link']) && empty($shared['message_id'])) {
|
$shared = [
|
||||||
return $item['body'];
|
'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']);
|
$id = self::fetchByLink($shared['link'] ?: $shared['message_id']);
|
||||||
|
|
Loading…
Reference in a new issue