|
@@ -3,6 +3,8 @@
|
3
|
3
|
namespace Muzich\CoreBundle\ElementFactory\Site;
|
4
|
4
|
|
5
|
5
|
use Muzich\CoreBundle\ElementFactory\Site\base\BaseFactory;
|
|
6
|
+use Muzich\CoreBundle\Entity\Element;
|
|
7
|
+use Symfony\Component\DependencyInjection\Container;
|
6
|
8
|
|
7
|
9
|
/**
|
8
|
10
|
*
|
|
@@ -11,7 +13,32 @@ use Muzich\CoreBundle\ElementFactory\Site\base\BaseFactory;
|
11
|
13
|
*/
|
12
|
14
|
class SoundCloudFactory extends BaseFactory
|
13
|
15
|
{
|
14
|
|
-
|
|
16
|
+ public function getEmbedCode()
|
|
17
|
+ {
|
|
18
|
+ $url = str_replace('www.', '', $this->element->getUrl());
|
|
19
|
+ $data = str_replace('http://soundcloud.com', '', $url);
|
|
20
|
+
|
|
21
|
+ // http://soundcloud.com/matas/sets/library-project
|
|
22
|
+ if (preg_match("#^\/[a-zA-Z0-9_-]+\/sets\/[a-zA-Z0-9_-]+#", $data)
|
|
23
|
+ // http://soundcloud.com/matas/anadrakonic-waltz
|
|
24
|
+ || preg_match("#^\/[a-zA-Z0-9_]+\/[a-zA-Z0-9_]+#", $data))
|
|
25
|
+ {
|
|
26
|
+ // l'url est valide pour l'api javascript que l'on utilise
|
|
27
|
+
|
|
28
|
+ $height = $this->container->getParameter('soundcloud_player_height');
|
|
29
|
+ $embed =
|
|
30
|
+ '<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.'&enable_api=true&object_id=embed_'.$this->element->getId().'"></param>
|
|
32
|
+ <param name="allowscriptaccess" value="always"></param>
|
|
33
|
+ <embed allowscriptaccess="always" height="'.$height.'" src="http://player.soundcloud.com/player.swf?url='.$url.'&enable_api=true&object_id=embed_'.$this->element->getId().'" type="application/x-shockwave-flash" width="100%" name="embed_'.$this->element->getId().'"></embed>
|
|
34
|
+ </object>
|
|
35
|
+ ';
|
|
36
|
+
|
|
37
|
+ return $embed;
|
|
38
|
+ }
|
|
39
|
+
|
|
40
|
+ return null;
|
|
41
|
+ }
|
15
|
42
|
}
|
16
|
43
|
|
17
|
44
|
?>
|