[2.0.6] PHP Syntax Highlighter BBCode

The cleanup is complete. This forum is now read only.

Rating:

Excellent!
30
60%
Very Good
5
10%
Good
3
6%
Fair
1
2%
Poor
11
22%
 
Total votes: 50

User avatar
annihilate
Registered User
Posts: 209
Joined: Thu Feb 19, 2004 11:44 pm
Location: England
Contact:

Post by annihilate »

Code: Select all

## easymod compliant
############################################################## 
## MOD Title:    Multiple BBCode MOD
## MOD Author:   Nuttzy99 < nospam@blizzhackers.com > (n/a) http://www.blizzhackers.com
## MOD Author, Secondary: wGEric < eric@best-dev.com > (Eric Faerber) http://mods.best-dev.com/
##
## MOD Description:  Allows you to install BBCode MODs that
##    add quick BBCode buttons in post edits.  Without this
##    MOD, there is no standard way of installing BBCode MODs.
## MOD Version:  1.4.0c
## 
## Installation Level:  EASY
## Installation Time:   2 minutes
## Files To Edit:       posting.php
##                      templates/subSilver/posting_body.tpl
## Included Files:      n/a
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/
############################################################## 
##
## Author Notes:
##     + if Multi BBCode MOD v1.0.1 is already installed, use the update to 1.2.0 MOD
##          and do NOT install this MOD script
##     + Works with phpBB 2.0.2 thru 2.0.10
##     + installable with EasyMOD
##
##	Version 1.4.0 makes it so MOD Authors don't have to set a hotkey for their BBCodes.
##
##	I have added instructions to the MOD that tell MOD Authors what to do in the language files
##	This isn't required but I heavily recommend that you do it anyways just in case the MOD Authors
##	use something in what I have added as their FIND.
##
############################################################## 
##
## MOD History:
##
##    2004-09-26 - Version 1.4.0
##	   + Sets hot key automatically
##	   + Adds it to Private Messages (version b)
##	   + Fixes a help line bug (version c)
##
##    2003-09-25 - Version 1.2.1
##         + improved MOD Template compliance
##
##    2003-08-15 - Version 1.2.0
##         + updated for 2.0.6
##         + allows additional hotkeys - Xore did most of the work ;-)
##         + made EasyMOD compatiable
##
##    2003-02-03 - Version 1.0.1
##         + updated for 2.0.4
##         + no code changes required, just updated the header info
##
##    2002-08-31 - Version 1.0.0
##         + initial release
##
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 


# 
#-----[ OPEN ]---------------------------------
# 
posting.php


