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:
48:
49:
50:
51:
|
function changetext($str)
{
$folder = "http://www.url.de/images/smilies";
$smilie1 = "<img src='$folder/smile.gif' alt=':)' />";
$smilie2 = "<img src='$folder/wink.gif' alt=';)' />";
$smilie3 = "<img src='$folder/biggrin.gif' alt=':D' />";
$smilie4 = "<img src='$folder/crying.gif' alt=':)' />";
$smilie5 = "<img src='$folder/crying.gif' alt=';)' />";
$smilie6 = "<img src='$folder/crying.gif' alt=':D' />";
$str = trim($str);
$str = preg_replace('/\S{60}/', '\0 ', $str);
$str = htmlspecialchars($str);
$str = preg_replace('/(\s{2})\s+/', '\1', $str);
$str = preg_replace('=\[b\](.*)\[/b\]=Uis',
'<b>\1</b>',
$str);
$str = preg_replace('=\[i\](.*)\[/i\]=Uis',
'<i>\1</i>',
$str);
$str = preg_replace('=\[u\](.*)\[/u\]=Uis',
'<u>\1</u>',
$str);
$str = preg_replace('=\[list\](.*)\[/list\]=Uis',
'<list>\1</list>',
$str);
$str = preg_replace('=\[img\](.*)\[/img\]=Uis',
'<img src=\1>',
$str);
$str = preg_replace('=\[url\](.*)\[/url\]=Uis',
'<a href="\1" target=\"_blank\">\1</a>',
$str);
$str = preg_replace('#\[size=(.*)\](.*)\[/size\]#Uis',
'<span style="font-size: \1px;">\2</span>',
$str);
$str = preg_replace('#\[url=(.*)\](.*)\[/url\]#Uis',
'<a href="\1" target=\"_blank\">\2</a>',
$str);
$str = preg_replace('#(^|[^"=]{1})(http://|ftp://|mailto:|news:)([^\s<>]+)([\s\n<>]|$)#sm',
'\1<a href="\2\3" target=\"_blank\">\2\3</a>\4',
$str);
$str = str_replace("[*]","<li>", $str);
$str = str_replace(':)', $smilie1 , $str);
$str = str_replace(';)', $smilie2 , $str);
$str = str_replace(':D', $smilie3 , $str);
$str = str_replace(';(', $smilie4 , $str);
$str = str_replace('=(', $smilie5 , $str);
$str = str_replace(':(', $smilie6 , $str);
// ...
$str = nl2br($str);
return $str;
} |