Good job banging it out!

there are many ways to do it and you found one that works for you. this is commendable wink

For the less regex inclined, i recommend regexbuddy or regexmagic tools (not free).. they allow you to play with regexes in various scenarios to test out before turning it loose..

Also, in watching you go thru the hassle of learning the 'how to', it would really be nice to have a more automated way (which i have recommended in the features thread) such as oEmbed.

Smugmug is an oEmbed provider, along with many others like Youtube and Flickr etc... what this API (or really xml specification) provides is a way to ASK a site like smugmug or their ilk what should be the embed code for a supplied video, photo or other resource like a slideshow..

The oEmbed provider then informs the client (ubbthreads in this scenario) what the embed code should be 'automagically'..

Soooo, to take this to a real world use.. this would allow ubb.threads to be simply told that a certain URL is an oEmbed provider, then ubb.threads can take a user inserted URL and turn it into an auto embed with the ubb.threads admin not having to know anything other than to have whitelisted the site..

Wordpress does this now and their list of providers is:

PHP Code
 $this->providers = apply_filters( 'oembed_providers', array(
			'#http://(www\.)?youtube.com/watch.*#i'		 => array( 'http://www.youtube.com/oembed',			true  ),
			'http://youtu.be/*'							 => array( 'http://www.youtube.com/oembed',			false ),
			'http://blip.tv/file/*'						 => array( 'http://blip.tv/oembed/',				   false ),
			'#http://(www\.)?vimeo\.com/.*#i'			   => array( 'http://www.vimeo.com/api/oembed.{format}', true  ),
			'#http://(www\.)?dailymotion\.com/.*#i'		 => array( 'http://www.dailymotion.com/api/oembed',	true  ),
			'#http://(www\.)?flickr\.com/.*#i'			  => array( 'http://www.flickr.com/services/oembed/',   true  ),
			'#http://(.+)?smugmug\.com/.*#i'				=> array( 'http://api.smugmug.com/services/oembed/',  true  ),
			'#http://(www\.)?hulu\.com/watch/.*#i'		  => array( 'http://www.hulu.com/api/oembed.{format}',  true  ),
			'#http://(www\.)?viddler\.com/.*#i'			 => array( 'http://lab.viddler.com/services/oembed/',  true  ),
			'http://qik.com/*'							  => array( 'http://qik.com/api/oembed.{format}',	   false ),
			'http://revision3.com/*'						=> array( 'http://revision3.com/api/oembed/',		 false ),
			'http://i*.photobucket.com/albums/*'			=> array( 'http://photobucket.com/oembed',			false ),
			'http://gi*.photobucket.com/groups/*'		   => array( 'http://photobucket.com/oembed',			false ),
			'#http://(www\.)?scribd\.com/.*#i'			  => array( 'http://www.scribd.com/services/oembed',	true  ),
			'http://wordpress.tv/*'						 => array( 'http://wordpress.tv/oembed/',			  false ),
			'#http://(answers|surveys)\.polldaddy.com/.*#i' => array( 'http://polldaddy.com/oembed/',			 true  ),
			'#http://(www\.)?funnyordie\.com/videos/.*#i'   => array( 'http://www.funnyordie.com/oembed',		 true  ),
		) ); 


so bottom line, there is no need for custom bbcode.. the user simply pastes a link to the resource (vid, image, slideshow) and it just happens..

that would be what i would like to see for the future..

see oEmbed information for more details. the code that would be needed to be added to bbcode.inc.php would be very minimal (in the handle_url routine for 'magic urls' ) and i have it working on a coupla boards as proof of concept smile

also, there are many more oEmbed providers than that list shows..

so take youtube as an example.. http://www.youtube.com/watch?v=vF6PyIML0hI is a link to a video..

ubb.threads would 'ask' youtube what the embed code might be (note that it changes every so often - rare).. the query (standard) would be: http://www.youtube.com/oembed/?url=http://www.youtube.com/watch?v=vF6PyIML0hI&format=xml

youtube answers with xml (or json)

Code
<oembed>
<provider_url>http://www.youtube.com/</provider_url>

<title>New York Lottery Sweet Million "Bunnies"</title>

&#8722;
<html>
<object width="480" height="295">
<param name="movie" value="http://www.youtube.com/v/vF6PyIML0hI&fs=1"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/vF6PyIML0hI&fs=1" 
type="application/x-shockwave-flash" 
width="480" height="295" 
allowscriptaccess="always" 
allowfullscreen="true"></embed></object>
</html>
<author_name>born4kicks</author_name>
<height>295</height>
<thumbnail_width>480</thumbnail_width>
<width>480</width>
<version>1.0</version>
<author_url>http://www.youtube.com/user/born4kicks</author_url>
<provider_name>YouTube</provider_name>
<thumbnail_url>http://i3.ytimg.com/vi/vF6PyIML0hI/hqdefault.jpg</thumbnail_url>
<type>video</type>
<thumbnail_height>360</thumbnail_height>
</oembed>

the ubbcode parser grabs it and puts it into the post like so:


note that there is also much more stuff that can be used from the response, like a thumbnail (would make for a MUCH quicker display in a thread, prior to click) etc etc.. wink

final note: peeps that wanna keep the custom bbcode should be allowed to.. no need to kill that off, because it can be used for a LOT more than just embedding vids.. this would just be an OPTION to be used in TANDEM or in LIEU of current stuff wink