예제 #1
0
 public function Tinhte_XenTag_actionSaveAfterTransaction(XenForo_DataWriter_Page $dw)
 {
     if (!empty($this->_tagger)) {
         unset($GLOBALS[Tinhte_XenTag_Constants::GLOBALS_CONTROLLERADMIN_PAGE_SAVE]);
         if ($dw->isInsert()) {
             $this->_tagger->setContent($dw->get('node_id'), true);
         }
         $this->_tagger->save();
     }
 }
예제 #2
0
 protected function _setInternal($table, $field, $newValue, $forceSet = false)
 {
     if ($table === 'xf_post' && $field === 'message' && Tinhte_XenTag_Option::get('useHashtag')) {
         $tagTexts = Tinhte_XenTag_Integration::parseHashtags($newValue, true);
         if ($this->_tagger === null) {
             /** @var XenForo_Model_Tag $tagModel */
             $tagModel = $this->getModelFromCache('XenForo_Model_Tag');
             $this->_tagger = $tagModel->getTagger('post');
             if ($this->isUpdate()) {
                 $this->_tagger->setPermissionsFromContext($this->getDiscussionData(), $this->_Tinhte_XenTag_getForumInfo());
                 $this->_tagger->setContent($this->get('post_id'), false);
             } else {
                 $this->_tagger->setPermissionsFromContext($this->_Tinhte_XenTag_getForumInfo());
             }
         }
         $this->_tagger->setTags($tagTexts);
         $errors = $this->_tagger->getErrors();
         if (!empty($errors)) {
             $this->mergeErrors($errors);
         }
     }
     parent::_setInternal($table, $field, $newValue, $forceSet);
 }