Przeglądaj źródła

Fixing YouTube, Vimeo and Dailymotion video integration

Cebabonet 7 lat temu
rodzic
commit
b43ca639a3
2 zmienionych plików z 6 dodań i 5 usunięć
  1. 3 3
      classes/sorbet.class.php
  2. 3 2
      classes/util.class.php

+ 3 - 3
classes/sorbet.class.php Wyświetl plik

@@ -176,13 +176,13 @@ class sorbet
176 176
         $util_class = new util();
177 177
         if ($util_class->isYoutubeVideo($url)) {
178 178
             $id_video = $util_class->getYoutubeVideoUrl($url);
179
-            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."\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
179
+            return "\t\t\t<iframe width=\"640\" height=\"360\" src=\"https://www.youtube.com/embed/".$id_video."\" frameborder=\"0\" allowfullscreen></iframe>\n";
180 180
         } elseif ($util_class->isVimeoVideo($url)) {
181 181
             $id_video = $util_class->getVimeoVideoUrl($url);
182
-            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."\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
182
+            return "\t\t\t<iframe src=\"https://player.vimeo.com/video/".$id_video."\" width=\"640\" height=\"360\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>\n";
183 183
         } elseif ($util_class->isDailymotionVideo($url)) {
184 184
             $id_video = $util_class->getDailymotionVideoUrl($url);
185
-            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."\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
185
+            return "\t\t\t<iframe frameborder=\"0\" width=\"640\" height=\"360\" src=\"//www.dailymotion.com/embed/video/".$id_video."\" allowfullscreen></iframe><br />\n";
186 186
         } elseif ($util_class->isYahooVideo($url)) {
187 187
             $id_video = $util_class->getYahooVideoCode($url);
188 188
             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\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";

+ 3 - 2
classes/util.class.php Wyświetl plik

@@ -150,7 +150,7 @@ class util
150 150
     public function isVimeoVideo($videoUrl)
151 151
     {
152 152
         $util_class = new util();
153
-        if ($util_class->beginsWith($videoUrl, "http://vimeo.com/") || $util_class->beginsWith($videoUrl, "http://www.vimeo.com/")) {
153
+        if ($util_class->beginsWith($videoUrl, "http://vimeo.com/") || $util_class->beginsWith($videoUrl, "http://www.vimeo.com/") || $util_class->beginsWith($videoUrl, "https://vimeo.com/")) {
154 154
             return true;
155 155
         } else {
156 156
             return false;
@@ -162,7 +162,8 @@ class util
162 162
         if (substr_count($videoUrl, "clip:")==1) {
163 163
             return array_pop(explode("clip:", $videoUrl));
164 164
         } else {
165
-            return array_pop(explode("/", $videoUrl));
165
+            $videoUrl = explode("/", $videoUrl);
166
+            return array_pop($videoUrl);
166 167
         }
167 168
     }
168 169