This is from TT-fr so big credit to original Author
Updates the bbcode and allows preview
[color=rgb(251, 160, 38)]In theme.css add[/color]
/* Display Part Of BBCodes */
#BBCode{
height: 30px;
width: 30px;
margin: 8px;
background: rgb(105, 105, 105, 100);
background: -moz-linear-gradient(top, rgba(105, 105, 105, 100) 0%, rgba(64, 64, 64, 100) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(105, 105, 105, 100)), color-stop(50%,rgba(64, 64, 64, 100)));
background: -webkit-linear-gradient(top, rgba(105, 105, 105, 100) 0%,rgba(64, 64, 64, 100) 50%);
background: -o-linear-gradient(top, rgba(105, 105, 105, 100) 0%,rgba(64, 64, 64, 100) 50%);
background: -ms-linear-gradient(top, rgba(105, 105, 105, 100) 0%,rgba(64, 64, 64, 100) 50%);
background: linear-gradient(top, rgba(105, 105, 105, 100) 0%,rgba(64, 64, 64, 100) 50%);
-moz-box-shadow: 0px 3px 6px #000, 0px -2px 5px #111;
-webkit-box-shadow: 0px 6px 6px #000, 0px -2px 5px #111;
box-shadow: 0px 3px 6px #000, 0px -2px 5px #111;
-moz-border-radius: 10px;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
-moz-border-radius-topleft: 8px;
-moz-border-radius-topright: 8px;
-webkit-border-top-left-radius:: 8px;
-webkit-border-top-right-radius:: 8px;
border-radius: 8px;
border: 3px groove #1c252d;
}
/* All For the Outline Effects of BBCode Buttons */
.BBCode-Contour{
margin: 2px;
margin-left : 5px;
text-align: center;
background: rgb(105, 105, 105, 100);
background: -moz-linear-gradient(top, rgba(105, 105, 105, 100) 0%, rgba(64, 64, 64, 100) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(105, 105, 105, 100)), color-stop(50%,rgba(64, 64, 64, 100)));
background: -webkit-linear-gradient(top, rgba(105, 105, 105, 100) 0%,rgba(64, 64, 64, 100) 50%);
background: -o-linear-gradient(top, rgba(105, 105, 105, 100) 0%,rgba(64, 64, 64, 100) 50%);
background: -ms-linear-gradient(top, rgba(105, 105, 105, 100) 0%,rgba(64, 64, 64, 100) 50%);
background: linear-gradient(top, rgba(105, 105, 105, 100) 0%,rgba(64, 64, 64, 100) 50%);
-moz-box-shadow: 0px 3px 6px #000, 0px -2px 5px #111;
-webkit-box-shadow: 0px 6px 6px #000, 0px -2px 5px #111;
box-shadow: 0px 3px 6px #000, 0px -2px 5px #111;
-moz-border-radius: 10px;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
-moz-border-radius-topleft: 8px;
-moz-border-radius-topright: 8px;
-webkit-border-top-left-radius:: 8px;
-webkit-border-top-right-radius:: 8px;
border-radius: 8px;
border: 3px groove #1c252d;
}
#BBCode-Contour2{
margin: 10px;
background: rgb(105, 105, 105, 100);
background: -moz-linear-gradient(top, rgba(105, 105, 105, 100) 0%, rgba(64, 64, 64, 100) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(105, 105, 105, 100)), color-stop(50%,rgba(64, 64, 64, 100)));
background: -webkit-linear-gradient(top, rgba(105, 105, 105, 100) 0%,rgba(64, 64, 64, 100) 50%);
background: -o-linear-gradient(top, rgba(105, 105, 105, 100) 0%,rgba(64, 64, 64, 100) 50%);
background: -ms-linear-gradient(top, rgba(105, 105, 105, 100) 0%,rgba(64, 64, 64, 100) 50%);
background: linear-gradient(top, rgba(105, 105, 105, 100) 0%,rgba(64, 64, 64, 100) 50%);
-moz-box-shadow: 0px 3px 6px #000, 0px -2px 5px #111;
-webkit-box-shadow: 0px 6px 6px #000, 0px -2px 5px #111;
box-shadow: 0px 3px 6px #000, 0px -2px 5px #111;
-moz-border-radius: 10px;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
-moz-border-radius-topleft: 8px;
-moz-border-radius-topright: 8px;
-webkit-border-top-left-radius:: 8px;
-webkit-border-top-right-radius:: 8px;
border-radius: 8px;
border: 3px groove #1c252d;
}
#BBCode-Contour2:hover{
background: rgb(105, 105, 105, 100);
background: -moz-linear-gradient(top, rgba(105, 105, 105, 100) 0%, rgba(64, 64, 64, 100) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(105, 105, 105, 100)), color-stop(50%,rgba(64, 64, 64, 100)));
background: -webkit-linear-gradient(top, rgba(105, 105, 105, 100) 0%,rgba(64, 64, 64, 100) 50%);
background: -o-linear-gradient(top, rgba(105, 105, 105, 100) 0%,rgba(64, 64, 64, 100) 50%);
background: -ms-linear-gradient(top, rgba(105, 105, 105, 100) 0%,rgba(64, 64, 64, 100) 50%);
background: linear-gradient(top, rgba(105, 105, 105, 100) 0%,rgba(64, 64, 64, 100) 50%);
}
/* Preview */
#previsualisation{
margin: 10px;
display: block;
width: 100%;
background: rgb(105, 105, 105, 100);
background: -moz-linear-gradient(top, rgba(105, 105, 105, 100) 0%, rgba(64, 64, 64, 100) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(105, 105, 105, 100)), color-stop(50%,rgba(64, 64, 64, 100)));
background: -webkit-linear-gradient(top, rgba(105, 105, 105, 100) 0%,rgba(64, 64, 64, 100) 50%);
background: -o-linear-gradient(top, rgba(105, 105, 105, 100) 0%,rgba(64, 64, 64, 100) 50%);
background: -ms-linear-gradient(top, rgba(105, 105, 105, 100) 0%,rgba(64, 64, 64, 100) 50%);
background: linear-gradient(top, rgba(105, 105, 105, 100) 0%,rgba(64, 64, 64, 100) 50%);
-moz-box-shadow: 0px 3px 6px #000, 0px -2px 5px #111;
-webkit-box-shadow: 0px 6px 6px #000, 0px -2px 5px #111;
box-shadow: 0px 3px 6px #000, 0px -2px 5px #111;
-moz-border-radius: 10px;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
-moz-border-radius-topleft: 8px;
-moz-border-radius-topright: 8px;
-webkit-border-top-left-radius:: 8px;
-webkit-border-top-right-radius:: 8px;
border-radius: 8px;
}
/* CSS BBcode */
[color=rgb(251, 160, 38)]in functions.php find (look at finish line smilies to help)[/color]
function format_comment($text) {
global $site_config, $smilies;
$s = $text;
$s = htmlspecialchars($s);
$s = format_urls($s);
//
$s = preg_replace("/\[\*\]/", "<li>", $s);
// Bold
$s = preg_replace("/\[b\]((\s|.)+?)\[\/b\]/", "<b>\\1</b>", $s);
// Italic
$s = preg_replace("/\[i\]((\s|.)+?)\[\/i\]/", "<i>\\1</i>", $s);
// Underline
$s = preg_replace("/\[u\]((\s|.)+?)\[\/u\]/", "<u>\\1</u>", $s);
// Underline
$s = preg_replace("/\[u\]((\s|.)+?)\[\/u\]/i", "<u>\\1</u>", $s);
// 
$s = preg_replace("/\[img\]((http|https):\/\/[^\s'\"<>]+(\.gif|\.jpg|\.png|\.bmp|\.jpeg))\[\/img\]/i", "<img border='0' src=\"\\1\" alt='' />", $s);
// [img=http://www/image.gif]
$s = preg_replace("/\[img=((http|https):\/\/[^\s'\"<>]+(\.gif|\.jpg|\.png|\.bmp|\.jpeg))\]/i", "<img border='0' src=\"\\1\" alt='' />", $s);
// Text
$s = preg_replace(
"/\[color=([a-zA-Z]+)\]((\s|.)+?)\[\/color\]/i",
"<font color='\\1'>\\2</font>", $s);
// Text
$s = preg_replace(
"/\[color=(#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9])\]((\s|.)+?)\[\/color\]/i",
"<font color='\\1'>\\2</font>", $s);
// Text
$s = preg_replace(
"/\[url=((http|ftp|https|ftps|irc):\/\/[^<>\s]+?)\]((\s|.)+?)\[\/url\]/i",
"<a href='\\1' target='_blank'>\\3</a>", $s);
// http://www.example.com
$s = preg_replace(
"/\[url\]((http|ftp|https|ftps|irc):\/\/[^<>\s]+?)\[\/url\]/i",
"<a href='\\1' target='_blank'>\\1</a>", $s);
// Text
$s = preg_replace(
"/\[size=([1-7])\]((\s|.)+?)\[\/size\]/i",
"<font size='\\1'>\\2</font>", $s);
// Text
$s = preg_replace(
"/\[font=([a-zA-Z ,]+)\]((\s|.)+?)\[\/font\]/i",
"<font face=\"\\1\">\\2</font>", $s);
//Quote:Text
while (preg_match("/\[quote\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i", $s))
$s = preg_replace(
"/\[quote\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i",
"<p class='sub'><b>Quote:</b></p><table class='main' border='1' cellspacing='0' cellpadding='10'><tr><td style='border: 1px black dotted'>\\1</td></tr></table><br />", $s);
//Author:Text
while (preg_match("/\[quote=(.+?)\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i", $s))
$s = preg_replace(
"/\[quote=(.+?)\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i",
"<p class='sub'><b>\\1 wrote:</b></p><table class='main' border='1' cellspacing='0' cellpadding='10'><tr><td style='border: 1px black dotted'>\\2</td></tr></table><br />", $s);
// [spoiler]Text[/spoiler]
$r = substr(md5($text), 0, 4);
$i = 0;
while (preg_match("/\[spoiler\]\s*((\s|.)+?)\s*\[\/spoiler\]\s*/i", $s)) {
$s = preg_replace("/\[spoiler\]\s*((\s|.)+?)\s*\[\/spoiler\]\s*/i",
"<br /><img src='images/plus.gif' id='pic$r$i' title='Spoiler' onclick='klappe_torrent(\"$r$i\")' alt='' /><div id='k$r$i' style='display: none;'>\\1<br /></div>", $s);
$i++;
}
// [spoiler=Heading]Text[/spoiler]
while (preg_match("/\[spoiler=(.+?)\]\s*((\s|.)+?)\s*\[\/spoiler\]\s*/i", $s)) {
$s = preg_replace("/\[spoiler=(.+?)\]\s*((\s|.)+?)\s*\[\/spoiler\]\s*/i",
"<br /><img src='images/plus.gif' id='pic$r$i' title='Spoiler' onclick='klappe_torrent(\"$r$i\")' alt='' /><b>\\1</b><div id='k$r$i' style='display: none;'>\\2<br /></div>", $s);
$i++;
}
//[align=(center|left|right)]text[/align]
$s = preg_replace(
"/\[align=([a-zA-Z]+)\](.+?)\[\/align\]/is",
"<div style=\"text-align:\\1\">\\2</div>", $s);
//
$s = preg_replace("/\[hr\]/i", "<hr />", $s);
//[hr=#ffffff] [hr=red]
$s = preg_replace("/\[hr=((#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9])|([a-zA-z]+))\]/i", "<hr color=\"\\1\"/>", $s);
//[swf]http://somesite.com/test.swf[/swf]
$s = preg_replace("/\[swf\]((www.|http:\/\/|https:\/\/)[^\s]+(\.swf))\[\/swf\]/i",
"<param name='movie' value='\\1'/><embed width='470' height='310' src='\\1'></embed>", $s);
//[swf=http://somesite.com/test.swf]
$s = preg_replace("/\[swf=((www.|http:\/\/|https:\/\/)[^\s]+(\.swf))\]/i",
"<param name='movie' value='\\1'/><embed width='470' height='310' src='\\1'></embed>", $s);
// Linebreaks
$s = nl2br($s);
// Maintain spacing
$s = str_replace(" ", " ", $s);
// Smilies
replace with
function format_comment($text) {
global $site_config, $smilies;
$s = $text;
$s = htmlspecialchars($s);
$s = format_urls($s);
//
$s = preg_replace("/\[\*\]/", "<li>", $s);
// Centrer
ou center
$s = preg_replace("#\[center\](.+)\[/center\]#isU", "<center>$1</center>", $s);
// Bold
$s = preg_replace("/\[b\]((\s|.)+?)\[\/b\]/", "<b>\\1</b>", $s);
// Italic
$s = preg_replace("/\[i\]((\s|.)+?)\[\/i\]/", "<i>\\1</i>", $s);
// Underline
$s = preg_replace("/\[u\]((\s|.)+?)\[\/u\]/", "<u>\\1</u>", $s);
// Line
$s = preg_replace("#\[s\](.+)\[/s\]#isU", "<span style='text-decoration:line-through;'>$1</span>", $s);
// List 1
$s = preg_replace("#\[list\](.+)\[/list\]#isU", "<li style= 'margin-left: 20px;'>$1</li>", $s);
// List 2
$s = preg_replace("#\[*\](.+)\[/*\]#isU", "<li style= 'margin-left: 20px;'>$1</li>", $s);
// Quote 1
while (preg_match("#\[quote\](.+)\[/quote\]#isU", $s))
$s = preg_replace("#\[quote\](.+)\[/quote\]#isU", "<blockquote><strong> Quote : </strong></blockquote><table class='main' border='1' cellspacing='0' cellpadding='10'><tr><td style='border: 1px black dotted'>$1</td></tr></table><br />", $s);
// Quote 2
while (preg_match("#\[quote=(.+)\](.+)\[/quote\]#isU", $s))
$s = preg_replace("#\[quote=(.*?)\](.+)\[/quote\]#isU", "<blockquote><strong>$1 écrit : </strong></blockquote><table class='main' border='1' cellspacing='0' cellpadding='10'><tr><td style='border: 1px black dotted'>$2</td></tr></table><br />", $s);
///Multi Quote For Private Message
while(preg_match( '#\[reponse(.*)\](.+)\[/reponse\]#isU', $s))
$s= preg_replace('#\[reponse(.*)\](.+)\[/reponse\]#isU','<table class=main border=2 cellspacing=0 cellpadding=10><tr><td style=border: 1px black dotted>$2</td></tr></table><br />',$s);
// Extract the Code
$s = preg_replace("#\[code\](.+)\[/code\]#isU", "<p class='sub'><b> Extract the Code : </b><center><table class=bbcodecode border=1 cellspacing=0 cellpadding=5><tr><td style='border: 1px lime solid'>$1</td></tr></table></center></p><br />", $s);
// Links
// Text
$s = preg_replace("#\[url=((?:ftp|https?)://.*?)\](.*?)\[/url\]#i", "<a href='$1' target='_blank'>$2</a>", $s);
// http://www.exemple.fr
$s = preg_replace("#\[url\]((?:ftp|https?)://.*?)\[/url\]#i", "<a href='$1' target='_blank'>$1</a>", $s);
// Image
// 
$s = preg_replace("#\[img\]((?:ftp|https?)://[a-z0-9._/-]+(\.gif|\.jpg|\.png|\.bmp|\.jpeg))\[/img\]#isU", "<img src='$1' />", $s);
// [img=http://www/image.gif]
$s = preg_replace("#\[img=((?:ftp|https?)://[a-z0-9._/-]+(\.gif|\.jpg|\.png|\.bmp|\.jpeg))\]\[/img\]#isU", "<img src='$1' />", $s);
// [video]http://youtube.com/[/video]
$s = preg_replace("#\[video\](https://www.youtube.com.*v=.+)\[\/video\]#isU", "<center><embed src='https://www.youtube.com/v/$1' type='video' height='140'></embed></center>", $s);
// [audio]http://image.gif[/audio]
$s = preg_replace("#\[audio\]((?:ftp|https?)://[a-z0-9._/-]+(\.mp3|\.wav|\.wma|\.aac|\.bwf|\.ogg|\.ac3|\.flac|\.asx|\.pls|\.alac))\[/audio\]#isU", "<img src='$1' />", $s);
// Polices
// Text
$s = preg_replace("#\[color=([a-zA-Z]+)\](.+)\[/color\]#isU", "<font color='$1'>$2</font>", $s);
// [color=#XXX ou #XXXXXX]Text[/color]
$s = preg_replace("#\[color=\#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})\](.+)\[/color\]#isU", "<font color='$1'>$2</font>", $s);
// Size of Style
$s = preg_replace("#\[size=([1-7])\](.+)\[/size\]#isU", "<font size='$1'>$2</font>", $s);
// Type of Style
$s = preg_replace("#\[font=([a-zA-Z].*?)\](.+)\[/font\]#isU", "<font face='$1'>$2</font>", $s);
// Blink
$s = preg_replace("#\[blink\](.+)\[/blink\]#isU", "<div id='blink'>$1</div>", $s);
// Scroller
$s = preg_replace("#\[df\](.+)\[/df\]#isU", "<div class='marquee'>$1</div>", $s);
// Text Alignment
//[align=(center|left|right)]text[/align]
$s = preg_replace(
"/\[align=([a-zA-Z]+)\](.+?)\[\/align\]/is",
"<div style=\"text-align:\\1\">\\2</div>", $s);
// HTML HTML tag If Need Horizontal Line
// Attention The Color Is Considered Only On IE For Info
//
$s = preg_replace("/\[hr\]/i", "<hr />", $s);
//[hr=#ffffff] [hr=red]
$s = preg_replace("/\[hr=((#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9])|([a-zA-z]+))\]/i", "<hr color=\"\\1\"/>", $s);
// Linebreaks
$s = nl2br($s);
// Maintain spacing
$s = str_replace(" ", " ", $s);
// Smilies
Upload to backend/ - bbcode.php & js
Upload bbcodes folder to images
NOTE - you may need to refresh cache, this should also work on 2.08[ATTACH type="full"]5073[/ATTACH]