DailyMotion support(patch by Michel Benard)

master
pecesama 2008-01-15 23:42:00 +00:00
parent 080503eaf6
commit 5f2003dc36
2 changed files with 21 additions and 3 deletions

View File

@ -126,11 +126,25 @@ if(!defined('entry') || !entry) die('Not a valid page');
$params = explode("?v=", $videoUrl);
$params2 = explode("&",$params[1]);
return $params2[0];
}
}
function isDailymotionVideo($videoUrl) {
if (beginsWith($videoUrl, "http://www.dailymotion.com/video/") || beginsWith($videoUrl, "http://dailymotion.com/video/"))
return true;
else
return false;
}
function getDailymotionVideoUrl($videoUrl) {
$params = explode("video/", $videoUrl);
$params2 = explode("_",$params[1]);
return $params2[0];
}
function isVideo($url) {
if (isYoutubeVideo($url)) { return true; }
elseif (isVimeoVideo($url)) { return true; }
elseif (isDailymotionVideo($url)) { return true; }
else { return false; }
}

View File

@ -165,9 +165,13 @@ class gelato extends Conexion_Mysql {
return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://www.youtube.com/v/".$id_video."\"><param name=\"movie\" value=\"http://www.youtube.com/v/".$id_video."\" /></object>\n";
} elseif (isVimeoVideo($url)) {
$id_video = getVimeoVideoUrl($url);
return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://www.vimeo.com/moogaloop.swf?clip_id=".$id_video."\"><param name=\"movie\" value=\"http://www.vimeo.com/moogaloop.swf?clip_id=".$id_video."\" /></object>\n";
return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://www.vimeo.com/moogaloop.swf?clip_id=".$id_video."\"><param name=\"movie\" value=\"http://www.vimeo.com/moogaloop.swf?clip_id=".$id_video."\" /></object>\n";}
elseif (isDailymotionVideo($url)) {
$id_video = getDailymotionVideoUrl($url);
return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://www.dailymotion.com/swf/".$id_video."\"><param name=\"movie\" value=\"http://www.dailymotion.com/swf/".$id_video."\" /></object>\n";
} else {
return "This URL is not a supported video (YouTube or Vimeo)";
return "This URL is not a supported video (YouTube, Vimeo or DailyMotion)";
}
}