| 
				
			 | 
			
			
				@@ -4,7 +4,6 @@ namespace Muzich\CoreBundle\Factory\Elements; 
			 | 
		
	
		
			
			| 
				4
			 | 
			
				4
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				5
			 | 
			
				5
			 | 
			
			
				 use Muzich\CoreBundle\Factory\ElementFactory; 
			 | 
		
	
		
			
			| 
				6
			 | 
			
				6
			 | 
			
			
				 use Muzich\CoreBundle\Entity\Element; 
			 | 
		
	
		
			
			| 
				7
			 | 
			
				
			 | 
			
			
				-use Muzich\CoreBundle\Util\TagLike; 
			 | 
		
	
		
			
			| 
				8
			 | 
			
				7
			 | 
			
			
				 use Muzich\CoreBundle\lib\Api\Response as ApiResponse; 
			 | 
		
	
		
			
			| 
				9
			 | 
			
				8
			 | 
			
			
				 use Muzich\CoreBundle\Factory\UrlMatchs; 
			 | 
		
	
		
			
			| 
				10
			 | 
			
				9
			 | 
			
			
				 use Symfony\Component\DependencyInjection\Container; 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -22,8 +21,6 @@ class Soundcloudcom extends ElementFactory 
			 | 
		
	
		
			
			| 
				22
			 | 
			
				21
			 | 
			
			
				   public function proceedDatas() 
			 | 
		
	
		
			
			| 
				23
			 | 
			
				22
			 | 
			
			
				   { 
			 | 
		
	
		
			
			| 
				24
			 | 
			
				23
			 | 
			
			
				     $this->setElementDatasWithApi(); 
			 | 
		
	
		
			
			| 
				25
			 | 
			
				
			 | 
			
			
				-    // TODO: Embed code ne devrais plus être necessaire (on créer les lecteurs avec JS) 
			 | 
		
	
		
			
			| 
				26
			 | 
			
				
			 | 
			
			
				-    $this->proceedEmbedCode(); 
			 | 
		
	
		
			
			| 
				27
			 | 
			
				24
			 | 
			
			
				     $this->proceedThumbnailUrl(); 
			 | 
		
	
		
			
			| 
				28
			 | 
			
				25
			 | 
			
			
				   } 
			 | 
		
	
		
			
			| 
				29
			 | 
			
				26
			 | 
			
			
				    
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -86,27 +83,7 @@ class Soundcloudcom extends ElementFactory 
			 | 
		
	
		
			
			| 
				86
			 | 
			
				83
			 | 
			
			
				   protected function setTagsData(ApiResponse $response) 
			 | 
		
	
		
			
			| 
				87
			 | 
			
				84
			 | 
			
			
				   { 
			 | 
		
	
		
			
			| 
				88
			 | 
			
				85
			 | 
			
			
				     $tags_string = $response->get('genre').' '.$response->get('tag_list').' '.str_replace(' ', '-', $response->get('genre')); 
			 | 
		
	
		
			
			| 
				89
			 | 
			
				
			 | 
			
			
				-    $tags_like = array(); 
			 | 
		
	
		
			
			| 
				90
			 | 
			
				
			 | 
			
			
				-    if (strlen($tags_string)) 
			 | 
		
	
		
			
			| 
				91
			 | 
			
				
			 | 
			
			
				-    { 
			 | 
		
	
		
			
			| 
				92
			 | 
			
				
			 | 
			
			
				-      $tag_like = new TagLike($this->entity_manager); 
			 | 
		
	
		
			
			| 
				93
			 | 
			
				
			 | 
			
			
				-      foreach (explode(' ', $tags_string) as $word) 
			 | 
		
	
		
			
			| 
				94
			 | 
			
				
			 | 
			
			
				-      { 
			 | 
		
	
		
			
			| 
				95
			 | 
			
				
			 | 
			
			
				-        $similar_tags = $tag_like->getSimilarTags($word, ($this->element->getOwner())?$this->element->getOwner()->getId():null); 
			 | 
		
	
		
			
			| 
				96
			 | 
			
				
			 | 
			
			
				-        if (count($similar_tags)) 
			 | 
		
	
		
			
			| 
				97
			 | 
			
				
			 | 
			
			
				-        { 
			 | 
		
	
		
			
			| 
				98
			 | 
			
				
			 | 
			
			
				-          if ($similar_tags['same_found']) 
			 | 
		
	
		
			
			| 
				99
			 | 
			
				
			 | 
			
			
				-          { 
			 | 
		
	
		
			
			| 
				100
			 | 
			
				
			 | 
			
			
				-            $tags_like[] = $similar_tags['tags'][0]['name']; 
			 | 
		
	
		
			
			| 
				101
			 | 
			
				
			 | 
			
			
				-          } 
			 | 
		
	
		
			
			| 
				102
			 | 
			
				
			 | 
			
			
				-        } 
			 | 
		
	
		
			
			| 
				103
			 | 
			
				
			 | 
			
			
				-      } 
			 | 
		
	
		
			
			| 
				104
			 | 
			
				
			 | 
			
			
				-      $tags_like[] = $response->get('genre'); 
			 | 
		
	
		
			
			| 
				105
			 | 
			
				
			 | 
			
			
				-      if (count($tags_like)) 
			 | 
		
	
		
			
			| 
				106
			 | 
			
				
			 | 
			
			
				-      { 
			 | 
		
	
		
			
			| 
				107
			 | 
			
				
			 | 
			
			
				-        $this->element->setData(Element::DATA_TAGS, array_unique($tags_like)); 
			 | 
		
	
		
			
			| 
				108
			 | 
			
				
			 | 
			
			
				-      } 
			 | 
		
	
		
			
			| 
				109
			 | 
			
				
			 | 
			
			
				-    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				86
			 | 
			
			
				+    $this->setDataTagsForElement($tags_string, array($response->get('genre'))); 
			 | 
		
	
		
			
			| 
				110
			 | 
			
				87
			 | 
			
			
				   } 
			 | 
		
	
		
			
			| 
				111
			 | 
			
				88
			 | 
			
			
				    
			 | 
		
	
		
			
			| 
				112
			 | 
			
				89
			 | 
			
			
				   protected function setElementEmbeddableData($response) 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -116,29 +93,6 @@ class Soundcloudcom extends ElementFactory 
			 | 
		
	
		
			
			| 
				116
			 | 
			
				93
			 | 
			
			
				     )); 
			 | 
		
	
		
			
			| 
				117
			 | 
			
				94
			 | 
			
			
				   } 
			 | 
		
	
		
			
			| 
				118
			 | 
			
				95
			 | 
			
			
				    
			 | 
		
	
		
			
			| 
				119
			 | 
			
				
			 | 
			
			
				-  public function proceedEmbedCode() 
			 | 
		
	
		
			
			| 
				120
			 | 
			
				
			 | 
			
			
				-  { 
			 | 
		
	
		
			
			| 
				121
			 | 
			
				
			 | 
			
			
				-    if (($ref_id = $this->element->getData(Element::DATA_REF_ID))  
			 | 
		
	
		
			
			| 
				122
			 | 
			
				
			 | 
			
			
				-      && ($this->element->getData(Element::DATA_TYPE) == 'track' || $this->element->getData(Element::DATA_TYPE) == 'playlist' )) 
			 | 
		
	
		
			
			| 
				123
			 | 
			
				
			 | 
			
			
				-    { 
			 | 
		
	
		
			
			| 
				124
			 | 
			
				
			 | 
			
			
				-      $ref_id = $this->element->getUrl(); 
			 | 
		
	
		
			
			| 
				125
			 | 
			
				
			 | 
			
			
				-      $embed_id = md5($ref_id); 
			 | 
		
	
		
			
			| 
				126
			 | 
			
				
			 | 
			
			
				-      $height = $this->container->getParameter('soundcloud_player_height'); 
			 | 
		
	
		
			
			| 
				127
			 | 
			
				
			 | 
			
			
				-      $this->element->setEmbed( 
			 | 
		
	
		
			
			| 
				128
			 | 
			
				
			 | 
			
			
				-        '<object height="'.$height.'" width="100%" id="embed_'.$embed_id.'" ' 
			 | 
		
	
		
			
			| 
				129
			 | 
			
				
			 | 
			
			
				-          .'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"> 
			 | 
		
	
		
			
			| 
				130
			 | 
			
				
			 | 
			
			
				-          <param name="movie" value="http://player.soundcloud.com/player.swf?url='.$ref_id.'&' 
			 | 
		
	
		
			
			| 
				131
			 | 
			
				
			 | 
			
			
				-          .'enable_api=true&object_id=embed_'.$embed_id.'"></param> 
			 | 
		
	
		
			
			| 
				132
			 | 
			
				
			 | 
			
			
				-          <param name="allowscriptaccess" value="always"></param> 
			 | 
		
	
		
			
			| 
				133
			 | 
			
				
			 | 
			
			
				-          <embed allowscriptaccess="always" height="'.$height.'" ' 
			 | 
		
	
		
			
			| 
				134
			 | 
			
				
			 | 
			
			
				-          .'src="http://player.soundcloud.com/player.swf?url='.$ref_id.'&enable_api=true' 
			 | 
		
	
		
			
			| 
				135
			 | 
			
				
			 | 
			
			
				-          .'&object_id=embed_'.$embed_id.'" type="application/x-shockwave-flash" ' 
			 | 
		
	
		
			
			| 
				136
			 | 
			
				
			 | 
			
			
				-          .'width="100%" name="embed_'.$embed_id.'"></embed> 
			 | 
		
	
		
			
			| 
				137
			 | 
			
				
			 | 
			
			
				-        </object>' 
			 | 
		
	
		
			
			| 
				138
			 | 
			
				
			 | 
			
			
				-      ); 
			 | 
		
	
		
			
			| 
				139
			 | 
			
				
			 | 
			
			
				-    } 
			 | 
		
	
		
			
			| 
				140
			 | 
			
				
			 | 
			
			
				-  } 
			 | 
		
	
		
			
			| 
				141
			 | 
			
				
			 | 
			
			
				-   
			 | 
		
	
		
			
			| 
				142
			 | 
			
				96
			 | 
			
			
				   public function proceedThumbnailUrl() 
			 | 
		
	
		
			
			| 
				143
			 | 
			
				97
			 | 
			
			
				   { 
			 | 
		
	
		
			
			| 
				144
			 | 
			
				98
			 | 
			
			
				     if (($thumb = $this->element->getData(Element::DATA_THUMB_URL))) 
			 |