Beispiel #1
0
 public function removeTags(array $tags, $ignoreNonRemovable = true)
 {
     if (!$this->_contextSet) {
         throw new Exception("Permissions context has not been set");
     }
     $userId = XenForo_Visitor::getUserId();
     $found = $this->_tagModel->getFoundTagsInList($tags, $this->_existingTags);
     foreach ($found as $tag) {
         if ($ignoreNonRemovable && !$this->_permissions['removeOthers'] && $tag['add_user_id'] != $userId) {
             // can't remove, just ignore
             continue;
         }
         $this->_removeTags[$tag['tag_id']] = $tag['tag'];
     }
     return $this;
 }
Beispiel #2
0
 public function Tinhte_XenTag_getContentTagCacheOnSave(XenForo_Model_Tag $model, array $cache)
 {
     if (!Tinhte_XenTag_Option::get('keepOrder') || empty($this->_Tinhte_XenTag_orderedTags)) {
         return $cache;
     }
     $cacheOrdered = $model->getFoundTagsInList($this->_Tinhte_XenTag_orderedTags, $cache);
     foreach ($cache as $tagId => $tag) {
         if (!isset($cacheOrdered[$tagId])) {
             $cacheOrdered[$tagId] = $tag;
         }
     }
     return $cacheOrdered;
 }