Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-03-2008, 09:14 AM
Frogdice Frogdice is offline
 
Join Date: Feb 2008
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Change the rules for syntax highlighting?

How can I change the rules vBulletin uses for syntax highlighting when using html and php tags?

I have been trying to create a code tag that actually does NO processing of code inside of it. If I could take my HTML tag, and turn off all the color changes inside, that would somewhat do the trick.

But I cannot find where vBulletin has its rules for syntax highlighting of html code.
Reply With Quote
  #2  
Old 04-03-2008, 09:42 AM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

/functions/class_bbcode.php around lines 1515 onwards, there are functions:
  • handle_bbcode_code() (You could probably run htmlspecialchars_uni() in this somewhere to output only in plain text),
  • handle_bbcode_html()
  • handle_bbcode_html_tag().
Reply With Quote
  #3  
Old 04-03-2008, 09:49 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The [ code] tag does not do any syntax highlighting.
Reply With Quote
  #4  
Old 04-03-2008, 09:51 AM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

FAO: Marco. Make code tags work correctly, or disable HTML in a post?
Reply With Quote
  #5  
Old 04-03-2008, 10:14 AM
Frogdice Frogdice is offline
 
Join Date: Feb 2008
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Opserty View Post
Right. Exactly.

I am trying to make one of my tags behave like a code tag, and not process ANY code inside of it (not bbcode, not html, etc).

Just so you know why, here's an example. When I post an in game help file of a new game feature, I want to be able to show it to my players in properly formatted form. Our help files make use of brackets very often, and right now, with HTML turned on, anything <inside of brackets> gets snipped in code tags. Here's an example:

Code:
USAGE:  group                 - Check your group status.
        group <message>       - Speak to the members of your group.
        group leave           - Leave your group.
        group follow <on/off> - Turn group following on or off.
        group settings        - Change your group settings.
(L)     group form <name>     - Form a group with an optional <name>
(L)     group name <name>     - Change the group name. Use remove to remove.
(L)     group invite <player> - Invite someone to join your group.
(L)     group boot <player>   - Boot someone from your group.
(L)     group leader <member> - Change the group leader.
(L)     group disband         - Disband your group.

This is the command interface for group management. The commands marked (L)
are leader only commands.
This works fine here, because html is turned off. But if HTML was turned on, everything inside <brackets> would be snipped and it would make the information very confusing and incorrect.

--------------- Added [DATE]1207222272[/DATE] at [TIME]1207222272[/TIME] ---------------

Quote:
Originally Posted by Opserty View Post
/functions/class_bbcode.php around lines 1515 onwards, there are functions:
  • handle_bbcode_code() (You could probably run htmlspecialchars_uni() in this somewhere to output only in plain text),
  • handle_bbcode_html()
  • handle_bbcode_html_tag().
Your suggestion put me on the right path of investigation. In this seciton of class_bbcode.php:

Quote:
/**
* Handles a [code] tag. Displays a preformatted string.
*
* @param string The code to display
*
* @return string HTML representation of the tag.
*/
Right after this line:

Code:
$code = $this->strip_front_back_whitespace($code, 1);
I added this line:

Code:
$code = htmlspecialchars_uni($code);
And now my code tags no longer process HTML inside of them.

Can you forsee any problem with this code hack for me?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:19 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03727 seconds
  • Memory Usage 2,207KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete