DBA::insert('post-tag', $fields, Database::INSERT_IGNORE);
- Logger::info('Stored tag/mention', ['uri-id' => $uriId, 'tag-id' => $tagid, 'contact-id' => $cid, 'name' => $name, 'type' => $type, 'callstack' => System::callstack(8)]);
+ Logger::debug('Stored tag/mention', ['uri-id' => $uriId, 'tag-id' => $tagid, 'contact-id' => $cid, 'name' => $name, 'type' => $type, 'callstack' => System::callstack(8)]);
}
/**
return;
}
- Logger::info('Removing tag/mention', ['uri-id' => $uriId, 'tid' => $tag['tid'], 'name' => $name, 'url' => $url, 'callstack' => System::callstack(8)]);
+ Logger::debug('Removing tag/mention', ['uri-id' => $uriId, 'tid' => $tag['tid'], 'name' => $name, 'url' => $url, 'callstack' => System::callstack(8)]);
DBA::delete('post-tag', ['uri-id' => $uriId, 'type' => $type, 'tid' => $tag['tid'], 'cid' => $tag['cid']]);
}
return DBA::selectToArray('tag-view', ['type', 'name', 'url', 'tag-type'], $condition);
}
+ /**
+ * Checks if the given url is mentioned in the post
+ *
+ * @param integer $uriId
+ * @param string $url
+ * @param array $type
+ *
+ * @return boolean
+ */
+ public static function isMentioned(int $uriId, string $url, array $type = [self::MENTION, self::EXCLUSIVE_MENTION]): bool
+ {
+ $tags = self::getByURIId($uriId, $type);
+ foreach ($tags as $tag) {
+ if (Strings::compareLink($url, $tag['url'])) {
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* Return a string with all tags and mentions
*
break;
default:
- Logger:warning('Unknown tag type found', $tag);
+ Logger::warning('Unknown tag type found', $tag);
}
}
DBA::close($taglist);