use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\DBM;
+use Friendica\Model\Contact;
use Friendica\Model\Event;
use Friendica\Model\Item;
use Friendica\Model\Profile;
$cnt = preg_match_all('/([!#@])\[url=(.*?)\](.*?)\[\/url\]/ism', $s, $matches, PREG_SET_ORDER);
if ($cnt) {
foreach ($matches as $mtch) {
+ if (in_array($mtch[1], ['!', '@'])) {
+ $contact = Contact::getDetailsByURL($mtch[2]);
+ $mtch[3] = empty($contact['addr']) ? $mtch[2] : $contact['addr'];
+ }
$s = str_replace($mtch[0], $mtch[1] . $mtch[3],$s);
}
}
$datarray['edit'] = true;
}
+ // Check for hashtags in the body and repair or add hashtag links
+ if ($preview || $orig_post) {
+ Item::setHashtags($datarray);
+ }
+
// preview mode - prepare the body for display and send it via json
if ($preview) {
require_once 'include/conversation.php';