prefix = framework_get_prefix(); /* Default services. */ $default_services = array( 'delicious' => 'Delicious', 'digg' => 'Digg', 'dribbble' => 'Dribbble', 'dropbox' => 'Dropbox', 'email' => 'Email', 'facebook' => 'Facebook', 'flickr' => 'Flickr', 'forrst' => 'Forrst', 'foursquare' => 'Foursquare', 'github' => 'Github', 'googleplus' => 'Google+', 'gosquared' => 'GoSquared', 'instagram' => 'Instagram', 'lastfm' => 'LastFM', 'linkedin' => 'LinkedIn', 'pinterest' => 'Pinterest', 'reddit' => 'Reddit', 'skype' => 'Skype', 'soundcloud' => 'Soundcloud', 'spotify' => 'Spotify', 'stumbleupon' => 'Stumbleupon', 'twitter' => 'Twitter', 'vimeo' => 'Vimeo', 'yelp' => 'Yelp', 'youtube' => 'YouTube', 'zerply' => 'Zerply', 'rss' => 'RSS' ); /* Apply filters. */ $this->services = apply_filters( 'social-profiles-services', $default_services ); /* Set up the widget options. */ $widget_options = array( 'classname' => 'social-profiles', 'description' => esc_html__( 'Display links to your social profiles.', 'wordsmith' ) ); /* Set up the widget control options. */ $control_options = array( 'width' => 200, 'height' => 350 ); /* Create the widget. */ $this->WP_Widget( "{$this->prefix}-social-profiles", __( 'Social Profiles', 'wordsmith' ), $widget_options, $control_options ); } /* Outputs the widget based on the arguments input through the widget controls. */ function widget( $args, $instance ) { extract( $args ); $links = array(); foreach( $this->services as $service => $name ) { $links[$service] = esc_url( $instance[$service] ); } $links = array_filter( $links ); if ( empty( $links ) ) return false; /* Output the theme's $before_widget wrapper. */ echo $before_widget; /* If a title was input by the user, display it. */ if ( !empty( $instance['title'] ) ) echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title; /* If a description was input by the user, display it. */ if ( !empty( $instance['description'] ) ) echo '

' . $instance['description'] . '

'; echo ''; /* Close the theme's widget wrapper. */ echo $after_widget; } /* Updates the widget control options for the particular instance of the widget. */ function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance = $new_instance; foreach( $this->services as $service => $name ) { $instance[$service] = !empty( $new_instance[$service] ) ? esc_url( $new_instance[$service] ) : ''; } return $instance; } /* Displays the widget control options in the Widgets admin screen. */ function form( $instance ) { /* Set up the default form values. */ $defaults = array( 'title' => esc_attr__( 'Social Profiles', 'wordsmith' ), 'description' => '', 'delicious' => 'http://delicious.com', 'digg' => 'http://digg.com', 'dribbble' => 'http://dribbble.com', 'dropbox' => 'https://www.dropbox.com', 'email' => '#nowhere', 'facebook' => 'http://facebook.com', 'flickr' => 'http://flickr.com', 'forrst' => 'http://forrst.com', 'foursquare' => 'https://foursquare.com', 'github' => 'https://github.com', 'googleplus' => 'https://plus.google.com', 'gosquared' => 'http://gosquared.com', 'instagram' => 'http://instagram.com', 'lastfm' => 'http://lastfm.com', 'linkedin' => 'http://linkedin.com', 'pinterest' => 'http://pinterest.com', 'reddit' => 'http://www.reddit.com', 'rss' => get_bloginfo( 'rss2_url' ), 'skype' => 'http://skype.com', 'soundcloud' => 'http://soundcloud.com', 'spotify' => 'http://spotify.com', 'stumbleupon' => 'http://www.stumbleupon.com', 'twitter' => 'http://twitter.com', 'vimeo' => 'http://vimeo.com', 'yelp' => 'http://www.yelp.com', 'youtube' => 'http://youtube.com', 'zerply' => 'http://zerply.com' ); /* Merge the user-selected arguments with the defaults. */ $instance = wp_parse_args( (array) $instance, $defaults ); ?>

services as $service => $name ) { ?>