vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Fix the [code] bbcode (https://vborg.vbsupport.ru/showthread.php?t=254160)

Kyojii 11-23-2010 11:36 PM

Fix the [code] bbcode
 
Currently putting bbcode inside the [code] 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
Code:

        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:

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


All times are GMT. The time now is 01:10 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00972 seconds
  • Memory Usage 1,714KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete