$pattern = array('#\[b\](.*?)\[/b\]#s',
'#\[i\](.*?)\[/i\]#s',
'#\[u\](.*?)\[/u\]#s',
'#\[url\]([^\[]*?)\[/url\]#e',
'#\[url=([^\[]*?)\](.*?)\[/url\]#e',
'#\[email\]([^\[]*?)\[/email\]#',
'#\[email=([^\[]*?)\](.*?)\[/email\]#',
'#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#s',
'#\[youtube\]http://www.youtube.(.*?)/watch\?v=(.*?)\[/youtube\]#s',
'#\[googlevid\]http://video.google.(.*?)/videoplay\?docid=(.*?)\[/googlevid\]#s',
'#\[myvideo\]http://www.myvideo.(.*?)/watch/(.*?)\[/myvideo\]#s',
'#\[clipfish\]http://www.clipfish.(.*?)/videoplay\?videoid=(.*?)\[/clipfish\]#s',
'#\[dailymotion\]http://www.dailymotion.com/swf/(.*?)\[/dailymotion\]#s',
'#\[metacafe\]http://www.metacafe.com/watch/(.*?)\[/metacafe\]#s',
'#\[ifilm\]http://www.ifilm.com/video/(.*?)\[/ifilm\]#s',
'#\[sevenload\]http://sevenload.de/videos/(.*?)\[/sevenload\]#s',
'#\[garagetv\]http://www.garagetv.be/v/(.*?)/v.aspx\[/garagetv\]#s',
'#\[revver\]http://one.revver.com/watch/(.*?)\[/revver\]#s',
'#\[guba\]http://www.guba.com/watch/(.*?)\[/guba\]#s',
'#\[myspace\]http://vids.myspace.com/index.cfm\?fuseaction=vids.individual&videoid=(.*?)\[/myspace\]#s',
'#\[yahoo\]http://video.yahoo.com/video/play\?vid=(.*?)&(.*?)\[/yahoo\]#s',
'#\[flv](.*?)\[/flv\]#',
'#\[mp3\](.*?)\[/mp3\]#',
'#\[swf height=([0-9]*)\](.*?)\[/swf\]#',
'#\[swf width=([0-9]*) height=([0-9]*)\](.*?)\[/swf\]#',
'#\[quicktime\](.*?)\[/quicktime\]#',
'#\[quicktime width=([0-9]*) height=([0-9]*)\](.*?)\[/quicktime\]#',
);// end array - don't remove //
$replace = array('<strong>$1</strong>',
'<em>$1</em>',
'<span class="bbu">$1</span>',
'handle_url_tag(\'$1\')',
'handle_url_tag(\'$1\', \'$2\')',
'<a href="mailto:$1">$1</a>',
'<a href="mailto:$1">$2</a>',
'<span style="color: $1">$2</span>',
//****** embed YouTube Videos ***********************************************
'<div class="bbvideo"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="425" height="350" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="http://www.youtube.$1/v/$2" />
<param name="quality" value="best" />
<embed src="http://www.youtube.$1/v/$2" width="425" height="350" quality="best" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>
</object></div>',
//****** endYouTube Videos **************************************************
//****** embed Google Videos ************************************************
'<div class="bbvideo"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="425" height="364" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="http://video.google.$1/googleplayer.swf?docId=$2" />
<param name="quality" value="best" />
<embed src="http://video.google.$1/googleplayer.swf?docId=$2" width="425" height="364" quality="best" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>
</object></div>',
//****** end Google Videos **************************************************
//****** embed MyVideo ******************************************************
'<div class="bbvideo"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="470" height="406" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="http://www.myvideo.$1/movie/$2" />
<param name="quality" value="best" />
<embed src="http://www.myvideo.$1/movie/$2" width="470" height="406" quality="best" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>
</object></div>',
//****** end MyVideo ********************************************************
//****** embed ClipFish *****************************************************
'<div class="bbvideo"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="464" height="380" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="http://www.clipfish.$1/videoplayer.swf?as=0&videoid=$2" />
<param name="quality" value="best" />
<embed src="http://www.clipfish.$1/videoplayer.swf?as=0&videoid=$2" width="464" height="380" quality="best" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>
</object></div>',
//****** end ClipFish *******************************************************
//****** embed Dailymotion Videos *******************************************
'<div class="bbvideo"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="520" height="406" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="http://www.dailymotion.com/swf/$1.swf" />
<param name="quality" value="best" />
<embed src="http://www.dailymotion.com/swf/$1" width="520" height="406" quality="best" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>
</object></div>',
//****** end Dailymotion Videos *********************************************
//****** embed Metacafe Videos **********************************************
'<div class="bbvideo"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="400" height="345" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="http://www.metacafe.com/fplayer/$1" />
<param name="quality" value="best" />
<embed src="http://www.metacafe.com/fplayer/$1.swf" width="400" height="345" quality="best" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>
</object></div>',
//****** end Metacafe Videos ************************************************
//****** embed iFilm Videos *************************************************
'<div class="bbvideo"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="448" height="365" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="http://www.ifilm.com/efp?flvbaseclip=$1" />
<param name="quality" value="best" />
<embed src="http://www.ifilm.com/efp?flvbaseclip=$1" width="448" height="365" quality="best" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>
</object></div>',
//****** end iFilm Videos ***************************************************
//****** embed Sevenload Videos *********************************************
'<div class="bbvideo"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="425" height="350" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="http://page.sevenload.com/swf/player.swf?id=$1" />
<param name="quality" value="best" />
<embed src="http://page.sevenload.com/swf/player.swf?id=$1" width="425" height="350" quality="best" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>
</object></div>',
//****** end Sevenload Videos ***********************************************
//****** embed GarageTV Videos **********************************************
'<div class="bbvideo"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="425" height="350" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="http://www.garagetv.be/v/$1/v.aspx" />
<param name="quality" value="best" />
<embed src="http://www.garagetv.be/v/$1/v.aspx" width="425" height="350" quality="best" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>
</object></div>',
//****** end GarageTV Videos ************************************************
//****** embed Revver Videos ************************************************
'<div class="bbvideo"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="480" height="392" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="http://flash.revver.com/player/1.0/player.swf?mediaId=$1" />
<param name="quality" value="best" />
<embed src="http://flash.revver.com/player/1.0/player.swf?mediaId=$1" width="480" height="392" quality="best" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>
</object></div>',
//****** end Revver Videos **************************************************
//****** embed Guba Videos **************************************************
'<div class="bbvideo"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="480" height="392" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="http://www.guba.com/f/root.swf?video_url=http://free.guba.com/uploaditem/$1/flash.flv" />
<param name="quality" value="best" />
<embed src="http://www.guba.com/f/root.swf?video_url=http://free.guba.com/uploaditem/$1/flash.flv" width="480" height="392" quality="best" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>
</object></div>',
//****** end Guba Videos ****************************************************
//****** embed mySpace Videos ***********************************************
'<div class="bbvideo"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="480" height="392" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="http://lads.myspace.com/videos/vplayer.swf?m=$1" />
<param name="quality" value="best" />
<embed src="http://lads.myspace.com/videos/vplayer.swf?m=$1" width="480" height="392" quality="best" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>
</object></div>',
//****** end mySpace Videos *************************************************
//****** embed Yahoo Videos **************************************************
'<div class="bbvideo"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="480" height="392" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="http://us.i1.yimg.com/cosmos.bcst.yahoo.com/player/media/swf/FLVVideoSolo.swf?id=$1" />
<param name="quality" value="best" />
<embed src="http://us.i1.yimg.com/cosmos.bcst.yahoo.com/player/media/swf/FLVVideoSolo.swf?id=$1" width="480" height="392" quality="best" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>
</object></div>',
//****** end Yahoo Videos ***************************************************
//****** embed FLV and Mp3 for JW - Players *********************************
'<div class="bbvideo"><embed src="mod_flvplayer.swf" width="464" height="380" allowfullscreen="true" flashvars="&height=380&width=464&autostart=false&usefullscreen=false&file=$1" /></embed></div>',
'<div class="bbvideo"><embed src="mod_mp3player.swf" width="320" height="20" allowfullscreen="true" flashvars="&height=20&width=320&showdownload=true&showicons=false&autostart=false&file=$1" /></embed></div>',
//****** end FLV and Mp3 for JW - Players ***********************************
//+++++++++++++++++++++++++++++++++++++++ SWF with fixed width set to 100% ++++++++++++++++++++++++++++++++++++++++++++//
//****** embed SWF **********************************************************
'<div class="bbvideo"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="100%" height="$1" align="middle" />
<param name="scale" value="noscale" />
<param name="allowScriptAccess" value="never" />
<param name="movie" value="$2" />
<param name="quality" value="best" />
<param name=menu value="false">
<param name="bgcolor" value="#000000" />
<param name="wmode" value="transparent" />
<embed align="middle" src="$2" quality="best" bgcolor="#000000" width="100%" height="$1" scale="noscale" wmode="transparent" allowScriptAccess="never" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object></div>',
//******** end SWF **********************************************************
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
//+++++++++++++++++++++++++++++++++++++++ SWF with width settings inside BBCode +++++++++++++++++++++++++++++++++++++++//
//****** embed SWF **********************************************************
'<div class="bbvideo"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="$1 height="$2" align="middle" />
<param name="scale" value="noscale" />
<param name="allowScriptAccess" value="never" />
<param name="movie" value="$3" />
<param name="quality" value="best" />
<param name=menu value="false">
<param name="bgcolor" value="#000000" />
<param name="wmode" value="transparent" />
<embed align="middle" src="$3" quality="best" bgcolor="#000000" width="$1" height="$2" scale="noscale" wmode="transparent" allowScriptAccess="never" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object></div>',
//******** end SWF **********************************************************
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
//+++++++++++++++++++++++++++++++++++++++ Quicktime with fixed width and height +++++++++++++++++++++++++++++++++++++++//
//****** embed QuickTime ****************************************************
'<div class="bbvideo"><object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="480" height="376" >
<param name="type" value="video/quicktime" />
<param name="scale" value="aspect"/>
<param name="cache" value="true"/>
<param name="src" value="$1"/>
<param name="autoplay" value="false"/>
<param name="controller" value="true"/>
<param name="loop" value="false"/>
<param name="bgcolor" value="transparent" />
<embed width="480" height="376" src="$1" type="video/quicktime" controller="true" autoplay="false" bgcolor="transparent" cache="true" scale="aspect" loop="false" pluginspage="http://www.apple.com/quicktime/download/"></embed>
</object></div>',
//****** end QuickTime *******************************************************
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
//+++++++++++++++++++++++++++++++++ Quicktime with dimensions settings inside BBCode +++++++++++++++++++++++++++++++++//
//****** embed QuickTime ****************************************************
'<div class="bbvideo"><object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="$1" height="$2" >
<param name="type" value="video/quicktime" />
<param name="scale" value="aspect"/>
<param name="cache" value="true"/>
<param name="src" value="$3"/>
<param name="autoplay" value="false"/>
<param name="controller" value="true"/>
<param name="loop" value="false"/>
<param name="bgcolor" value="transparent" />
<embed width="$1" height="$2" src="$3" type="video/quicktime" controller="true" autoplay="false" bgcolor="transparent" cache="true" scale="aspect" loop="false" pluginspage="http://www.apple.com/quicktime/download/"></embed>
</object></div>',
//****** end QuickTime *******************************************************
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
);// end array - don't remove //