Bladeren bron

les embed doivent qd même être renseigné

Sevajol Bastien 11 jaren geleden
bovenliggende
commit
09317b4fd3

+ 28 - 0
src/Muzich/CoreBundle/Factory/Elements/Jamendocom.php Bestand weergeven

@@ -45,6 +45,7 @@ class Jamendocom extends ElementFactory
45 45
   {
46 46
     $this->retrieveDatas();
47 47
     $this->proceedThumbnailUrl();
48
+    $this->proceedEmbedCode();
48 49
   }
49 50
   
50 51
   protected function getApiUrl()
@@ -111,4 +112,31 @@ class Jamendocom extends ElementFactory
111 112
     }
112 113
   }
113 114
   
115
+  public function proceedEmbedCode()
116
+  {
117
+    if (($ref_id = $this->element->getData(Element::DATA_REF_ID)) 
118
+      && ($type = $this->element->getData(Element::DATA_TYPE)))
119
+    {
120
+      $height = $this->container->getParameter('jamendo_player_height');
121
+      $width = $this->container->getParameter('jamendo_player_width');
122
+      $embed_url = "http://widgets.jamendo.com/fr/$type/?".$type."_id=$ref_id&playertype=2008";
123
+      $this->element->setEmbed(
124
+        '<object width="'.$width.'" height="'.$height.'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'
125
+            .' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" align="middle">
126
+            <param name="allowScriptAccess" value="always" />
127
+            <param name="wmode" value="transparent" />
128
+            <param name="movie" value="'.$embed_url.'" />
129
+            <param name="quality" value="high" />
130
+            <param name="bgcolor" value="#FFFFFF" />
131
+            <embed src="'.$embed_url.'" quality="high" wmode="transparent" bgcolor="#FFFFFF"'
132
+            .' width="'.$width.'" height="'.$height.'" align="middle" allowScriptAccess="always"'
133
+            .' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
134
+              &nbsp;
135
+            </embed>
136
+            &nbsp;
137
+          </object>'
138
+      );
139
+    }
140
+  }
141
+  
114 142
 }

+ 25 - 0
src/Muzich/CoreBundle/Factory/Elements/Soundcloudcom.php Bestand weergeven

@@ -23,6 +23,7 @@ class Soundcloudcom extends ElementFactory
23 23
     $this->cleanUrl();
24 24
     $this->setElementDatasWithApi();
25 25
     $this->proceedThumbnailUrl();
26
+    $this->proceedEmbedCode();
26 27
   }
27 28
   
28 29
   protected function cleanUrl()
@@ -110,4 +111,28 @@ class Soundcloudcom extends ElementFactory
110 111
     }
111 112
   }
112 113
   
114
+  public function proceedEmbedCode()
115
+  {
116
+    if (($ref_id = $this->element->getData(Element::DATA_REF_ID)) 
117
+      && ($this->element->getData(Element::DATA_TYPE) == 'track' || $this->element->getData(Element::DATA_TYPE) == 'playlist' ))
118
+    {
119
+      $ref_id = $this->element->getUrl();
120
+      $embed_id = md5($ref_id);
121
+      $height = $this->container->getParameter('soundcloud_player_height');
122
+      $this->element->setEmbed(
123
+        '<object height="'.$height.'" width="100%" id="embed_'.$embed_id.'" '
124
+          .'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
125
+          <param name="movie" value="http://player.soundcloud.com/player.swf?url='.$ref_id.'&amp;'
126
+          .'enable_api=true&amp;object_id=embed_'.$embed_id.'"></param>
127
+          <param name="allowscriptaccess" value="always"></param>
128
+          <embed allowscriptaccess="always" height="'.$height.'" '
129
+          .'src="http://player.soundcloud.com/player.swf?url='.$ref_id.'&amp;enable_api=true'
130
+          .'&amp;object_id=embed_'.$embed_id.'" type="application/x-shockwave-flash" '
131
+          .'width="100%" name="embed_'.$embed_id.'"></embed>
132
+        </object>'
133
+      );
134
+    }
135
+  }
136
+
137
+  
113 138
 }

+ 91 - 0
src/Muzich/CoreBundle/Tests/ElementFactory/ElementFactoryTest.php Bestand weergeven

@@ -118,6 +118,48 @@ class ElementFactoryTest extends UnitTest
118 118
         .'height="'.$this->getParam('dailymotion_player_height').'" '
119 119
         .'src="http://www.dailymotion.com/embed/video/xafj1q?autoPlay=1"></iframe>'
120 120
     );
