Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Advanced Syntax Highlighting - BBCode [highlight] Details »»
Advanced Syntax Highlighting - BBCode [highlight]
Version: 1.00, by Andreas Andreas is offline
Developer Last Online: Jan 2023 Show Printable Version Email this Page

Version: 3.5.0 RC1 Rating:
Released: 07-27-2005 Last Update: Never Installs: 143
Uses Plugins Template Edits
Additional Files Is in Beta Stage  
No support by the author.

Advanced Syntax Highlighting
This Hack provides a [highlight] BBCode to highlight a wide range of Languages such as XML, HTML, Java, Javascript, SQL and so on.
It uses GeSHi, which is included in this ZIP.

Details
1 Product XML with 2 Plugins and 2 Templates

Please only click Install if you actually have installed/are using this Hack, and click Uninstall whan you don't use it any longer!

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #62  
Old 04-03-2006, 10:04 PM
ffevo's Avatar
ffevo ffevo is offline
 
Join Date: Feb 2003
Location: California
Posts: 79
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is a problem I am having with ALL code on my forums including the code that your modification uses. In the first attachment you will see that there is a large space at the bottom of all the code.

That was the first issue.

You will also see that all the code used with YOUR modification does not get highlighted at ALL AND is on one line. You can see that on the second attachment.

I also wanted to change the highlight colors of ALL code including PHP. I also wanted to change the default font for highlighted code from courier new to something else. I use 10px font size and courier new is just too small for 10px. I would like to change the font face NOT the size.
Reply With Quote
  #63  
Old 04-25-2006, 02:56 PM
Delphiprogrammi Delphiprogrammi is offline
 
Join Date: Feb 2004
Location: Landen(Belgium)
Posts: 1,335
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

everytime you update Geshi it stops working ?????

PHP Code:
if (!function_exists('handle_bbcode_highlight'))
{
 function 
handle_bbcode_highlight(&$parser$code$type)
 {
  global 
$vbulletin$vbphrase$stylevar$show;
  static 
$codefind1$codereplace1$codefind2$codereplace2;
  
$code $parser->strip_front_back_whitespace($code1);
  if (!
is_array($codefind))
  {
   
$codefind1 = array(
    
'<br>',  // <br> to nothing
    
'<br />' // <br /> to nothing
   
);
   
$codereplace1 = array(
    
'',
    
''
   
);
   
$codefind2 = array(
    
'&gt;',  // &gt; to >
    
'&lt;',  // &lt; to <
    
'&quot;'// &quot; to ",
    
'&amp;'// &amp; to &
    
'[',    // [ to [
    
']',    // ] to ]
   
);
   
$codereplace2 = array(
    
'>',
    
'<',
    
'"',
    
'&',
    
'[',
    
']',
   );
  }
  
$code trim(str_replace($codefind1$codereplace1$code));
  
$blockheight $parser->fetch_block_height($code) + 18// fetch height of block element
  
$code str_replace($codefind2$codereplace2$code); // finish replacements
  
$path DIR '/includes/geshi/';
  
//$code = geshi_highlight($code, $type, $path, true);
  
$geshi = new GeSHi($code$type$path);
  
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
  
$geshi->set_url_for_keyword_group($group$url);
  
$geshi->set_link_target('_BLANK'$styles); 
  
$tabs 4;
  
$geshi->set_header_type(GESHI_HEADER_DIV);
  
$geshi->set_tab_width($tabs);
  
$code $geshi->parse_code();
  
$code preg_replace('/&amp;#([0-9]+);/''&#$1;'$code);
  
$code str_replace(array('['']'"\n"), array('['']'''), $code);
  
$template $parser->printthread 'bbcode_highlight_printthread' 'bbcode_highlight';
  eval(
'$html = "' fetch_template($template) . '";');
  return 
$html;
 }
}
$this->tag_list['option']['highlight'] = array(
 
'callback' => 'handle_external',
 
'strip_empty' => true,
 
'stop_parse' => true,
 
'disable_smilies' => true,
 
'disable_wordwrap' => true,
 
'strip_space_after' => 1,
 
'external_callback' => 'handle_bbcode_highlight'
);
require_once(
DIR '/includes/geshi.php'); 
still the php keywords are not linked damn it
Reply With Quote
  #64  
Old 05-04-2006, 02:59 PM
blueaura blueaura is offline
 
Join Date: Feb 2005
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Any way to get this to plug into the code button? The by doign [code] example code [/ code] it would automatically replace it with [highlight=Java] example code [/ highlight].

