Ben bezig met zelf een forum schrijven, maar het deel van de BBCode gaat erg mis. Ik heb nu:
Nou wil ik 't zo maken dat je geen icoontjes / afbeelding in een [ code] ... [/code] hebt, dus dat ALLES wordt geparsed behalve dat wat tussen [ code] en [/code] staat ...
iemand enig idee?
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
| <? function code($f){ $f = str_replace("&", "&", $f); $regels = count(explode("<br>", nl2br($f))); $regels2 = count(explode("<br \>", nl2br($f))); $regels3 = count(explode("\n", nl2br($f))); $f = str_replace(">", ">", $f); $f = str_replace("<", "<", $f); $f = str_replace(""", "\"", $f); $f = str_replace("\"", "\\\"", $f); $f = str_replace("´", "`", $f); $f = htmlspecialchars($f); $code = str_replace("&", "&", $code); $return = "<div style=\"width: 550px; overflow: auto; table-style: fixed;\">Code:<br><table width=\"400\" style=\"font-family: courier new; font-size: 12px;\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\"><tr><td valign=\"top\">"; for ($i = 1; $i < ($regels + $regels2 + $regels3); $i++){ $return .= $i . "<br>"; } $return .= "</td><td valign=\"top\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td nowrap>" . stripslashes(nl2br($f)) . "</td></tr></table></td></tr></table></div>"; return $return; } function quote($f){ return "<div class=\"mainquote\">Quote:<div class=\"quote\">" . $f. "</div></div>"; } function ubb($f){ $f = nl2br($f); $query = mysql_query("SELECT * FROM `" . $GLOBALS['prefix'] . "smilies`"); while ($row = mysql_fetch_array($query)){ $f = str_replace($row['shortcut'], "[img]'"[/img]", $f); } $f = preg_replace("/\[quote](.+?)\\[\/quote]/ise", "quote('\\1')", ($f)); $f = preg_replace("/\[message=(.*?)\](.+?)\\[\/message]/isD", '<a href="singlepost.php?post=\\1">\\2</a>', ($f)); $f = preg_replace("/\[img]http:\/\/(.+?)\\[\/img]/isD", '[img]"http://\\1"[/img]', ($f)); $f = preg_replace('#(^|[\n ])(http://[^ \n\r\t<]*)#is', '\\1<a href="\\2" target="_BLANK">\\2</a>', $f); $f = preg_replace('#(^|[\n ])(www.[^ \n\r\t<]*)#is', '\\1<a href="http://\\2" target="_BLANK">\\2</a>', $f); $f = str_replace("[b]", "<b>", ($f)); $f = str_replace("[/b]", "</b>", ($f)); $f = str_replace("[i]", "<i>", ($f)); $f = str_replace("[/i]", "</i>", ($f)); $f = str_replace("[u]", "<u>", ($f)); $f = str_replace("[/u]", "</u>", ($f)); return $f; } |
Nou wil ik 't zo maken dat je geen icoontjes / afbeelding in een [ code] ... [/code] hebt, dus dat ALLES wordt geparsed behalve dat wat tussen [ code] en [/code] staat ...
iemand enig idee?

[ Voor 26% gewijzigd door lennartkocken op 05-05-2006 20:16 ]