public function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     $count = $instance['count'];
     $user = isset($instance['user']) ? $instance['user'] : '';
     $user = $user == '' ? 'self' : $user;
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     $instagram = new Simple_Instagram();
     $feed = $instagram->get_user_media($user, $count);
     $return = '';
     if ($feed && count($feed) > 0) {
         $return = '<div class="si_feed_widget">';
         $return .= '<ul class="si_feed_list">';
         foreach ($feed as $image) {
             $url = $image->images->standard_resolution->url;
             // Fix https
             $url = str_replace('http://', '//', $url);
             $return .= '<li class="si_item">';
             $return .= '<a href="' . $image->link . '" target="_blank">';
             $image_caption = is_object($image->caption) ? $image->caption->text : '';
             $return .= '<img alt="' . $image_caption . '" src="' . $url . '">';
             $return .= '</a>';
             $return .= '</li>';
         }
         $return .= '</ul>';
         $return .= '</div>';
     }
     echo $return;
     echo $after_widget;
 }
 /**
  * SI Feed - Enables and returns formatted HTML for
  * the [si_feed] shortcode
  *
  * @param array $atts - The Array of provided attributes
  * @return str $return - The formatted HTML
  */
 public function si_feed($atts)
 {
     $defaults = shortcode_atts(array('limit' => 10, 'size' => 'medium', 'wrapper' => 'div', 'link' => 'true', 'width' => 'auto', 'tag' => '', 'user' => 'self'), $atts);
     foreach ($defaults as $key => $value) {
         ${$key} = $value;
     }
     $instagram = new Simple_Instagram();
     $feed = $tag == '' ? $instagram->get_user_media($user, $limit) : $instagram->get_tagged_media($tag, $limit);
     if (!$feed || count($feed) < 0) {
         return '';
     }
     $feed = $this->check_count($feed, $limit);
     $return = $this->get_image_markup($feed, $width, $size, $wrapper, $link);
     return $return;
 }