Improved checks in "storeForUserByUriId" to reduce recursion depth

This commit is contained in:
Michael 2022-08-17 05:28:24 +00:00
parent 3e2c684319
commit 6070221364
2 changed files with 74 additions and 31 deletions

View file

@ -471,6 +471,26 @@ class Tag
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
*