[MOD] BBcode Visual Basic Syntax Highlighter / BBkod Sanal..

[url=http://www.phpbbturkey.com/mods.html:34cnv4ga]phpBB 2.0.x MOD Veritabanımızda[/url:34cnv4ga] yayınlanan ve tarafınızca eklenen tüm yeni phpBB 2.0.x sürümleri için MODların duyuruları buradan yapılmaktadır. MODlar hakkında ihtiyacınız olan desteği lütfen [b:34cnv4ga]2.0.x MOD Destek[/b:34cnv4ga] forumuna başlık açarak sorunuz.
Kilitli
Kullanıcı avatarı
NEFRİT
Uzaklaştırıldı
Mesajlar: 1404
Kayıt: 28.01.2006, 04:15
Konum: DarkKingdom
İletişim:

[MOD] BBcode Visual Basic Syntax Highlighter / BBkod Sanal..

Mesaj gönderen NEFRİT »

Bu mod sayesinde artık forumunuza Visual Basic kodlarını ekleyebilrisiniz.

Kod: Tümünü seç

###############################################################################################
## MOD İSMİ: Visual Basic Syntax Highlighter BBCode
## MOD VERSİYONU: 1.0.1
##
## YAPIMCISI: AvisSoft < tapan@maxvb.com > (Tapan Bhanot) http://www.maxvb.com
## AÇIKLAMASI: This mod creates a new BBCode, "[vb]your_code[/vb]". It simply
## takes the code and uses a custom highlighting function and makes a pretty, color
## coded presentation of your code. The function has several enhancements which makes
## it more intelligent like:
##
## * Case Detection of Reserved Keywords.
## * Improved algorithm.
## * More keywords supported than any other vb code tag available.
## * Advanced Variable Detection.
##
## Compatibility Issues & Notes:
## This mod has been tested on a moded phpbb 2.0.10 and is working fine. You can check
## the mod in action at http://www.maxvb.com and no issues have been found till now.
## 
## Installation Level: Easy
## Installation Time: 5-10 Minutes
##
## Files To Edit: posting.php
##                includes/bbcode.php
##                language/lang_YOUR_LANGUAGE/lang_main.php
##                templates/YOUR_TEMPLATE_NAME/bbcode.tpl
##                templates/YOUR_TEMPLATE_NAME/posting_body.tpl
##                templates/YOUR_TEMPLATE_NAME/overall_header.tpl
##
## Included Files: N/A
###############################################################################################
## This MOD is released under the GPL License.
## Intellectual Property is retained by the MOD Author(s) listed above
###############################################################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ 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/downloads/
###############################################################################################
##
## Author Note:
## Large chunks of VB code within the tags will signigicantly slow down the page,
## since the custom function has to do a lot of search and replacing. But overall the
## mod is stable and does not really slows down the bb.
##
###############################################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
###############################################################################################

# 
#-----[ OPEN ]------------------------------------------
#

includes/bbcode.php


#
#-----[ FIND ]------------------------------------------
#

        $bbcode_tpl['code_open'] = str_replace('{L_CODE}', $lang['Code'], $bbcode_tpl['code_open']);


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

        $bbcode_tpl['vb_open'] = str_replace('{L_VB}', $lang['VBCode'], $bbcode_tpl['vb_open']); // VB MOD


#
#-----[ FIND ]------------------------------------------
#

        // [code] and 
for posting code (HTML, PHP, C etc etc) in your posts.
$text = bbencode_second_pass_code($text, $uid, $bbcode_tpl);


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

// VB MOD
// [VB] and [/VB] for posting PHP code in your posts.
$text = bbencode_second_pass_vb($text, $uid, $bbcode_tpl);


#
#-----[ FIND ]------------------------------------------
#

//

Kod: Tümünü seç

 and 
for posting code (HTML, PHP, C etc etc) in your posts.
$text = bbencode_first_pass_pda($text, $uid, '', '', true, '');


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

// VB MOD
// [VB] and [/VB] for posting PHP code in your posts.
$text = bbencode_first_pass_pda($text, $uid, '[vb]', '[/vb]', '', true, '');


#
#-----[ FIND ]------------------------------------------
#

} // bbencode_second_pass_code()


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