This would be much easier for less technical forum users to work and means the admin could limit the syntax highlighting to one specific language like Java if you run a Java programming forum.

Previously I got Geshi to work on the code button but I had to hack the php code for BBcode. Nice to see a more friendly way to get Geshi in there now anyway.

ffevo: You can change fonts and colours by editing the php.php file or what ever language you are using in /incudes/geshi

Also would like to suggest the following changes
Code:
if (!is_array($codefind))
        {
            $codefind1 = array(
                '<br>',        // <br> to nothing
                '<br />'    // <br /> to nothing
            );
            $codereplace1 = array(
                '',
                ''
            );

            $codefind2 = array(
                '&gt;',        // &gt; to >
                '&lt;',        // &lt; to <
                '&quot;',    // &quot; to ",
                '&amp;',    // &amp; to &
                '& #91;',    // without the space after the &
                '& #93;',    // ] without the space after the &
            );
            $codereplace2 = array(
                '>',
                '<',
                '"',
                '&',
                '[',
                ']',
            );
        }
It sorts out the issue with square brackets.

EDIT: you can edit includes/class_bbcode.php to get the plugin to use [code] with a bit of hacking. Can't be doign with that at the moment so I'm back at my own method. The author of this mod may want to explore this though.
Reply With Quote
  #65  
Old 05-04-2006, 04:54 PM
kirupa kirupa is offline
 
Join Date: Dec 2002
Posts: 53
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So, basically, does the highlighter work in vBulletin 3.5.4? I recall not being able to get it to work in an earlier vB 3.5.x version, so I have delayed updating my boards because of it.
Reply With Quote
  #66  
Old 05-04-2006, 05:55 PM
blueaura blueaura is offline
 
Join Date: Feb 2005
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kirupa
So, basically, does the highlighter work in vBulletin 3.5.4? I recall not being able to get it to work in an earlier vB 3.5.x version, so I have delayed updating my boards because of it.
Yes it works
Reply With Quote
  #67  
Old 07-16-2006, 10:04 PM
bullzeye bullzeye is offline
 
Join Date: Jul 2006
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there any way to change the location of Geshi? For use with other parts of our site we had a directory /lib where geshi can be found and for update work and similarity on out other parts we want to place geshi in the folder /lib/geshi. I changed the path and the require_once in the xml-file of this plugin to lib/geshi (for $path) and require_once('lib/gehsi/geshi.php'). Installation was no problem and it seems that this gets parsed correctly but there is no highlightning only a gray Background with line numbers. I hope it is possible to understand what i want.

Excuse my bad english.
Reply With Quote
  #68  
Old 08-16-2006, 06:30 PM
StarShaper StarShaper is offline
 
Join Date: Sep 2005
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by bullzeye
Is there any way to change the location of Geshi?
You have to change the include path. Just edit the plugin code.

There is a problem with this product. If you do a manual cache update of all Postings all geshi Code Blocks are deleted.
Reply With Quote
  #69  
Old 12-27-2006, 08:56 AM
zylstra zylstra is offline
 
Join Date: Aug 2004
Posts: 144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by digitalpoint View Post
I changed it to be CODE instead of HIGHLIGHT (more natural to me) and I added a little extra to have it intercept the normal PHP and HTML tag calls.
digitalpoint, care to share your modification with us?
Reply With Quote
  #70  
Old 12-27-2006, 10:51 AM
zylstra zylstra is offline
 
Join Date: Aug 2004
Posts: 144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When I place
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" lang="en">
<head>
<base href="http://www.example.com/" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
inside the tags with the html4strict option I get
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[ur l="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/ur l]">
<html dir="ltr" lang="en">
<head>
<base href="[ur l="http://www.example.com/"]http://www.example.com/[/ur l]" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
without the space between the "ur" and the "l". It seems that URLs are parsed into links within code blocks, but this fails inside the Geshi parsed code. How do I turn off URL parsing within code blocks?

vB.org parses URLs inside posts, but not inside code blocks. This is how I want my site to work also.

Test: http://www.example.com/
Reply With Quote
  #71  
Old 12-27-2006, 05:21 PM
zylstra zylstra is offline
 
Join Date: Aug 2004
Posts: 144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I discovered that the automatic URL linking is due to the WYSIWYG interface in IE: http://www.vbulletin.com/forum/bugs3...2018&status=60 .
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 01:55 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.04610 seconds
  • Memory Usage 2,347KB
  • Queries Executed 25 (?)
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
  • (3)bbcode_code
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete