X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FTag.php;h=04f3f1627eae8249706192bce0b3f44e1ec34780;hb=f842e7b81395803d4bd914175455d120837da312;hp=362df49ec763e46a1d83256ac71b2eb39b68081e;hpb=c5effdadeca85194b844abc1ace44cf98580a032;p=friendica.git diff --git a/src/Model/Tag.php b/src/Model/Tag.php index 362df49ec7..04f3f1627e 100644 --- a/src/Model/Tag.php +++ b/src/Model/Tag.php @@ -50,14 +50,16 @@ class Tag */ const IMPLICIT_MENTION = 8; /** - * An exclusive mention transmits the post only to the target account without transmitting it to the followers, usually a forum. + * An exclusive mention transmits the post only to the target account without transmitting it to the followers, usually a group. */ const EXCLUSIVE_MENTION = 9; - const TO = 10; - const CC = 11; - const BTO = 12; - const BCC = 13; + const TO = 10; + const CC = 11; + const BTO = 12; + const BCC = 13; + const AUDIENCE = 14; + const ATTRIBUTED = 15; const ACCOUNT = 1; const GENERAL_COLLECTION = 2; @@ -103,7 +105,7 @@ class Tag $cid = 0; $tagid = 0; - if (in_array($type, [self::MENTION, self::EXCLUSIVE_MENTION, self::IMPLICIT_MENTION, self::TO, self::CC, self::BTO, self::BCC])) { + if (in_array($type, [self::MENTION, self::EXCLUSIVE_MENTION, self::IMPLICIT_MENTION, self::TO, self::CC, self::BTO, self::BCC, self::AUDIENCE, self::ATTRIBUTED])) { if (empty($url)) { // No mention without a contact url return; @@ -130,7 +132,7 @@ class Tag } if (empty($cid)) { - if (!in_array($type, [self::TO, self::CC, self::BTO, self::BCC])) { + if (!in_array($type, [self::TO, self::CC, self::BTO, self::BCC, self::AUDIENCE, self::ATTRIBUTED])) { if (($type != self::HASHTAG) && !empty($url) && ($url != $name)) { $url = strtolower($url); } else { @@ -485,7 +487,7 @@ class Tag * * @return boolean */ - public static function isMentioned(int $uriId, string $url, array $type = [self::MENTION, self::EXCLUSIVE_MENTION]): bool + public static function isMentioned(int $uriId, string $url, array $type = [self::MENTION, self::EXCLUSIVE_MENTION, self::AUDIENCE]): bool { $tags = self::getByURIId($uriId, $type); foreach ($tags as $tag) { @@ -652,7 +654,7 @@ class Tag if (empty($tags)) { $tags = self::setGlobalTrendingHashtags($period, 1000); } - return array_slice($tags, $limit * $offset, $limit); + return array_slice($tags, $offset, $limit); } /** @@ -735,7 +737,7 @@ class Tag if (empty($tags)) { $tags = self::setLocalTrendingHashtags($period, 1000); } - return array_slice($tags, $limit * $offset, $limit); + return array_slice($tags, $offset, $limit); } /** @@ -826,12 +828,13 @@ class Tag public static function getUIDListByURIId(int $uriId): array { $uids = []; - $tags = self::getByURIId($uriId, [self::HASHTAG]); - foreach ($tags as $tag) { - $uids = array_merge($uids, self::getUIDListByTag(self::TAG_CHARACTER[self::HASHTAG] . $tag['name'])); + foreach (self::getByURIId($uriId, [self::HASHTAG]) as $tag) { + foreach (self::getUIDListByTag(self::TAG_CHARACTER[self::HASHTAG] . $tag['name']) as $uid) { + $uids[$uid][] = $tag['name']; + } } - return array_unique($uids); + return $uids; } }