View Full Version : [SQL] BBcode breaks
sockwater
08-14-2008, 08:56 PM
This bbcode breaks when previewing or quick editing in full WYSIWYG mode.
To fix this, you can add an HTML comment to the beginning and end of the [sql] bbcode replacement text (to identify where it begins and ends), and then in a plugin on wysiwyg_parse_start (or wysiwyg_parse_complete (either one should work)), add something similar to this:
$text = preg_replace('#<!-- {STARTSQLTAG} -->(.+)<!-- {ENDSQLTAG} -->#U', '[SQL]$1', $text);
Jase2
08-15-2008, 03:05 PM
This was reported before, although the staff didn't know how to fix it. I'm sure they will appreciate this. :)
sockwater
08-15-2008, 05:24 PM
Actually my code is a little bit off, since I just wrote it from memory. I've looked back at my code, and I've found an even easier way to do this. Here is a full working example.
1. Create a custom SQL bbcode, fill in any dummy text in the replacement HTML box (it won't be used). This will cause the bbcode to show up on misc,php?do=bbcode
2. Create a plugin on bbcode_create: The trick is adding 'sql' to the list of unparsed tags (the last line).
if (!function_exists ('handle_sql_bbcode_tag'))
{
function handle_sql_bbcode_tag (&$theobj, &$value, &$option)
{
// format the HTML output for an SQL tag here
return "<div style='border:1px solid red;padding:10px;'>$value</div>";
}
}
$this->tag_list['no_option']['sql'] = array ();
$this->tag_list['no_option']['sql']['callback'] = 'handle_external';
$this->tag_list['no_option']['sql']['external_callback'] = 'handle_sql_bbcode_tag';
$this->unparsed_tags[] = 'sql';
Jase2
08-16-2008, 09:40 AM
Any comment from staff?
Marco van Herwaarden
08-16-2008, 09:44 AM
Staff will respond once we have information to share.
Jase2
08-16-2008, 09:16 PM
Ok.
Adrian Schneider
09-05-2008, 09:52 PM
This bbcode breaks when previewing or quick editing in full WYSIWYG mode.
To fix this, you can add an HTML comment to the beginning and end of the [sql] bbcode replacement text (to identify where it begins and ends), and then in a plugin on wysiwyg_parse_start (or wysiwyg_parse_complete (either one should work)), add something similar to this:
$text = preg_replace('#<!-- {STARTSQLTAG} -->(.+)<!-- {ENDSQLTAG} -->#U', '[SQL]$1', $text);
Here's the original thread:
https://vborg.vbsupport.ru/showthread.php?t=168734
sockwater
09-06-2008, 02:48 AM
Here's the original thread:
https://vborg.vbsupport.ru/showthread.php?t=168734
Thanks for the link. The instructions in post #3 will fix this bug.
Jase2
09-06-2008, 11:42 AM
Staff will respond once we have information to share.
So have you decided on this or not?
Paul M
09-06-2008, 11:57 AM
So have you decided on this or not?Nope, so far no one has had time to look - its been this way for a number of years so there is no hurry. :)
sockwater
06-12-2009, 03:13 PM
Nope, so far no one has had time to look - its been this way for a number of years so there is no hurry. :)
May I reiterate that the only change you need to make is add the following code to any plugin on bbcode_create:
$this->unparsed_tags[] = 'sql';
This tells vBulletin that the bbcode should be displayed in the WYSIWYG editor as [SQL]Raw SQL text instead of sending the actual formatted display text to the WYSIWYG editor.
For example, the [B] bbcode is parsed; it displays as bold instead of bold in the WYSIWYG editor. On the other hand, the bbcode is unparsed; it displays as [QUOTE]some quote in the WYSIWYG editor, and not as the formatted display HTML for the quote.
Paul M
06-12-2009, 05:41 PM
Added.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.