1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

view bbCodeParser : prevent urls getting passed

Discussion in 'XenForo Development Discussions' started by tenants, May 29, 2013.

  1. tenants

    tenants Well-Known Member

    I have my view set up to include the following
        public function renderHtml()
            $bbCodeParser = new XenForo_BbCode_Parser(
                    XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this))
            $bbCodeOptions = array(
                'states' => array(
                    'viewAttachments' => true
            $messageArray = array('message' => $this->_params['content']);
            $this->_params['content']= XenForo_ViewPublic_Helper_Message::getBbCodeWrapper(
                    $messageArray, $bbCodeParser, $bbCodeOptions
    This parses any bbcode, and renders attachments, but there is one thing I do not want to do. I do not want the urls to get passed, I want them to remain as:
    [url=www.example.com]test[/url] (or even remove the link and just leave "test")
    (The reason for this, is that the data I am rendering is already within a link)
    I've been searching through the core parser classes, and can't find an option to do this.

    Is it possible, or should I just strip out these bbulrs before passing?
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Maybe set a flag in the 'states' and extend XenForo_BbCode_Formatter_Base::renderTagUrl to check that flag. You can see a code example in the default function where it checks $rendererStates['noFollowDefault'] which is a state set in XenForo_ViewPublic_Helper_Message.
    tenants likes this.

Share This Page