/*
* Visual Basic Syntax Highlighter BBCode
* ======================================
* vb_highlight_string($str)
* - All parameters required
* - Returns a string
*
* Takes a string and color codes it to VB's syntax.
* BEWARE! This CAN and WILL slow down page generation times! At least with large chunks of code.
*
* NOTE: DO NOT REORDER UNLESS YOU KNOW WHAT YOU'RE DOING
*/

function vb_highlight_string($str)
{
// VB Words Color
$color['comment'] = '#008800';
$color['default'] = '#000000';
$color['reserved'] = '#000088';
$color['string'] = '#000000';

// VB Words Array
$vb=array("#Const","#If","Abs","Add","Alias","And","Any","AppActivate","Array","As","Asc","Atn","Base","Beep",
"Boolean","Byte","ByVal","CBool","CByte","CCur","CDBl","CDate","CDec","CInt","CLng","CSng","CStr","CVErr","CVar",
"Call","Case","ChDir","ChDrive","Chr","Clear","Close","Collection","Command","Compare","Const","Cos","CreateObject",
"CurDir","Currency","DDB","Date","DateAdd","DateDiff","DatePart","DateSerial","DateValue","Day","Debug","Declare",
"DefBool","DefByte","DefCur","DefDate","DefDbl","DefDec","DefInt","DefLng","DefObj","DefSng","DefStr","DefVar",
"DeleteSetting","Dim","Dir","Do","DoEvents","Double","EOF","Each","Else","ElseIf","End","Endif","Environ",
"Eqv","Erase","Err","Error","Exit","Exp","Explicit","False","FV","FileAttr","FileCopy","FileDateTime","FileLen",
"Filelen","Fix","For","Format","Function","Get","GetAllSettings","GetAttr","GetObject","GetSetting","Global","GoSub",
"GoTo","Hex","Hour","IIR","IPmt","If","Imp","In","InStr","Input #","Int","Integer","Is","IsArray","IsDate",
"IsEmpty","IsError","IsMissing","IsNull","IsNumeric","IsObject","Item","Kill","LBound","LCase","LOF","LSet","LTrim",
"Left","Len","Let","Lib","Like","Line Input #","Loc","Lock","Log","Long","Loop","MIRR","Me","Mid","Minute","MkDir",
"Mod","Module","Month","MsgBox","NPV","NPer","Name","New","Next","Not","Now","Object","Oct","On","Open","Option","Or",
"PPmt","PV","Pmt","Print","Print #","Private","Property","Public","Put","QBColor","RGB","RSet","RTrim","Raise",
"Randomize","Rate","ReDim","Remove","Reset","Resume","Return","Right","RmDir","Rnd","SLN","SYD","SaveSetting",
"Second","Seek","Select","SendKeys","Set","SetAttr","Sgn","Shell","Sin","Single","Space","Spc","Sqr","Static","Step",
"Stop","Str","StrComp","StrConv","String","Sub","Switch","Tab","Tan","Then","Time","TimeSerial","TimeValue","Timer",
"To","Trim","True", "Type","TypeName","UBound","UCase","Unlock","Until","Val","VarType","Variant","Weekday","Wend",
"While","Width #","With","Write #","Xor","Year","Optional","InStrRev","Replace","Split","Join");

$val = "";
$gretext = "";
$lines = explode("\n", $str);

if (count($lines) == "1") {
// Green highlighting for 1 line only!
$quoteplace = substr($lines[0], 0, 1);
if ($quoteplace == "'")
{
$beforequote = substr($lines[0], 0, $quoteplace);
$afterquote="<font class=\"vbcode\" color=\"#007F00\">".substr($lines[0],$quoteplace)."</font>";
$codebit=$beforequote;
$gretext .= $beforequote . $afterquote;
$afterquote = "";
$codebit = $lines[0];
}
else
{
$gretext .= $lines[0];
}
}
else
{
// Green highlighting for multiple lines!
while (list($brr, $line) = each($lines))
{
if (substr(trim($line), 0, 1) == "'")
{
$line = "<font class=\"vbcode\" color=\"#007F00\">$line</font>";
$gretext .= $line;
}
else
{
$quoteplace = strrpos($line, "'");
if ($quoteplace > 0)
{
$beforequote = substr($line, 0, $quoteplace);
$afterquote="<font class=\"vbcode\" color=\"#007F00\">".substr($line,$quoteplace)."</font>";
$codebit=$beforequote;
$gretext .= $beforequote . $afterquote;
$afterquote = "";
$codebit = $line;
}
else
{
$afterquote = "";
$codebit = $line;
$gretext .= $line;
}
}
}
}

$str = $gretext;


// Do some magic
$str = eregi_replace ("\n", " || ", $str);
$str = eregi_replace ("\r", " || ", $str);

// Split Word by Word
$words = explode(" ", $str);

$found = "";
$newtext = "";

for ($y = 0; $y < count($words); $y++) {
$getuserword = $words[$y];

for ($x = 0; $x < count($vb); $x++) {
$getvbword = $vb[$x];

if (strtolower($getvbword) == strtolower($getuserword))
{
$found = "true";
$newtext .= " " . eregi_replace ($vb[$x], '<font class="vbcode" color="' . $color['reserved'] . '">' . $vb[$x] . '</font>', $words[$y]);
}
}
if ($found == "")
{
// Finally We give Up!
$newtext .= " " . $words[$y];
}
$found = "";
}

// Remove magic and some stuff we done earlier
$newtext = str_replace(' || ', '<br>', $newtext);

// Start VB Output
return trim($newtext);
}

