浏览代码

added MTV Video support

vbracco 16 年前
父节点
当前提交
5d47c990b2
共有 2 个文件被更改,包括 26 次插入7 次删除
  1. 22 6
      classes/functions.php
  2. 4 1
      classes/gelato.class.php

+ 22 - 6
classes/functions.php 查看文件

140
 		else
140
 		else
141
 			return false;
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
 	function isYahooVideo($videoUrl){
150
 	function isYahooVideo($videoUrl){
145
 		if (beginsWith($videoUrl, "http://video.yahoo.com/watch/") || beginsWith($videoUrl, "http://www.video.yahoo.com/watch/"))
151
 		if (beginsWith($videoUrl, "http://video.yahoo.com/watch/") || beginsWith($videoUrl, "http://www.video.yahoo.com/watch/"))
146
 			return true;
152
 			return true;
155
 		$values[1] = $params2[1];
161
 		$values[1] = $params2[1];
156
 		return $values;
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
 	function isGoogleVideoUrl($videoUrl){
165
 	function isGoogleVideoUrl($videoUrl){
165
 		if (beginsWith($videoUrl, "http://video.google.com/videoplay?")){
166
 		if (beginsWith($videoUrl, "http://video.google.com/videoplay?")){
174
 		$params2 = explode("&",$params[1]);
175
 		$params2 = explode("&",$params[1]);
175
 		return $params2[0];
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
 	function isDailymotionVideo($videoUrl) {
193
 	function isDailymotionVideo($videoUrl) {
179
 		if (beginsWith($videoUrl, "http://www.dailymotion.com/video/") || beginsWith($videoUrl, "http://dailymotion.com/video/"))
194
 		if (beginsWith($videoUrl, "http://www.dailymotion.com/video/") || beginsWith($videoUrl, "http://dailymotion.com/video/"))
209
 		elseif (isYahooVideo($url)) { return true; }
224
 		elseif (isYahooVideo($url)) { return true; }
210
 		elseif (isSlideSharePresentation($url)) { return true; }
225
 		elseif (isSlideSharePresentation($url)) { return true; }
211
 		elseif (isGoogleVideoUrl($url)) { return true; }
226
 		elseif (isGoogleVideoUrl($url)) { return true; }
227
+		elseif (isMTVVideoUrl($url)) { return true; }
212
 		else { return false; }
228
 		else { return false; }
213
 	}
229
 	}
214
 
230
 

+ 4 - 1
classes/gelato.class.php 查看文件

176
 		} elseif (isGoogleVideoUrl($url)) {
176
 		} elseif (isGoogleVideoUrl($url)) {
177
 			$id_video = getGoogleVideoCode($url);
177
 			$id_video = getGoogleVideoCode($url);
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";
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
 		} else {
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
 	function getMp3Player($url) {
186
 	function getMp3Player($url) {