소스 검색

added MTV Video support

vbracco 15 년 전
부모
커밋
5d47c990b2
2개의 변경된 파일26개의 추가작업 그리고 7개의 파일을 삭제
  1. 22 6
      classes/functions.php
  2. 4 1
      classes/gelato.class.php

+ 22 - 6
classes/functions.php 파일 보기

@@ -140,7 +140,13 @@ if(!defined('entry') || !entry) die('Not a valid page');
140 140
 		else
141 141
 			return false;
142 142
 	}
143
-
143
+	
144
+	function getYoutubeVideoUrl($videoUrl) {
145
+		$params = explode("?v=", $videoUrl);
146
+		$params2 = explode("&",$params[1]);
147
+		return $params2[0];
148
+	}
149
+	
144 150
 	function isYahooVideo($videoUrl){
145 151
 		if (beginsWith($videoUrl, "http://video.yahoo.com/watch/") || beginsWith($videoUrl, "http://www.video.yahoo.com/watch/"))
146 152
 			return true;
@@ -155,11 +161,6 @@ if(!defined('entry') || !entry) die('Not a valid page');
155 161
 		$values[1] = $params2[1];
156 162
 		return $values;
157 163
 	}
158
-	function getYoutubeVideoUrl($videoUrl) {
159
-		$params = explode("?v=", $videoUrl);
160
-		$params2 = explode("&",$params[1]);
161
-		return $params2[0];
162
-	}
163 164
 
164 165
 	function isGoogleVideoUrl($videoUrl){
165 166
 		if (beginsWith($videoUrl, "http://video.google.com/videoplay?")){
@@ -174,6 +175,20 @@ if(!defined('entry') || !entry) die('Not a valid page');
174 175
 		$params2 = explode("&",$params[1]);
175 176
 		return $params2[0];
176 177
 	}
178
+	
179
+	function isMTVVideoUrl($videoUrl){
180
+		if (beginsWith($videoUrl, "http://www.mtvmusic.com/video/?id=") || beginsWith($videoUrl, "http://mtvmusic.com/video/?id=")){
181
+			return true;
182
+		} else {
183
+			return false;
184
+		}
185
+	}
186
+
187
+	function getMTVVideoCode($videoUrl){
188
+		$params = explode("?id=", $videoUrl);
189
+		$params2 = explode("&",$params[1]);
190
+		return $params2[0];
191
+	}
177 192
 
178 193
 	function isDailymotionVideo($videoUrl) {
179 194
 		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');
209 224
 		elseif (isYahooVideo($url)) { return true; }
210 225
 		elseif (isSlideSharePresentation($url)) { return true; }
211 226
 		elseif (isGoogleVideoUrl($url)) { return true; }
227
+		elseif (isMTVVideoUrl($url)) { return true; }
212 228
 		else { return false; }
213 229
 	}
214 230
 

+ 4 - 1
classes/gelato.class.php 파일 보기

@@ -176,8 +176,11 @@ class gelato extends Conexion_Mysql {
176 176
 		} elseif (isGoogleVideoUrl($url)) {
177 177
 			$id_video = getGoogleVideoCode($url);
178 178
 			return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://video.google.com/googleplayer.swf?docid=".$id_video."&amp;hl=es&amp;fs=true\"><param name=\"movie\" value=\"http://video.google.com/googleplayer.swf?docid=".$id_video."&amp;hl=es&amp;fs=true\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"allowScriptAccess\" value=\"always\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
179
+		} elseif (isMTVVideoUrl($url)) {
180
+			$id_video = getMTVVideoCode($url);
181
+			return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://media.mtvnservices.com/mgid:uma:video:mtvmusic.com:".$id_video."\"><param name=\"movie\" value=\"http://media.mtvnservices.com/mgid:uma:video:mtvmusic.com:".$id_video."\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"allowScriptAccess\" value=\"never\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";	
179 182
 		} else {
180
-			return "This URL is not a supported video (YouTube, Google Video, Vimeo, DailyMotion, Yahoo Video or SlideShare)";
183
+			return "This URL is not a supported video (YouTube, Google Video, Vimeo, DailyMotion, Yahoo Video, MTV or SlideShare)";
181 184
 		}
182 185
 	}
183 186
 	function getMp3Player($url) {