/*
* VB MOD
* Does second-pass bbencoding of the [vb] tags. This includes
* running htmlspecialchars() over the text contained between
* any pair of [vb] tags that are at the first level of
* nesting. Tags at the first level of nesting are indicated
* by this format: [vb:1:$uid] ... [/vb:1:$uid]
* Other tags are in this format: [vb:$uid] ... [/vb:$uid]
*
* Original code/function by phpBB Group
* Modified by JW Frazier / Fubonis < php@fubonis.com >
*/

function bbencode_second_pass_vb($text, $uid, $bbcode_tpl)
{
global $lang;

$html_entities_match = array("#<#", "#>#");
$html_entities_replace = array("<", ">");

$code_start_html = $bbcode_tpl['vb_open'];
$code_end_html = $bbcode_tpl['vb_close'];

// First, do all the 1st-level matches. These need an htmlspecialchars() run,
// so they have to be handled differently.
$match_count = preg_match_all("#\[vb:1:$uid\](.*?)\[/vb:1:$uid\]#si", $text, $matches);

for ($i = 0; $i < $match_count; $i++)
{
$before_replace = $matches[1][$i];
$after_replace = $matches[1][$i];

$after_replace = preg_replace($html_entities_match, $html_entities_replace, $after_replace);

// Replace 2 spaces with "&nbsp; " so non-tabbed code indents without making huge long lines.
$after_replace = str_replace(" ", "&nbsp; ", $after_replace);
// now Replace 2 spaces with " &nbsp;" to catch odd #s of spaces.
$after_replace = str_replace(" ", " &nbsp;", $after_replace);

// Replace tabs with "&nbsp; &nbsp;" so tabbed code indents sorta right without making huge long lines.
$after_replace = str_replace("\t", "&nbsp; &nbsp;", $after_replace);

$str_to_match = "[vb:1:$uid]" . $before_replace . "[/vb:1:$uid]";

$replacement = $code_start_html;

$after_replace = vb_highlight_string($after_replace);
$replacement .= $after_replace;
$replacement .= $code_end_html;

$text = str_replace($str_to_match, $replacement, $text);
}

// Now, do all the non-first-level matches. These are simple.
$text = str_replace("[vb:$uid]", $code_start_html, $text);
$text = str_replace("[/vb:$uid]", $code_end_html, $text);

return $text;

} // bbencode_second_pass_vb()


