defaults = array( 'title' => '', 'new_tab' => 0, 'size' => 32, 'facebook' => '', 'twitter' => '', 'gplus' => '', 'youtube' => '', 'rss' => '', 'pinterest' => '', 'linkedin' => '', 'stumbleupon' => '', 'reddit' => '', 'tumblr' => '', 'instagram' => '', 'vimeo' => '', 'foursquare' => '', 'soundcloud' => '', 'github' => '', 'flickr' => '', 'skype' => '', 'behance' => '', 'dribbble' => '', 'dropbox' => '', 'email' => '', ); $this->sizes = array( '32' ); $this->profiles = array( 'facebook' => array( 'label' => __( 'Facebook URI', 'realistic' ), 'pattern' => '
  • ', ), 'twitter' => array( 'label' => __( 'Twitter URI', 'realistic' ), 'pattern' => '
  • ', ), 'gplus' => array( 'label' => __( 'Google+ URI', 'realistic' ), 'pattern' => '
  • ', ), 'youtube' => array( 'label' => __( 'YouTube URI', 'realistic' ), 'pattern' => '
  • ', ), 'rss' => array( 'label' => __( 'RSS URI', 'realistic' ), 'pattern' => '
  • ', ), 'pinterest' => array( 'label' => __( 'Pinterest URI', 'realistic' ), 'pattern' => '
  • ', ), 'linkedin' => array( 'label' => __( 'Linkedin URI', 'realistic' ), 'pattern' => '
  • ', ), 'stumbleupon' => array( 'label' => __( 'StumbleUpon URI', 'realistic' ), 'pattern' => '
  • ', ), 'reddit' => array( 'label' => __( 'Reddit URI', 'realistic' ), 'pattern' => '
  • ', ), 'tumblr' => array( 'label' => __( 'Tumblr URI', 'realistic' ), 'pattern' => '
  • ', ), 'instagram' => array( 'label' => __( 'Instagram URI', 'realistic' ), 'pattern' => '
  • ', ), 'vimeo' => array( 'label' => __( 'Vimeo URI', 'realistic' ), 'pattern' => '
  • ', ), 'foursquare' => array( 'label' => __( 'FourSquare URI', 'realistic' ), 'pattern' => '
  • ', ), 'soundcloud' => array( 'label' => __( 'Soundcloud URI', 'realistic' ), 'pattern' => '
  • ', ), 'github' => array( 'label' => __( 'GitHub URI', 'realistic' ), 'pattern' => '
  • ', ), 'flickr' => array( 'label' => __( 'Flickr URI', 'realistic' ), 'pattern' => '
  • ', ), 'skype' => array( 'label' => __( 'Skype URI', 'realistic' ), 'pattern' => '
  • ', ), 'behance' => array( 'label' => __( 'Behance URI', 'realistic' ), 'pattern' => '
  • ', ), 'dribbble' => array( 'label' => __( 'Dribbble URI', 'realistic' ), 'pattern' => '
  • ', ), 'dropbox' => array( 'label' => __( 'Dropbox URI', 'realistic' ), 'pattern' => '
  • ', ), 'email' => array( 'label' => __( 'Email URI', 'realistic' ), 'pattern' => '
  • ', ), ); $widget_ops = array( 'classname' => 'realistic_social_icons_widget', 'description' => __( 'Show social profile icons.', 'realistic' ), ); $control_ops = array( 'id_base' => 'social-icons', #'width' => 505, #'height' => 350, ); parent::__construct ( 'social-icons', __( 'Realistic: Social Icons', 'realistic' ), $widget_ops, $control_ops ); } function form( $instance ) { /** Merge with defaults */ $instance = wp_parse_args( (array) $instance, $this->defaults ); ?>


    profiles as $profile => $data ) { printf( '

    ', esc_attr( $this->get_field_id( $profile ) ), esc_attr( $data['label'] ) ); printf( '

    ', esc_attr( $this->get_field_id( $profile ) ), esc_attr( $this->get_field_name( $profile ) ), esc_url( $instance[$profile] ) ); } } function update( $newinstance, $oldinstance ) { foreach ( $newinstance as $key => $value ) { /** Sanitize Profile URIs */ if ( array_key_exists( $key, (array) $this->profiles ) ) { $newinstance[$key] = esc_url( $newinstance[$key] ); } } return $newinstance; } function widget( $args, $instance ) { extract( $args ); /** Merge with defaults */ $instance = wp_parse_args( (array) $instance, $this->defaults ); echo $before_widget; if ( ! empty( $instance['title'] ) ) echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title; $output = ''; $new_tab = $instance['new_tab'] ? 'target="_blank"' : ''; foreach ( (array) $this->profiles as $profile => $data ) { if ( ! empty( $instance[$profile] ) ) $output .= sprintf( $data['pattern'], esc_url( $instance[$profile] ), $new_tab ); } if ( $output ) printf( '
    ', '',$output ); echo $after_widget; } } add_action( 'widgets_init', create_function( '', 'register_widget("realistic_social_icons_widget");' ) );