Options/Video Embedder.
Version: 1.5
Author: Kristoffer Forsgren
Author URI: http://www.gate303.net/
Copyright 2007 Kristoffer Forsgren */
defaultSettings();
add_filter('the_content', 'videoembedder_embed');
add_action('admin_menu', 'videoembedder_add_pages');
function videoembedder_add_pages() {
add_options_page('Video Embedder Options', 'Video Embedder', 8, basename(__FILE__), 'videoembedder_options_page');
}
function videoembedder_options_page() {
if ($_POST){
$options = array (
"video_width" => $_POST["video_width"],
"video_height" => $_POST["video_height"],
"youtube_tag" => $_POST["youtube_tag"],
"google_tag" => $_POST["google_tag"],
"metacafe_tag" => $_POST["metacafe_tag"],
"liveleak_tag" => $_POST["liveleak_tag"],
"revver_tag" => $_POST["revver_tag"],
"ifilm_tag" => $_POST["ifilm_tag"],
"myspace_tag" => $_POST["myspace_tag"],
"bliptv_tag" => $_POST["bliptv_tag"],
"college_tag" => $_POST["college_tag"],
"videojug_tag" => $_POST["videojug_tag"],
"godtube_tag" => $_POST["godtube_tag"],
"veoh_tag" => $_POST["veoh_tag"],
"break_tag" => $_POST["break_tag"],
"dailymotion_tag" => $_POST["dailymotion_tag"],
"movieweb_tag" => $_POST["movieweb_tag"],
"jaycut_tag" => $_POST["jaycut_tag"],
"myvideo_tag" => $_POST["myvideo_tag"],
"vimeo_tag" => $_POST["vimeo_tag"],
"gtrailers_tag" => $_POST["gtrailers_tag"],
"viddler_tag" => $_POST["viddler_tag"],
"quicktime_tag" => $_POST["quicktime_tag"],
"windowsmedia_tag" => $_POST["windowsmedia_tag"],
);
$updated=false;
update_option('videoembedder_options', $options);
defaultSettings();
}
$videoembedder_options = get_option(videoembedder_options);
$video_height = $videoembedder_options["video_height"];
$video_width = $videoembedder_options["video_width"];
$youtube_tag = $videoembedder_options["youtube_tag"];
$google_tag = $videoembedder_options["google_tag"];
$metacafe_tag = $videoembedder_options["metacafe_tag"];
$liveleak_tag = $videoembedder_options["liveleak_tag"];
$revver_tag = $videoembedder_options["revver_tag"];
$ifilm_tag = $videoembedder_options["ifilm_tag"];
$myspace_tag = $videoembedder_options["myspace_tag"];
$bliptv_tag = $videoembedder_options["bliptv_tag"];
$college_tag = $videoembedder_options["college_tag"];
$videojug_tag = $videoembedder_options["videojug_tag"];
$godtube_tag = $videoembedder_options["godtube_tag"];
$veoh_tag = $videoembedder_options["veoh_tag"];
$break_tag = $videoembedder_options["break_tag"];
$dailymotion_tag = $videoembedder_options["dailymotion_tag"];
$movieweb_tag = $videoembedder_options["movieweb_tag"];
$jaycut_tag = $videoembedder_options["jaycut_tag"];
$myvideo_tag = $videoembedder_options["myvideo_tag"];
$vimeo_tag = $videoembedder_options["vimeo_tag"];
$gtrailers_tag = $videoembedder_options["gtrailers_tag"];
$viddler_tag = $videoembedder_options["viddler_tag"];
$quicktime_tag = $videoembedder_options["quicktime_tag"];
$windowsmedia_tag = $videoembedder_options["windowsmedia_tag"];
echo '
Help
';
echo '
Youtube help
';
echo '
For Youtube movies, check the URL and use the red part: http://www.youtube.com/watch?v=zORv8wwiadQ
';
echo '
Type ['.$youtube_tag.']zORv8wwiadQ[/'.$youtube_tag.'] in the editor to embed the video.
';
echo '
Google Video help
';
echo '
For Google Video, check the URL and use the red part: http://video.google.com/videoplay?docid=6063985264803214006
';
echo '
Type ['.$google_tag.']6063985264803214006[/'.$google_tag.'] in the editor to embed the video.
';
echo '
Metacafe help
';
echo '
For Metacafe, check the URL and use the red part: http://www.metacafe.com/watch/975366/secrets_of_google_earth/ (the trailing slash should not be included)
';
echo '
Type ['.$metacafe_tag.']975366/secrets_of_google_earth[/'.$metacafe_tag.'] in the editor to embed the video.
';
echo '
Liveleak help
';
echo '
For Liveleak, check the URL and use the red part: http://www.liveleak.com/view?i=d62_1594640234
';
echo '
Type ['.$liveleak_tag.']d62_1594640234[/'.$liveleak_tag.'] in the editor to embed the video.
';
echo '
Revver help
';
echo '
For Revver, check the URL and use the red part: http://revver.com/video/527514/ (the trailing slash should not be included)
';
echo '
Type ['.$revver_tag.']527514[/'.$revver_tag.'] in the editor to embed the video.
';
echo '
IFILM help
';
echo '
For IFILM, check the URL and use the red part: http://www.ifilm.com/video/3521648
';
echo '
Type ['.$ifilm_tag.']3521648[/'.$ifilm_tag.'] in the editor to embed the video.
';
echo '
Myspace help
';
echo '
For Myspace, check the URL and use the red part: http://vids.myspace.com/index.cfm?fuseaction=vids.individual&videoid=56884863
';
echo '
Type ['.$myspace_tag.']56884863[/'.$myspace_tag.'] in the editor to embed the video.
';
echo '
Blip.tv help
';
echo '
For Blip.tv, check the URL and use the red part: http://blip.tv/file/254683
';
echo '
Type ['.$bliptv_tag.']254683[/'.$bliptv_tag.'] in the editor to embed the video.
';
echo '
CollegeHumor help
';
echo '
For CollegeHumor, check the URL and use the red part: http://www.collegehumor.com/video:3567863
';
echo '
Type ['.$college_tag.']3567863[/'.$college_tag.'] in the editor to embed the video.
';
echo '
Videojug help
';
echo '
For Videojug, check the embed code and use the red part: <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="movie" value="http://www.videojug.com/film/player?id=3ff6e533-5eaf-4ff8-540e-02334f7ac808" /><embed src (...)
';
echo '
Type ['.$videojug_tag.']3ff6e533-5eaf-4ff8-540e-02334f7ac808[/'.$videojug_tag.'] in the editor to embed the video.
';
echo '
Godtube help
';
echo '
For Godtube, check the URL and use the red part: http://www.godtube.com/view_video.php?viewkey=83abb6308b8842ca6f1f
';
echo '
Type ['.$godtube_tag.']83abb6308b8842ca6f1f[/'.$godtube_tag.'] in the editor to embed the video.
';
echo '
Veoh help
';
echo '
For Veoh, check the URL and use the red part: http://www.veoh.com/videos/v1683095mYFrF3Xc
';
echo '
Type ['.$veoh_tag.']v1683095mYFrF3Xc[/'.$veoh_tag.'] in the editor to embed the video.
';
echo '
Break help
';
echo '
For Break, check the embed code and use the red part:<object width="464" height="392"><param name="movie" value="http://embed.break.com/NDExNjU2"></para...
';
echo '
Type ['.$break_tag.']NDExNjU2[/'.$break_tag.'] in the editor to embed the video.
';
echo '
Dailymotion help
';
echo '
For Dailymotion, check the URL and use the red part: http://www.dailymotion.com/video/xoh8j_monty-python-dead-parrot-sketch_family
';
echo '
Type ['.$dailymotion_tag.']xoh8j[/'.$dailymotion_tag.'] in the editor to embed the video.
';
echo '
Movieweb help
';
echo '
For Movieweb, check the URL and use the red part: http://www.movieweb.com/video/V07L3flnvxMUWY
';
echo '
Type ['.$movieweb_tag.']V07L3flnvxMUWY[/'.$movieweb_tag.'] in the editor to embed the video.
';
echo '
Jaycut help
';
echo '
For Jaycut, check the URL and use the red part: http://jaycut.se/mix/2493/preview
';
echo '
Type ['.$jaycut_tag.']2493[/'.$jaycut_tag.'] in the editor to embed the video.
';
echo '
Myvideo help
';
echo '
For Myvideo, check the URL and use the red part: http://www.myvideo.de/watch/3033737
';
echo '
Type ['.$myvideo_tag.']3033737[/'.$myvideo_tag.'] in the editor to embed the video.
';
echo '
Vimeo help
';
echo '
For Vimeo, check the URL and use the red part: http://www.vimeo.com/367351
';
echo '
Type ['.$vimeo_tag.']367351[/'.$vimeo_tag.'] in the editor to embed the video.
';
echo '
Gametrailers help
';
echo '
For Gametrailers, check the URL and use the red part: http://www.gametrailers.com/player/32532.html
';
echo '
Type ['.$gtrailers_tag.']32532[/'.$gtrailers_tag.'] in the editor to embed the video.
';
echo '
Viddler help
';
echo '
For Viddler, check the embed code and use the red part: <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="437" height="370" id="viddler"><param name="movie" value="http://www.viddler.com/player/6708b741/" /><param name
';
echo '
Type ['.$viddler_tag.']6708b741[/'.$viddler_tag.'] in the editor to embed the video.
';
// Local media
echo '
Quicktime help
';
echo '
For Quicktime files, enclose the URL
';
echo '
Type ['.$quicktime_tag.']http://www.yoursite.com/path/file.mov[/'.$quicktime_tag.'] in the editor to embed the video.
';
echo '
Windows Media Player help
';
echo '
For Windows Media files, enclose the URL
';
echo '
Type ['.$windowsmedia_tag.']http://www.yoursite.com/path/file.wmv[/'.$windowsmedia_tag.'] in the editor to embed the video.
';
echo '
More help
';
echo '
Visit the home page for Video Embedder for more help and support
';
echo '
Video Embedder version '.$videoembedder_options["version"].'
';
echo '
';
}
function videoembedder_embed($content)
{
$tags = get_option(videoembedder_options);
// Youtube
$tag = $tags["youtube_tag"];
preg_match_all('/\['.$tag.'\](.*?)\[\/'.$tag.'\]/is', $content, $videocode);
for ($i=0; $i < count($videocode['0']); $i++)
{
$video = $videocode['1'][$i];
$replace = $videocode['0'][$i];
$new = buildEmbed("http://www.youtube.com/v/".$video."&rel=1");
$content = str_replace($replace, $new, $content);
}
// Google
$tag = $tags["google_tag"];
preg_match_all('/\['.$tag.'\](.*?)\[\/'.$tag.'\]/is', $content, $videocode);
for ($i=0; $i < count($videocode['0']); $i++)
{
$video = $videocode['1'][$i];
$replace = $videocode['0'][$i];
$new = buildEmbed("http://video.google.com/googleplayer.swf?docId=".$video);
$content = str_replace($replace, $new, $content);
}
// Metacafe
$tag = $tags["metacafe_tag"];
preg_match_all('/\['.$tag.'\](.*?)\[\/'.$tag.'\]/is', $content, $videocode);
for ($i=0; $i < count($videocode['0']); $i++)
{
$video = $videocode['1'][$i];
$replace = $videocode['0'][$i];
$new = buildEmbed("http://www.metacafe.com/fplayer/".$video.".swf");
$content = str_replace($replace, $new, $content);
}
// Liveleak
$tag = $tags["liveleak_tag"];
preg_match_all('/\['.$tag.'\](.*?)\[\/'.$tag.'\]/is', $content, $videocode);
for ($i=0; $i < count($videocode['0']); $i++)
{
$video = $videocode['1'][$i];
$replace = $videocode['0'][$i];
$new = buildEmbed("http://www.liveleak.com/player.swf?autostart=false&token=".$video);
$content = str_replace($replace, $new, $content);
}
// Revver
$tag = $tags["revver_tag"];
$height = $tags["video_height"];
$width = $tags["video_width"];
preg_match_all('/\['.$tag.'\](.*?)\[\/'.$tag.'\]/is', $content, $videocode);
for ($i=0; $i < count($videocode['0']); $i++)
{
$video = $videocode['1'][$i];
$replace = $videocode['0'][$i];
$new = '';
$content = str_replace($replace, $new, $content);
}
// IFILM
$tag = $tags["ifilm_tag"];
preg_match_all('/\['.$tag.'\](.*?)\[\/'.$tag.'\]/is', $content, $videocode);
for ($i=0; $i < count($videocode['0']); $i++)
{
$video = $videocode['1'][$i];
$replace = $videocode['0'][$i];
$new = buildEmbed("http://www.ifilm.com/efp?flvbaseclip=".$video);
$content = str_replace($replace, $new, $content);
}
// Myspace
$tag = $tags["myspace_tag"];
preg_match_all('/\['.$tag.'\](.*?)\[\/'.$tag.'\]/is', $content, $videocode);
for ($i=0; $i < count($videocode['0']); $i++)
{
$video = $videocode['1'][$i];
$replace = $videocode['0'][$i];
$new = buildEmbed("http://lads.myspace.com/videos/vplayer.swf?m=".$video."&v=2&type=video");
$content = str_replace($replace, $new, $content);
}
// Blip.tv
$tag = $tags["bliptv_tag"];
preg_match_all('/\['.$tag.'\](.*?)\[\/'.$tag.'\]/is', $content, $videocode);
for ($i=0; $i < count($videocode['0']); $i++)
{
$video = $videocode['1'][$i];
$replace = $videocode['0'][$i];
$new = buildEmbed("http://blip.tv/scripts/flash/showplayer.swf?autostart=false&file=http%3A%2F%2Fcreationsnet%2Eblip%2Etv%2Ffile%2F".$video."%2F%3Fskin%3Drss%26sort%3Ddate&fullscreenpage=http%3A%2F%2Fblip%2Etv%2Ffullscreen%2Ehtml&fsreturnpage=http%3A%2F%2Fblip%2Etv%2Fexitfullscreen%2Ehtml&showfsbutton=true&brandlink=http%3A%2F%2Fcreationsnet%2Eblip%2Etv%2F&brandname=cre%2Eations%2Enet&showguidebutton=false&showplayerpath=http%3A%2F%2Fblip%2Etv%2Fscripts%2Fflash%2Fshowplayer%2Eswf");
$content = str_replace($replace, $new, $content);
}
// Collegehumor
$tag = $tags["college_tag"];
preg_match_all('/\['.$tag.'\](.*?)\[\/'.$tag.'\]/is', $content, $videocode);
for ($i=0; $i < count($videocode['0']); $i++)
{
$video = $videocode['1'][$i];
$replace = $videocode['0'][$i];
$new = buildEmbed("http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=".$video."&fullscreen=1");
$content = str_replace($replace, $new, $content);
}
// Videojug
$tag = $tags["videojug_tag"];
preg_match_all('/\['.$tag.'\](.*?)\[\/'.$tag.'\]/is', $content, $videocode);
for ($i=0; $i < count($videocode['0']); $i++)
{
$video = $videocode['1'][$i];
$replace = $videocode['0'][$i];
$new = buildEmbed("http://www.videojug.com/film/player?id=".$video);
$content = str_replace($replace, $new, $content);
}
// Godtube
$tag = $tags["godtube_tag"];
preg_match_all('/\['.$tag.'\](.*?)\[\/'.$tag.'\]/is', $content, $videocode);
for ($i=0; $i < count($videocode['0']); $i++)
{
$video = $videocode['1'][$i];
$replace = $videocode['0'][$i];
$new = buildEmbed("http://godtube.com/flvplayer.swf?viewkey=".$video);
$content = str_replace($replace, $new, $content);
}
// Veoh
$tag = $tags["veoh_tag"];
preg_match_all('/\['.$tag.'\](.*?)\[\/'.$tag.'\]/is', $content, $videocode);
for ($i=0; $i < count($videocode['0']); $i++)
{
$video = $videocode['1'][$i];
$replace = $videocode['0'][$i];
$new = buildEmbed("http://www.veoh.com/videodetails2.swf?player=videodetailsembedded&type=v&permalinkId=".$video."&id=anonymous");
$content = str_replace($replace, $new, $content);
}
// Break
$tag = $tags["break_tag"];
preg_match_all('/\['.$tag.'\](.*?)\[\/'.$tag.'\]/is', $content, $videocode);
for ($i=0; $i < count($videocode['0']); $i++)
{
$video = $videocode['1'][$i];
$replace = $videocode['0'][$i];
$new = buildEmbed("http://embed.break.com/".$video);
$content = str_replace($replace, $new, $content);
}
// Dailymotion
$tag = $tags["dailymotion_tag"];
preg_match_all('/\['.$tag.'\](.*?)\[\/'.$tag.'\]/is', $content, $videocode);
for ($i=0; $i < count($videocode['0']); $i++)
{
$video = $videocode['1'][$i];
$replace = $videocode['0'][$i];
$new = buildEmbed("http://www.dailymotion.com/swf/".$video);
$content = str_replace($replace, $new, $content);
}
// Movieweb
$tag = $tags["movieweb_tag"];
preg_match_all('/\['.$tag.'\](.*?)\[\/'.$tag.'\]/is', $content, $videocode);
for ($i=0; $i < count($videocode['0']); $i++)
{
$video = $videocode['1'][$i];
$replace = $videocode['0'][$i];
$new = buildEmbed("http://www.movieweb.com/v/".$video);
$content = str_replace($replace, $new, $content);
}
// jaycut
$tag = $tags["jaycut_tag"];
preg_match_all('/\['.$tag.'\](.*?)\[\/'.$tag.'\]/is', $content, $videocode);
for ($i=0; $i < count($videocode['0']); $i++)
{
$video = $videocode['1'][$i];
$replace = $videocode['0'][$i];
$new = buildEmbed("http://jaycut.se/flash/preview.swf?file=http://jaycut.se/mixes/send_preview/".$video."&type=flv&autostart=false");
$content = str_replace($replace, $new, $content);
}
// Myvideo
$tag = $tags["myvideo_tag"];
preg_match_all('/\['.$tag.'\](.*?)\[\/'.$tag.'\]/is', $content, $videocode);
for ($i=0; $i < count($videocode['0']); $i++)
{
$video = $videocode['1'][$i];
$replace = $videocode['0'][$i];
$new = buildEmbed("http://www.myvideo.de/movie/".$video);
$content = str_replace($replace, $new, $content);
}
// Vimeo
$tag = $tags["vimeo_tag"];
preg_match_all('/\['.$tag.'\](.*?)\[\/'.$tag.'\]/is', $content, $videocode);
for ($i=0; $i < count($videocode['0']); $i++)
{
$video = $videocode['1'][$i];
$replace = $videocode['0'][$i];
$new = buildEmbed("http://www.vimeo.com/moogaloop.swf?clip_id=".$video."&server=www.vimeo.com&fullscreen=1&show_title=0&show_byline=0&show_portrait=0&color=");
$content = str_replace($replace, $new, $content);
}
// Gametrailers
$tag = $tags["gtrailers_tag"];
preg_match_all('/\['.$tag.'\](.*?)\[\/'.$tag.'\]/is', $content, $videocode);
for ($i=0; $i < count($videocode['0']); $i++)
{
$video = $videocode['1'][$i];
$replace = $videocode['0'][$i];
$new = buildEmbed("http://www.gametrailers.com/remote_wrap.php?mid=".$video);
$content = str_replace($replace, $new, $content);
}
// Viddler
$tag = $tags["viddler_tag"];
preg_match_all('/\['.$tag.'\](.*?)\[\/'.$tag.'\]/is', $content, $videocode);
for ($i=0; $i < count($videocode['0']); $i++)
{
$video = $videocode['1'][$i];
$replace = $videocode['0'][$i];
$new = buildEmbed("http://www.viddler.com/player/".$video."/");
$content = str_replace($replace, $new, $content);
}
// Quicktime
$tag = $tags["quicktime_tag"];
$height = $tags["video_height"];
$width = $tags["video_width"];
preg_match_all('/\['.$tag.'\](.*?)\[\/'.$tag.'\]/is', $content, $videocode);
for ($i=0; $i < count($videocode['0']); $i++)
{
$video = $videocode['1'][$i];
$replace = $videocode['0'][$i];
$new='