This is my script, it also uses geshi.(for text coloring,etc.)
function parseCode($source,$lang="html"){
$geshi = &new GeSHi($source, $lang,'');
$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 55);
return $geshi->parse_code();
}
function bbcode($string) {
$replace = array(
'@\[b\](.*?)\[/b\]@si',
'@\[url=(.*?)\](.*?)\[/url\]@si',
'@\[code lang=(.*?)\](.*?)\[/code\]@si',
'@\[code\](.*?)\[/code\]@si',
'@\[FONT=(.*?)\](.*?)\[/FONT\]@si',
'@\[u\](.*?)\[/u\]@si',
'@\[marquee\](.*?)\[/marquee\]@si',
'@\[IMG\](.*?)\[/IMG\]@si',
'@<script[^>]*?>.*?</script>@si',
'@\[quote\](.*?)\[/quote\]@si',
//'@(?i)http(.*?)@si'
);
$replacements = array ('<b>\\1</b>',
'<a href="\\1" target="_blank">\\2</a>',
'<div class="CDCodeTitle"><code>$1 Code:</code></div>'.
$this->parseCode(htmlentities('$2'),'$1'),
'<div class="CDCodeTitle"><code>Code:</code></div>'.
$this->parseCode(htmlentities('$1')),
'<font color="\\1">\\2</font>',
'<U>\\1</U>',
'<marquee>\\1</marquee>',
'<img src="\\1" border=0 alt="USER POSTED IMAGE">',
'chr(\1)',
'<div class="CDCodeTitle">Quote:</div>
<div class="CDCodeBox"> <font color=orange>\\1</font></div>',
//'<a href=\\1>\\1</a>'
);
$smileys1 = array(
'>:(',
':(',
':)',
';)',
'LOL',
':google:',
':OWNED:',
':D',
':YeahThat:',
':FLOUR',
':FINGER:',
'STFU',
':BUMP:',
':NEWBIE:',
':ANTIOLD:',
':tid:',
'when its done',
':CLOSED:',
':WORD:'
);
$smileys2 = array(
'<img src="smilies/angry.gif" />',
'<img src="smilies/sad.gif" />',
'<img src="smilies/smile.gif" />',
'<img src="smilies/wink.gif" />',
'<img src="smilies/lol.gif" />',
'<img src="smilies/google.gif" />',
'<img src="smilies/owned.gif" />',
'<img src="smilies/offtopic.gif" />',
'<img src="smilies/yeahthat.gif" />',
'<img src="smilies/flour.gif" />',
'<img src="smilies/finger.gif" />',
'<img src="smilies/gramps4.gif" />',
'<img src="smilies/bump.gif" />',
'<img src="smilies/newbie.gif" />',
'<img src="smilies/anti-old.gif" />',
'<img src="smilies/ttidead.gif" />',
'<img src="smilies/whenitsdone.gif" />',
'<img src="smilies/closed.gif" />',
'<img src="smilies/signs_word.gif" />'
);
$string = preg_replace($replace, $replacements, $string); // CDCode Filter
$string = str_replace($smileys1, $smileys2, $string); // SMileys filter
return $string;
}
i know im doing something wrong.
My problem is this: I cannot figure out how to make it show the html instead of the parsed results, when using the codebox.
I tried using a second replacement for JUST the codebox, but it didnt work.
currently, its trying to show an image instead of just showing the html
Edited by PlaGuEX, 12 May 2007 - 01:19 AM.
