class solofolio_social_widget extends WP_Widget {
  function solofolio_social_widget() {
    parent::WP_Widget(false, $name = 'Solofolio Social Media');
  }
  function widget( $args, $i ) {
    extract( $args );
    global $wpdb;
    echo $before_widget;
    echo "
";
      echo $this->widgetlink( $this->fNilVal( $i, 'facebook'),  $this->fNilKey( $i, 'icon_1', 'facebook'));
      echo $this->widgetLink( $this->fNilVal( $i, 'twitter'),   $this->fNilKey( $i, 'icon_2', 'twitter'));
      echo $this->widgetLink( $this->fNilVal( $i, 'instagram'), $this->fNilKey( $i, 'icon_3', 'instagram'));
      echo $this->widgetLink( $this->fNilVal( $i, 'blink'),     $this->fNilKey( $i, 'icon_4', 'map-marker'));
      echo $this->widgetLink( $this->fNilVal( $i, 'vimeo'),     $this->fNilKey( $i, 'icon_5', 'vimeo-square'));
      echo $this->widgetLink( $this->fNilVal( $i, 'linkedin'),  $this->fNilKey( $i, 'icon_6', 'linkedin'));
  	echo "
";
  	echo $after_widget;
  }
  function update( $new_instance, $i ) {
    foreach (array_keys($new_instance) as $key) {
      $i[$key] = strip_tags($new_instance[$key]);
    }
    return $i;
  }
  function form( $i ) {
    ?>    
      selectIcon('icon_1',    $this->fNilKey($i, 'icon_1', 'facebook')); ?>
      inputField('facebook',  $this->fNilVal($i, 'facebook')); ?>
    
    
      selectIcon('icon_2',    $this->fNilKey($i, 'icon_2', 'twitter')); ?>
      inputField('twitter',   $this->fNilVal($i, 'twitter')); ?>
    
    
      selectIcon('icon_3',    $this->fNilKey($i, 'icon_3', 'instagram')); ?>
      inputField('instagram', $this->fNilVal($i, 'instagram')); ?>
    
    
      selectIcon('icon_4',    $this->fNilKey($i, 'icon_4', 'map-marker')); ?>
      inputField('blink',     $this->fNilVal($i, 'blink')); ?>
    
    
      selectIcon('icon_5',    $this->fNilKey($i, 'icon_5', 'vimeo-square')); ?>
      inputField('vimeo',     $this->fNilVal($i, 'vimeo')); ?>
    
    
      selectIcon('icon_6',    $this->fNilKey($i, 'icon_6', 'linkedin')); ?>
      inputField('linkedin',  $this->fNilVal($i, 'linkedin')); ?>
    
      }
  function selectIcon( $slug, $value ) {
    ?> 
   }
  function inputField( $slug, $value ) {
    ?>
   }
  function widgetLink( $value, $icon_slug ) {
    if (!empty($value)) {
      return "
";
    }
  }
  function fNilKey( $array, $key, $default ) {
    return ( array_key_exists( $key, $array ) ? esc_attr( $array[$key] ) : $default );
  }
  function fNilVal( $array, $key ) {
    if (array_key_exists( $key, $array )) {
      return apply_filters('widget_title', $array[$key]);
    } else {
      return '';
    }
  }
  function iconOptions() {
    return array( array('Facebook',      'facebook'),
                  array('Dribbble',      'dribbble'),
                  array('Google Plus',   'google-plus'),
                  array('Instagram',     'instagram'),
                  array('LinkedIn',      'linkedin'),
                  array('Blink',         'map-marker'),
                  array('Medium',        'medium'),
                  array('Pinterest',     'pinterest-p'),
                  array('Tumblr',        'tumblr'),
                  array('Twitter',       'twitter'),
                  array('Vimeo',         'vimeo-square'),
                  array('Youtube',       'youtube-play'));
  }
}
add_action('widgets_init', create_function('', 'return register_widget("solofolio_social_widget");'));
?>