Browse Source

Anomalie #80: liens Soundcloud marchent pas

bastien 13 years ago
parent
commit
ecc77ec8e5

+ 1 - 0
src/Muzich/CoreBundle/ElementFactory/Site/DailymotioncomFactory.php View File

14
   public function getEmbedCode()
14
   public function getEmbedCode()
15
   {
15
   {
16
     $url = $this->getCleanedUrl();
16
     $url = $this->getCleanedUrl();
17
+    $embed_url = null;
17
     
18
     
18
     // /video/xnqcwx_le-nazisme-dans-le-couple_fun#hp-v-v2
19
     // /video/xnqcwx_le-nazisme-dans-le-couple_fun#hp-v-v2
19
     if (preg_match("#(video\/)([a-zA-Z0-9]+)([a-zA-Z0-9_-]*)#", $url, $chaines))
20
     if (preg_match("#(video\/)([a-zA-Z0-9]+)([a-zA-Z0-9_-]*)#", $url, $chaines))

+ 21 - 4
src/Muzich/CoreBundle/ElementFactory/Site/SoundcloudcomFactory.php View File

17
   {
17
   {
18
     $url = str_replace('www.', '', $this->element->getUrl());
18
     $url = str_replace('www.', '', $this->element->getUrl());
19
     $data = str_replace('http://soundcloud.com', '', $url);
19
     $data = str_replace('http://soundcloud.com', '', $url);
20
+    $embed_url = null;
20
     
21
     
21
     // http://soundcloud.com/matas/sets/library-project
22
     // http://soundcloud.com/matas/sets/library-project
22
-    if (preg_match("#^\/[a-zA-Z0-9_-]+\/sets\/[a-zA-Z0-9_-]+#", $data)
23
+    if (preg_match("#^\/[a-zA-Z0-9_-]+\/sets\/[a-zA-Z0-9_-]+#", $data, $chaines))
24
+    {
25
+      $embed_url = $url;
26
+    }
23
     // http://soundcloud.com/matas/anadrakonic-waltz
27
     // http://soundcloud.com/matas/anadrakonic-waltz
24
-         || preg_match("#^\/[a-zA-Z0-9_]+\/[a-zA-Z0-9_]+#", $data))
28
+    else if (preg_match("#^\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+#", $data, $chaines))
29
+    {
30
+      $embed_url = $url;
31
+    }
32
+        
33
+    // Si c'est une recherche, on gère pas !
34
+    // /search?q[fulltext]=tatou
35
+    // /tracks/search?q%5Bfulltext%5D=EEK+A+MOUSSE&q%5Btype%5D=&q%5Bduration%5D=
36
+    if (preg_match("#\/search\?q#", $data, $chaines))
37
+    {
38
+      $embed_url = null;
39
+    }
40
+    
41
+    if ($embed_url)
25
     {
42
     {
26
       // l'url est valide pour l'api javascript que l'on utilise
43
       // l'url est valide pour l'api javascript que l'on utilise
27
       
44
       
28
       $height = $this->container->getParameter('soundcloud_player_height');
45
       $height = $this->container->getParameter('soundcloud_player_height');
29
       $embed = 
46
       $embed = 
30
         '<object height="'.$height.'" width="100%" id="embed_'.$this->element->getId().'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
47
         '<object height="'.$height.'" width="100%" id="embed_'.$this->element->getId().'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
31
-          <param name="movie" value="http://player.soundcloud.com/player.swf?url='.$url.'&amp;enable_api=true&amp;object_id=embed_'.$this->element->getId().'"></param>
48
+          <param name="movie" value="http://player.soundcloud.com/player.swf?url='.$embed_url.'&amp;enable_api=true&amp;object_id=embed_'.$this->element->getId().'"></param>
32
           <param name="allowscriptaccess" value="always"></param>
49
           <param name="allowscriptaccess" value="always"></param>
33
-          <embed allowscriptaccess="always" height="'.$height.'" src="http://player.soundcloud.com/player.swf?url='.$url.'&amp;enable_api=true&amp;object_id=embed_'.$this->element->getId().'" type="application/x-shockwave-flash" width="100%" name="embed_'.$this->element->getId().'"></embed>
50
+          <embed allowscriptaccess="always" height="'.$height.'" src="http://player.soundcloud.com/player.swf?url='.$embed_url.'&amp;enable_api=true&amp;object_id=embed_'.$this->element->getId().'" type="application/x-shockwave-flash" width="100%" name="embed_'.$this->element->getId().'"></embed>
34
         </object>
51
         </object>
35
         ';
52
         ';
36
       
53
       

+ 1 - 0
src/Muzich/CoreBundle/ElementFactory/Site/YoutubeFactory.php View File

14
   public function getEmbedCode()
14
   public function getEmbedCode()
15
   {
15
   {
16
     $url = $this->getCleanedUrl();
16
     $url = $this->getCleanedUrl();
17
+    $embed_url = null;
17
     
18
     
18
     // http://youtu.be/9hQVA2sloGc
19
     // http://youtu.be/9hQVA2sloGc
19
     if (preg_match("#\/([a-zA-Z0-9]+)#", $url, $chaines))
20
     if (preg_match("#\/([a-zA-Z0-9]+)#", $url, $chaines))

+ 1 - 0
src/Muzich/CoreBundle/ElementFactory/Site/YoutubecomFactory.php View File

14
   public function getEmbedCode()
14
   public function getEmbedCode()
15
   {
15
   {
16
     $url = $this->getCleanedUrl();
16
     $url = $this->getCleanedUrl();
17
+    $embed_url = null;
17
     
18
     
18
     // '/watch?v=kOLQIV22JAs&feature=feedrec_grec_index'
19
     // '/watch?v=kOLQIV22JAs&feature=feedrec_grec_index'
19
     if (preg_match("#(v\/|watch\?v=)([\w\-]+)#", $url, $chaines))
20
     if (preg_match("#(v\/|watch\?v=)([\w\-]+)#", $url, $chaines))