Browse Source

Evolution #205: Gestion d'URL HTTPS

bastien 12 years ago
parent
commit
c79765485a

+ 2 - 5
src/Muzich/CoreBundle/ElementFactory/Site/DeezercomFactory.php View File

@@ -13,8 +13,7 @@ class DeezercomFactory extends BaseFactory
13 13
 {
14 14
   public function getEmbedCode()
15 15
   {
16
-    $url = str_replace('www.', '', $this->element->getUrl());
17
-    $data = str_replace('http://deezer.com', '', $url);
16
+    $data = $this->getCleanedUrl();
18 17
         
19 18
     $embed = null;
20 19
     $element_id = null;
@@ -75,6 +74,4 @@ class DeezercomFactory extends BaseFactory
75 74
     return $url;
76 75
   }
77 76
   
78
-}
79
-
80
-?>
77
+}

+ 2 - 25
src/Muzich/CoreBundle/ElementFactory/Site/JamendocomFactory.php View File

@@ -13,8 +13,7 @@ class JamendocomFactory extends BaseFactory
13 13
 {
14 14
   public function getEmbedCode()
15 15
   {
16
-    $url = str_replace('www.', '', $this->element->getUrl());
17
-    $data = str_replace('http://jamendo.com', '', $url);
16
+    $data = $this->getCleanedUrl();
18 17
     
19 18
     $embed_url = null;
20 19
     // http://www.jamendo.com/fr/album/30661
@@ -117,30 +116,8 @@ class JamendocomFactory extends BaseFactory
117 116
      * api.jamendo.com/get2/album/id/track/json/?id=
118 117
      * 
119 118
      */
120
-    
121
-
122
-    
123
-    
124
-//    if (isset($result->errors))
125
-//    {
126
-//      if (count($result->errors))
127
-//      {
128
-//        return null;
129
-//      }
130
-//    }
131
-//    
132
-//    $getjsonurl = $result->location;
133
-//    $ch = curl_init($getjsonurl);
134
-//    curl_setopt_array($ch, $options);
135
-//    $result = json_decode(curl_exec($ch));
136
-//    
137
-//    $url = $result->artwork_url;
138
-    
139
-    
119
+     
140 120
     return $url;
141 121
   }
142 122
   
143
-  //http://api.jamendo.com/get2/name+url/album/json/?id=116
144 123
 }
145
-
146
-?>

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

@@ -16,7 +16,7 @@ class SoundcloudcomFactory extends BaseFactory
16 16
   public function getEmbedCode()
17 17
   {
18 18
     $url = str_replace('www.', '', $this->element->getUrl());
19
-    $data = str_replace('http://soundcloud.com', '', $url);
19
+    $data = $this->getCleanedUrl();
20 20
     $embed_url = null;
21 21
     
22 22
     // http://soundcloud.com/matas/sets/library-project
@@ -91,6 +91,4 @@ class SoundcloudcomFactory extends BaseFactory
91 91
     $url = $result->artwork_url;
92 92
     return $url;
93 93
   }
94
-}
95
-
96
-?>
94
+}

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

@@ -46,6 +46,4 @@ class YoutubeFactory extends BaseFactory
46 46
     
47 47
     return $url;
48 48
   }
49
-}
50
-
51
-?>
49
+}

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

@@ -55,5 +55,3 @@ class YoutubecomFactory extends BaseFactory
55 55
     return $url;
56 56
   }
57 57
 }
58
-
59
-?>

+ 3 - 1
src/Muzich/CoreBundle/ElementFactory/Site/base/BaseFactory.php View File

@@ -40,7 +40,9 @@ class BaseFactory implements FactoryInterface
40 40
   protected function getCleanedUrl()
41 41
   {
42 42
     $url = str_replace('www.', '', $this->element->getUrl());
43
-    return str_replace('http://'.$this->element->getType(), '', $url);
43
+    $url = str_replace('http://'.$this->element->getType(), '', $url);
44
+    $url = str_replace('https://'.$this->element->getType(), '', $url);
45
+    return $url;
44 46
   }
45 47
   
46 48
   public function getThumbnailUrl()