+ public static function tagTextFromItemId($itemid)
+ {
+ $tag_text = '';
+ $condition = ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => [TERM_HASHTAG, TERM_MENTION]];
+ $tags = DBA::select('term', [], $condition);
+ while ($tag = DBA::fetch($tags)) {
+ if ($tag_text != '') {
+ $tag_text .= ',';
+ }
+
+ if ($tag['type'] == 1) {
+ $tag_text .= '#';
+ } else {
+ $tag_text .= '@';
+ }
+ $tag_text .= '[url=' . $tag['url'] . ']' . $tag['term'] . '[/url]';
+ }
+ return $tag_text;
+ }
+
+ public static function fileTextFromItemId($itemid)
+ {
+ $file_text = '';
+ $condition = ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => [TERM_FILE, TERM_CATEGORY]];
+ $tags = DBA::select('term', [], $condition);
+ while ($tag = DBA::fetch($tags)) {
+ if ($tag['type'] == TERM_CATEGORY) {
+ $file_text .= '<' . $tag['term'] . '>';
+ } else {
+ $file_text .= '[' . $tag['term'] . ']';
+ }
+ }
+ return $file_text;
+ }
+
+ public static function insertFromTagFieldByItemId($itemid, $tags)