'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' => 850, 'height' => 350, 'id_base' => 'social-widget' );
/* Create the widget. */
$this->WP_Widget( 'social-widget', __('CUSTOM - 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'] );
$text = apply_filters( 'widget_text', $instance['text'], $instance );
$imgcaption = $instance['imgcaption'];
$facebook = $instance['facebook'];
$googleplus = $instance['googleplus'];
$twitter = $instance['twitter'];
$myspace = $instance['myspace'];
$friendfeed = $instance['friendfeed'];
$orkut = $instance['orkut'];
$hyves = $instance['hyves'];
$linkedin = $instance['linkedin'];
$asmallworld = $instance['asmallworld'];
$flickr = $instance['flickr'];
$picasa = $instance['picasa'];
$youtube = $instance['youtube'];
$skype = $instance['skype'];
$digg = $instance['digg'];
$reddit = $instance['reddit'];
$delicious = $instance['delicious'];
$stumble = $instance['stumble'];
$tumblr = $instance['tumblr'];
$buzz = $instance['buzz'];
$talk = $instance['talk'];
$vimeo = $instance['vimeo'];
$blogger = $instance['blogger'];
$wordpress = $instance['wordpress'];
$yelp = $instance['yelp'];
$lastfm = $instance['lastfm'];
$pandora = $instance['pandora'];
$ustream = $instance['ustream'];
$imdb = $instance['imdb'];
$hulu = $instance['hulu'];
$flixster = $instance['flixster'];
$foursquare = $instance['foursquare'];
$meetup = $instance['meetup'];
$tungle = $instance['tungle'];
$plancast = $instance['plancast'];
$slideshare = $instance['slideshare'];
$deviantart = $instance['deviantart'];
$ping = $instance['ping'];
$live365 = $instance['live365'];
$digitaltunes = $instance['digitaltunes'];
$soundcloud = $instance['soundcloud'];
$bandcamp = $instance['bandcamp'];
$etsy = $instance['etsy'];
$bbb = $instance['bbb'];
$merchantcircle = $instance['merchantcircle'];
$ebay = $instance['ebay'];
$steam = $instance['steam'];
$rss = $instance['rss_url'];
$subscribe = $instance['subscribe'];
$icon_size = $instance['icon_size'];
$icon_pack = $instance['icon_pack'];
$customiconsurl = $instance['customiconsurl'];
$customiconspath = $instance['customiconspath'];
$animation = $instance['animation'];
$icon_opacity = $instance['icon_opacity'];
$newtab = $instance['newtab'];
$nofollow = $instance['nofollow'];
$alignment = $instance['alignment'];
$custom1icon = $instance['custom1icon'];
$custom2icon = $instance['custom2icon'];
$custom3icon = $instance['custom3icon'];
$custom4icon = $instance['custom4icon'];
$custom5icon = $instance['custom5icon'];
$custom6icon = $instance['custom6icon'];
$custom1name = $instance['custom1name'];
$custom2name = $instance['custom2name'];
$custom3name = $instance['custom3name'];
$custom4name = $instance['custom4name'];
$custom5name = $instance['custom5name'];
$custom6name = $instance['custom6name'];
$custom1url = $instance['custom1url'];
$custom2url = $instance['custom2url'];
$custom3url = $instance['custom3url'];
$custom4url = $instance['custom4url'];
$custom5url = $instance['custom5url'];
$custom6url = $instance['custom6url'];
/* 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 = '';
}
/* Set alignment */
if ($alignment == 'centered') {
$alignment = 'smw_center';
} elseif ($alignment == 'right') {
$alignment = 'smw_right';
} else {
$alignment = 'smw_left';
}
/* Get Plugin Path */
if($icon_pack == 'custom') {
$smw_path = $customiconsurl;
$smw_dir = $customiconspath;
} else {
$smw_path = SMW_PLUGINPATH . 'images/' . $icon_pack. '/' . $icon_size;
$smw_dir = SMW_PLUGINDIR . 'images/' . $icon_pack. '/' . $icon_size;
}
/* 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 short description */
if ( $text )
echo "
" . $instance['filter'] ? wpautop($text) : $text . '
';
/* Display linked images to profiles from widget settings if one was input. */
// Facebook
if ( $facebook != '' && $facebook != ' ' && file_exists($smw_dir.'/facebook.png')) {
?>
>
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="" /> >
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="" width="" height="" /> >
style="opacity: ; -moz-opacity: ;" class="" width="" height="" /> >
style="opacity: ; -moz-opacity: ;" class="" width="" height="" /> >
style="opacity: ; -moz-opacity: ;" class="" width="" height="" /> >
style="opacity: ; -moz-opacity: ;" class="" width="" height="" /> >
style="opacity: ; -moz-opacity: ;" class="" width="" height="" /> >
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'] );
if ( current_user_can('unfiltered_html') )
$instance['text'] = $new_instance['text'];
else
$instance['text'] = stripslashes( wp_filter_post_kses( addslashes($new_instance['text']) ) ); // wp_filter_post_kses() expects slashed
$instance['imgcaption'] = $new_instance['imgcaption'];
$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'];
$instance['alignment'] = $new_instance['alignment'];
$instance['facebook'] = strip_tags( $new_instance['facebook'] );
$instance['googleplus'] = strip_tags( $new_instance['googleplus'] );
$instance['twitter'] = strip_tags( $new_instance['twitter'] );
$instance['myspace'] = strip_tags( $new_instance['myspace'] );
$instance['orkut'] = strip_tags( $new_instance['orkut'] );
$instance['hyves'] = strip_tags( $new_instance['hyves'] );
$instance['linkedin'] = strip_tags( $new_instance['linkedin'] );
$instance['asmallworld'] = strip_tags( $new_instance['asmallworld'] );
$instance['foursquare'] = strip_tags( $new_instance['foursquare'] );
$instance['meetup'] = strip_tags( $new_instance['meetup'] );
$instance['flickr'] = strip_tags( $new_instance['flickr'] );
$instance['picasa'] = strip_tags( $new_instance['picasa'] );
$instance['deviantart'] = strip_tags( $new_instance['deviantart'] );
$instance['youtube'] = strip_tags( $new_instance['youtube'] );
$instance['hulu'] = strip_tags( $new_instance['hulu'] );
$instance['ustream'] = strip_tags( $new_instance['ustream'] );
$instance['vimeo'] = strip_tags( $new_instance['vimeo'] );
$instance['flixster'] = strip_tags( $new_instance['flixster'] );
$instance['imdb'] = strip_tags( $new_instance['imdb'] );
$instance['steam'] = strip_tags( $new_instance['steam'] );
$instance['skype'] = strip_tags( $new_instance['skype'] );
$instance['talk'] = strip_tags( $new_instance['talk'] );
$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['friendfeed'] = strip_tags( $new_instance['friendfeed'] );
$instance['rss_url'] = strip_tags( $new_instance['rss_url'] );
$instance['subscribe'] = strip_tags( $new_instance['subscribe'] );
$instance['tumblr'] = strip_tags( $new_instance['tumblr'] );
$instance['blogger'] = strip_tags( $new_instance['blogger'] );
$instance['wordpress'] = strip_tags( $new_instance['wordpress'] );
$instance['yelp'] = strip_tags( $new_instance['yelp'] );
$instance['slideshare'] = strip_tags( $new_instance['slideshare'] );
$instance['bbb'] = strip_tags( $new_instance['bbb'] );
$instance['merchantcircle'] = strip_tags( $new_instance['merchantcircle'] );
$instance['etsy'] = strip_tags( $new_instance['etsy'] );
$instance['ebay'] = strip_tags( $new_instance['ebay'] );
$instance['lastfm'] = strip_tags( $new_instance['lastfm'] );
$instance['pandora'] = strip_tags( $new_instance['pandora'] );
$instance['ping'] = strip_tags( $new_instance['ping'] );
$instance['live365'] = strip_tags( $new_instance['live365'] );
$instance['digitaltunes'] = strip_tags( $new_instance['digitaltunes'] );
$instance['soundcloud'] = strip_tags( $new_instance['soundcloud'] );
$instance['bandcamp'] = strip_tags( $new_instance['bandcamp'] );
$instance['tungle'] = strip_tags( $new_instance['tungle'] );
$instance['plancast'] = strip_tags( $new_instance['plancast'] );
$instance['custom1name'] = strip_tags( $new_instance['custom1name'] );
$instance['custom1icon'] = strip_tags( $new_instance['custom1icon'] );
$instance['custom1url'] = strip_tags( $new_instance['custom1url'] );
$instance['custom2name'] = strip_tags( $new_instance['custom2name'] );
$instance['custom2icon'] = strip_tags( $new_instance['custom2icon'] );
$instance['custom2url'] = strip_tags( $new_instance['custom2url'] );
$instance['custom3name'] = strip_tags( $new_instance['custom3name'] );
$instance['custom3icon'] = strip_tags( $new_instance['custom3icon'] );
$instance['custom3url'] = strip_tags( $new_instance['custom3url'] );
$instance['custom4name'] = strip_tags( $new_instance['custom4name'] );
$instance['custom4icon'] = strip_tags( $new_instance['custom4icon'] );
$instance['custom4url'] = strip_tags( $new_instance['custom4url'] );
$instance['custom5name'] = strip_tags( $new_instance['custom5name'] );
$instance['custom5icon'] = strip_tags( $new_instance['custom5icon'] );
$instance['custom5url'] = strip_tags( $new_instance['custom5url'] );
$instance['custom6name'] = strip_tags( $new_instance['custom6name'] );
$instance['custom6icon'] = strip_tags( $new_instance['custom6icon'] );
$instance['custom6url'] = strip_tags( $new_instance['custom6url'] );
$instance['customiconsurl'] = strip_tags( $new_instance['customiconsurl'] );
$instance['customiconspath'] = strip_tags( $new_instance['customiconspath'] );
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!', 'smw'),
'text' => '',
'imgcaption' => __('Follow Us on', 'care'),
'icon_size' => 'default',
'icon_pack' => 'default',
'icon_opacity' => 'default',
'newtab' => 'yes',
'nofollow' => 'on',
'alignment' => 'left',
'facebook' => __('', 'smw'),
'googleplus' => __('', 'smw'),
'twitter' => __('', 'smw'),
'myspace' => __('', 'smw'),
'orkut' => __('', 'smw'),
'hyves' => __('', 'smw'),
'linkedin' => __('', 'smw'),
'asmallworld' => __('', 'smw'),
'foursquare' => __('', 'smw'),
'meetup' => __('', 'smw'),
'flickr' => __('', 'smw'),
'picasa' => __('', 'smw'),
'deviantart' => __('', 'smw'),
'youtube' => __('', 'smw'),
'hulu' => __('', 'smw'),
'ustream' => __('', 'smw'),
'vimeo' => __('', 'smw'),
'flixster' => __('', 'smw'),
'imdb' => __('', 'smw'),
'steam' => __('', 'smw'),
'skype' => __('', 'smw'),
'talk' => __('', 'smw'),
'digg' => __('', 'smw'),
'reddit' => __('', 'smw'),
'delicious' => __('', 'smw'),
'stumble' => __('', 'smw'),
'buzz' => __('', 'smw'),
'friendfeed' => __('', 'smw'),
'rss_url' => __('', 'smw'),
'subscribe' => __('mailto:', 'smw'),
'tumblr' => __('', 'smw'),
'blogger' => __('', 'smw'),
'wordpress' => __('', 'smw'),
'yelp' => __('', 'smw'),
'slideshare' => __('', 'smw'),
'bbb' => __('', 'smw'),
'merchantcircle' => __('', 'smw'),
'etsy' => __('', 'smw'),
'ebay' => __('', 'smw'),
'lastfm' => __('', 'smw'),
'pandora' => __('', 'smw'),
'ping' => __('', 'smw'),
'live365' => __('', 'smw'),
'digitaltunes' => __('', 'smw'),
'soundcloud' => __('', 'smw'),
'bandcamp' => __('', 'smw'),
'tungle' => __('', 'smw'),
'plancast' => __('', 'smw'),
'custom1name' => __('', 'smw'),
'custom1icon' => __('', 'smw'),
'custom1url' => __('', 'smw'),
'custom2name' => __('', 'smw'),
'custom2icon' => __('', 'smw'),
'custom2url' => __('', 'smw'),
'custom3name' => __('', 'smw'),
'custom3icon' => __('', 'smw'),
'custom3url' => __('', 'smw'),
'custom4name' => __('', 'smw'),
'custom4icon' => __('', 'smw'),
'custom4url' => __('', 'smw'),
'custom5name' => __('', 'smw'),
'custom5icon' => __('', 'smw'),
'custom5url' => __('', 'smw'),
'custom6name' => __('', 'smw'),
'custom6icon' => __('', 'smw'),
'custom6url' => __('', 'smw'),
'customiconsurl' => __('http://wwww.yoursite.com/wordpress/wp-content/your-icons', 'smw'),
'customiconspath' => __('/path/to/your-icons', 'smw'));
$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.