From 5d47c990b27792dfdcafc7aebcc0c41f22c3cb50 Mon Sep 17 00:00:00 2001 From: vbracco Date: Thu, 30 Oct 2008 16:03:35 +0000 Subject: [PATCH] added MTV Video support --- classes/functions.php | 28 ++++++++++++++++++++++------ classes/gelato.class.php | 5 ++++- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/classes/functions.php b/classes/functions.php index a664252..af91292 100644 --- a/classes/functions.php +++ b/classes/functions.php @@ -140,7 +140,13 @@ if(!defined('entry') || !entry) die('Not a valid page'); else return false; } - + + function getYoutubeVideoUrl($videoUrl) { + $params = explode("?v=", $videoUrl); + $params2 = explode("&",$params[1]); + return $params2[0]; + } + function isYahooVideo($videoUrl){ if (beginsWith($videoUrl, "http://video.yahoo.com/watch/") || beginsWith($videoUrl, "http://www.video.yahoo.com/watch/")) return true; @@ -155,11 +161,6 @@ if(!defined('entry') || !entry) die('Not a valid page'); $values[1] = $params2[1]; return $values; } - function getYoutubeVideoUrl($videoUrl) { - $params = explode("?v=", $videoUrl); - $params2 = explode("&",$params[1]); - return $params2[0]; - } function isGoogleVideoUrl($videoUrl){ if (beginsWith($videoUrl, "http://video.google.com/videoplay?")){ @@ -174,6 +175,20 @@ if(!defined('entry') || !entry) die('Not a valid page'); $params2 = explode("&",$params[1]); return $params2[0]; } + + function isMTVVideoUrl($videoUrl){ + if (beginsWith($videoUrl, "http://www.mtvmusic.com/video/?id=") || beginsWith($videoUrl, "http://mtvmusic.com/video/?id=")){ + return true; + } else { + return false; + } + } + + function getMTVVideoCode($videoUrl){ + $params = explode("?id=", $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/")) @@ -209,6 +224,7 @@ if(!defined('entry') || !entry) die('Not a valid page'); elseif (isYahooVideo($url)) { return true; } elseif (isSlideSharePresentation($url)) { return true; } elseif (isGoogleVideoUrl($url)) { return true; } + elseif (isMTVVideoUrl($url)) { return true; } else { return false; } } diff --git a/classes/gelato.class.php b/classes/gelato.class.php index 985fafd..2e99a36 100644 --- a/classes/gelato.class.php +++ b/classes/gelato.class.php @@ -176,8 +176,11 @@ class gelato extends Conexion_Mysql { } elseif (isGoogleVideoUrl($url)) { $id_video = getGoogleVideoCode($url); return "\t\t\t\n"; + } elseif (isMTVVideoUrl($url)) { + $id_video = getMTVVideoCode($url); + return "\t\t\t\n"; } else { - return "This URL is not a supported video (YouTube, Google Video, Vimeo, DailyMotion, Yahoo Video or SlideShare)"; + return "This URL is not a supported video (YouTube, Google Video, Vimeo, DailyMotion, Yahoo Video, MTV or SlideShare)"; } } function getMp3Player($url) {