Renamed function

This commit is contained in:
Michael 2020-05-01 15:43:50 +00:00
parent c3ecc19b41
commit 776a1dd7c3

View File

@ -70,7 +70,7 @@ class Term
public static function tagTextFromItemId($item_id) public static function tagTextFromItemId($item_id)
{ {
$tag_list = []; $tag_list = [];
$tags = self::tagArrayFromItemId($item_id, [self::HASHTAG, self::MENTION, self::IMPLICIT_MENTION]); $tags = self::getByItemId($item_id, [self::HASHTAG, self::MENTION, self::IMPLICIT_MENTION]);
foreach ($tags as $tag) { foreach ($tags as $tag) {
$tag_list[] = self::TAG_CHARACTER[$tag['type']] . '[url=' . $tag['url'] . ']' . $tag['term'] . '[/url]'; $tag_list[] = self::TAG_CHARACTER[$tag['type']] . '[url=' . $tag['url'] . ']' . $tag['term'] . '[/url]';
} }
@ -86,7 +86,7 @@ class Term
* @return array * @return array
* @throws \Exception * @throws \Exception
*/ */
private static function tagArrayFromItemId($item_id, $type = [self::HASHTAG, self::MENTION]) private static function getByItemId($item_id, $type = [self::HASHTAG, self::MENTION])
{ {
$condition = ['otype' => self::OBJECT_TYPE_POST, 'oid' => $item_id, 'type' => $type]; $condition = ['otype' => self::OBJECT_TYPE_POST, 'oid' => $item_id, 'type' => $type];
$tags = DBA::select('term', ['type', 'term', 'url'], $condition); $tags = DBA::select('term', ['type', 'term', 'url'], $condition);
@ -108,7 +108,7 @@ class Term
public static function fileTextFromItemId($item_id) public static function fileTextFromItemId($item_id)
{ {
$file_text = ''; $file_text = '';
$tags = self::tagArrayFromItemId($item_id, [self::FILE, self::CATEGORY]); $tags = self::getByItemId($item_id, [self::FILE, self::CATEGORY]);
foreach ($tags as $tag) { foreach ($tags as $tag) {
if ($tag['type'] == self::CATEGORY) { if ($tag['type'] == self::CATEGORY) {
$file_text .= '<' . $tag['term'] . '>'; $file_text .= '<' . $tag['term'] . '>';