|
@@ -17,20 +17,37 @@ class SoundcloudcomFactory extends BaseFactory
|
17
|
17
|
{
|
18
|
18
|
$url = str_replace('www.', '', $this->element->getUrl());
|
19
|
19
|
$data = str_replace('http://soundcloud.com', '', $url);
|
|
20
|
+ $embed_url = null;
|
20
|
21
|
|
21
|
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
|
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
|
43
|
// l'url est valide pour l'api javascript que l'on utilise
|
27
|
44
|
|
28
|
45
|
$height = $this->container->getParameter('soundcloud_player_height');
|
29
|
46
|
$embed =
|
30
|
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.'&enable_api=true&object_id=embed_'.$this->element->getId().'"></param>
|
|
48
|
+ <param name="movie" value="http://player.soundcloud.com/player.swf?url='.$embed_url.'&enable_api=true&object_id=embed_'.$this->element->getId().'"></param>
|
32
|
49
|
<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>
|
|
50
|
+ <embed allowscriptaccess="always" height="'.$height.'" src="http://player.soundcloud.com/player.swf?url='.$embed_url.'&enable_api=true&object_id=embed_'.$this->element->getId().'" type="application/x-shockwave-flash" width="100%" name="embed_'.$this->element->getId().'"></embed>
|
34
|
51
|
</object>
|
35
|
52
|
';
|
36
|
53
|
|