Nieuw lid |
|
hey
ik heb een UBB script he
maar als ik een code invoeg word de pagina niet meer mooi
nu is het bij sitemasters zo dat er scrollbalken in komen
hoe doe je dat
mijn highlight functie is
function color($code){
$code = str_replace("<br>", "", $code);
$code = str_replace("<br />", "", $code);
$code = str_replace(">", ">", $code);
$code = str_replace("<", "<", $code);
$code = str_replace("&", "&", $code);
$code = str_replace(""", "\"", $code);
$code = str_replace('$', '\$', $code);
$code = str_replace('\n', '\\\\n', $code);
$code = str_replace('\r', '\\\\r', $code);
$code = str_replace('\t', '\\\\t', $code);
$code = trim($code);
$code = stripslashes($code);
ob_start();
highlight_string($code);
$regel = ob_get_contents();
ob_end_clean();
$regel = explode("<br />", $regel);
$code = "";
$code .= "<table border=\"0\" width=\"100\" cellspacing=\"0\" cellpadding=\"0\">";
$code .= "<tr><td width=\"20\" align=\"right\"><code>";
for($i = 0; $i < (count($regel)); $i++){
$t = $i;
$t++;
$code .= $t."<br />";
}
$code .= "</code></td><td width=\"100\">";
for($i = 0; $i < (count($regel)); $i++){
$t = $i;
$t++;
$code .= $regel[$i]."<br />";
}
$code .= "</td></tr></table>";
$code .= "</table>";
return $code;
}
function color($code){ $regel = explode("<br />", $regel); $code = ""; $code .= "<table border=\"0\" width=\"100\" cellspacing=\"0\" cellpadding=\"0\">"; $code .= "<tr><td width=\"20\" align=\"right\"><code>"; for($i = 0; $i < (count($regel)); $i++){ $t = $i; $t++; $code .= $t."<br />"; } $code .= "</code></td><td width=\"100\">"; for($i = 0; $i < (count($regel)); $i++){ $t = $i; $t++; $code .= $regel[$i]."<br />"; } $code .= "</td></tr></table>"; $code .= "</table>"; return $code; }
het hele script:D
<?
// functie als er ergens op geklikt wordt, dan toevoegen
function klik(){
echo "<script language=\"JavaScript\">
function addtext(veld,text) {
text = ' '+text+' ';
if (document.form.elements[veld].createTextRange) {
document.form.elements[veld].focus();
document.selection.createRange().duplicate().text = text;
} else {
document.form.elements[veld].focus();
document.form.elements[veld].value += text;
}
}</script>
";
}
// functie om knopjes weer te geven
function buttons(){
echo "<input type=\"button\" value=\"I\" style=\"font-size: 14px; color: #FFFFFF; font-weight: bold; border: 1px solid #999999; background-color: #000000\" onClick=\"javascript:addtext('bericht','[i] [/i]')\">
<input type=\"button\" value=\"U\" style=\"font-size: 14px; color: #FFFFFF; font-weight: bold; border: 1px solid #999999; background-color: #000000\" onClick=\"javascript:addtext('bericht','[u] [/u]')\">
<input type=\"button\" value=\"URL\" style=\"font-size: 14px; color: #FFFFFF; font-weight: bold; border: 1px solid #999999; background-color: #000000\" onClick=\"javascript:addtext('bericht','[url=] [/url]')\">
<input type=\"button\" value=\"CODE\" style=\"font-size: 14px; color: #FFFFFF; font-weight: bold; border: 1px solid #999999; background-color: #000000\" onClick=\"javascript:addtext('bericht','[code]
<? // functie als er ergens op geklikt wordt, dan toevoegen function klik(){ echo "<script language=\"JavaScript\"> function addtext(veld,text) { text = ' '+text+' '; if (document.form.elements[veld].createTextRange) { document.form.elements[veld].focus(); document.selection.createRange().duplicate().text = text; } else { document.form.elements[veld].focus(); document.form.elements[veld].value += text; } }</script> "; } // functie om knopjes weer te geven function buttons(){ echo "<input type=\"button\" value=\"I\" style=\"font-size: 14px; color: #FFFFFF; font-weight: bold; border: 1px solid #999999; background-color: #000000\" onClick=\"javascript:addtext('bericht','[i] [/i]')\"> <input type=\"button\" value=\"U\" style=\"font-size: 14px; color: #FFFFFF; font-weight: bold; border: 1px solid #999999; background-color: #000000\" onClick=\"javascript:addtext('bericht','[u] [/u]')\"> <input type=\"button\" value=\"URL\" style=\"font-size: 14px; color: #FFFFFF; font-weight: bold; border: 1px solid #999999; background-color: #000000\" onClick=\"javascript:addtext('bericht','[url=] [/url]')\"> <input type=\"button\" value=\"CODE\" style=\"font-size: 14px; color: #FFFFFF; font-weight: bold; border: 1px solid #999999; background-color: #000000\" onClick=\"javascript:addtext('bericht','[code]
')\">
<input type=\"button\" value=\"Quote\" style=\"font-size: 14px; color: #FFFFFF; font-weight: bold; border: 1px solid #999999; background-color: #000000\" onClick=\"javascript:addtext('bericht','')\">";
}
// functie om smilies weer te geven
function smileys(){
echo "<a href=\"javascript:addtext('bericht',':)')\"><img src=\"smileys/icon_smile.gif\" border=\"0\"></a>
<a href=\"javascript:addtext('bericht',':cry:')\"><img src=\"smileys/icon_cry.gif\" border=\"0\"></a>
<a href=\"javascript:addtext('bericht',':(')\"><img src=\"smileys/icon_frown.gif\" border=\"0\"></a>
<a href=\"javascript:addtext('bericht',';)')\"><img src=\"smileys/icon_wink.gif\" border=\"0\"></a>
<a href=\"javascript:addtext('bericht',':D')\"><img src=\"smileys/icon_biggrin.gif\" border=\"0\"></a>
<a href=\"javascript:addtext('bericht',':S')\"><img src=\"smileys/icon_confused.gif\" border=\"0\"></a>
<a href=\"javascript:addtext('bericht',':P')\"><img src=\"smileys/icon_razz.gif\" border=\"0\"></a>
<a href=\"javascript:addtext('bericht',':B')\"><img src=\"smileys/icon_cool.gif\" border=\"0\"></a>
<a href=\"javascript:addtext('bericht',':$')\"><img src=\"smileys/icon_redface.gif\" border=\"0\"></a>
<a href=\"javascript:addtext('bericht',':O')\"><img src=\"smileys/icon_eek.gif\" border=0></a>
<a href=\"javascript:addtext('bericht',':sad:')\"><img src=\"smileys/icon_sad.gif\" border=0></a>
<a href=\"javascript:addtext('bericht','^^')\"><img src=\"smileys/icon_cheesygrin.gif\" border=0></a>
<a href=\"javascript:addtext('bericht',':!:')\"><img src=\"smileys/icon_exclaim.gif\" border=0></a>
<a href=\"javascript:addtext('bericht',':idea:')\"><img src=\"smileys/icon_idea.gif\" border=0></a>
<a href=\"javascript:addtext('bericht',':mad:')\"><img src=\"smileys/icon_mad.gif\" border=0></a>
<a href=\"javascript:addtext('bericht',':|')\"><img src=\"smileys/icon_neutral.gif\" border=0></a>
<a href=\"javascript:addtext('bericht',':?:')\"><img src=\"smileys/icon_question.gif\" border=0></a>
<a href=\"javascript:addtext('bericht',':roll:')\"><img src=\"smileys/icon_rolleyes.gif\" border=0></a>
<a href=\"javascript:addtext('bericht',':surprised:')\"><img src=\"smileys/icon_surprised.gif\" border=0></a>
";
}
function color($code){
$code = str_replace("<br>", "", $code);
$code = str_replace("<br />", "", $code);
$code = str_replace(">", ">", $code);
$code = str_replace("<", "<", $code);
$code = str_replace("&", "&", $code);
$code = str_replace(""", "\"", $code);
$code = str_replace('$', '\$', $code);
$code = str_replace('\n', '\\\\n', $code);
$code = str_replace('\r', '\\\\r', $code);
$code = str_replace('\t', '\\\\t', $code);
$code = trim($code);
$code = stripslashes($code);
ob_start();
highlight_string($code);
$regel = ob_get_contents();
ob_end_clean();
$regel = explode("<br />", $regel);
$code = "";
$code .= "<table border=\"0\" width=\"100\" cellspacing=\"0\" cellpadding=\"0\">";
$code .= "<tr><td width=\"20\" align=\"right\"><code>";
for($i = 0; $i < (count($regel)); $i++){
$t = $i;
$t++;
$code .= $t."<br />";
}
$code .= "</code></td><td width=\"100\">";
for($i = 0; $i < (count($regel)); $i++){
$t = $i;
$t++;
$code .= $regel[$i]."<br />";
}
$code .= "</td></tr></table>";
$code .= "</table>";
return $code;
}
function ubb($bericht) {
$bericht = stripslashes($bericht);
$bericht = nl2br($bericht);
$bericht = eregi_replace("([a-zA-Z0-9_-]+)@([a-zA-Z0-9\._-]+)(\.[a-zA-Z]+)", "<a href=\"mailto:\\1@\\2\\3\">\\1@\\2\\3</a>", $bericht);
$bericht = str_replace("[img]","<img src=\"http://",$bericht);
$bericht = str_replace("[/img]","\">",$bericht);
$bericht = eregi_replace("\[url\]www.([^\[]*)","<a href=\"http://www.\\1\" target=_blank>\\1", $bericht);
$bericht = eregi_replace("\[url\]([^\[]*)","<a href=\"\\1\" target=_blank>\\1", $bericht);
$bericht = eregi_replace("(\[url=)([A-Za-z0-9_~&=;\?:%@#./\-]+[A-Za-z0-9/])(\])", "<a href=\"http://\\2\" target=_blank>", $bericht);
$bericht = eregi_replace("\[url](http://(.*))", "<a href=\"\\1\" target=\"_blank\">\\1", $bericht);
$bericht = eregi_replace("(\[/url\])", "</a>", $bericht);
$bericht = str_replace("http://http://", "http://", $bericht);
$bericht = str_replace("","<b>",$bericht);
$bericht = str_replace("","</b>",$bericht);
$bericht = str_replace("","<i>",$bericht);
$bericht = str_replace("","</i>",$bericht);
$bericht = str_replace("","<u>",$bericht);
$bericht = str_replace("","</u>",$bericht);
//De smilies staan hierzo
$bericht = str_replace(":)","<img src=\"smileys/icon_smile.gif\">",$bericht);
$bericht = str_replace(":cry:","<img src=\"smileys/icon_cry.gif\">",$bericht);
$bericht = str_replace(":(","<img src=\"smileys/icon_frown.gif\">",$bericht);
$bericht = str_replace(";)","<img src=\"smileys/icon_wink.gif\">",$bericht);
$bericht = str_replace(":D","<img src=\"smileys/icon_biggrin.gif\">",$bericht);
$bericht = str_replace(":S","<img src=\"smileys/icon_confused.gif\">",$bericht);
$bericht = str_replace(":P","<img src=\"smileys/icon_razz.gif\">",$bericht);
$bericht = str_replace(":B","<img src=\"smileys/icon_cool.gif\">",$bericht);
$bericht = str_replace(":$","<img src=\"smileys/icon_redface.gif\">",$bericht);
$bericht = str_replace(":O","<img src=\"smileys/icon_eek.gif\">",$bericht);
$bericht = str_replace(":sad:","<img src=\"smileys/icon_sad.gif\">",$bericht);
$bericht = str_replace("^^","<img src=\"smileys/icon_cheesygrin.gif\">",$bericht);
$bericht = str_replace(":!:","<img src=\"smileys/icon_exclaim.gif\">",$bericht);
$bericht = str_replace(":idea:","<img src=\"smileys/icon_idea.gif\">",$bericht);
$bericht = str_replace(":mad:","<img src=\"smileys/icon_mad.gif\">",$bericht);
$bericht = str_replace(":|","<img src=\"smileys/icon_neutral.gif\">",$bericht);
$bericht = str_replace(":?:","<img src=\"smileys/icon_question.gif\">",$bericht);
$bericht = str_replace(":roll:","<img src=\"smileys/icon_rolleyes.gif\">",$bericht);
$bericht = str_replace(":surprised:","<img src=\"smileys/icon_surprised.gif\">",$bericht);
$bericht = preg_replace('_\[code\](.*?)\[/code\]_ise', "color(' \\1 ')", $bericht);
$bericht = str_replace("Citaat: ","<table border="0" width="100%"><tr><td width="10"> </td><td><font size="1">Quote:</font></td></tr><tr><td width="10"> </td><td><hr>",$bericht);
$bericht = str_replace(" ","<hr></td></tr></table>",$bericht);
$bericht = preg_replace("#\[B\](.*?)\[/B\]#si","<b>\\1</b>", $bericht);
$bericht = preg_replace("#\[I\](.*?)\[/I\]#si","<i>\\1</i>", $bericht);
$bericht = preg_replace("#\[U\](.*?)\[/U\]#si","<u>\\1</u>", $bericht);
$bericht = preg_replace("#\[CENTER\](.*?)\[/CENTER\]#si","<center>\\1</center>", $bericht);
$bericht = preg_replace("#\[L\](.*?)\[/L\]#si","<div align='left'>\\1</div>", $bericht);
$bericht = preg_replace("#\[R\](.*?)\[/R\]#si","<div align='right'>\\1</div>", $bericht);
$bericht = preg_replace("#\[UIT\](.*?)\[/UIT\]#si","<div align='justify'>\\1</div>", $bericht);
$bericht = preg_replace("#\[H1\](.*?)\[/H1\]#si","<h1>\\1</h1>", $bericht);
$bericht = preg_replace("#\[H2\](.*?)\[/H2\]#si","<h2>\\1</h2>", $bericht);
$bericht = preg_replace("#\[H3\](.*?)\[/H3\]#si","<h3>\\1</h3>", $bericht);
$bericht = preg_replace("#\[H3\](.*?)\[/H3\]#si","<h3>\\1</h3>", $bericht);
$bericht = preg_replace("#\[type=Arial\](.*?)\[/type\]#si","<span class='Arial'>\\1</span>", $bericht);
$bericht = preg_replace("#\[type=TRoman\](.*?)\[/type\]#si","<span class='TRoman'>\\1</span>", $bericht);
$bericht = preg_replace("#\[type=TMS\](.*?)\[/type\]#si","<span class='TMS'>\\1</span>", $bericht);
$bericht = preg_replace("#\[type=Verdana\](.*?)\[/type\]#si","<span class='Verdana'>\\1</span>", $bericht);
$bericht = preg_replace("#\[size=10\](.*?)\[/size\]#si","<div class='TT10'>\\1</div>", $bericht);
$bericht = preg_replace("#\[size=11\](.*?)\[/size\]#si","<div class='TT11'>\\1</div>", $bericht);
$bericht = preg_replace("#\[size=12\](.*?)\[/size\]#si","<div class='TT12'>\\1</div>", $bericht);
$bericht = preg_replace("#\[size=16\](.*?)\[/size\]#si","<div class='TT16'>\\1</div>", $bericht);
$bericht = preg_replace("#\[size=20\](.*?)\[/size\]#si","<div class='TT20'>\\1</div>", $bericht);
$bericht = preg_replace("#\[URL\](.*?)\[/URL\]#si","<a href='\"\\1\"'>\"\\1\"</a>", $bericht);
$bericht = preg_replace("#\[IMG\](.*?)\[/IMG\]#si","<img src=\"\\1\">", $bericht);
return $bericht;
}
?>[/code]
|