
Código :
preg_replace("#\[flash width=([0-6]?[0-9]?[0-9]) height=([0-4]?[0-9]?[0-9])\](([a-z]+?)://([^, \n\r]+))\[\/flash\]#si","<OBJECT WIDTH=\\1 HEIGHT=\\2><PARAM NAME=movie VALUE=\\3><PARAM NAME=quality VALUE=high><PARAM NAME=wmode VALUE=transparent><EMBED src=\\3 quality=high scale=noborder wmode=transparent WIDTH=\\1 HEIGHT=\\2 TYPE=\"application/x-shockwave-flash\"></EMBED></OBJECT>", $entry);
al poner el siguiente bbcode
Código :
[flash width=512 height=512]http://213.251.135.30/flash-mania/flash3/sport/tennis/055.swf[/flash]
tendria que mostrarme como resultado
Código :
<OBJECT WIDTH=512 HEIGHT=512><PARAM NAME=movie VALUE=http://213.251.135.30/flash-mania/flash3/sport/tennis/055.swf><PARAM NAME=quality VALUE=high><PARAM NAME=wmode VALUE=transparent><EMBED src=http://213.251.135.30/flash-mania/flash3/sport/tennis/055.swf quality=high scale=noborder wmode=transparent WIDTH=512 HEIGHT=512 TYPE=\"application/x-shockwave-flash\"></EMBED></OBJECT>
Es parte de una funcion para parsear bbcode (con soporte para flash). La funcion completa es esta:
Código :
function bbcode ($entry) { $entry = eregi_replace("\n","<br>",$entry); $entry = eregi_replace("\[b\]([^\[]+)\[/b\]","<b>\\1</b>",$entry); $entry = eregi_replace("\[i\]([^\[]+)\[/i\]","<i>\\1</i>",$entry); $entry = eregi_replace("\[u\]([^\[]+)\[/u\]","<u>\\1</u>",$entry); $entry = eregi_replace("\[mail\]([^\[]+)\[/mail\]","<a href=\"mailto:\\1\">\\1</a>",$entry); $entry = preg_replace("#\[size=([1-2]?[0-9])\](.*?)\[/size\]#si", "<FONT SIZE=\\1>\\2</FONT>", $entry); $entry = eregi_replace("\[url\]([^\[]+)\[/url\]","<a href=\"\\1\" >\\1</a>",$entry); $entry = eregi_replace("\[url=\"([^\"]+)\"]([^\[]+)\[/url\]","<a href=\"\\1\" >\\2</a>",$entry); // Simple Link $entry = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "<a href=\"\\2\">\\2</a>", $entry); // [IMG]source.jpg[/IMG] $entry = eregi_replace("\[img\]([^\[]+)\[/img\]","<img USEMAP=\"\" onload=\"javascript:if(this.width>577 ){this.width=577;}\" src=\"\\1\" border=\"0\">",$entry); // [mp3] // new bbcode [STREAM]source.mp3[/STREAM] $entry = eregi_replace("\[stream\]([^\[]+)\[/stream\]","<object type=\"application/x-shockwave-flash\" data=\"http://www.1pixelout.net/wp-content/plugins/audio-player/player.swf\" width=\"290\" height=\"24\" id=\"audioplayer1\"> <param name=\"movie\" value=\"http://www.1pixelout.net/wp-content/plugins/audio-player/player.swf\"/><param name=\"FlashVars\" value=\"playerID=1&autostart=no&leftbg=0xcccccc&&lefticon=0x767676&rightbg=0xB4B2B4&rightbghover=0x999999&righticon=0xFFFFFF&righticonhover=0xFFFFFF&text=0x666666&slider=0x666666&track=0xFFFFFF&border=0x666666&loader=0xE4E4E4&soundFile=\\1\" /> <param name=\"quality\" value=\"high\"/><param name=wmode value=transparent><param name=\"menu\" value=\"false\"/></object>",$entry); // [FLASH WIDTH=x HEIGHT=y]source.swf[/FLASH] $entry = preg_replace("#\[flash width=([0-6]?[0-9]?[0-9]) height=([0-4]?[0-9]?[0-9])\](([a-z]+?)://([^, \n\r]+))\[\/flash\]#si","<OBJECT WIDTH=\\1 HEIGHT=\\2><PARAM NAME=movie VALUE=\\3><PARAM NAME=quality VALUE=high><PARAM NAME=wmode VALUE=transparent><EMBED src=\\3 quality=high scale=noborder wmode=transparent WIDTH=\\1 HEIGHT=\\2 TYPE=\"application/x-shockwave-flash\"></EMBED></OBJECT>", $entry); return $entry; }