'Social_Widget', 'description' => __('A widget that allows the user to display social media icons in their sidebar', 'smw') );
/* Widget control settings. */
$control_ops = array( 'width' => 600, 'height' => 350, 'id_base' => 'social-widget' );
/* Create the widget. */
$this->WP_Widget( 'social-widget', __('Social Media Widget', 'smw'), $widget_ops, $control_ops );
}
/* Display the widget */
function widget( $args, $instance ) {
extract( $args );
/* Our variables from the widget settings. */
$title = apply_filters('widget_title', $instance['title'] );
$facebook = $instance['facebook'];
$twitter = $instance['twitter'];
$myspace = $instance['myspace'];
$friendfeed = $instance['friendfeed'];
$orkut = $instance['orkut'];
$linkedin = $instance['linkedin'];
$flickr = $instance['flickr'];
$youtube = $instance['youtube'];
$skype = $instance['skype'];
$digg = $instance['digg'];
$reddit = $instance['reddit'];
$delicious = $instance['delicious'];
$stumble = $instance['stumble'];
$buzz = $instance['buzz'];
$vimeo = $instance['vimeo'];
$blogger = $instance['blogger'];
$wordpress = $instance['wordpress'];
$yelp = $instance['yelp'];
$lastfm = $instance['lastfm'];
$foursquare = $instance['foursquare'];
$meetup = $instance['meetup'];
$digitaltunes = $instance['digitaltunes'];
$soundcloud = $instance['soundcloud'];
$rss = $instance['rss_url'];
$subscribe = $instance['subscribe'];
$icon_size = $instance['icon_size'];
$icon_pack = $instance['icon_pack'];
$animation = $instance['animation'];
$icon_opacity = $instance['icon_opacity'];
$newtab = $instance['newtab'];
$nofollow = $instance['nofollow'];
/* Choose Icon Size if Value is 'default' */
if($icon_size == 'default') {
$icon_size = '32';
}
/* Choose icon opacity if Value is 'default' */
if($icon_opacity == 'default') {
$icon_opacity = '0.8';
}
/* Need to make opacity a whole number for IE styling filter() */
$icon_ie = $icon_opacity * 100;
/* Check to see if nofollow is set or not */
if ($nofollow == 'on') {
$nofollow = "rel=\"nofollow\"";
} else {
$nofollow = '';
}
/* Check to see if New Tab is set to yes */
if ($newtab == 'yes') {
$newtab = "target=\"_blank\"";
} else {
$newtab = '';
}
/* Get Plugin Path */
$smw_path = SMW_PLUGINPATH;
/* Before widget (defined by themes). */
echo $before_widget;
/* Display the widget title if one was input (before and after defined by themes). */
if ( $title )
echo $before_title . $title . $after_title;
echo "
";
/* Display linked images to profiles from widget settings if one was input. */
// Facebook
if ( $facebook != '') {
?>
>
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class=""" /> >
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class="" /> >
style="opacity: ; -moz-opacity: ;" class="" />";
echo $after_widget;
}
/* Update the widget settings */
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
/* Strip Tags For Text Boxes */
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['facebook'] = strip_tags( $new_instance['facebook'] );
$instance['twitter'] = strip_tags( $new_instance['twitter'] );
$instance['myspace'] = strip_tags( $new_instance['myspace'] );
$instance['friendfeed'] = strip_tags( $new_instance['friendfeed'] );
$instance['orkut'] = strip_tags( $new_instance['orkut'] );
$instance['linkedin'] = strip_tags( $new_instance['linkedin'] );
$instance['flickr'] = strip_tags( $new_instance['flickr'] );
$instance['youtube'] = strip_tags( $new_instance['youtube'] );
$instance['skype'] = strip_tags( $new_instance['skype'] );
$instance['digg'] = strip_tags( $new_instance['digg'] );
$instance['reddit'] = strip_tags( $new_instance['reddit'] );
$instance['delicious'] = strip_tags( $new_instance['delicious'] );
$instance['stumble'] = strip_tags( $new_instance['stumble'] );
$instance['buzz'] = strip_tags( $new_instance['buzz'] );
$instance['vimeo'] = strip_tags( $new_instance['vimeo'] );
$instance['blogger'] = strip_tags( $new_instance['blogger'] );
$instance['wordpress'] = strip_tags( $new_instance['wordpress'] );
$instance['yelp'] = strip_tags( $new_instance['yelp'] );
$instance['lastfm'] = strip_tags( $new_instance['lastfm'] );
$instance['foursquare'] = strip_tags( $new_instance['foursquare'] );
$instance['meetup'] = strip_tags( $new_instance['meetup'] );
$instance['digitaltunes'] = strip_tags( $new_instance['digitaltunes'] );
$instance['soundcloud'] = strip_tags( $new_instance['soundcloud'] );
$instance['rss_url'] = strip_tags( $new_instance['rss_url'] );
$instance['subscribe'] = strip_tags( $new_instance['subscribe'] );
$instance['icon_size'] = $new_instance['icon_size'];
$instance['icon_pack'] = $new_instance['icon_pack'];
$instance['animation'] = $new_instance['animation'];
$instance['icon_opacity'] = $new_instance['icon_opacity'];
$instance['newtab'] = $new_instance['newtab'];
$instance['nofollow'] = $new_instance['nofollow'];
return $instance;
}
/**
* Displays the widget settings controls on the widget panel.
* Make use of the get_field_id() and get_field_name() function
* when creating your form elements. This handles the confusing stuff.
*/
function form( $instance ) {
/* Set up some default widget settings. */
$defaults = array(
'title' => __('Follow Us!', 'test'),
'facebook' => __('http://www.facebook.com/your_name', 'smw'),
'twitter' => __('http://www.twitter.com/yourname', 'smw'),
'myspace' => __('http://www.myspace.com/yourname', 'smw'),
'friendfeed' => __('http://www.friendfeed.com/yourname', 'smw'),
'orkut' => __('http://www.orkut.com/Main#Profile?uid=youruid', 'smw'),
'linkedin' => __('http://www.linkedin.com/in/yourname', 'smw'),
'flickr' => __('http://www.flickr.com/photos/yourname', 'smw'),
'youtube' => __('http://www.youtube.com/user/yourname', 'smw'),
'skype' => __('skype:yourusername?add', 'smw'),
'digg' => __('http://www.digg.com/users/yourname', 'smw'),
'reddit' => __('http://www.reddit.com/user/yourname', 'smw'),
'delicious' => __('http://delicious.com/yourname', 'smw'),
'stumble' => __('http://www.stumbleupon.com/stumbler/yourname', 'smw'),
'buzz' => __('http://www.google.com/profiles/yourname#buzz', 'smw'),
'vimeo' => __('http://www.vimeo.com/yourname', 'smw'),
'blogger' => __('http://www.blogger.com/profile/youridnumber', 'smw'),
'wordpress' => __('http://en.gravatar.com/yourname', 'smw'),
'yelp' => __('http://yourname.yelp.com', 'smw'),
'lastfm' => __('http://www.last.fm/user/yourname', 'smw'),
'foursquare' => __('http://foursquare.com/user/yourname', 'smw'),
'meetup' => __('http://www.meetup.com/your-group', 'smw'),
'digitaltunes' => __('http://www.digital-tunes.net/user_profile/yourname', 'smw'),
'soundcloud' => __('http://www.soundcloud.com/your-name', 'smw'),
'rss_url' => __('http://www.yoursite.com/feed', 'smw'),
'icon_size' => 'default',
'icon_pack' => 'default',
'icon_opacity' => 'default',
'newtab' => 'yes',
'nofollow' => 'on');
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
Note: Make sure you include FULL URL (i.e. http://www.example.com)
If you do not want an icon to be visible, simply delete the supplied URL and leave the input blox blank.
This plugin takes up a great deal of my free time, and I don't get paid for any of the time I put into making fixes and adding features. If you can, please donate. Any contribution will help keep Social Media Widget up-to-date.
>