瀏覽代碼

Adding support for Google Video

vbracco 16 年之前
父節點
當前提交
75a278de6c
共有 2 個文件被更改,包括 19 次插入1 次删除
  1. 15 0
      classes/functions.php
  2. 4 1
      classes/gelato.class.php

+ 15 - 0
classes/functions.php 查看文件

@@ -161,6 +161,20 @@ if(!defined('entry') || !entry) die('Not a valid page');
161 161
 		return $params2[0];
162 162
 	}
163 163
 	
164
+	function isGoogleVideoUrl($videoUrl){
165
+		if (beginsWith($videoUrl, "http://video.google.com/videoplay?")){
166
+			return true;
167
+		} else {
168
+			return false;
169
+		}
170
+	}
171
+	
172
+	function getGoogleVideoCode($videoUrl){
173
+		$params = explode("?docid=", $videoUrl);
174
+		$params2 = explode("&",$params[1]);
175
+		return $params2[0];
176
+	}
177
+	
164 178
 	function isDailymotionVideo($videoUrl) {
165 179
 		if (beginsWith($videoUrl, "http://www.dailymotion.com/video/") || beginsWith($videoUrl, "http://dailymotion.com/video/"))
166 180
 			return true;
@@ -194,6 +208,7 @@ if(!defined('entry') || !entry) die('Not a valid page');
194 208
 		elseif (isDailymotionVideo($url)) { return true; }
195 209
 		elseif (isYahooVideo($url)) { return true; }
196 210
 		elseif (isSlideSharePresentation($url)) { return true; }
211
+		elseif (isGoogleVideoUrl($url)) { return true; }
197 212
 		else { return false; }
198 213
 	}
199 214
 	

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

@@ -173,8 +173,11 @@ class gelato extends Conexion_Mysql {
173 173
 		} elseif (isSlideSharePresentation($url)) {
174 174
 			$id_video = getSlideSharePresentationCode($url);
175 175
 			return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://www.slideshare.net/swf/player.swf?presentationId=".$id_video[0]."&amp;doc=".$id_video[1]."&amp;inContest=0&amp;startSlide=1\"><param name=\"quality\" value=\"high\" /></object>\n";
176
+		} elseif (isGoogleVideoUrl($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."&hl=es&fs=true\"><param name=\"movie\" value=\"http://video.google.com/googleplayer.swf?docid=".$id_video."&hl=es&fs=true\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"allowScriptAccess\" value=\"always\" /></object>\n";
176 179
 		} else {
177
-			return "This URL is not a supported video (YouTube, Vimeo, DailyMotion, Yahoo Video or SlideShare)";
180
+			return "This URL is not a supported video (YouTube, Google Video, Vimeo, DailyMotion, Yahoo Video or SlideShare)";
178 181
 		}		
179 182
 	}
180 183
 	function getMp3Player($url) {