I need them for my site not a forum. I found this UBB somewhere: array( "#\[youtube\]([a-zA-Z0-9-]+)\[/youtube\]#i", '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/\1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/\1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>' ), PHP: Can anyone help me transform those for my site? bold code for example is works like this in my site: $in= str_replace("[b]","<b>", $in);$in= str_replace("[/b]","</b>", $in); PHP: So the youtube could should be something like that I think.. They shouldn't be able to link to any other sites than youtube and [a-zA-Z0-9-]
This should take care of it: $in = preg_replace("#\[youtube\]([a-zA-Z0-9-]+)\[/youtube\]#i", '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/\1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/\1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>', $in); PHP: