BBCode tô màu code cho xenforo add vào khung soạn thảo

tô màu code hay code tô màu bạn, mình vẫn không hiểu lắm ^^
 

Là mình muốn bài post trong diễn đàn nếu có code thì nó sẽ hiện ra như thế này nè bạn:
16767281333_01e815232d_o.png
 
PHP:
<?php

class Brivium_HideAttachment_ControllerPublic_Attachment extends XFCP_Brivium_HideAttachment_ControllerPublic_Attachment
{
    public function actionIndex()
    {
        $attachmentId = $this->_input->filterSingle('attachment_id', XenForo_Input::UINT);
        $attachment = $this->_getAttachmentOrError($attachmentId);
       
        if(isset($attachment)){
            if($attachment['content_type'] == 'post'){
                $ftpHelper = $this->getHelper('ForumThreadPost');
                list($post, $thread, $forum) = $ftpHelper->assertPostValidAndViewable($attachment['content_id']);
                $hideAttachment = $this->_getHideAttachmentModel();
                $visitorId = XenForo_Visitor::getUserId();
                if($hideAttachment->requirePermission($forum['node_id'],$post) && $hideAttachment->requirePermissionPost($post,$visitorId)){
                    $options = XenForo_Application::get('options');
                    $extensionMap =    preg_split('/\s+/', trim($options->BRHA_excludedFileExtensions));
                    $extension = XenForo_Helper_File::getFileExtension($attachment['filename']);
                   
                    if (!in_array($extension, $extensionMap))
                    {
                        $mustReply = false;
                        $mustLike = false;
                       
                        if($options->BRHA_likeRequired && !$this->getModelFromCache('XenForo_Model_Like')->getContentLikeByLikeUser('post',$post['post_id'],$visitorId)){
                            $mustLike = true;
                        }
                        if($options->BRHA_replyRequired && !$hideAttachment->checkReplied($thread['thread_id'],$visitorId)){
                            $mustReply = true;
                        }   

                        if($mustReply && $mustLike){
                            return $this->responseError(new XenForo_Phrase('BRHA_mustLikeAndReply'));
                        }else if($mustLike){
                            return $this->responseError(new XenForo_Phrase('BRHA_mustLike'));
                        }else if($mustReply){
                            return $this->responseError(new XenForo_Phrase('BRHA_mustReply'));
                        }
                       
                    }
                }
            }
        }
        return parent::actionIndex();
    }
   
    /**
     * @return Brivium_HideAttachment_Model_HideAttachment
     */
    protected function _getHideAttachmentModel()
    {
        return $this->getModelFromCache('Brivium_HideAttachment_Model_HideAttachment');
    }

}
 
PHP:
<?php

class Brivium_HideAttachment_ControllerPublic_Attachment extends XFCP_Brivium_HideAttachment_ControllerPublic_Attachment
{
    public function actionIndex()
    {
        $attachmentId = $this->_input->filterSingle('attachment_id', XenForo_Input::UINT);
        $attachment = $this->_getAttachmentOrError($attachmentId);
      
        if(isset($attachment)){
            if($attachment['content_type'] == 'post'){
                $ftpHelper = $this->getHelper('ForumThreadPost');
                list($post, $thread, $forum) = $ftpHelper->assertPostValidAndViewable($attachment['content_id']);
                $hideAttachment = $this->_getHideAttachmentModel();
                $visitorId = XenForo_Visitor::getUserId();
                if($hideAttachment->requirePermission($forum['node_id'],$post) && $hideAttachment->requirePermissionPost($post,$visitorId)){
                    $options = XenForo_Application::get('options');
                    $extensionMap =    preg_split('/\s+/', trim($options->BRHA_excludedFileExtensions));
                    $extension = XenForo_Helper_File::getFileExtension($attachment['filename']);
                  
                    if (!in_array($extension, $extensionMap))
                    {
                        $mustReply = false;
                        $mustLike = false;
                      
                        if($options->BRHA_likeRequired && !$this->getModelFromCache('XenForo_Model_Like')->getContentLikeByLikeUser('post',$post['post_id'],$visitorId)){
                            $mustLike = true;
                        }
                        if($options->BRHA_replyRequired && !$hideAttachment->checkReplied($thread['thread_id'],$visitorId)){
                            $mustReply = true;
                        }  

                        if($mustReply && $mustLike){
                            return $this->responseError(new XenForo_Phrase('BRHA_mustLikeAndReply'));
                        }else if($mustLike){
                            return $this->responseError(new XenForo_Phrase('BRHA_mustLike'));
                        }else if($mustReply){
                            return $this->responseError(new XenForo_Phrase('BRHA_mustReply'));
                        }
                      
                    }
                }
            }
        }
        return parent::actionIndex();
    }
  
    /**
     * @return Brivium_HideAttachment_Model_HideAttachment
     */
    protected function _getHideAttachmentModel()
    {
        return $this->getModelFromCache('Brivium_HideAttachment_Model_HideAttachment');
    }

}

Anh Dev.xf làm thế nào vậy ạ?
 
Back
Top