]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Term.php
Update function calls
[friendica.git] / src / Model / Term.php
index 854861ccb589b022609d48000a7b21f0d2ce286c..f62fced70904c81dffe384b6fe49c720e37c60bf 100644 (file)
@@ -76,7 +76,7 @@ class Term
                $message['tag'] = $tags;
 
                // Clean up all tags
-               DBA::delete('term', ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => [TERM_HASHTAG, TERM_MENTION]]);
+               self::deleteByItemId($itemid);
 
                if ($message['deleted']) {
                        return;
@@ -290,4 +290,20 @@ class Term
 
                return $return;
        }
+
+       /**
+        * Delete all tags from an item
+        * @param int itemid - choose from which item the tags will be removed
+        * @param array type - items type. default is [TERM_HASHTAG, TERM_MENTION]
+        */
+       public static function deleteByItemId($itemid, $type = [TERM_HASHTAG, TERM_MENTION])
+       {
+               if (empty($itemid)) {
+                       return;
+               }
+
+               // Clean up all tags
+               DBA::delete('term', ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => $type]);
+
+       }
 }