| 
					
				 | 
			
			
				@@ -1,67 +1,202 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <?php 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-class Fritzing { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	public static function manifest(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		return array( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			'uid' => 'fritzing', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			'label' => 'Schéma fritzing', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			'description' => 'Fichier pour le logiciel fritzing', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			'fromExtension' => array('fzz'), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			'toExtension' => 'fzz', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			'upload' => array( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				'url'     => 'action.php?action=upload_resource_file', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				'element' => '#dropZoneFiles', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				'callback' => "refresh_fritzing();", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+class Fritzing{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public $file;  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public $files = array(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public $xml,$parts = array(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	private $coreIndicator = '/fritzing-parts/'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	private $minY,$minX; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public $ino ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public $comment ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	function __construct($file){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$this->file = $file; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	//Import depuis un glisser déposé du fichier 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	public static function fromFile($resource){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$resource->save(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$ext = getExt($resource->label); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$name = $resource->id.'.'.$ext; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		file_put_contents(SKETCH_PATH.$name,$resource->content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$resource->content = $name; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		return $resource; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	//Import depuis un flux json compressé de la ressource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	public static function fromJson($resource){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$resource->save(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$stream = base64_decode($resource->content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$resource->content = $resource->id.'.png'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		file_put_contents(SKETCH_PATH.$resource->content,$stream); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		return $resource; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$zip = new ZipArchive; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$res = $zip->open($this->file); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$properties = array(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if ($res !== TRUE)  throw new Exception('Impossible d\'ouvrir le ZIP, code:' . $res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		for( $i = 0; $i < $zip->numFiles; $i++ ){  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		    $stat = $zip->statIndex($i);  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(substr($stat['name'], -3) == '.fz') $this->xml = new SimpleXMLElement($zip->getFromName($stat['name'])); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(substr($stat['name'], -4) == '.ino') $this->ino = $zip->getFromName($stat['name']); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$this->files[$stat['name']] =  $zip->getFromName($stat['name']); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$zip->close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$this->parse(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	private function parse(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	//export en fichier JSON compressé de la ressource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	public static function toJson($resource){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$resource = $resource->toArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$resource['content'] = base64_encode(file_get_contents(SKETCH_PATH.$resource['content'])); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		return $resource; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$this->minY = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$this->minX = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		foreach($this->xml->instances->instance as $instance){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$part = array(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$part['sigle'] = (string) $instance->title; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$attributes = $instance->attributes(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$part['id'] = (string) $attributes->moduleIdRef; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$part['properties'] = array(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			foreach($instance->property as $property){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$attribute = $property->attributes(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$part['properties'][(string)$attribute['name']] = (string)$attribute['value']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$part['type'] = 'component'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(isset($instance->views->breadboardView->geometry)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$geometry = $instance->views->breadboardView->geometry->attributes(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$part['geometry'] = array( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						'x' => array(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						'z' => 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						'y' => array() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if(isset($instance->views->breadboardView->geometry->transform)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					$part['geometry']['r'] = $instance->views->breadboardView->geometry->transform; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					$this->comment = json_encode($instance->views->breadboardView->geometry->transform->attributes()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if(isset($geometry['wireFlags'])) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					$part['type'] = 'wire'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				foreach ($geometry as $key => $value) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					if(substr($key, 0,1) == 'x') $part['geometry']['x'][] =(float)$value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					if(substr($key, 0,1) == 'y') $part['geometry']['y'][] =(float)$value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$part['geometry']['z'] =(float)$geometry['z']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if($this->minY>$part['geometry']['y'][0])$this->minY = $part['geometry']['y'][0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if($this->minX>$part['geometry']['x'][0])$this->minX = $part['geometry']['x'][0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if(	$part['type']== 'wire'){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					$wireAttributes = $instance->views->breadboardView->wireExtras->attributes(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					$part['color'] = (string)$wireAttributes['color']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$part['component'] = $this->getComponent($attributes->path); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$this->parts[] = $part; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$this->minY = abs($this->minY); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$this->minX = abs($this->minX); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$this->comment = '<h1>Composants</h1><ul>'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		foreach ($this->parts as $part) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if($part['type'] == 'component' && isset($part['component']['name'])){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$this->comment .= '<li>'.$part['sigle'].' : '. $part['component']['name'].' ('. $part['component']['description'].')</li>'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$this->comment .= '</ul>'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	public static function toFile($resource){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public function toHtml(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$ext = getExt($resource->content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$infos = self::manifest(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		return array( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			'name'=> slugify($resource->label).'.'.$ext, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			'content' => file_exists(SKETCH_PATH.$resource->content) ? file_get_contents(SKETCH_PATH.$resource->content) : '' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$html = '<svg id="vis" width="1500" height="500" ></svg> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		<script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			 var vis = d3.select("#vis");'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				foreach ($this->parts as $part) {  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					if(!isset($part['component']) || $part['type']!='component' || !isset($part['component']['breadboard'])) continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$html .= "var part = vis.append('svg');"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$html .= "part.attr('x',".($part['geometry']['x'][0]+$this->minX).");"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$html .= "part.attr('y',".($part['geometry']['y'][0]+$this->minY).");"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$html .= "part.html('".str_replace(array("'","\n"),array("\'"," "),$part['component']['breadboard'])."');"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				//part.select('g').attr("transform","rotate(45)"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				 }  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				  foreach ($this->parts as $part) {  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if( $part['type']!='wire' ) continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$html .= 'var line = vis.append("polyline")'."\n\t\t".'.attr("stroke-linejoin","round").style("stroke", \''.$part['color'].'\').attr("stroke-width", 5)'."\n\t\t"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					$x = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					$y = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$html .= '.attr("points","'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					for ($i=0;$i<count($part['geometry']['x']);$i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						$x += $part['geometry']['x'][$i]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						$y += $part['geometry']['y'][$i]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						if($i==0) $y+= $this->minY; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						if($i==0) $x+= $this->minX; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						$html .= "$x,$y,"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					$html .= '");'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			   }  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$html .= '</script>'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return $html; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	public static function toHtml($resource,$sketch){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		global $myUser; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$infos = self::manifest(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	private function getComponent($path){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$component = array(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(substr($path, 0,1)==':') return $component; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(isset($this->files['part.'.$path])){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$path = 'part.'.basename($path); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			//if(!isset($this->files[$path])) return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$xmlPart = new SimpleXMLElement($this->files[$path]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$from = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$content = $resource->content ==''?'Envoyer un fichier':'<a href="action.php?action=get_resource&id='.$resource->id.'">Télécharger</a>'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$response['content'] = '<div id="dropZoneFiles" style="width:100%;height:auto;" class="dropzone">'.$content.'</div>'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		if($myUser->id == $sketch->owner) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			$response['upload'] = $infos['upload']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}else if(strpos($path,$this->coreIndicator)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$path = __DIR__.SLASH.substr($path, strpos($path, $this->coreIndicator)+1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(!file_exists($path)) return $component ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$xmlPart = new SimpleXMLElement(file_get_contents($path)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$from = __DIR__.SLASH.'fritzing-parts/svg/core/'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}else if( file_exists( __DIR__.SLASH.'fritzing-parts/core/'.basename($path))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$path =  __DIR__.SLASH.'fritzing-parts/core/'.basename($path); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$xmlPart = new SimpleXMLElement(file_get_contents($path)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$from = __DIR__.SLASH.'fritzing-parts/svg/core/'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			return $component ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		return $response; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$component['name'] = (string)$xmlPart->title; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$component['description'] = (string)$xmlPart->description; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$partAttributes = $xmlPart->views->breadboardView->layers->attributes(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if($from==''){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$component['breadboard'] = $this->files['svg.'.str_replace('/', '.', $partAttributes['image'])]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$component['breadboard'] = file_get_contents($from.$partAttributes['image']); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return $component; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ?> 
			 |