Allows users to auto-embed video simply by adding a link to the video. This mod will cause all prior supported video links to now show up as embedded videos, and trims the excess white off the youtube videos. This mod also generates a DownThisVideo! link. For an example of it's usage go here: http://www.opposingdigits.com/forums/viewtopic.php?t=213
Open:
includes/bbcode.php
Find:
Code:
function make_clickable($text)
{
$text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $text);
// pad it with a space so we can match things at the start of the 1st line.
$ret = ' ' . $text;
After Add:
Code:
// youtube code..
$ret = preg_replace("#(^|[\n ]|<a(.*?)>)http://(www\.)?youtube\.com/watch\?v=([a-zA-Z0-9\-_]+)(</a>)?#im",' <br /><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/$4"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/$4" type="application/x-shockwave-flash" wmode="transparent" width="425" height="338"></embed></object><br /><br /><a href="http://downthisvideo.com/?url=http://www.youtube.com/watch?v=$4" target="_blank">insert download message or html for image here</a>', $ret);
// google code..
$ret = preg_replace("#(^|[\n ]|<a(.*?)>)http://video.google.([a-z]+)/videoplay\?docid=([0-9\-_]+)(</a>)?#im",' <br /><embed style="width:400px; height:326px;" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.$3/googleplayer.swf?docId=$4"> </embed><br /><br /><a href="http://downthisvideo.com/?url=http://video.google.com/videoplay?docid=$4" target="_blank">insert download message or html for image here</a>', $ret);
// metacafe..
$ret = preg_replace("#(^|[\n ]|<a(.*?)>)http://(www\.)?metacafe\.com/watch/([0-9\/-_]+)(</a>)?#im",' <br /><embed src="http://www.metacafe.com/fplayer/$4.swf" width="400" height="345" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed><br /><br /><a href="http://downthisvideo.com/?url=http://www.metacafe.com/watch/$4/" target="_blank">insert download message or html for image here</a>', $ret);
// glumbert ..
$ret = preg_replace("#(^|[\n ]|<a(.*?)>)http://(www\.)?glumbert\.com/media/([a-zA-Z0-9\-_]+)(</a>)?#im",' <br /><embed src="http://www.glumbert.com/embed/$4" type="application/x-shockwave-flash" wmode="transparent" width="448" height="336"></embed><br /><br /><a href="http://cdn.glumbert.com/video/flash/$4.flv" target="_blank">insert download message or html for image here</a>', $ret);
// vimeo ..
$ret = preg_replace("#(^|[\n ]|<a(.*?)>)http://(www\.)?vimeo\.com/clip:([0-9]+)(</a>)?#im",' <br /><embed src="http://www.vimeo.com/moogaloop.swf?clip_id=$4" quality="best" scale="exactfit" width="400" height="300" type="application/x-shockwave-flash"></embed><br /><br /><a href="http://downthisvideo.com/?url=http://www.vimeo.com/clip:$4" target="_blank">insert download message or html for image here</a><br /><br />', $ret);
Replace:
"insert download message or html for image here" in the code with download message like "Download this Video!" or use html to use an image. Save, and close.