I dont have time in the moment to find the snippet (also im not a programmer but i could find it if i had time.)
But i have an "smf" forum on one of my sites, and it has a module i downloded to be able to insert a youtube and co video in the forum posts.
This is so excellently made, that all the enduser needs to do is insert the url in the post !! i mean.. no bb tags no embed code necessary! just copy and paste the url from the page where your clip was found and presto!
you cant get get any better than that, here is a link to some post
http://www.dharmathai.com/forum/index.php?topic=132.0so you can look (i hope im allowed to do this, sorry in case i shouldnt post links to my site im not doing it for any other reason to help you all think of a way to get your result.. if you like the result on that link, then i would recommend downloading one of the smf forums and looking at the code.
actually , better even - here is the name of the module for you to downlaod and look at code instead.
Auto Embed Video Clips 2.1.4
whle im at it id like to compare the bb forum with the smf too..
on posting if you wish to insert a smiley in the middle of the post you have to insert smile forst (will appear always at bottom of post! regardless of where you selcted on the textfield burrrrrrrr~!! boring! and then cut and paste where you want.. urtl inserts are the same BS.. the thing just is useless.
But heres the worst thing.. to install a module you have to uplaod per ftp prgram! *separate program) On SMF forums they have an upload interface on the admin CP where oyu just upload the zip folder of the module and press install so you dont need a separate
ftp program to install../ plus you dont have to uplooad as unzipped which is so very slow.
here is the snippet i found of code from the videoclip module, along with a hack for it.
-----------------------
/********************************************************************************* Subs-AutoEmbedVideoClips.php v2.1.4 ** By Karl Benson **********************************************************************************This program is distributed in the hope that it is and will be useful, butWITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITYor FITNESS FOR A PARTICULAR PURPOSE.********************************************************************************/if (!defined('SMF')) die('Hacking attempt...');function AutoEmbedVideoClips($message){ // Access globals global $context, $modSettings; // Max auto embedded video clips *per page* to avoid flash overload. It only applies to this mod, and not other video mods. // Use -1 for no-limit (not recommended) static $autoembedmax = 12; $video_sites = array( // Put the most popular first for speed array( 'name' => 'YouTube', 'enabled' => 1, 'pattern' => 'http://(?:video.google.(?:com|com.au|co.uk|de|es|fr|it|nl|pl|ca|cn)/(?:[^"]*?))?(?:(?:www|au|br|ca|es|fr|de|hk|ie|it|jp|mx|nl|nz|pl|ru|tw|uk).)?youtube.com(?:[^"]*?)?(?:&|/|?|;|%3F|%2F)(?:video_id=|v(?:/|=|%3D|%2F))([0-9a-z-_]{11})', // Includes parsing of youtube videos on google 'movie' => 'http://www.youtube.com/v/$1&rel=1', 'width' => '425', 'height' => '350', ), array( 'name' => 'YouTube Playlist', 'enabled' => 1, 'pattern' => 'http://(?:(?:www|au|br|ca|es|fr|de|hk|ie|it|jp|mx|nl|nz|pl|ru|tw|uk).)?youtube.com(?:[^"]*?)?(?:&|/|?|;)(?:id=|p=|p/)([0-9a-f]{16})', 'movie' => 'http://www.youtube.com/p/$1&rel=1', 'width' => '425', 'height' => '355', ), array( 'name' => 'Google Video', 'enabled' => 1, 'pattern' => 'http://video.google.(com|com.au|co.uk|de|es|fr|it|nl|pl|ca|cn)/(?:videoplay|url|googleplayer.swf)?(?:[^"]*?)?docid=([0-9a-z-_]{1,20})', 'movie' => 'http://video.google.$1/googleplayer.swf?docId=$2', 'width' => '400', 'height' => '326', ), array( 'name' => 'Dailymotion', 'enabled' => 1, 'pattern' => 'http://(?:www.)?dailymotion.(?:com|alice.it)/(?:(?:[^"]*?)?video|swf)/([a-z0-9]{1,8})', 'movie' => 'http://www.dailymotion.com/swf/$1', 'width' => '420', 'height' => '335', ), array( 'name' => 'Megavideo', 'enabled' => 1, 'pattern' => 'http://(?:www.)?megavideo.com/?(?:[^"]*?)?v=([0-9a-z]{8})', 'movie' => 'http://www.megavideo.com/v/$1.0.0', 'width' => '432', 'height' => '351', ), array( 'name' => 'MetaCafe', 'enabled' => 1, 'pattern' => 'http://(?:www.)?metacafe.com/(?:watch|fplayer)/([0-9]{1,10})/', 'movie' => 'http://www.metacafe.com/fplayer/$1/metacafe.swf', 'width' => '400', 'height' => '345', ), array( 'name' => '123video.nl', 'enabled' => 1, 'pattern' => 'http://(?:www.)?123video.nl/playvideos.asp?(?:[^"]*?)?MovieID=([0-9]{1,8})', 'movie' => 'http://www.123video.nl/123video_share.swf?mediaSrc=$1', 'width' => '420', 'height' => '339', ), array( 'name' => 'Aniboom', 'enabled' => 1, 'pattern' => 'http://(?:www.)?aniboom.com/Player.aspx?(?:[^"]*?)?v=([0-9]{1,8})', 'movie' => 'http://api.aniboom.com/embedded.swf?videoar=$1', 'width' => '448', 'height' => '372', ), array( 'name' => 'AOL Uncut', 'enabled' => 1, 'pattern' => 'http://uncutvideo.aol.com/videos/([0-9a-f]{32})', 'movie' => 'http://uncutvideo.aol.com/v6.220/en-US/uc_videoplayer.swf?aID=1$1&site=http://uncutvideo.aol.com/', 'width' => '415', 'height' => '347', ), array( 'name' => 'AtomFilms', 'enabled' => 1, 'pattern' => 'http://(?:www.)?atomfilms.com/film/([0-9a-z_-]{1,40}).jsp', 'movie' => 'http://www.atomfilms.com:80/a/autoplayer/shareEmbed.swf?keyword=$1', 'width' => '426', 'height' => '350', ), array( 'name' => 'AtomFilms Uploads', 'enabled' => 1, 'pattern' => 'http://uploads.atomfilms.com/Clip.aspx?(?:[^"]*?)?key=([0-9a-f]{1,16})', 'movie' => 'http://uploads.atomfilms.com/player.swf?key=$1', 'width' => '430', 'height' => '354', ), array( 'name' => 'Biku', 'enabled' => 1, 'pattern' => 'http://(?:www.)?biku.com/opus/(?:player.swf?(?:[^"]*?)?VideoID=)?([0-9]{1,8})', 'movie' => 'http://www.biku.com/opus/player.swf?VideoID=$1&embed=true&autoStart=false', 'width' => '480', 'height' => '395', ), array( 'name' => 'BrightCove', 'enabled' => 1, 'pattern' => 'http://(?:www.)?brightcove.(tv|com)/title.jsp?(?:[^"]*?)?title=([0-9]{1,12})', 'movie' => 'http://www.brightcove.$1/playerswf?allowFullScreen=true&initVideoId=$2&servicesURL=http://www.brightcove.tv' .'&viewerSecureGatewayURL=https://www.brightcove.tv&cdnURL=http://admin.brightcove.com&autoStart=false', 'width' => '486', 'height' => '412', ), array( 'name' => 'CellFish', 'enabled' => 1, 'pattern' => 'http://cellfish.cellfish.com/(?:video|multimedia)/([0-9]{1,8})', 'movie' => 'http://cellfish.com/static/swf/player.swf?Id=$1', 'width' => '420', 'height' => '315', ), array( 'name' => 'ClipFish.de', 'enabled' => 1, 'pattern' => 'http://(?:www.)?clipfish.de/(?:player.php|videoplayer.swf)?(?:[^"]*?)?videoid=([a-z0-9]{1,20})', 'movie' => 'http://www.clipfish.de/videoplayer.swf?as=0&videoid=$1&r=1&c=0067B3', 'width' => '464', 'height' => '380', ), array( 'name' => 'CollegeHumor', 'enabled' => 1, 'pattern' => 'http://(?:www.)?collegehumor.com/video:([0-9]{1,12})', 'movie' => 'http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=$1', 'width' => '480', 'height' => '360', ), array( 'name' => 'Dave.tv', 'enabled' => 1, 'pattern' => 'http://(?:www.)?dave.tv/MediaPlayer.aspx?(?:[^"]*?)?contentItemId=([0-9]{1,10})', 'movie' => 'http://dave.tv/dbox/dbox_small.swf?configURI=http://dave.tv/dbox/config.ashx&volume=50&channelContentId=$1', 'width' => '300', 'height' => '260', ), array( 'name' => 'dv.ouou', 'enabled' => 1, 'pattern' => 'http://dv.ouou.com/(?:play/v_|v/)([a-f0-9]{14})', 'movie' => 'http://dv.ouou.com/v/$1', 'width' => '480', 'height' => '385', ), array( 'name' => 'ESPN', 'enabled' => 1, 'pattern' => 'http://sports.espn.go.com/broadband/video/videopage?(?:[^"]*?)?videoId=([0-9]{1,10})', 'movie' => 'http://sports.espn.go.com/broadband/player.swf?mediaId=$1', 'width' => '440', 'height' => '361', ), array( 'name' => 'Gametrailers', 'enabled' => 1, 'pattern' => 'http://(?:www.)?gametrailers.com/(?:player/|remote_wrap.php?mid=)([0-9]{1,10})', 'movie' => 'http://www.gametrailers.com/remote_wrap.php?mid=$1', 'width' => '480', 'height' => '392', ), array( 'name' => 'Gametrailers User Movies', 'enabled' => 1, 'pattern' => 'http://(?:www.)?gametrailers.com/(?:player/usermovies/|remote_wrap.php?umid=)([0-9]{1,10})', 'movie' => 'http://www.gametrailers.com/remote_wrap.php?umid=$1', 'width' => '480', 'height' => '392', ), array( 'name' => 'GameVideos', 'enabled' => 1, 'pattern' => 'http://(?:www.)?gamevideos.com/(?:video/id/|video/embed?(?:[^"]*?)?video=)([0-9]{1,8})', 'movie' => 'http://gamevideos.com:80/swf/gamevideos11.swf?embedded=1&autoplay=0&src=http://gamevideos.com:80/video/videoListXML%3Fid%3D$1%26adPlay%3Dfalse', 'width' => '420', 'height' => '405', ), array( 'name' => 'Glumbert', 'enabled' => 1, 'pattern' => 'http://(?:www.)?glumbert.com/media/([a-z0-9_-]{1,30})', 'movie' => 'http://www.glumbert.com/embed/$1', 'width' => '425', 'height' => '335', ), array( 'name' => 'Godtube', 'enabled' => 1, 'pattern' => 'http://(?:www.)?godtube.com/view_video.php?(?:[^"]*?)?viewkey=([0-9a-f]{20})', 'movie' => 'http://godtube.com/flvplayer.swf?viewkey=$1', 'width' => '330', 'height' => '270', ), array( 'name' => 'Gofish Videos', 'enabled' => 1, 'pattern' => 'http://(?:www.)?gofish.com/player(?:.gfp?|/fwplayer.swf?(?:[^"]*?))gfid=([0-9-]{10})', 'movie' => 'http://www.gofish.com/player/fwplayer.swf?loc=blog&gf=true&ns=false&fs=false&gfid=$1&c=grey&autoPlay=false&getAd=false&wm=false&ct=true&tb=false&svr=www.gofish.com', 'width' => '448', 'height' => '336', ), array( 'name' => 'Gofish Channels', // Channels are different than videos :( 'enabled' => 1, 'pattern' => 'http://(?:www.)?gofish.com/(?:channel.gfp|player/gfplayer.swf)(?:?gfid|(?:[^"]*?)cgfid)=([0-9-]{7})(?:[^"]*?)(?:videogfid|vgfid)=([0-9-]{7})', 'movie' => 'http://www.gofish.com/player/GFPlayer.swf?cm=false&tb=true&ap=false&co=false&ct=true&gf=true&loc=external&lp=true&sb=true&cgfid=$1&pgfid=&vgfid=$2&ad=false&svr=www.gofish.com', 'width' => '492', 'height' => '336', ), array( 'name' => 'Guba', 'enabled' => 1, 'pattern' => 'http://(?:www.)?guba.com/watch/([0-9]{1,12})', 'movie' => 'http://www.guba.com/f/root.swf?video_url=http://free.guba.com/uploaditem/$1/flash.flv&isEmbeddedPlayer=true', 'width' => '525', 'height' => '360', ), array( 'name' => 'Hulu.com (US Only)', 'enabled' => 1, 'pattern' => 'http://(?:www.)?hulu.com/(?:watch/embed/|playerembed.swf?(?:[^"]*?)?pid=)?([a-z0-9-_]{1,32})', 'movie' => 'http://www.hulu.com/embed/$1', 'width' => '567', 'height' => '350', ), array( 'name' => 'IFilm', 'enabled' => 1, 'pattern' => 'http://(?:www.)?ifilm.com/video/([0-9]{1,8})', 'movie' => 'http://www.ifilm.com/efp?flvbaseclip=$1', 'width' => '448', 'height' => '365', ), array( 'name' => 'Imageshack.us', 'enabled' => 1, 'pattern' => 'http://img([0-9]{1,5}).imageshack.us/(?:my.php?image=|img(?:[0-9]{1,5})/(?:[0-9]{1,8})/|flvplayer.swf?f=T)([a-z0-9-_]{1,20}).flv', 'movie' => 'http://img$1.imageshack.us/flvplayer.swf?f=T$2&autostart=false', 'width' => '424', 'height' => '338', ), array( 'name' => 'Koreus', 'enabled' => 1, 'pattern' => 'http://(?:www.)?koreus.com/video/([0-9a-z-]{1,50}).html', 'movie' => 'http://www.koreus.com/video/$1', 'width' => '400', 'height' => '300', ), array( 'name' => 'Libero.it', 'enabled' => 1, 'pattern' => 'http://video.libero.it/app/play(?:/index.html)??(?:[^"]*?)?id=([a-f0-9]{32})', 'movie' => 'http://video.libero.it/static/swf/eltvplayer.swf?id=$1.flv&ap=0', 'width' => '400', 'height' => '333', ), array( 'name' => 'LiveLeak', 'enabled' => 1, 'pattern' => 'http://(?:www.)?liveleak.com/(?:player.swf?autostart=false&token=|view?(?:[^"]*?)?i=)([0-9a-z]{3})_([a-z0-9]{10})', 'movie' => 'http://www.liveleak.com/player.swf?autostart=false&token=$1_$2', 'width' => '450', 'height' => '370', ), array( 'name' => 'LiveVideo', 'enabled' => 1, 'pattern' => 'http://(?:www.)?livevideo.com/(?:flvplayer/embed/|video/(?:view/)?(?:(?:[^"]*?)?/)?)([0-9a-f]{32})', 'movie' => 'http://www.livevideo.com/flvplayer/embed/$1', 'width' => '445', 'height' => '369', ), array( 'name' => 'MSN Live/Soapbox Video', 'enabled' => 1, 'pattern' => 'http://(?:soapbox|video).msn.com/video.aspx?(?:(?:[^"]*?)?vid=|from=msnvideo&showPlaylist=true&playlist=videoByUuids:uuids:)((?:[0-9a-z]{8})(?:(?:-(?:[0-9a-z]{4})){3})-(?:[0-9a-z]{12}))', 'movie' => 'http://images.video.msn.com/flash/soapbox1_1.swf?c=v&v=$1', 'width' => '432', 'height' => '364', ), array( 'name' => 'Mofile', 'enabled' => 1, 'pattern' => 'http://(?:www.|tv.)?mofile.com/([0-9a-z]{8})', 'movie' => 'http://tv.mofile.com/cn/xplayer.swf?v=$1', 'width' => '480', 'height' => '395', ), array( 'name' => 'M Thai', 'enabled' => 1, 'pattern' => 'http://video.mthai.com/player.php?(?:[^"]*?)?id=([0-9a-z]{14,20})', 'movie' => 'http://video.mthai.com/Flash_player/player.swf?idMovie=$1', 'width' => '370', 'height' => '330', ), array( 'name' => 'Mtvu', 'enabled' => 1, 'pattern' => 'http://(?:www.)?mtvu.com/video/?id=([0-9]{1,9})(?:[^"]*?)vid=([0-9]{1,9})', 'movie' => 'http://www.mtvu.com/player/embed/?CONFIG_URL=http://www.mtvu.com/player/embed/configuration.jhtml%3Fid%3D$1%26vid%3D$2$1', 'width' => '480', 'height' => '395', ), array( 'name' => 'MySpaceTv', 'enabled' => 1, 'pattern' => 'http://(?:vids.myspace|myspacetv).com/index.cfm?(?:[^"]*?)?VideoID=([0-9]{1,10})', 'movie' => 'http://lads.myspace.com/videos/myspacetv_vplayer0005.swf?m=$1&type=video', 'width' => '480', 'height' => '386', ), array( 'name' => 'MyVideo.de', 'enabled' => 1, 'pattern' => 'http://(?:www.)?myvideo.de/(?:watch|movie)/([0-9]{1,8})', 'movie' => 'http://www.myvideo.de/movie/$1', 'width' => '470', 'height' => '406', ), array( 'name' => 'OnSmash', 'enabled' => 1, 'pattern' => 'http://(?:www.|videos.)?onsmash.com/(?:v|e)/([0-9a-z]{16})', 'movie' => 'http://videos.onsmash.com/e/$1', 'width' => '448', 'height' => '374', ), array( 'name' => 'Photobucket', 'enabled' => 1, 'pattern' => 'http://(?:(?:i(?:[0-9]{1,5}).|www.)?photobucket.com/player.swf?file=http://vid|s)([0-9]{1,5}).photobucket.com/albums/((?:(?:[%0-9a-z_-]{1,50})/){1,10})(?:?(?:[^"]*?)current=)?([%0-9a-z_-]{1,50}).flv', 'movie' => 'http://i$1.photobucket.com/player.swf?file=http://vid$1.photobucket.com/albums/$2$3.flv', 'width' => '448', 'height' => '361', ), array( 'name' => 'Revver', 'enabled' => 1, 'pattern' => 'http://(?:one.|www.)?revver.com/(?:watch|video)/([0-9]{1,8})(?:/)?', 'movie' => 'http://flash.revver.com/player/1.0/player.swf?mediaId=$1', 'width' => '480', 'height' => '392', ), array( 'name' => 'Sevenload', 'enabled' => 1, 'pattern' => 'http://((?:en|tr|de|www).)?sevenload.com/(?:videos|videolar)/([0-9a-z]{1,8})', 'movie' => 'http://$1sevenload.com/pl/$2/425x350/swf', 'width' => '425', 'height' => '350', ), array( 'name' => 'Streetfire.net', 'enabled' => 1, 'pattern' => 'http://(?:www.|videos.)?streetfire.net/video/((?:[0-9a-z]{8})(?:(?:-(?:[0-9a-z]{4})){3})-(?:[0-9a-z]{12})).htm', 'movie' => 'http://videos.streetfire.net/vidiac.swf?video=$1', 'width' => '428', 'height' => '352', ), array( 'name' => 'Stupidvideos.com', 'enabled' => 1, 'pattern' => 'http://(?:www.)?stupidvideos.com/video/(?:[^"]*?)#([0-9]{1,10})', 'movie' => 'http://img.purevideo.com/images/player/player.swf?sa=1&sk=5&si=2&i=$1', 'width' => '451', 'height' => '433', ), array( 'name' => 'Tudou', 'enabled' => 1, 'pattern' => 'http://(?:www.)?tudou.com/(?:programs/view/|v/)([a-z0-9-]{1,12})', 'movie' => 'http://www.tudou.com/v/$1', 'width' => '400', 'height' => '300', ), array( 'name' => 'Veoh', 'enabled' => 1, 'pattern' => 'http://(?:www.)?veoh.com/(?:videos/|videodetails2.swf?permalinkId=)([0-9a-z]{14,16})', 'movie' => 'http://www.veoh.com/videodetails2.swf?permalinkId=$1&id=anonymous&player=videodetailsembedded&videoAutoPlay=0', 'width' => '540', 'height' => '438', ), array( 'name' => 'videotube.de', 'enabled' => 1, 'pattern' => 'http://(?:www.)?videotube.de/watch/([0-9]{1,8})', 'movie' => 'http://www.videotube.de/flash/player.swf?baseURL=http%3A%2F%2Fwww.videotube.de%2Fwatch%2F$1', 'width' => '480', 'height' => '400', ), array( 'name' => 'Vidiac', 'enabled' => 1, 'pattern' => 'http://(?:www.)?vidiac.com/video/((?:[0-9a-z]{8})(?:(?:-(?:[0-9a-z]{4})){3})-(?:[0-9a-z]{12})).htm', 'movie' => 'http://www.vidiac.com/vidiac.swf?video=$1', 'width' => '428', 'height' => '352', ), array( 'name' => 'VidMax', 'enabled' => 1, 'pattern' => 'http://(?:www.)?vidmax.com/index.php/videos/view/([0-9]{1,10})', 'movie' => 'http://vidmax.com/img/vidmax_player.swf?xml=http://vidmax.com/index.php/videos/playlist/&id=$1&autoPlay=true&bg=http://vidmax.com/img/back.jpg', 'width' => '450', 'height' => '447', ), array( 'name' => 'Vimeo', 'enabled' => 1, 'pattern' => 'http://(?:www.)?vimeo.com/([0-9]{1,12})', 'movie' => 'http://vimeo.com/moogaloop.swf?clip_id=$1&server=vimeo.com&fullscreen=1&show_title=1' .'&show_byline=1&show_portrait=0&color=01AAEA', 'width' => '400', 'height' => '225', ), array( 'name' => 'VSocial', 'enabled' => 1, 'pattern' => 'http://(?:www.)?vsocial.com/video/?d=([0-9]{1,8})', 'movie' => 'http://static.vsocial.com/flash/ups.swf?d=$1&a=0', 'width' => '410', 'height' => '400', ), array( 'name' => 'WeGame', 'enabled' => 1, 'pattern' => 'http://(?:www.)?wegame.com/watch/([0-9a-z_-]*?)/', 'movie' => 'http://wegame.com/static/flash/player2.swf?tag=$1', 'width' => '480', 'height' => '387', ), array( 'name' => 'Yahoo (Except HK)', 'enabled' => 1, 'pattern' => 'http://(?:(?:www|uk|fr|it|es|br|au|mx|de|ca).)?video.yahoo.com/video/play?(?:[^"]*?)?vid=([0-9]{1,10})', 'movie' => 'http://us.i1.yimg.com/cosmos.bcst.yahoo.com/player/media/swf/FLVVideoSolo.swf?id=$1', 'width' => '425', 'height' => '350', ), array( 'name' => 'Yahoo HK Only', 'enabled' => 1, 'pattern' => 'http://hk.video.yahoo.com/video/video.html?id=([0-9]{1,10})', 'movie' => 'http://w.video.hk.yahoo.net/video/dplayer.html?vid=$1', 'width' => '420', 'height' => '370', ), array( 'name' => 'Youku', 'enabled' => 1, 'pattern' => 'http://(?:v.youku.com/v_show/id_(?:[0-9a-z]{4})|player.youku.com/player.php/sid/)([0-9a-z]{6,14})', 'movie' => 'http://player.youku.com/player.php/sid/$1=/v.swf', 'width' => '450', 'height' => '372', ), array( 'name' => 'You.Video.Sina.com.cn', 'enabled' => 1, 'pattern' => 'http://you.video.sina.com.cn/pg/topicdetail/topicPlay.php?(?:[^"]*?)?uid=([0-9]{5,12})(?:[^"]*?)#([0-9]{5,10})', 'movie' => 'http://vhead.blog.sina.com.cn/player/outer_player.swf?auto=0&vid=$2&uid=$1', 'width' => '475', 'height' => '447', ), ); // Protect any noembed bbcoded links or objects if(preg_match_all('~(?:([noembed])(?:.*?)[/noembed]|(?:.*?))~im', $message, $noembed, PREG_SET_ORDER)) { foreach ($noembed as $a) { // Copy it so we can modify a copy $a[2] = $a[0]; // Make any non-active links active if(!empty($a[1]) && strtolower($a[1]) == '[noembed]' && !empty($modSettings['autoLinkUrls'])) // Strip the noembed tags $a[2] = StripAndFixNoEmbed($a[2]); // Protect links so they don't get caught by our preg, any so much so they are likely to be unique. $a[2] = str_replace(' 'transparent', 'quality' => 'high', 'allowFullScreen' => 'true', 'allowScriptAccess' => 'never', 'pluginspage' => 'http://www.macromedia.com/go/getflashplayer', ); // Build the params for the object (same for all) $object_params = $embed_params = ''; foreach($default_params as $a => $b) { // '; // Note the link inside the remember to close it if($context['browser']['is_ie'] && !$context['browser']['is_mac_ie']) $object .= ''; // Build the pattern/(re)set the count $pattern = '~~i'.($context['utf8'] ? 'u' : '') ; $count = 0; // Pre php 5.1.0, No count parameter, so do it the slower, inefficient way if (@version_compare(PHP_VERSION, '5.1.0') == -1) { // Grab all the matches to count the no. of replacements that will be made if(preg_match_all($pattern, $message, $out, PREG_PATTERN_ORDER)) { $count = count($out[0]); unset($out); $message = preg_replace($pattern, $object, $message, $autoembedmax); } } else // Fantastic! From 5.1.0 we can use the count parameter $message = preg_replace($pattern, $object, $message, $autoembedmax, $count); // Reduce remaining replacements allowed if($autoembedmax != -1) $autoembedmax = $autoembedmax - $count; // Tidy up unset($object, $pattern, $count); // If we've reached our max replacements OR there are no links remaining, exit; if($autoembedmax == 0 || stripos($message, ' ''', ' ' => $context['utf8'] ? "xC2xA0" : "xA0", '"' => '>">', '"' => '<"<', '<' => '.(;'"]|^)((?:http|https|ftp|ftps)://[w-_%@:|]+(?:.[w-_%]+)*(?::d+)?(?:/[w-_~%.@,?&;=#+:'\\]*|[({][w-_~%.@,?&;=#(){}+:'\\]*)*[/w-_~%@?;=#}\\])~i', '~(?<=[s>('<]|^)(www(?:.[w-_]+)+(?::d+)?(?:/[w-_~%.@,?&;=#+:'\\]*|[({][w-_~%.@,?&;=#(){}+:'\\]*)*[/w-_~%@?;=#}\\])~i'), array('$1', '$1'), $input); $input = strtr($input, array(''' => ''', $context['utf8'] ? "xC2xA0" : "xA0" => ' ', '>">' => '"', '<"<' => '"', ' '<')); } // Return it return $input;}?>
and here is a mod
CompatibilityFor SMF 1.1.x and SMF 2.0 Beta x
IntroductionAutomatically embeds video clips from links for 50+ sites including YouTube/DailyMotion/MetaCafe/GoogleVideo without the need for html or bbcode.
Just copy the url from your address bar into a post and let the mod will do the rest.
Its the ultimate user friendly way of posting clips and safe from a security standpoint.
Featureso Supports
50+ Video clip sites
- 123video.nl, Aniboom, AOL Uncut, AtomFilms, AtomFilms Uploads, Biku, BrightCove, CellFish, ClipFish.de, CollegeHumor, DailyMotion.com, DailyMotion.Alice.It, Dave.tv, dv.ouou, ESPN, Gametrailers, GameVideos, Glumbert, Godtube, GoFish, Google Video, Guba, Hulu (US Visitors Only), IFilm, Imageshack.us, Koreus, Libero.it, LiveLeak, LiveVideo, Megavideo, MetaCafe, MSN Live/Soapbox Video, Mofile, MThai, MySpaceTv, MyVideo.de, OnSmash, Photobucket, Revver, Sevenload, Sina.com.cn, Stage6, Streetfire.net, Stupidvideos.com, Tudou, Veoh, videotube.de, Vidiac, VidMax, Vimeo, VSocial, WeGame, Yahoo, Yahoo HK, Youku, YouTube (including Playlists)
o Safe from security standpoint
- They can't just embed ANY object hosted ANYWHERE, it only works for trusted supported sites
- Properly validates/sanitizes/parses the video id before including it in the url
- Disables script access (allowScriptAccess="never")
o No configuration necessary
o Works for all themes/languages, no manual edits necessary
o Use [noembed][/noembed] bbcode to prevent links being converted to embedded clips
o Hard-coded limit to number to converted links per page (to prevent flash overload/browser crash)
- Only applies to links converted by this mod (not other video clip mods)
o Disabled for Printer Friendly pages & Signatures
o Since all the videos are hosted by external sites, it won't consume your bandwidth
Since the mod only converts active links, it is recommended to have the setting "Automatically link posted URLs" enabled.
(via Admin > Posts & Topics > Bulletin Board Code)
Other than that there are no admin settings with this mod. Uninstall the mod to disable it.
Other video mods (such as my
YouTube BBCode mod) will take precedence for bbcoded links.
Note: Some users have reported that the players won't go fullscreen. This maybe caused by bugs in some versions of Adobe Flash Player when wmode="transparent" is in use. Check
[here] whether you have the latest version of Adobe Flash Player.
InstallationAny previous versions of this mod MUST be uninstalled BEFORE installing this version.
Install the mod via the SMF Package Manager, and your done. It installs on
ALL themes automatically as it only affects Source files.
There are NO theme edits required and there are NO language strings to translate.
Useful LinksSMF Package ParserManual Installation Of ModsHow Do I Modify Files?DonateHas this modification helped you? Support the developer by
Donating(Optional) Convert Old Video BBCode(Mysql users only) If you have had video bbcode mods previously installed eg [nobbc][youtube][/nobbc], then you might want to use my
convert_old_video_bbcodes.php script to convert bbcoded video links to normal links (and therefore make those links work with this mod).
Use this at your OWN risk.
This cannot be undone, so backup your database and files prior to running it.
Upload it via ftp to your directory where SMF runs from. Put your forum in maintenance mode, and then point to it in your browser.
For security reasons, remove the file once completed.
o Only applies to topics/posts.
o Works for valid links or ids
o Works for both types of bbcode (with or without sizes)
o Converts the following bbcodes
[nobbc][youtube], [yt], [ytplaylist], [stage6], [metacafe], [googlevid], [gv], [google_video], [gvideo], [dailymotion], [livevideo], [liveleak], [myvideo], [clipfish], [veoh][/nobbc]
Other uses of the bbcode will remain untouched.
o You can use the script at any time (with or without the AutoEmbedVideoClips mod installed)
CustomizingThe mod has been designed to be fully functional 'out of the box' and not require any configuration or manual edits.
However some 'hardcoded' capability/hooks have been included for those who understand php/smf and maybe wish to customize the mod.
Enable/Disable Specific SitesEg to enable/disable Stage6
Open Sources/Subs-AutoEmbedVideoClips.php
FIND
array(
'name' => 'YouTube',
'enabled' => 1,
Change the number 1 to enable, 0 to disable (note, all sites are enabled by default)
Similarly change it for any of the other sites supported to disable them.
Increase/Decrease The Limit On The Number Embedded Objects Per PageToo much flash can be bad for your health (eg it will crash your browser). Thats why the limit was put in place.
IE, Firefox, Opera etc start kicking and screaming if you get over 10 objects.
Open Sources/Subs.php
FIND
[CODE] static $autoembedmax = 12 ;[/CODE]
Change 12 to another number. Use -1 for no limit (Not Recommended).
Disabling Embedding In Specific AreasBy default embedding is disabled in signatures.
Some people requested a way to disable it for other sections such as Shoutbox.
You must find in the relevant SOURCE file where that string or data is put through the function "parse_bbc"
And on the line BEFORE it, put
$context['disableautoembedvideo'] = 1 ;
SupportPlease use the modification thread for support with this modification.
(Please don't ask me to do the edits for you)
Note: I do NOT have the time nor the desire to provide support for making or helping to make this mod support videos hosted on your OWN site.
You may be able to find someone to help by posting a request in the
Help Wanted board on the SimpleMachines.org
But be careful with regex patterns.
Note: Whilst I do take requests to support other popular video clip sites in future versions, it is
NOT possible to add support for the following sites because the video id/filename in the url is not the same as in the actual filename in the embed code.
Break.com, ebaumsworld, garagetv.be, 56.com, Blip.Tv, slideshare.net, videojug, vidlife, Filefront, IGN, Gamespot, Dipvid, youSportz, tinypic.com
I won't include sites which require users 'fishing' in the embed code for the correct file url.
No adult/porn ones please (although most will NOT work anyway).
ChangelogI am still recommending anyone who is using less than v2.1 to uninstall that version and then install the latest version.
2.1.4 - 1st March 2008- Removed Stage6 (since its
CLOSED)
- Fixed codebase to specify latest adobe flash version 9.0.115.0
- By request, moved default params into array
- Simplified the building of the object
- Fixed Gametrailer to support uservideos
For the full changelog for previous versions please see changelog.txt
so there you are! its open source so either adapt it or if XOOPS want it then contact the guy for hm to make another one for bbforums!
I just think that you cant get any better for the end user... actually if i get a bit better at php and MySQL then maybe ill make an installer
to make smf insertable in XOOPS - as it is anyway much better than phpbb
(pretty hard to use properly, Bull(s) and Boring! - PHPBB)