PDA

View Full Version : Fix the [code] bbcode


Kyojii
11-23-2010, 11:36 PM
Currently putting bbcode inside the bbcode it is still parsed as bbcode. This shouldn't happen and I was wondering if someone would be able to help me fix this.

[code]this text shouldn't be bold or underlined

function handle_bbcode_code($code)
{
global $vbulletin, $vbphrase, $stylevar, $show;

// remove unnecessary line breaks and escaped quotes
$code = str_replace(array('<br>', '<br />'), array('', ''), $code);

$code = $this->strip_front_back_whitespace($code, 1);

if ($this->printable)
{
$code = $this->emulate_pre_tag($code);
$template = 'bbcode_code_printable';
}
else
{
$blockheight = $this->fetch_block_height($code);
$template = 'bbcode_code';
}

eval('$html = "' . fetch_template($template) . '";');
return $html;
}

In the ACP for custom bbcodes there is a way to disable bbcode inside of a bbcode but for some reason that was not applied to this bbcode. I tried converting $code to htmlentities and thought it would make the bbcode parser not parse it as bbcode but that didn't work. It simply made the code tag output html.

kh99
11-24-2010, 12:14 AM
If you want it to work that way you can create a new plugin using hook location bbcode_fetch_tags, and this code:


if (($vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_CODE) OR $force_all)
{
$tag_list['no_option']['code']['stop_parse'] = true;
}



However, I'm not sure if I'd say that "fixes" the CODE bbcode. I've seen a lot of people post some code and highlight part of it by making it red or something, and that isn't possible if you disable bbcode within CODE.

Kyojii
11-24-2010, 05:27 AM
Thanks