]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
Merge branch 'at-mention-url' into 'master'
[quix0rs-gnu-social.git] / lib / util.php
index f58e8cd112a8b980aa9b75b0730054c0d6b48885..1844240f455497e15ee7150d7f38bee46933e798 100644 (file)
@@ -648,7 +648,7 @@ function common_linkify_mentions($text, Notice $notice)
 
         $linkText = common_linkify_mention($mention);
 
-        $text = substr_replace($text, $linkText, $position, mb_strlen($mention['text']));
+        $text = substr_replace($text, $linkText, $position, $mention['length']);
     }
 
     return $text;
@@ -765,6 +765,7 @@ function common_find_mentions($text, Notice $notice)
                                  'type' => 'mention',
                                  'text' => $match[0],
                                  'position' => $match[1],
+                                 'length' => mb_strlen($match[0]),
                                  'url' => $url);
 
                 if (!empty($mentioned->fullname)) {
@@ -795,6 +796,7 @@ function common_find_mentions($text, Notice $notice)
                                 'type'      => 'list',
                                 'text' => $hmatch[0],
                                 'position' => $hmatch[1],
+                                'length' => mb_strlen($hmatch[0]),
                                 'url' => $url);
         }
 
@@ -814,6 +816,7 @@ function common_find_mentions($text, Notice $notice)
                                 'type'      => 'group',
                                 'text'      => $hmatch[0],
                                 'position'  => $hmatch[1],
+                                'length'    => mb_strlen($hmatch[0]),
                                 'url'       => $group->permalink(),
                                 'title'     => $group->getFancyName());
         }