- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
function replaceBBCodes($text){
$text=str_replace("/\n/m", "$0<br/>", $text);
$text = htmlspecialchars($text);
$text=nl2br($text);
$text=stripslashes($text);
$text=str_replace("!#3040#!", "&", $text);
$text=str_replace('[b]', '<strong>', $text);
$text=str_replace('[/b]', '</strong>', $text);
$text=str_replace('[i]', '<em>', $text);
$text=str_replace('[/i]', '</em>', $text);
$text=str_replace('[u]', '<u>', $text);
$text=str_replace('[/u]', '</u>', $text);
$text=str_replace('[s]', '<s>', $text);
$text=str_replace('[/s]', '</s>', $text);
$text=str_replace('[left]', '<span class="bb_left">', $text);
$text=str_replace('[/left]', '</span>', $text);
$text=str_replace('[right]', '<span class="bb_right">', $text);
$text=str_replace('[/right]', '</span>', $text);
$text=str_replace('[center]', '<span class="bb_center">', $text);
$text=str_replace('[/center]', '</span>', $text);
$text=str_replace('[justify]', '<span class="bb_justify">', $text);
$text=str_replace('[/justify]', '</span>', $text);
$text=preg_replace("#\[color=(.*?)](.*?)\[/color\]#si", '<span style="color:$1">$2</span>',$text);
$text=preg_replace("#\[size=(.*?)](.*?)\[/size\]#si", '<span style="font-size:$1px">$2</span>',$text);
$text=preg_replace("#\[a=(.*?)](.*?)\[/a\]#si", '<a href="$1">$2</a>',$text);
$text=preg_replace("#\[img=(.*?)](.*?)\[/img\]#si", '<img src="$2" alt="images" style="float:$1;margin:5px;" />',$text);
$text=preg_replace("#\[youtube](.*?)\[/youtube\]#si",'<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/$1"></param><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350"></embed></object>',$text);
$text=preg_replace("#\[youtube](.*?)\[/youtube\]#si",'<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/$1"></param><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350"></embed></object>',$text);
$text=preg_replace("#\[spoiler=(.*?)](.*?)\[/spoiler\]#si", '<div id=\'video\'><h1 class="headtt2" onclick="expandit(this)">$1</h1>
<div style="display:none;" class="sdsp"> $2</div> </div>', $text);
$text=preg_replace("#\[podspoiler=(.*?)](.*?)\[/podspoiler\]#si", '<h1 class="headtt" onclick="expandit(this)">$1</h1>
<div style="display:none;text-align:center">$2</div>', $text);
return $text;
}