#
#-----[ OPEN ]------------------------------------------
#

templates/YOUR_TEMPLATE_NAME/bbcode.tpl


#
#-----[ FIND ]------------------------------------------
#

<!-- END email -->


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

<!-- BEGIN vb_open -->
</span>
<blockquote>
<span class="genmed">visual basic code:</span>
<hr>
<span class="vbcode">
<BASEFONT FACE="Courier New" SIZE="2">
<!-- END vb_open -->
<!-- BEGIN vb_close -->
</BASEFONT>
</span>
<hr>
</blockquote>
<span class="postbody">
<!-- END vb_close -->

#
#-----[ OPEN ]------------------------------------------
#

templates/YOUR_TEMPLATE_NAME/posting_body.tpl


#
#-----[ FIND ]------------------------------------------
#

f_help = "{L_BBCODE_F_HELP}";


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

v_help = "{L_BBCODE_V_HELP}";


#
#-----[ FIND ]------------------------------------------
#

bbtags = new Array('','','','','','','[quote]','[/quote]','','
  • ','
','
  • ','
','[img]','[/img]','','');


#
#-----[ REPLACE WITH ]------------------------------------------
#
bbtags = new Array('','','','','','','[quote]','[/quote]','','
  • ','
','
  • ','
','[img]','[/img]','','','[vb]','[/vb]');


#
#-----[ FIND ]------------------------------------------
#

<td><span class="genmed">
<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>


#
#-----[ AFTER, ADD ]------------------------------------------
#
<td><span class="genmed">
<input type="button" class="button" accesskey="h" name="addbbcode18" value="VB" style="width: 40px" onClick="bbstyle(18)" onMouseOver="helpline('h')" />
</span></td>


#
#-----[ FIND ]------------------------------------------
#

<select name="addbbcode18" onChange="bbfontstyle('[color=' + this.form.addbbcode18.options[this.form.addbbcode18.selectedIndex].value + ']', '[/color]');this.selectedIndex=0;" onMouseOver="helpline('s')">


#
#-----[ REPLACE WITH ]------------------------------------------
#

<select name="addbbcode20" onChange="bbfontstyle('[color=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/color]');this.selectedIndex=0;" onMouseOver="helpline('s')">

#
#-----[ FIND ]------------------------------------------
#

<select name="addbbcode20" onChange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]')" onMouseOver="helpline('f')">


#
#-----[ REPLACE WITH ]------------------------------------------
#

<select name="addbbcode22" onChange="bbfontstyle('[size=' + this.form.addbbcode22.options[this.form.addbbcode22.selectedIndex].value + ']', '[/size]')" onMouseOver="helpline('f')">


#
#-----[ ACTION: OPEN ]------------------------------------------
#

/language/lang_YOUR_LANGUAGE/lang_main.php


#
#-----[ FIND ]------------------------------------------
#

$lang['bbcode_f_help'] = 'Font size: [size=x-small]small text[/size]';


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

$lang['bbcode_v_help'] = 'VB syntax highlighter. [vb]VB code[/vb] (alt+h)'; // VB MOD


#
#-----[ ACTION: OPEN ]------------------------------------------
#

posting.php


#
#-----[ FIND ]------------------------------------------
#

'L_BBCODE_F_HELP' => $lang['bbcode_f_help'],


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

'L_BBCODE_V_HELP' => $lang['bbcode_v_help'], // VB MOD


#
#-----[ ACTION: OPEN ]------------------------------------------
#
# Just edit whichever you use for css. I use subSilver.css
# instead of overall_header.tpl. If you use subSilver.css then
# specify subSilver.css instead of overall_header.tpl

templates/YOUR_TEMPLATE_NAME/overall_header.tpl

#
#-----[ FIND ]------------------------------------------
#

/* Quote & Code blocks */
.code {
...
...
...
}

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

.vbcode {
font-family: 'Courier New'; font-size: 12px;
}


#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
[/code]
Özellerden kullanıcılara reklam yaptığım için sayın yöneticim beni uzaklaştırdı.
fikretba
Kayıtlı Kullanıcı
Mesajlar: 121
Kayıt: 20.05.2006, 11:08
İletişim:

bu tam olarak nedir

Mesaj gönderen fikretba »

vbasic kod derken anlamadım nasıl bir şey?
Kullanıcı avatarı
NEFRİT
Uzaklaştırıldı
Mesajlar: 1404
Kayıt: 28.01.2006, 04:15
Konum: DarkKingdom
İletişim:

Re: bu tam olarak nedir

Mesaj gönderen NEFRİT »

fikretba yazdı:vbasic kod derken anlamadım nasıl bir şey?
V basic bir programlama dilidir. Kendine özel kodları vardır. Bu mod o kodları mesajların içine eklemeye yarar.
Özellerden kullanıcılara reklam yaptığım için sayın yöneticim beni uzaklaştırdı.
sideLord
Kayıtlı Kullanıcı
Mesajlar: 51
Kayıt: 23.05.2006, 00:02
İletişim:

Mesaj gönderen sideLord »

güzel bir eklenti. işime yaradı. teşekkürler nefrit.
fikretba
Kayıtlı Kullanıcı
Mesajlar: 121
Kayıt: 20.05.2006, 11:08
İletişim:

Mesaj gönderen fikretba »

benimde işime yarayacak vbasic forumum var benimde :) vb.ueuo.com
lord-volkan
Kayıtlı Kullanıcı
Mesajlar: 127
Kayıt: 19.08.2006, 04:47
İletişim:

