* @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)
return $match[0];
}
- $mention = '@{' . $match[2] . '; ' . $contact['addr'] . '}';
+ $mention = $match[1] . '{' . $match[2] . '; ' . $contact['addr'] . '}';
return $mention;
}
if ($for_diaspora) {
$url_search_string = "^\[\]";
$text = preg_replace_callback(
- "/([@]\[(.*?)\])\(([$url_search_string]*?)\)/ism",
+ "/([@!])\[(.*?)\]\(([$url_search_string]*?)\)/ism",
['self', 'bbCodeMention2DiasporaCallback'],
$text
);