} elseif ((substr(trim($tag), 0, 1) == '@') || (substr(trim($tag), 0, 1) == '!')) {
$type = TERM_MENTION;
} elseif ((substr(trim($tag), 0, 1) == '@') || (substr(trim($tag), 0, 1) == '!')) {
$type = TERM_MENTION;
- if (DBA::exists('term', ['uid' => $message['uid'], 'otype' => TERM_OBJ_POST, 'oid' => $itemid, 'url' => $link])) {
+ if (DBA::exists('term', ['uid' => $message['uid'], 'otype' => TERM_OBJ_POST, 'oid' => $itemid, 'term' => $term])) {
$author = ['uid' => 0, 'id' => $item['author-id'],
'network' => $item['author-network'], 'url' => $item['author-link']];
$author = ['uid' => 0, 'id' => $item['author-id'],
'network' => $item['author-network'], 'url' => $item['author-link']];
- if ($tag["type"] == TERM_HASHTAG) {
- if ($orig_tag != $tag["url"]) {
- $item['body'] = str_replace($orig_tag, $tag["url"], $item['body']);
+ if ($tag['type'] == TERM_HASHTAG) {
+ if ($orig_tag != $tag['url']) {
+ $item['body'] = str_replace($orig_tag, $tag['url'], $item['body']);
- $return['hashtags'][] = "#<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
- $prefix = "#";
- } elseif ($tag["type"] == TERM_MENTION) {
- $return['mentions'][] = "@<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
- $prefix = "@";
+ $return['hashtags'][] = '#<a href="' . $tag['url'] . '" target="_blank">' . $tag['term'] . '</a>';
+ $prefix = '#';
+ } elseif ($tag['type'] == TERM_MENTION) {
+ $return['mentions'][] = '@<a href="' . $tag['url'] . '" target="_blank">' . $tag['term'] . '</a>';
+ $prefix = '@';