protected function _createAssociatedMediaString( array $mediaItems, $baseurl = null, $attributes )
	{
		$string = '';
		$enc = $this->encoder();

		foreach( $mediaItems as $item )
		{
			$url = $item->getUrl();
			$previewUrl = $item->getPreview();
			$parts = explode( '/', $item->getMimetype() );

			switch( $parts[0] )
			{
				case 'audio':
				case 'video':
					$tag = "<source src=\"%1\$s\" title=\"%3\$s\" type=\"%4\$s\" ${attributes} />";
					break;
				case 'image':
					$tag = "<img src=\"%2\$s\" title=\"%3\$s\" ${attributes} />";
					break;
				default:
					$tag = '';
			}

			if( strncmp( $url, 'http', 4 ) !== 0 && strncmp( $url, 'data', 4 ) !== 0 && $baseurl !== null ) {
				$url = $baseurl . '/' . $url;
			}

			if( strncmp( $previewUrl, 'http', 4 ) !== 0 && strncmp( $previewUrl, 'data', 4 ) !== 0 && $baseurl !== null ) {
				$previewUrl = $baseurl . '/' . $previewUrl;
			}

			$mimetype = $enc->attr( $item->getMimetype() );
			$name = $enc->html( $item->getName() );

			$string .= sprintf( $tag, $enc->attr( $url ), $enc->attr( $previewUrl ), $name, $mimetype );
		}

		return $string;
	}
protected function _createAssociatedMediaString( array $mediaItems, $baseurl = null, $attributes )
	{
		$string = '';
		$enc = $this->encoder();

		foreach( $mediaItems as $item )
		{
			$url = $item->getUrl();
			$previewUrl = $item->getPreview();
			$parts = explode( '/', $item->getMimetype() );

			switch( $parts[0] )
			{
				case 'audio':
				case 'video':
					$tag = "<source src=\"%1\$s\" title=\"%3\$s\" type=\"%4\$s\" ${attributes} />";
					break;
				case 'image':
					$tag = "<img src=\"%2\$s\" title=\"%3\$s\" ${attributes} />";
					break;
				default:
					$tag = '';
			}

			if( strncmp( $url, 'http', 4 ) !== 0 && strncmp( $url, 'data', 4 ) !== 0 && $baseurl !== null ) {
				$url = $baseurl . '/' . $url;
			}

			if( strncmp( $previewUrl, 'http', 4 ) !== 0 && strncmp( $previewUrl, 'data', 4 ) !== 0 && $baseurl !== null ) {
				$previewUrl = $baseurl . '/' . $previewUrl;
			}

			$mimetype = $enc->attr( $item->getMimetype() );
			$name = $enc->html( $item->getName() );

			$string .= sprintf( $tag, $enc->attr( $url ), $enc->attr( $previewUrl ), $name, $mimetype );
		}

		return $string;
	}
protected function _createAssociatedMediaString ( array $ mediaItems , $ baseurl = null , $ attributes ) { $ string = '' ; $ enc = $ this -> encoder ( ) ; foreach ( $ mediaItems as $ item ) { $ url = $ item -> getUrl ( ) ; $ previewUrl = $ item -> getPreview ( ) ; $ parts = explode ( '/' , $ item -> getMimetype ( ) ) ; switch ( $ parts [ 0 ] ) { case 'audio' : case 'video' : $ tag = "<source src=\"%1\$s\" title=\"%3\$s\" type=\"%4\$s\" ${attributes} />" ; break ; case 'image' : $ tag = "<img src=\"%2\$s\" title=\"%3\$s\" ${attributes} />" ; break ; default : $ tag = '' ; } if ( strncmp ( $ url , 'http' , 4 ) !== 0 && strncmp ( $ url , 'data' , 4 ) !== 0 && $ baseurl !== null ) { $ url = $ baseurl . '/' . $ url ; } if ( strncmp ( $ previewUrl , 'http' , 4 ) !== 0 && strncmp ( $ previewUrl , 'data' , 4 ) !== 0 && $ baseurl !== null ) { $ previewUrl = $ baseurl . '/' . $ previewUrl ; } $ mimetype = $ enc -> attr ( $ item -> getMimetype ( ) ) ; $ name = $ enc -> html ( $ item -> getName ( ) ) ; $ string .= sprintf ( $ tag , $ enc -> attr ( $ url ) , $ enc -> attr ( $ previewUrl ) , $ name , $ mimetype ) ; } return $ string ; }
Creates the inner tags for associated media items.

@param array $mediaItems Item objects implementing MShop_Media_Item_Interface
@param string|null $baseurl Base URL that must be prepended to the relative URL
@param string $attributes String of name="value" pairs as item attributes.
Item attributes can contain placeholders for the URL (%1$s) and the preview URL (%2$s)
@return string Inner string for media HTML tags
Creates the inner tags for associated media items .