+/**
+ * @brief Callback function to replace a Friendica style mention in a mention for Diaspora
+ *
+ * @param array $match Matching values for the callback
+ * @return string Replaced mention
+ */
+function diaspora_mentions($match) {
+
+ $contact = get_contact_details_by_url($match[3]);
+
+ if (!isset($contact['addr'])) {
+ $contact = Probe::uri($match[3]);
+ }
+
+ if (!isset($contact['addr'])) {
+ return $match[0];
+ }
+
+ $mention = '@{'.$match[2].'; '.$contact['addr'].'}';
+ return $mention;
+}
+