# 
#-----[ FIND ]---------------------------------
#
#  NOTE - the full line to look for is:
# make_jumpbox('viewforum.'.$phpEx);
#
make_jumpbox(


# 
#-----[ AFTER, ADD ]---------------------------------
#
Multi_BBCode();

# 
#-----[ OPEN ]---------------------------------
# 
privmsg.php


# 
#-----[ FIND ]---------------------------------
#
	generate_smilies('inline', PAGE_PRIVMSGS);


# 
#-----[ AFTER, ADD ]---------------------------------
#
Multi_BBCode();

# 
#-----[ OPEN ]---------------------------------
#
includes/bbcode.php
# 
#-----[ FIND ]---------------------------------
#
$bbcode_tpl = null;
# 
#-----[ AFTER, ADD ]---------------------------------
#

// MULTI BBCODE-begin
function Multi_BBCode()
{
	global $template, $lang;

	// DO NOT CHANGE THIS ARRAY
	$hotkeys = array('', 'd', 'e', 'g', 'h', 'j', 'k', 'm', 'n', 'r', 't', 'v', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0');

	//NOTE: the first element of each array must be ''   Add new elements AFTER the ''
	$EMBB_widths = array('') ;
	$EMBB_values = array('') ;
	for ($i=1; $i<count($EMBB_values); $i++)
	{
		// load BBcode MODs info
		$val = ($i*2)+16 ;
		$help_lang = ( !empty($lang['bbcode_help'][(strtolower($EMBB_values[$i]))]) ) ? $lang['bbcode_help'][(strtolower($EMBB_values[$i]))] : $lang['bbcode_help'][$EMBB_values[$i]];
		$template->assign_block_vars('MultiBB', array(
			'KEY' => $hotkeys[$i],
			'NAME' => "addbbcode$val",
			'HELP' => sprintf($help_lang, $hotkeys[$i]),
			'WIDTH' => $EMBB_widths[$i],
			'VALUE' => $EMBB_values[$i],
			'STYLE' => "bbstyle($val)")
		);
	}
}
// MULTI BBCODE-end

# 
#-----[ OPEN ]---------------------------------
# 
templates/subSilver/posting_body.tpl


#
#-----[ FIND ]---------------------------------
#
f_help = "{L_BBCODE_F_HELP}";

# 
#-----[ AFTER, ADD ]---------------------------------
#
<!-- BEGIN MultiBB -->
{MultiBB.VALUE}_help = "{MultiBB.HELP}";
<!-- END MultiBB -->

#
#-----[ FIND ]---------------------------------
#
#  NOTE - the full line to look for is:
#			  <input type="button" class="button" accesskey="w" name="addbbcode16" value="URL" style="text-decoration: underline; width: 40px" onClick="bbstyle(16)" onMouseOver="helpline('w')" />
#			  </span></td>
#
	name="addbbcode16"
	</td>

# 
#-----[ AFTER, ADD ]---------------------------------
#

			<!-- BEGIN MultiBB -->
			<td><span class="genmed">
			  <input type="button" class="button" accesskey="{MultiBB.KEY}" name="{MultiBB.NAME}" value="{MultiBB.VALUE}" style="width: {MultiBB.WIDTH}px" onClick="{MultiBB.STYLE}" onMouseOver="helpline('{MultiBB.VALUE}')" />
			  </span></td>
			<!-- END MultiBB -->
# 
#-----[ FIND ]---------------------------------
#
#  NOTE - the full line to look for is:
#					<select name="addbbcodefontcolor" onChange="bbfontstyle('[color=' + this.form.addbbcodefontcolor.options[this.form.addbbcodefontcolor.selectedIndex].value + ']', '[/color]')" onMouseOver="helpline('s')">
#
	name="addbbcode18"


# 
#-----[ IN-LINE FIND ]---------------------------------
#
name="addbbcode18"


# 
#-----[ IN-LINE REPLACE WITH ]---------------------------------
#
name="addbbcodefontcolor"


# 
#-----[ IN-LINE FIND ]---------------------------------
#
this.form.addbbcode18.options


# 
#-----[ IN-LINE REPLACE WITH ]---------------------------------
#
this.form.addbbcodefontcolor.options


# 
#-----[ IN-LINE FIND ]---------------------------------
#
this.form.addbbcode18.selectedIndex


# 
#-----[ IN-LINE REPLACE WITH ]---------------------------------
#
this.form.addbbcodefontcolor.selectedIndex


# 
#-----[ FIND ]---------------------------------
#
#  NOTE - the full line to look for is:
#					</select> &nbsp;{L_FONT_SIZE}:<select name="addbbcodefontsize" onChange="bbfontstyle('[size=' + this.form.addbbcodefontsize.options[this.form.addbbcodefontsize.selectedIndex].value + ']', '[/size]')" onMouseOver="helpline('f')">
#
	name="addbbcode20"

# 
#-----[ IN-LINE FIND ]---------------------------------
#
name="addbbcode20"


# 
#-----[ IN-LINE REPLACE WITH ]---------------------------------
#
name="addbbcodefontsize"


# 
#-----[ IN-LINE FIND ]---------------------------------
#
this.form.addbbcode20.options


# 
#-----[ IN-LINE REPLACE WITH ]---------------------------------
#
this.form.addbbcodefontsize.options


# 
#-----[ IN-LINE FIND ]---------------------------------
#
this.form.addbbcode20.selectedIndex


# 
#-----[ IN-LINE REPLACE WITH ]---------------------------------
#
this.form.addbbcodefontsize.selectedIndex

# 
#-----[ OPEN ]---------------------------------
#
language/lang_english/lang_main.php

# 
#-----[ FIND ]---------------------------------
#
#  NOTE - the full line to look for is:
#	$lang['bbcode_f_help'] = 'Font size: [size=x-small]small text[/size]';
#
$lang['bbcode_f_help']

# 
#-----[ AFTER, ADD ]---------------------------------
#

//
// bbcode help format goes like this
// $lang['bbcode_help']['value'] = 'BBCode Name: Info (Alt+%s)';
//
// value is what you put in $EMBB_values in posting.php
// %s gets replaced with the automatic hotkey that the bbcode gets assigned
//
$lang['bbcode_help']['value'] = 'BBCode Name: Info (Alt+%s)';

#
#-----[ SAVE/CLOSE ALL FILES ]---------------------------------
#
# EoM
gdk
Registered User
Posts: 1
Joined: Thu Mar 17, 2005 8:57 am

Re: [2.0.6] PHP Syntax Highlighter BBCode

Post by gdk »

AbelaJohnB wrote: ## Author Notes:
## You MUST install the following MOD for my MOD work:
## http://www.phpbb.com/phpBB/viewtopic.php?t=74705

Could you please be more descriptive? Especially since that link is not working, and there's no indication of what MOD is actually required. It would be a great help if you can update the file with these changes.

Thank you very much!!
symstealth
Registered User
Posts: 3
Joined: Fri Jan 13, 2006 2:44 am

this is sad

Post by symstealth »

nice job....
DarksterV2
Registered User
Posts: 186
Joined: Thu Dec 23, 2004 3:24 pm
Contact:

Post by DarksterV2 »

Not sure if this has been asked already but is there a way to fix this?

Some font color text seems to show before the php text. It's just an example image below:

Image
Laler
Registered User
Posts: 19
Joined: Fri Jun 20, 2003 3:56 am
Contact:

Re: [2.0.6] PHP Syntax Highlighter BBCode

Post by Laler »

gdk wrote:
AbelaJohnB wrote:## Author Notes:
## You MUST install the following MOD for my MOD work:
## http://www.phpbb.com/phpBB/viewtopic.php?t=74705

Could you please be more descriptive? Especially since that link is not working, and there's no indication of what MOD is actually required. It would be a great help if you can update the file with these changes.

Thank you very much!!


Look above :wink:
EonStrife
Registered User
Posts: 2
Joined: Sun Feb 27, 2005 6:33 am

Post by EonStrife »

BTW, any similar mods, but for another programming language ? Like the one in GameDev.net forum :

Code: Select all

C	  [source lang="c"][/source]
C++	[source lang="cpp"][/source]
C#	 [source lang="c#"][/source] or [source lang="csharp"][/source]
Java	 [source lang="java"][/source]
Javascript	[source lang="javascript"][/source]
JScript	[source lang="jscript"][/source]
Python	[source lang="python"][/source]
X86 Assembly  	[source lang="asm"][/source]
Visual Basic	[source lang="vb"][/source]
VBScript	[source lang="vbscript"][/source]
Thanks.
User avatar
-=ET=-
Registered User
Posts: 799
Joined: Sun May 25, 2003 5:32 pm

Post by -=ET=- »

EonStrife wrote: BTW, any similar mods, but for another programming language ? Like the one in GameDev.net forum :

I think yes but you have to search. I don't have any link.
The point is for php there is a useful PHP function to do it. For other languages it's more complex. You have to develop and maintain everything.
Eternal newbie
everah
Registered User
Posts: 5
Joined: Tue May 18, 2004 1:00 am

Post by everah »

Have you tried GeSHi? I am not sure if it links to code language functions but it has an enormous code language base.
Cyberian75
Registered User
Posts: 28
Joined: Tue Nov 19, 2002 3:54 am
Location: Oregon, U.S.
Contact:

Post by Cyberian75 »

DarksterV2 wrote: Not sure if this has been asked already but is there a way to fix this?

Some font color text seems to show before the php text. It's just an example image below:

Image


I've the exact problem. Help anyone???
Michael
everah
Registered User
Posts: 5
Joined: Tue May 18, 2004 1:00 am

Post by everah »

The problem comes from not using the opening <?php tag when wrapping php code in the PHP BBCode. There is something in the regex replacement code that adds a new line character and leaves off the section you see in the posts when you do not include the openeing tag or when there is space between the opening BBCode tag and the openeing PHP tag. I am sure it will be corrected in the next release.
Cyberian75
Registered User
Posts: 28
Joined: Tue Nov 19, 2002 3:54 am
Location: Oregon, U.S.
Contact:

Post by Cyberian75 »

Thanks for your reply, everah.

So, ET, when can we expect a fix?
Michael
EonStrife
Registered User
Posts: 2
Joined: Sun Feb 27, 2005 6:33 am

Post by EonStrife »

GeShi ? All right, thanks for the info, Everah :)
KI
Registered User
Posts: 32
Joined: Sat Nov 20, 2004 11:46 pm

Post by KI »

Cyberian75 wrote:
DarksterV2 wrote:Not sure if this has been asked already but is there a way to fix this?

Some font color text seems to show before the php text. It's just an example image below:

Image


I've the exact problem. Help anyone???

I noticed the same problem as well.
scrotaye
Registered User
Posts: 1
Joined: Thu Feb 16, 2006 6:39 pm

Post by scrotaye »

yeah I'm having the same problem as a lot of other people

[[I DID install the mod that needed to be installed before this one (posted above)]]

Find:

Code: Select all

# 
#-----[ FIND ]---------------------------------
#
$EMBB_keys = array(''
$EMBB_widths = array(''
$EMBB_values = array(''
That code's not anywhere.... in the previous mod, in this mod, or in phpBB.

Can someone please verify?
Petey B
Registered User
Posts: 28
Joined: Mon Feb 27, 2006 10:57 pm

Post by Petey B »

how would i change the code tags from [php] to [amx] ?

i dont need anything else to change just the code tags
Post Reply

Return to “[2.0.x] MOD Database Cleanup”