Mesaj gönderen lord-volkan »

arkadaşım bu şöyle birşey mi? yukarıdaki kod yazısı yerine V basic mi yazıyor.
selam millet!!!
süper bi pro süper bi forum
yapanların ellerine sağlık............
fikretba
Kayıtlı Kullanıcı
Mesajlar: 121
Kayıt: 20.05.2006, 11:08
İletişim:

Mesaj gönderen fikretba »

lord-volkan yazdı:arkadaşım bu şöyle birşey mi? yukarıdaki kod yazısı yerine V basic mi yazıyor.

evet ama farkı şu mesela

Kod: Tümünü seç

for t=1 to 10
print t
next t
yazdıgında ayırt edici çıkmaz bu kod ise şunu yapar

buradaki vbasic kodlarını yeşil ile ayrı renkte görterir ve ilk harflerini büyük yazar

For t=1 to 10
Print t
Next t

gibi
lord-volkan
Kayıtlı Kullanıcı
Mesajlar: 127
Kayıt: 19.08.2006, 04:47
İletişim:

Mesaj gönderen lord-volkan »

arkadaşım bende gelişmiş mesajlaşma modu kurulu bunu o moda nasıl ekleyebiliriz ben bi türlü yapamadım?
yardım edebilirsen çok sevinirim.............
selam millet!!!
süper bi pro süper bi forum
yapanların ellerine sağlık............
www.unigenclik.org
Kayıtlı Kullanıcı
Mesajlar: 65
Kayıt: 28.10.2006, 14:35
İletişim:

Re: bu tam olarak nedir

Mesaj gönderen www.unigenclik.org »

NEFRİT yazdı:
fikretba yazdı:vbasic kod derken anlamadım nasıl bir şey?
V basic bir programlama dilidir. Kendine özel kodları vardır. Bu mod o kodları mesajların içine eklemeye yarar.

offff bea hocam ellerin dert görmesin ya..manyak güzel bir çalışma..ayıptır söylemesi Visual Basic"te baya iyiyimdir...her hangi bir kod lazım olursa V.Basic"ten yardımcı olabilirim..[/b]
Kilitli

“2.0.x MOD Duyuruları” sayfasına dön

Kimler çevrimiçi

Bu forumu görüntüleyen kullanıcılar: Hiç bir kayıtlı kullanıcı yok ve 0 misafir