<?php
	$list = '';

	foreach($instance['list'] as $item) {
		$image = $item['image_fallback'];

		if( $item['image'] ) {
			$image = wp_get_attachment_image_src($item['image'], 'full');
			$image = $image[0];
		}

		$new_window = '';
		$attributes = '';

		if( !empty($item['new_window']) ) {
			$new_window = 'true';
		}

		$attributes .= ' image="' . $image . '"';
		$attributes .= ' name="' . $item['name'] . '"';
		$attributes .= ' rating="' . $item['rating'] . '"';
		$attributes .= ' title="' . $item['title'] . '"';
		$attributes .= ' text="' . $item['text'] . '"';
		$attributes .= ' link="' . $item['link'] . '"';
		$attributes .= ' link_text="' . $item['link_text'] . '"';
		$attributes .= ' new_window="' . $new_window . '"';

		$list .= '[testimonials_item "' . $attributes . '][/testimonials_item]';
	}

	echo do_shortcode('[testimonials]' . $list . '[/testimonials]');
?>