]> git.mxchange.org Git - friendica.git/commitdiff
Simplified share element
authorMichael <heluecht@pirati.ca>
Fri, 7 Oct 2022 05:51:36 +0000 (05:51 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 7 Oct 2022 05:51:36 +0000 (05:51 +0000)
mod/share.php
src/Model/Item.php

index 09097f070f3c6738200ebee43d6043d441a58f0d..792ee400824b15f6aab10b5b01dc314fe0a2430e 100644 (file)
@@ -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;
index 6cce806bed9434288af740e76b274a7b0c3b850f..a88e61124ae4b7aa0c0f067ee623adb0295baab9 100644 (file)
@@ -3666,9 +3666,18 @@ class Item
         */
        public static function improveSharedDataInBody(array $item): string
        {
-               $shared = BBCode::fetchShareAttributes($item['body']);
-               if (empty($shared['link']) && empty($shared['message_id'])) {
-                       return $item['body'];
+               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']);