Просмотр исходного кода

Adding support for Yahoo Video

vbracco 16 лет назад
Родитель
Сommit
f77a625c12
3 измененных файлов с 21 добавлено и 4 удалено
  1. 1 1
      admin/themes/admin/template_add_video.htm
  2. 15 0
      classes/functions.php
  3. 5 3
      classes/gelato.class.php

+ 1 - 1
admin/themes/admin/template_add_video.htm Просмотреть файл

@@ -3,7 +3,7 @@
3 3
 			<label for="url">Video URL</label>			
4 4
 			<input class="txt" type="text" name="url" id="url" value="{editUrl}" size="80" />
5 5
 			<div style="color: rgb(136, 136, 136); margin-bottom: 5px; font-size: 11px; font-weight: bold;">
6
-				This is the URL from the video sites YouTube or Vimeo.<br>
6
+				This is the URL from the video sites YouTube, Vimeo or Yahoo.<br>
7 7
 				<span style="font-size: 10px; font-weight: normal;">(ie. http://youtube.com/watch?v=HcBFLN9cli0)</span>
8 8
 			</div>
9 9
 		</div>									

+ 15 - 0
classes/functions.php Просмотреть файл

@@ -137,6 +137,20 @@ if(!defined('entry') || !entry) die('Not a valid page');
137 137
 			return false;
138 138
 	}
139 139
 	
140
+	function isYahooVideo($videoUrl){
141
+		if (beginsWith($videoUrl, "http://video.yahoo.com/watch/") || beginsWith($videoUrl, "http://www.video.yahoo.com/watch/"))
142
+			return true;
143
+		else
144
+			return false;
145
+	}
146
+	
147
+	function getYahooVideoCode($videoUrl){
148
+		$params = explode("http://video.yahoo.com/watch/", $videoUrl);
149
+		$params2 = explode("/",$params[1]);
150
+		$values[0] = $params2[0];
151
+		$values[1] = $params2[1];
152
+		return $values;
153
+	}
140 154
 	function getYoutubeVideoUrl($videoUrl) {
141 155
 		$params = explode("?v=", $videoUrl);
142 156
 		$params2 = explode("&",$params[1]);
@@ -160,6 +174,7 @@ if(!defined('entry') || !entry) die('Not a valid page');
160 174
 		if (isYoutubeVideo($url)) { return true; }
161 175
 		elseif (isVimeoVideo($url)) { return true; }
162 176
 		elseif (isDailymotionVideo($url)) { return true; }
177
+		elseif (isYahooVideo($url)) { return true; }
163 178
 		else { return false; }
164 179
 	}
165 180
 	

+ 5 - 3
classes/gelato.class.php Просмотреть файл

@@ -165,11 +165,13 @@ class gelato extends Conexion_Mysql {
165 165
 			return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://www.youtube.com/v/".$id_video."\"><param name=\"movie\" value=\"http://www.youtube.com/v/".$id_video."\" /></object>\n";
166 166
 		} elseif (isVimeoVideo($url)) {
167 167
 			$id_video = getVimeoVideoUrl($url);
168
-			return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://www.vimeo.com/moogaloop.swf?clip_id=".$id_video."\"><param name=\"movie\" value=\"http://www.vimeo.com/moogaloop.swf?clip_id=".$id_video."\" /></object>\n";}
169
-		elseif (isDailymotionVideo($url)) {
168
+			return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://www.vimeo.com/moogaloop.swf?clip_id=".$id_video."\"><param name=\"movie\" value=\"http://www.vimeo.com/moogaloop.swf?clip_id=".$id_video."\" /></object>\n";
169
+		} elseif (isDailymotionVideo($url)) {
170 170
 			$id_video = getDailymotionVideoUrl($url);
171 171
 			return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://www.dailymotion.com/swf/".$id_video."\"><param name=\"movie\" value=\"http://www.dailymotion.com/swf/".$id_video."\" /></object>\n";
172
-
172
+		} elseif (isYahooVideo($url)) {
173
+			$id_video = getYahooVideoCode($url);
174
+			return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf\"><param name=\"quality\" value=\"high\" /><param name=\"FlashVars\" value=\"event_function=YAHOO.yv.Player.SWFInterface&amp;id=".$id_video[1]."&amp;vid=".$id_video[0]."&amp;onsite=1&amp;site=video.yahoo.com&amp;page=792730258&amp;lang=en-US&amp;intl=us\" /></object>\n";
173 175
 		} else {
174 176
 			return "This URL is not a supported video (YouTube, Vimeo or DailyMotion)";
175 177
 		}