Adding support for Yahoo Video
parent
78ee1d2ec3
commit
f77a625c12
|
|
@ -3,7 +3,7 @@
|
|||
<label for="url">Video URL</label>
|
||||
<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;">
|
||||
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>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -137,6 +137,20 @@ if(!defined('entry') || !entry) die('Not a valid page');
|
|||
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) {
|
||||
$params = explode("?v=", $videoUrl);
|
||||
$params2 = explode("&",$params[1]);
|
||||
|
|
@ -160,6 +174,7 @@ if(!defined('entry') || !entry) die('Not a valid page');
|
|||
if (isYoutubeVideo($url)) { return true; }
|
||||
elseif (isVimeoVideo($url)) { return true; }
|
||||
elseif (isDailymotionVideo($url)) { return true; }
|
||||
elseif (isYahooVideo($url)) { return true; }
|
||||
else { return false; }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
} 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";}
|
||||
elseif (isDailymotionVideo($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";
|
||||
} 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";
|
||||
|
||||
} 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&id=".$id_video[1]."&vid=".$id_video[0]."&onsite=1&site=video.yahoo.com&page=792730258&lang=en-US&intl=us\" /></object>\n";
|
||||
} else {
|
||||
return "This URL is not a supported video (YouTube, Vimeo or DailyMotion)";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue