From f77a625c1299c368cd68ca6f5ad27cfe00f7293f Mon Sep 17 00:00:00 2001 From: vbracco Date: Sun, 17 Feb 2008 02:35:49 +0000 Subject: [PATCH] Adding support for Yahoo Video --- admin/themes/admin/template_add_video.htm | 2 +- classes/functions.php | 15 +++++++++++++++ classes/gelato.class.php | 8 +++++--- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/admin/themes/admin/template_add_video.htm b/admin/themes/admin/template_add_video.htm index c589f85..9f1275b 100644 --- a/admin/themes/admin/template_add_video.htm +++ b/admin/themes/admin/template_add_video.htm @@ -3,7 +3,7 @@
- This is the URL from the video sites YouTube or Vimeo.
+ This is the URL from the video sites YouTube, Vimeo or Yahoo.
(ie. http://youtube.com/watch?v=HcBFLN9cli0)
diff --git a/classes/functions.php b/classes/functions.php index a54e577..dfc3998 100644 --- a/classes/functions.php +++ b/classes/functions.php @@ -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; } } diff --git a/classes/gelato.class.php b/classes/gelato.class.php index b796f18..07c8f91 100644 --- a/classes/gelato.class.php +++ b/classes/gelato.class.php @@ -165,11 +165,13 @@ class gelato extends Conexion_Mysql { return "\t\t\t\n"; } elseif (isVimeoVideo($url)) { $id_video = getVimeoVideoUrl($url); - return "\t\t\t\n";} - elseif (isDailymotionVideo($url)) { + return "\t\t\t\n"; + } elseif (isDailymotionVideo($url)) { $id_video = getDailymotionVideoUrl($url); return "\t\t\t\n"; - + } elseif (isYahooVideo($url)) { + $id_video = getYahooVideoCode($url); + return "\t\t\t\n"; } else { return "This URL is not a supported video (YouTube, Vimeo or DailyMotion)"; }