ops...
Mene ero dimenticato
Codice PHP:
<?php
function bbcode($var){
$search = array(
'/\[b\](.*?)\[\/b\]/is',
'/\[i\](.*?)\[\/i\]/is',
'/\[u\](.*?)\[\/u\]/is',
'/\[img\](.*?)\[\/img\]/is',
'/\[url\](.*?)\[\/url\]/is',
'/\[url\=(.*?)\](.*?)\[\/url\]/is',
'/\[quote\](.*?)\[\/quote\]/is',
'/\[youtube\](.*?)\[\/youtube\]/is',
'/\[code\](.*?)\[\/code\]/is',
'/\[marquee\](.*?)\[\/marquee\]/is',
);
$replace = array(
'<strong>$1</strong>',
'<em>$1</em>',
'<u>$1</u>',
'<img src="$1" />',
'<a href="$1">$1</a>',
'<a href="$1">$2</a>',
'<div class="forum_quote">$1</div>',
'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0">
<param name="movie" value="$3" />
<param name="quality" value="best" />
<param name="play" value="true" />
<embed pluginspage="http://www.macromedia.com/go/getflashplayer" src="$1" type="application/x-shockwave-flash" quality="best" play="true"></embed>
</object>',
'<div class="forum_code">$1</div>',
'<marquee>$1</marquee>',
);
$var = preg_replace ($search, $replace, $var);
}
return $var;
?>
Il codice l'ho preso da qui e poi l'ho leggermente riadattato...