]> git.mxchange.org Git - friendica.git/blobdiff - src/Content/Text/BBCode.php
Add support for Hubzilla forum mentions (starting with !)
[friendica.git] / src / Content / Text / BBCode.php
index 6d2b152ee8de490c8013f3364023b2ac63aaeb8a..1ddae09eaca8a451fae36f514f50106b9858f58d 100644 (file)
@@ -1809,6 +1809,9 @@ class BBCode extends BaseObject
         * @brief Callback function to replace a Friendica style mention in a mention for Diaspora
         *
         * @param array $match Matching values for the callback
+        *                     [1] = Mention type (! or @)
+        *                     [2] = Name
+        *                     [3] = Address
         * @return string Replaced mention
         */
        private static function bbCodeMention2DiasporaCallback($match)
@@ -1823,7 +1826,7 @@ class BBCode extends BaseObject
                        return $match[0];
                }
 
-               $mention = '@{' . $match[2] . '; ' . $contact['addr'] . '}';
+               $mention = $match[1] . '{' . $match[2] . '; ' . $contact['addr'] . '}';
                return $mention;
        }
 
@@ -1908,7 +1911,7 @@ class BBCode extends BaseObject
                if ($for_diaspora) {
                        $url_search_string = "^\[\]";
                        $text = preg_replace_callback(
-                               "/([@]\[(.*?)\])\(([$url_search_string]*?)\)/ism",
+                               "/([@!])\[(.*?)\]\(([$url_search_string]*?)\)/ism",
                                ['self', 'bbCodeMention2DiasporaCallback'],
                                $text
                        );