121
+    
122
+    /*
123
+     * - soundcloud.com
124
+     */
125
+    $url_id = 'http://soundcloud.com/matas/sets/library-project';
126
+    $embed_id = md5($url_id);
127
+    $this->proceed_elementAndFill(
128
+      $bux, 
129
+      'faez7tf8re9h4gf5j64dssz', 
130
+      'http://soundcloud.com/matas/sets/library-project', 
131
+      array($hardtek->getId(), $tribe->getId()), 
132
+      '<object height="'.$this->getParam('soundcloud_player_height').'" width="100%" id="embed_'.$embed_id.'" '
133
+          .'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
134
+          <param name="movie" value="http://player.soundcloud.com/player.swf?url='.$url_id.'&amp;'
135
+          .'enable_api=true&amp;object_id=embed_'.$embed_id.'"></param>
136
+          <param name="allowscriptaccess" value="always"></param>
137
+          <embed allowscriptaccess="always" height="'.$this->getParam('soundcloud_player_height').'" '
138
+          .'src="http://player.soundcloud.com/player.swf?url='.$url_id.'&amp;enable_api=true'
139
+          .'&amp;object_id=embed_'.$embed_id.'" type="application/x-shockwave-flash" '
140
+          .'width="100%" name="embed_'.$embed_id.'"></embed>
141
+        </object>'
142
+    );
143
+    
144
+    $url_id = 'http://soundcloud.com/matas/above-hyperion-redux';
145
+    $embed_id = md5($url_id);
146
+    $this->proceed_elementAndFill(
147
+      $bux, 
148
+      'faez7tf8re9h4gf5j64dssz', 
149
+      'http://soundcloud.com/matas/above-hyperion-redux', 
150
+      array($hardtek->getId(), $tribe->getId()), 
151
+      
152
+        '<object height="'.$this->getParam('soundcloud_player_height').'" width="100%" id="embed_'.$embed_id.'" '
153
+          .'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
154
+          <param name="movie" value="http://player.soundcloud.com/player.swf?url='.$url_id.'&amp;'
155
+          .'enable_api=true&amp;object_id=embed_'.$embed_id.'"></param>
156
+          <param name="allowscriptaccess" value="always"></param>
157
+          <embed allowscriptaccess="always" height="'.$this->getParam('soundcloud_player_height').'" '
158
+          .'src="http://player.soundcloud.com/player.swf?url='.$url_id.'&amp;enable_api=true'
159
+          .'&amp;object_id=embed_'.$embed_id.'" type="application/x-shockwave-flash" '
160
+          .'width="100%" name="embed_'.$embed_id.'"></embed>
161
+        </object>'
162
+    );
121 163
         
122 164
     $this->proceed_elementAndFill(
123 165
       $bux, 
@@ -143,6 +185,55 @@ class ElementFactoryTest extends UnitTest
143 185
       null
144 186
     );
145 187
      
188
+    /*
189
+     *   - jamendo.com
190
+     */
191
+    
192
+    $this->proceed_elementAndFill(
193
+      $bux, 
194
+      'gthyk456+liszz', 
195
+      'http://www.jamendo.com/fr/album/30661', 
196
+      array($hardtek->getId(), $tribe->getId()), 
197
+      
198
+        '<object width="'.$this->getParam('jamendo_player_width').'" height="'.$this->getParam('jamendo_player_height').'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'
199
+            .' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" align="middle">
200
+            <param name="allowScriptAccess" value="always" />
201
+            <param name="wmode" value="transparent" />
202
+            <param name="movie" value="http://widgets.jamendo.com/fr/album/?album_id=30661&playertype=2008" />
203
+            <param name="quality" value="high" />
204
+            <param name="bgcolor" value="#FFFFFF" />
205
+            <embed src="http://widgets.jamendo.com/fr/album/?album_id=30661&playertype=2008" quality="high" wmode="transparent" bgcolor="#FFFFFF"'
206
+            .' width="'.$this->getParam('jamendo_player_width').'" height="'.$this->getParam('jamendo_player_height').'" align="middle" allowScriptAccess="always"'
207
+            .' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
208
+              &nbsp;
209
+            </embed>
210
+            &nbsp;
211
+          </object>' 
212
+    );
213
+    
214
+    $this->proceed_elementAndFill(
215
+      $bux, 
216
+      'gthyk456+liszz', 
217
+      'http://www.jamendo.com/fr/track/207079', 
218
+      array($hardtek->getId(), $tribe->getId()), 
219
+      
220
+      '<object width="'.$this->getParam('jamendo_player_width').'" height="'.$this->getParam('jamendo_player_height').'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'
221
+      .' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" align="middle">
222
+            <param name="allowScriptAccess" value="always" />
223
+            <param name="wmode" value="transparent" />
224
+            <param name="movie" value="http://widgets.jamendo.com/fr/track/?track_id=207079&playertype=2008" />
225
+            <param name="quality" value="high" />
226
+            <param name="bgcolor" value="#FFFFFF" />
227
+            <embed src="http://widgets.jamendo.com/fr/track/?track_id=207079&playertype=2008" quality="high" wmode="transparent" bgcolor="#FFFFFF"'
228
+      .' width="'.$this->getParam('jamendo_player_width').'" height="'.$this->getParam('jamendo_player_height').'" align="middle" allowScriptAccess="always"'
229
+      .' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
230
+              &nbsp;
231
+            </embed>
232
+            &nbsp;
233
+          </object>' 
234
+    );
235
+
236
+     
146 237
     $this->proceed_elementAndFill(
147 238
       $bux, 
148 239
       'gthyk456+liszz',