I called the tags [vid][/vid] I would like to be able to just input the youtube id to embed it in the post this is what I have sofar for the bbcode.
can someone tell me what Im doing wrong? Currently it posts a blank flash image with the id of the video on the side.
- Code: Select all
function bb($r) {
$r = trim($r);
$r = htmlentities($r);
$r = nl2br($r);
$r = str_replace(" "," ",$r);
$r = str_replace("[vid]","<object width='425' height='350'><param name='movie' value='http://www.youtube.com/watch?v={param}'></param><embed src='http://www.youtube.com/watch?v={param}' type='application/x-shockwave-flash' width='425' height='350'></embed></object>",$r);
$r = str_replace("[/vid]","",$r);
$r = str_replace("\r\n","<br>",$r);
$r = str_replace("[b]","<b>",$r);
$r = str_replace("[/b]","</b>",$r);
$r = str_replace("[img]","<img src='",$r);
$r = str_replace("[/img]","'>",$r);
$r = str_replace("[IMG]","<img src='",$r);
$r = str_replace("[/IMG]","'>",$r);
$r = str_replace("[s]","<s>",$r);
$r = str_replace("[/s]","</s>",$r);
$r = str_replace("[ul]","<ul>",$r);
$r = str_replace("[/ul]","</ul>",$r);
$r = str_replace("[li]","<li>",$r);
$r = str_replace("[/li]","</li>",$r);
$r = str_replace("[ol]","<ol>",$r);
$r = str_replace("[/ol]","</ol>",$r);
$r = str_replace("[quote]","<br /><table width='80%' bgcolor='#ffff66' align='center'><tr><td style='border: 1px dotted black'><font color=black><b>Quote:<br></b>",$r);
$r = str_replace("[/quote]","</font></td></tr></table>",$r);
$r = str_replace("[i]","<i>",$r);
$r = str_replace("[/i]","</i>",$r);
$r = str_replace("[u]","<u>",$r);
$r = str_replace("[/u]","</u>",$r);
$r = str_replace("[spoiler]",'[spoiler]<font bgcolor ="#000000" color="#DDDDDD">',$r);
$r = str_replace("[/spoiler]","</font>[/spoiler]",$r);
$r = preg_replace("/\[size=(.*)\](.*)\[\/size\]/Usi", "<span style=\"font-size:\\1px\">\\2</span>", $r);
$r = preg_replace("/\[color=(\#[0-9A-F]{6}|[a-z]+)\](.*)\[\/color\]/Usi", "<span style=\"color:\\1\">\\2</span>", $r);

