Adding support for Yahoo Video

master
vbracco 2008-02-17 02:35:49 +00:00
parent 78ee1d2ec3
commit f77a625c12
3 changed files with 21 additions and 4 deletions

View File

@ -3,7 +3,7 @@
<label for="url">Video URL</label> <label for="url">Video URL</label>
<input class="txt" type="text" name="url" id="url" value="{editUrl}" size="80" /> <input class="txt" type="text" name="url" id="url" value="{editUrl}" size="80" />
<div style="color: rgb(136, 136, 136); margin-bottom: 5px; font-size: 11px; font-weight: bold;"> <div style="color: rgb(136, 136, 136); margin-bottom: 5px; font-size: 11px; font-weight: bold;">
This is the URL from the video sites YouTube or Vimeo.<br> This is the URL from the video sites YouTube, Vimeo or Yahoo.<br>
<span style="font-size: 10px; font-weight: normal;">(ie. http://youtube.com/watch?v=HcBFLN9cli0)</span> <span style="font-size: 10px; font-weight: normal;">(ie. http://youtube.com/watch?v=HcBFLN9cli0)</span>
</div> </div>
</div> </div>

View File

@ -137,6 +137,20 @@ if(!defined('entry') || !entry) die('Not a valid page');
return false; return false;
} }
function isYahooVideo($videoUrl){
if (beginsWith($videoUrl, "http://video.yahoo.com/watch/") || beginsWith($videoUrl, "http://www.video.yahoo.com/watch/"))
return true;
else
return false;
}
function getYahooVideoCode($videoUrl){
$params = explode("http://video.yahoo.com/watch/", $videoUrl);
$params2 = explode("/",$params[1]);
$values[0] = $params2[0];
$values[1] = $params2[1];
return $values;
}
function getYoutubeVideoUrl($videoUrl) { function getYoutubeVideoUrl($videoUrl) {
$params = explode("?v=", $videoUrl); $params = explode("?v=", $videoUrl);
$params2 = explode("&",$params[1]); $params2 = explode("&",$params[1]);
@ -160,6 +174,7 @@ if(!defined('entry') || !entry) die('Not a valid page');
if (isYoutubeVideo($url)) { return true; } if (isYoutubeVideo($url)) { return true; }
elseif (isVimeoVideo($url)) { return true; } elseif (isVimeoVideo($url)) { return true; }
elseif (isDailymotionVideo($url)) { return true; } elseif (isDailymotionVideo($url)) { return true; }
elseif (isYahooVideo($url)) { return true; }
else { return false; } else { return false; }
} }

View File

@ -165,11 +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"; 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)) { } elseif (isVimeoVideo($url)) {
$id_video = getVimeoVideoUrl($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)) { } elseif (isDailymotionVideo($url)) {
$id_video = getDailymotionVideoUrl($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"; 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";
} elseif (isYahooVideo($url)) {
$id_video = getYahooVideoCode($url);
return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf\"><param name=\"quality\" value=\"high\" /><param name=\"FlashVars\" value=\"event_function=YAHOO.yv.Player.SWFInterface&amp;id=".$id_video[1]."&amp;vid=".$id_video[0]."&amp;onsite=1&amp;site=video.yahoo.com&amp;page=792730258&amp;lang=en-US&amp;intl=us\" /></object>\n";
} else { } else {
return "This URL is not a supported video (YouTube, Vimeo or DailyMotion)"; return "This URL is not a supported video (YouTube, Vimeo or DailyMotion)";
} }