XenForo community

Description: this code will allow to use normal bbcodes in an opening tag options of a bbcode; ie: [mybbcode=[b]title[/b]]content[/mybbcode]. By default this inner bbcode will not be parsed.

File: {yourForum}\library\XenForo\BbCode\parser.php
Function: protected function _parseTag()

Search:
Code:
$tagContentEndPosition = strpos($this->_text, ']', $tagStartPosition);

Replace with (code on pastbin):
PHP:
        //Modification starts
        $bbCodesOptionsPattern = '#\[(?:/)?[\w\d]+?(?:=(\[([\w\d]+?)(?:=.+?)?\].+?\[/\2\]|[^\[\]])+?)?(?P<closingBracket>\])#iu';
        if(preg_match($bbCodesOptionsPattern, $this->_text, $matches, PREG_OFFSET_CAPTURE, $tagStartPosition) && isset($matches['closingBracket'][1]))
        {
            $tagContentEndPosition = $matches['closingBracket'][1];
        }
        else
        {
            $tagContentEndPosition = false;
        }
        //Modification ends
 
        //$tagContentEndPosition = strpos($this->_text, ']', $tagStartPosition); //for reference

Last edit: 2013/02/15 @thanks to Volion
Back
Top Bottom