Social Icons Widget - Version 14.08

Version Description

  • Added prefixes to PHP variables to prevent conflicts with other plugins.
Download this release

Release Info

Developer dannisbet
Plugin Icon 128x128 Social Icons Widget
Version 14.08
Comparing to
See all releases

Code changes from version 14.07 to 14.08

lib/form.php CHANGED
@@ -1,27 +1,27 @@
1
  <?php
2
- global $social_accounts;
3
 
4
- $data = array();
5
 
6
- foreach ($social_accounts as $site => $id) {
7
- if($instance[$id] == '') { $data[$id] = 'http://'; }
8
- else { $data[$id] = $instance[$id]; }
9
  }
10
 
11
- $data['title'] = $instance['title'];
12
- $data['icons'] = $instance['icons'];
13
- $data['labels'] = $instance['labels'];
14
- $data['show_title'] = $instance['show_title'];
15
 
16
  ?>
17
 
18
  <div class="social_icons_widget">
19
 
20
  <p><label for="<?php echo $this->get_field_id('title'); ?>">Title:</label>
21
- <input class="widefat" type="text" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($data['title']); ?>" /></p>
22
 
23
  <?php
24
- $sizes = array(
25
  'None' => 'none',
26
  'Small (16px)' => 'small',
27
  'Medium (32px)' => 'medium',
@@ -35,9 +35,9 @@ $sizes = array(
35
  <p class="icon_options"><label for="<?php echo $this->get_field_id('icons'); ?>">Icon Type:</label>
36
  <select id="<?php echo $this->get_field_id('icons'); ?>" name="<?php echo $this->get_field_name('icons'); ?>">
37
  <?php
38
- foreach($sizes as $option => $value) :
39
 
40
- if(esc_attr($data['icons'] == $value)) { $selected = ' selected="selected"'; }
41
  else { $selected = ''; }
42
  ?>
43
 
@@ -47,16 +47,16 @@ $sizes = array(
47
  </select>
48
  </p>
49
 
50
- <?php if(esc_attr($data['labels'] == 'show')) { $checked = ' checked="checked"'; } else { $checked = ''; } ?>
51
  <p class="label_options"><input type="checkbox" id="<?php echo $this->get_field_id('labels'); ?>" name="<?php echo $this->get_field_name('labels'); ?>" value="show"<?php echo $checked; ?> /> <label for="<?php echo $this->get_field_id('labels'); ?>">Show Labels</label></p>
52
 
53
- <?php if(esc_attr($data['show_title'] == 'show')) { $checked = ' checked="checked"'; } else { $checked = ''; } ?>
54
  <p class="label_options"><input type="checkbox" id="<?php echo $this->get_field_id('show_title'); ?>" name="<?php echo $this->get_field_name('show_title'); ?>" value="show"<?php echo $checked; ?> /> <label for="<?php echo $this->get_field_id('show_title'); ?>">Hide Title</label></p>
55
 
56
  <ul class="social_accounts">
57
- <?php foreach ($social_accounts as $site => $id) : ?>
58
  <li><label for="<?php echo $this->get_field_id($id); ?>" class="<?php echo $id; ?>"><?php echo $site; ?>:</label>
59
- <input class="widefat" type="text" id="<?php echo $this->get_field_id($id); ?>" name="<?php echo $this->get_field_name($id); ?>" value="<?php echo esc_attr($data[$id]); ?>" /></li>
60
  <?php endforeach; ?>
61
  </ul>
62
 
1
  <?php
2
+ global $siw_social_accounts;
3
 
4
+ $siw_data = array();
5
 
6
+ foreach ($siw_social_accounts as $site => $id) {
7
+ if($instance[$id] == '') { $siw_data[$id] = 'http://'; }
8
+ else { $siw_data[$id] = $instance[$id]; }
9
  }
10
 
11
+ $siw_data['title'] = $instance['title'];
12
+ $siw_data['icons'] = $instance['icons'];
13
+ $siw_data['labels'] = $instance['labels'];
14
+ $siw_data['show_title'] = $instance['show_title'];
15
 
16
  ?>
17
 
18
  <div class="social_icons_widget">
19
 
20
  <p><label for="<?php echo $this->get_field_id('title'); ?>">Title:</label>
21
+ <input class="widefat" type="text" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($siw_data['title']); ?>" /></p>
22
 
23
  <?php
24
+ $siw_sizes = array(
25
  'None' => 'none',
26
  'Small (16px)' => 'small',
27
  'Medium (32px)' => 'medium',
35
  <p class="icon_options"><label for="<?php echo $this->get_field_id('icons'); ?>">Icon Type:</label>
36
  <select id="<?php echo $this->get_field_id('icons'); ?>" name="<?php echo $this->get_field_name('icons'); ?>">
37
  <?php
38
+ foreach($siw_sizes as $option => $value) :
39
 
40
+ if(esc_attr($siw_data['icons'] == $value)) { $selected = ' selected="selected"'; }
41
  else { $selected = ''; }
42
  ?>
43
 
47
  </select>
48
  </p>
49
 
50
+ <?php if(esc_attr($siw_data['labels'] == 'show')) { $checked = ' checked="checked"'; } else { $checked = ''; } ?>
51
  <p class="label_options"><input type="checkbox" id="<?php echo $this->get_field_id('labels'); ?>" name="<?php echo $this->get_field_name('labels'); ?>" value="show"<?php echo $checked; ?> /> <label for="<?php echo $this->get_field_id('labels'); ?>">Show Labels</label></p>
52
 
53
+ <?php if(esc_attr($siw_data['show_title'] == 'show')) { $checked = ' checked="checked"'; } else { $checked = ''; } ?>
54
  <p class="label_options"><input type="checkbox" id="<?php echo $this->get_field_id('show_title'); ?>" name="<?php echo $this->get_field_name('show_title'); ?>" value="show"<?php echo $checked; ?> /> <label for="<?php echo $this->get_field_id('show_title'); ?>">Hide Title</label></p>
55
 
56
  <ul class="social_accounts">
57
+ <?php foreach ($siw_social_accounts as $site => $id) : ?>
58
  <li><label for="<?php echo $this->get_field_id($id); ?>" class="<?php echo $id; ?>"><?php echo $site; ?>:</label>
59
+ <input class="widefat" type="text" id="<?php echo $this->get_field_id($id); ?>" name="<?php echo $this->get_field_name($id); ?>" value="<?php echo esc_attr($siw_data[$id]); ?>" /></li>
60
  <?php endforeach; ?>
61
  </ul>
62
 
lib/social-networks.php CHANGED
@@ -14,8 +14,8 @@
14
  The full-website-id should reflect the name of the image you create in each of the icon folder sizes, or in your custom icon directory. It is also used to populate the class field of the icon when the widget displays. The Social Icon Widget looks for .gif, .jpg, .jpeg, and .png in order and returns the first extention it finds.
15
  */
16
 
17
- global $social_accounts;
18
- $social_accounts = array(
19
  '500px' => 'fivehundredpx',
20
  'About.me' => 'aboutme',
21
  'Behance' => 'behance',
@@ -50,6 +50,6 @@
50
  );
51
 
52
  if( has_filter('social_icon_accounts') ) {
53
- $social_accounts = apply_filters('social_icon_accounts', $social_accounts);
54
  }
55
  ?>
14
  The full-website-id should reflect the name of the image you create in each of the icon folder sizes, or in your custom icon directory. It is also used to populate the class field of the icon when the widget displays. The Social Icon Widget looks for .gif, .jpg, .jpeg, and .png in order and returns the first extention it finds.
15
  */
16
 
17
+ global $siw_social_accounts;
18
+ $siw_social_accounts = array(
19
  '500px' => 'fivehundredpx',
20
  'About.me' => 'aboutme',
21
  'Behance' => 'behance',
50
  );
51
 
52
  if( has_filter('social_icon_accounts') ) {
53
+ $siw_social_accounts = apply_filters('social_icon_accounts', $siw_social_accounts);
54
  }
55
  ?>
lib/widget.php CHANGED
@@ -1,78 +1,78 @@
1
  <?php
2
- global $social_accounts;
3
  extract($args);
4
 
5
- $title = empty($instance['title']) ? 'Follow Us' : apply_filters('widget_title', $instance['title']);
6
- $icons = $instance['icons'];
7
- $labels = $instance['labels'];
8
- $show_title = $instance['show_title'];
9
 
10
  echo $before_widget;
11
 
12
- if($show_title == '') {
13
  echo $before_title;
14
- echo $title;
15
  echo $after_title;
16
  }
17
 
18
- if($labels == 'show') { $ul_class = 'show-labels '; }
19
  else { $ul_class = ''; }
20
- $ul_class .= 'icons-'.$icons;
21
  ?>
22
 
23
  <?php echo apply_filters('social_icon_opening_tag', '<ul class="'.$ul_class.'">'); ?>
24
 
25
- <?php foreach($social_accounts as $title => $id) : ?>
26
  <?php if($instance[$id] != '' && $instance[$id] != 'http://') :
27
 
28
- global $data;
29
- global $icon_output;
30
 
31
- $data['id'] = $id;
32
- $data['url'] = $instance[$id];
33
- $custom_sizes = array('custom_small','custom_medium','custom_large');
34
 
35
- if (in_array($icons, $custom_sizes)) {
36
- $size = str_replace("custom_","",$icons);
37
- $icon_path = STYLESHEETPATH .'/social_icons/'.$size.'/'.$id.'.{gif,jpg,jpeg,png}';
38
  }
39
  else {
40
  $siw_abs_path = str_replace('lib/', '', plugin_dir_path( __FILE__ ));
41
- $icon_path = $siw_abs_path . 'icons/'.$icons.'/'.$id.'.{gif,jpg,jpeg,png}';
42
 
43
- if($icons == 'large') { $imgsize = 'height="64" width="64"'; }
44
- elseif($icons == 'medium') { $imgsize = 'height="32" width="32"'; }
45
- elseif($icons == 'small') { $imgsize = 'height="16" width="16"'; }
46
  }
47
 
48
- $result = glob( $icon_path, GLOB_BRACE );
49
 
50
  if($result) {
51
- if (in_array($icons, $custom_sizes)) {
52
- $path = explode('themes', $result[0]);
53
- $icon = get_bloginfo('url').'/wp-content/themes'.$path[1];
54
  }
55
  else {
56
- $path = explode('plugins', $result[0]);
57
- $icon = plugins_url().''.$path[1];
58
  }
59
  }
60
- elseif( $labels != 'show' && $icons != 'small' ) {
61
- $icon = plugins_url().'/social-media-icons-widget/icons/'.$icons.'/_unknown.jpg';
62
  }
63
  else {
64
- $icon = '';
65
  }
66
 
67
- if ( $icon ) { $data['image'] = '<img class="site-icon" src="'.$icon.'" alt="'.$title.'" title="'.$title.'" '.$imgsize.' />'; }
68
- else { $data['image'] = ''; }
69
 
70
- if($labels != 'show') { $data['title'] = ''; }
71
- else { $data['title'] = '<span class="site-label">'.$title.'</span>'; }
72
 
73
  $format = '<li class="%1$s"><a href="%2$s" target="_blank">%3$s%4$s</a></li>';
74
- $icon_output = apply_filters('social_icon_output', $format);
75
- echo vsprintf($icon_output, $data);
76
 
77
  ?>
78
 
1
  <?php
2
+ global $siw_social_accounts;
3
  extract($args);
4
 
5
+ $siw_title = empty($instance['title']) ? 'Follow Us' : apply_filters('widget_title', $instance['title']);
6
+ $siw_icons = $instance['icons'];
7
+ $siw_labels = $instance['labels'];
8
+ $siw_show_title = $instance['show_title'];
9
 
10
  echo $before_widget;
11
 
12
+ if($siw_show_title == '') {
13
  echo $before_title;
14
+ echo $siw_title;
15
  echo $after_title;
16
  }
17
 
18
+ if($siw_labels == 'show') { $ul_class = 'show-labels '; }
19
  else { $ul_class = ''; }
20
+ $ul_class .= 'icons-'.$siw_icons;
21
  ?>
22
 
23
  <?php echo apply_filters('social_icon_opening_tag', '<ul class="'.$ul_class.'">'); ?>
24
 
25
+ <?php foreach($siw_social_accounts as $siw_title => $id) : ?>
26
  <?php if($instance[$id] != '' && $instance[$id] != 'http://') :
27
 
28
+ global $siw_data;
29
+ global $siw_icon_output;
30
 
31
+ $siw_data['id'] = $id;
32
+ $siw_data['url'] = $instance[$id];
33
+ $siw_custom_sizes = array('custom_small','custom_medium','custom_large');
34
 
35
+ if (in_array($siw_icons, $siw_custom_sizes)) {
36
+ $size = str_replace("custom_","",$siw_icons);
37
+ $siw_icon_path = STYLESHEETPATH .'/social_icons/'.$size.'/'.$id.'.{gif,jpg,jpeg,png}';
38
  }
39
  else {
40
  $siw_abs_path = str_replace('lib/', '', plugin_dir_path( __FILE__ ));
41
+ $siw_icon_path = $siw_abs_path . 'icons/'.$siw_icons.'/'.$id.'.{gif,jpg,jpeg,png}';
42
 
43
+ if($siw_icons == 'large') { $imgsize = 'height="64" width="64"'; }
44
+ elseif($siw_icons == 'medium') { $imgsize = 'height="32" width="32"'; }
45
+ elseif($siw_icons == 'small') { $imgsize = 'height="16" width="16"'; }
46
  }
47
 
48
+ $result = glob( $siw_icon_path, GLOB_BRACE );
49
 
50
  if($result) {
51
+ if (in_array($siw_icons, $siw_custom_sizes)) {
52
+ $siw_path = explode('themes', $result[0]);
53
+ $siw_icon = get_bloginfo('url').'/wp-content/themes'.$siw_path[1];
54
  }
55
  else {
56
+ $siw_path = explode('plugins', $result[0]);
57
+ $siw_icon = plugins_url().''.$siw_path[1];
58
  }
59
  }
60
+ elseif( $siw_labels != 'show' && $siw_icons != 'small' ) {
61
+ $siw_icon = plugins_url().'/social-media-icons-widget/icons/'.$siw_icons.'/_unknown.jpg';
62
  }
63
  else {
64
+ $siw_icon = '';
65
  }
66
 
67
+ if ( $siw_icon ) { $siw_data['image'] = '<img class="site-icon" src="'.$siw_icon.'" alt="'.$siw_title.'" title="'.$siw_title.'" '.$imgsize.' />'; }
68
+ else { $siw_data['image'] = ''; }
69
 
70
+ if($siw_labels != 'show') { $siw_data['title'] = ''; }
71
+ else { $siw_data['title'] = '<span class="site-label">'.$siw_title.'</span>'; }
72
 
73
  $format = '<li class="%1$s"><a href="%2$s" target="_blank">%3$s%4$s</a></li>';
74
+ $siw_icon_output = apply_filters('social_icon_output', $format);
75
+ echo vsprintf($siw_icon_output, $siw_data);
76
 
77
  ?>
78
 
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Social Icons Widget ===
2
  Contributors: dannisbet
3
  Tags: social, media, widget, follow, profile, icons, 500px, About.me, Behance, Dribbble, Codepen, Email, Envato, Facebook, Flickr, FourSquare, GitHub, Google+, Instagram, Kickstarter, Klout, LinkedIn, Medium, Path, Pinterest, RSS, Speaker Deck, StumbleUpon, Technorati, Tumblr, Twitter, Vimeo, Vine, WordPress, Yelp, YouTube, Zerply
4
- Donate link: https://github.com/dannisbet/social-icons-widget
5
  Requires at least: 3.5.1
6
- Tested up to: 3.9
7
- Stable tag: 14.07
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -14,15 +14,11 @@ Displays a list of social media website icons and a link to your profile.
14
 
15
  The Social Media Icons widget takes a simple, extendable approach to displaying links to your social media profiles in WordPress. The purpose of this plugin was to strip away the complexities I found most other plugins to have and simply display a set of basic social icons in an unordered list. There's no frills and no fanciness, making it easy to style to your website's look.
16
 
17
- = Custom Icons =
18
-
19
- Custom icons are easy to add. To enable them, select "Custom" from the Icon Type dropdown in the widget settings. In the directory of your active theme, create a folder titled 'social_icons'. Within that directory, add folders titled 'small', 'medium', and 'large' for each icon size you wish to use. Add your icons in .gif, .jpg, .jpeg, or .png format, using the name of the ID in the $social_accounts array (details above).
20
-
21
  = Icons =
22
 
23
  Default icons are from the [Simple Icons](http://simpleicons.org/) set created by Dan Leech.
24
 
25
- Email envelope icon is from Cy Me at [Noun Project](http://thenounproject.com/term/envelope/24786/).
26
 
27
  == Installation ==
28
 
@@ -30,6 +26,10 @@ Download the zip file and upload to your WordPress installation. Upon activation
30
 
31
  == Frequently Asked Questions ==
32
 
 
 
 
 
33
  = Extending =
34
 
35
  Developers can easily add more social media websites by creating a filter in the active theme's functions.php file like such:
@@ -74,6 +74,9 @@ The opening and closing unordered list tags can be edited or changed with the so
74
 
75
  == Changelog ==
76
 
 
 
 
77
  = 14.07 =
78
  * Added 500px, Codepen, Envato, Kickstarter, Speaker Deck, Vine
79
  * Removed Forrst
@@ -91,10 +94,10 @@ The opening and closing unordered list tags can be edited or changed with the so
91
  * Removed @getimagesize function for compatibility purposes
92
  * New accounts are now added via WordPress filter rather than editing core plugin code
93
 
94
- = 2013.05 =
95
  * Fixed image and CSS paths
96
 
97
- = 2013.04 =
98
  * Initial commit
99
 
100
  = trunk =
@@ -105,8 +108,8 @@ The opening and closing unordered list tags can be edited or changed with the so
105
  = 14.03 =
106
  Removed @getimagesize function for compatibility purposes. New accounts are now added via WordPress filter rather than editing core plugin code.
107
 
108
- = 2013.05 =
109
  Fixed image and CSS paths
110
 
111
- = 2013.04 =
112
  Initial commit to WordPress plugin repository
1
  === Social Icons Widget ===
2
  Contributors: dannisbet
3
  Tags: social, media, widget, follow, profile, icons, 500px, About.me, Behance, Dribbble, Codepen, Email, Envato, Facebook, Flickr, FourSquare, GitHub, Google+, Instagram, Kickstarter, Klout, LinkedIn, Medium, Path, Pinterest, RSS, Speaker Deck, StumbleUpon, Technorati, Tumblr, Twitter, Vimeo, Vine, WordPress, Yelp, YouTube, Zerply
4
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CJN7XU3Z7XHDL
5
  Requires at least: 3.5.1
6
+ Tested up to: 4.0
7
+ Stable tag: 14.08
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
14
 
15
  The Social Media Icons widget takes a simple, extendable approach to displaying links to your social media profiles in WordPress. The purpose of this plugin was to strip away the complexities I found most other plugins to have and simply display a set of basic social icons in an unordered list. There's no frills and no fanciness, making it easy to style to your website's look.
16
 
 
 
 
 
17
  = Icons =
18
 
19
  Default icons are from the [Simple Icons](http://simpleicons.org/) set created by Dan Leech.
20
 
21
+ Envelope designed by [Cy Me](http://www.thenounproject.com/Litrynn) from the [Noun Project](http://www.thenounproject.com)
22
 
23
  == Installation ==
24
 
26
 
27
  == Frequently Asked Questions ==
28
 
29
+ = Custom Icons =
30
+
31
+ Custom icons are easy to add. To enable them, select "Custom" from the Icon Type dropdown in the widget settings. In the directory of your active theme, create a folder titled 'social_icons'. Within that directory, add folders titled 'small', 'medium', and 'large' for each icon size you wish to use. Add your icons in .gif, .jpg, .jpeg, or .png format, following the naming format used for the default set of icons.
32
+
33
  = Extending =
34
 
35
  Developers can easily add more social media websites by creating a filter in the active theme's functions.php file like such:
74
 
75
  == Changelog ==
76
 
77
+ = 14.08 =
78
+ * Added prefixes to PHP variables to prevent conflicts with other plugins.
79
+
80
  = 14.07 =
81
  * Added 500px, Codepen, Envato, Kickstarter, Speaker Deck, Vine
82
  * Removed Forrst
94
  * Removed @getimagesize function for compatibility purposes
95
  * New accounts are now added via WordPress filter rather than editing core plugin code
96
 
97
+ = 13.05 =
98
  * Fixed image and CSS paths
99
 
100
+ = 13.04 =
101
  * Initial commit
102
 
103
  = trunk =
108
  = 14.03 =
109
  Removed @getimagesize function for compatibility purposes. New accounts are now added via WordPress filter rather than editing core plugin code.
110
 
111
+ = 13.05 =
112
  Fixed image and CSS paths
113
 
114
+ = 13.04 =
115
  Initial commit to WordPress plugin repository
social-media-icons-widget.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Social Icons Widget
4
  Plugin URI: http://github.com/dannisbet/Social-Icons-Widget
5
- Version: 14.07
6
  Description: Displays a list of social media website icons and a link to your profile.
7
  Author: Dan Nisbet
8
  Author URI: http://nisbetcreative.com/
@@ -35,10 +35,10 @@ class Social_Icons_Widget extends WP_Widget {
35
  }
36
 
37
  function update($new_instance, $old_instance) {
38
- global $social_accounts;
39
  $instance = array();
40
 
41
- foreach ($social_accounts as $site => $id) {
42
  $instance[$id] = $new_instance[$id];
43
  }
44
 
2
  /*
3
  Plugin Name: Social Icons Widget
4
  Plugin URI: http://github.com/dannisbet/Social-Icons-Widget
5
+ Version: 14.08
6
  Description: Displays a list of social media website icons and a link to your profile.
7
  Author: Dan Nisbet
8
  Author URI: http://nisbetcreative.com/
35
  }
36
 
37
  function update($new_instance, $old_instance) {
38
+ global $siw_social_accounts;
39
  $instance = array();
40
 
41
+ foreach ($siw_social_accounts as $site => $id) {
42
  $instance[$id] = $new_instance[$id];
43
  }
44