Social Media Feather | social media sharing - Version 2.0.1

Version Description

  • Replace http links with https.
Download this release

Release Info

Developer socialmediafeather
Plugin Icon 128x128 Social Media Feather | social media sharing
Version 2.0.1
Comparing to
See all releases

Code changes from version 2.0.0 to 2.0.1

readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: socialmediafeather, scottstorebloom
3
  Tags: social media, social sharing, social buttons, Facebook, Share, Like, twitter, google, Reddit, youtube, instagram, pinterest, social media buttons, button, shortcode, sidebar, sharing buttons, follow buttons
4
  Requires at least: 3.1
5
- Tested up to: 5.4.1
6
- Stable tag: 2.0.0
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -191,6 +191,9 @@ margin-left: 10px;
191
 
192
  == Changelog ==
193
 
 
 
 
194
  = 2.0.0 =
195
  * Fixed missing index error.
196
  * Added review us dismissable popup.
2
  Contributors: socialmediafeather, scottstorebloom
3
  Tags: social media, social sharing, social buttons, Facebook, Share, Like, twitter, google, Reddit, youtube, instagram, pinterest, social media buttons, button, shortcode, sidebar, sharing buttons, follow buttons
4
  Requires at least: 3.1
5
+ Tested up to: 5.4.2
6
+ Stable tag: 2.0.1
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
191
 
192
  == Changelog ==
193
 
194
+ = 2.0.1 =
195
+ * Replace http links with https.
196
+
197
  = 2.0.0 =
198
  * Fixed missing index error.
199
  * Added review us dismissable popup.
social-media-feather.php CHANGED
@@ -4,11 +4,11 @@ Plugin Name: Social Media Feather
4
  Plugin URI: http://socialmediafeather.com/
5
  Description: Super lightweight social media plugin to add nice and effective social media sharing and following buttons and icons anywhere on your site quickly and easily
6
  Author: socialmediafeather
7
- Version: 2.0.0
8
  Author URI: http://socialmediafeather.com/
9
  */
10
 
11
- define( 'SYNVED_VERSION', '2.0.0' );
12
 
13
  if (!function_exists('synved_wp_social_load'))
14
  {
4
  Plugin URI: http://socialmediafeather.com/
5
  Description: Super lightweight social media plugin to add nice and effective social media sharing and following buttons and icons anywhere on your site quickly and easily
6
  Author: socialmediafeather
7
+ Version: 2.0.1
8
  Author URI: http://socialmediafeather.com/
9
  */
10
 
11
+ define( 'SYNVED_VERSION', '2.0.1' );
12
 
13
  if (!function_exists('synved_wp_social_load'))
14
  {
synved-connect/synved-connect-sponsor.php CHANGED
@@ -3,59 +3,59 @@
3
  function synved_connect_sponsor_list($filter = null)
4
  {
5
  global $synved_connect;
6
-
7
  $sponsor_list = array(
8
  'wordpress-themes-1' => array(
9
  'type' => 'credit',
10
  'label' => 'WordPress Themes',
11
  'tip' => 'WordPress plugins and themes',
12
- 'link' => 'http://synved.com',
13
  'text' => '%%link%% by Synved'
14
  ),
15
  'wordpress-design-1' => array(
16
  'type' => 'credit',
17
  'label' => 'WordPress Design',
18
  'tip' => 'WordPress development, themes and custom plugins',
19
- 'link' => 'http://synved.com',
20
  'text' => '%%link%% by Synved'
21
  ),
22
  'synved-options' => array(
23
  'type' => 'intern',
24
  'label' => 'WordPress Options',
25
  'tip' => 'Add options to your products, the easy way!',
26
- 'link' => 'http://synved.com/wordpress-options/',
27
  'text' => 'If you are a designer or developer you might want to chek out our free plugin %%link%% to easily add options to your WordPress products and sell your own addons for them too'
28
  ),
29
  'hosting-1' => array(
30
  'type' => 'extern',
31
  'label' => 'professional hosting',
32
  'tip' => 'recommended hosting',
33
- 'link' => 'http://synved.com/suggests/hosting/',
34
  'text' => 'If searching for a reliable hosting service you might wanna check out our recommended %%link%%'
35
  ),
36
  'photocrati' => array(
37
  'type' => 'extern',
38
  'label' => 'Photocrati',
39
  'tip' => 'WordPress theme for gallery management',
40
- 'link' => 'http://synved.com/suggests/photocrati/',
41
  'text' => 'For more advanced image and gallery management features we recommend %%link%% and their fantastic support ;)'
42
  )
43
  );
44
-
45
  if (isset($synved_connect['sponsor-list']))
46
  {
47
  $sponsor_list = $synved_connect['sponsor-list'];
48
  }
49
  else
50
  {
51
- $feed = fetch_feed('http://feeds.feedburner.com/_SynvedConnectList?format=xml');
52
-
53
  if (!is_wp_error($feed))
54
  {
55
  $maxitems = $feed->get_item_quantity();
56
  $feed_items = $feed->get_items(0, $maxitems);
57
  $feed_list = array();
58
-
59
  if ($maxitems > 0)
60
  {
61
  foreach ($feed_items as $feed_item)
@@ -65,31 +65,31 @@ function synved_connect_sponsor_list($filter = null)
65
  $tip = $feed_item->get_description();
66
  $link = $feed_item->get_permalink();
67
  $text = $feed_item->get_content();
68
-
69
  $id_parts = array();
70
  parse_str(parse_url($id, PHP_URL_QUERY), $id_parts);
71
  $id = $id_parts['guid'];
72
-
73
  $feed_categories = $feed_item->get_categories();
74
  $type = null;
75
-
76
  if ($feed_categories != null)
77
  {
78
  $category_tag = 'synved-connect-type-';
79
-
80
  foreach ($feed_categories as $feed_category)
81
  {
82
  $feed_category = $feed_category->get_label();
83
-
84
  if (substr($feed_category, 0, strlen($category_tag)) == $category_tag)
85
  {
86
  $type = substr($feed_category, strlen($category_tag));
87
-
88
  break;
89
  }
90
  }
91
  }
92
-
93
  if ($type != null && $id != null)
94
  {
95
  $feed_list[$id] = array(
@@ -102,20 +102,20 @@ function synved_connect_sponsor_list($filter = null)
102
  }
103
  }
104
  }
105
-
106
  if ($feed_list != null)
107
  {
108
  $sponsor_list = $feed_list;
109
  }
110
  }
111
-
112
- $synved_connect['sponsor-list'] = $sponsor_list;
113
  }
114
-
115
  if ($filter != null)
116
  {
117
  $final_list = array();
118
-
119
  foreach ($sponsor_list as $sponsor_key => $sponsor_item)
120
  {
121
  foreach ($filter as $filter_key => $filter_value)
@@ -123,7 +123,7 @@ function synved_connect_sponsor_list($filter = null)
123
  if (isset($sponsor_item[$filter_key]))
124
  {
125
  $sponsor_value = $sponsor_item[$filter_key];
126
-
127
  if (synved_connect_key_item_match($sponsor_value, $filter_value))
128
  {
129
  $final_list[$sponsor_key] = $sponsor_item;
@@ -131,17 +131,17 @@ function synved_connect_sponsor_list($filter = null)
131
  }
132
  }
133
  }
134
-
135
  $sponsor_list = $final_list;
136
  }
137
-
138
  $sponsor_keys = array_keys($sponsor_list);
139
-
140
  foreach ($sponsor_keys as $sponsor_key)
141
  {
142
- $sponsor_list[$sponsor_key]['id'] = $sponsor_key;
143
  }
144
-
145
  return $sponsor_list;
146
  }
147
 
@@ -150,45 +150,45 @@ function synved_connect_sponsor_id_pick($filter = null)
150
  $sponsor_list = synved_connect_sponsor_list($filter);
151
  $sponsor_keys = array_keys($sponsor_list);
152
  $count = count($sponsor_keys);
153
-
154
  $index = rand(0, $count - 1);
155
  $sponsor_id = $sponsor_keys[$index];
156
-
157
  return $sponsor_id;
158
  }
159
 
160
  function synved_connect_sponsor_item_by_id($sponsor_id, $filter = null)
161
  {
162
  $sponsor_list = synved_connect_sponsor_list($filter);
163
-
164
  if ($sponsor_id != null && isset($sponsor_list[$sponsor_id]))
165
  {
166
  $sponsor = $sponsor_list[$sponsor_id];
167
-
168
  return $sponsor;
169
  }
170
-
171
  return null;
172
  }
173
 
174
  function synved_connect_sponsor_item_pick($filter = null)
175
  {
176
  $sponsor_id = synved_connect_sponsor_id_pick($filter);
177
-
178
  return synved_connect_sponsor_item_by_id($sponsor_id);
179
  }
180
 
181
  function synved_connect_sponsor_item($component = null, $filter = null)
182
  {
183
  $sponsor = null;
184
-
185
- // for now it is valid to have null $component
186
  //if ($component != null)
187
  {
188
  $sponsor_id = synved_connect_id_get($component);
189
  $sponsor = synved_connect_sponsor_item_by_id($sponsor_id, $filter);
190
  }
191
-
192
  return $sponsor;
193
  }
194
 
@@ -198,16 +198,16 @@ function synved_connect_sponsor_link(array $sponsor_item = null)
198
  {
199
  $sponsor_item = synved_connect_sponsor_item();
200
  }
201
-
202
  if ($sponsor_item == null)
203
  {
204
  return null;
205
  }
206
-
207
  $sponsor_label = isset($sponsor_item['label']) ? $sponsor_item['label'] : null;
208
  $sponsor_tip = isset($sponsor_item['tip']) ? $sponsor_item['tip'] : null;
209
  $sponsor_link = isset($sponsor_item['link']) ? $sponsor_item['link'] : null;
210
-
211
  return '<a class="synved-connect-link" href="' . $sponsor_link . '" target="_blank" title="' . $sponsor_tip . '">' . $sponsor_label . '</a>';
212
  }
213
 
@@ -216,23 +216,23 @@ function synved_connect_sponsor_content(array $sponsor_item = null)
216
  if ($sponsor_item == null)
217
  {
218
  $sponsor_item = synved_connect_sponsor_item();
219
-
220
  if ($sponsor_item == null)
221
  {
222
  $sponsor_item = synved_connect_sponsor_item_pick();
223
  }
224
  }
225
-
226
  if ($sponsor_item == null)
227
  {
228
  return null;
229
  }
230
-
231
  $sponsor_type = isset($sponsor_item['type']) ? $sponsor_item['type'] : null;
232
  $sponsor_text = isset($sponsor_item['text']) ? $sponsor_item['text'] : null;
233
  $sponsor_markup = isset($sponsor_item['markup']) ? $sponsor_item['markup'] : null;
234
  $sponsor_link = synved_connect_sponsor_link($sponsor_item);
235
-
236
  if ($sponsor_text == null)
237
  {
238
  if ($sponsor_type == 'credit')
@@ -244,7 +244,7 @@ function synved_connect_sponsor_content(array $sponsor_item = null)
244
  return null;
245
  }
246
  }
247
-
248
  if ($sponsor_markup == null)
249
  {
250
  if ($sponsor_type == 'credit')
@@ -256,19 +256,19 @@ function synved_connect_sponsor_content(array $sponsor_item = null)
256
  $sponsor_markup = '<div class="%%class%%">%%content%%</div>';
257
  }
258
  }
259
-
260
  $sponsor_class = 'sponsor-holder';
261
-
262
  if ($sponsor_type != null)
263
  {
264
  $sponsor_class .= ' sponsor-type-' . $sponsor_type;
265
  }
266
-
267
  $sponsor_markup = str_replace('%%class%%', $sponsor_class, $sponsor_markup);
268
-
269
  $sponsor_content = str_replace('%%link%%', $sponsor_link, $sponsor_text);
270
  $sponsor_content = str_replace('%%content%%', $sponsor_content, $sponsor_markup);
271
-
272
  return $sponsor_content;
273
  }
274
 
3
  function synved_connect_sponsor_list($filter = null)
4
  {
5
  global $synved_connect;
6
+
7
  $sponsor_list = array(
8
  'wordpress-themes-1' => array(
9
  'type' => 'credit',
10
  'label' => 'WordPress Themes',
11
  'tip' => 'WordPress plugins and themes',
12
+ 'link' => 'https://synved.com',
13
  'text' => '%%link%% by Synved'
14
  ),
15
  'wordpress-design-1' => array(
16
  'type' => 'credit',
17
  'label' => 'WordPress Design',
18
  'tip' => 'WordPress development, themes and custom plugins',
19
+ 'link' => 'https://synved.com',
20
  'text' => '%%link%% by Synved'
21
  ),
22
  'synved-options' => array(
23
  'type' => 'intern',
24
  'label' => 'WordPress Options',
25
  'tip' => 'Add options to your products, the easy way!',
26
+ 'link' => 'https://synved.com/wordpress-options/',
27
  'text' => 'If you are a designer or developer you might want to chek out our free plugin %%link%% to easily add options to your WordPress products and sell your own addons for them too'
28
  ),
29
  'hosting-1' => array(
30
  'type' => 'extern',
31
  'label' => 'professional hosting',
32
  'tip' => 'recommended hosting',
33
+ 'link' => 'https://synved.com/suggests/hosting/',
34
  'text' => 'If searching for a reliable hosting service you might wanna check out our recommended %%link%%'
35
  ),
36
  'photocrati' => array(
37
  'type' => 'extern',
38
  'label' => 'Photocrati',
39
  'tip' => 'WordPress theme for gallery management',
40
+ 'link' => 'https://synved.com/suggests/photocrati/',
41
  'text' => 'For more advanced image and gallery management features we recommend %%link%% and their fantastic support ;)'
42
  )
43
  );
44
+
45
  if (isset($synved_connect['sponsor-list']))
46
  {
47
  $sponsor_list = $synved_connect['sponsor-list'];
48
  }
49
  else
50
  {
51
+ $feed = fetch_feed('https://feeds.feedburner.com/_SynvedConnectList?format=xml');
52
+
53
  if (!is_wp_error($feed))
54
  {
55
  $maxitems = $feed->get_item_quantity();
56
  $feed_items = $feed->get_items(0, $maxitems);
57
  $feed_list = array();
58
+
59
  if ($maxitems > 0)
60
  {
61
  foreach ($feed_items as $feed_item)
65
  $tip = $feed_item->get_description();
66
  $link = $feed_item->get_permalink();
67
  $text = $feed_item->get_content();
68
+
69
  $id_parts = array();
70
  parse_str(parse_url($id, PHP_URL_QUERY), $id_parts);
71
  $id = $id_parts['guid'];
72
+
73
  $feed_categories = $feed_item->get_categories();
74
  $type = null;
75
+
76
  if ($feed_categories != null)
77
  {
78
  $category_tag = 'synved-connect-type-';
79
+
80
  foreach ($feed_categories as $feed_category)
81
  {
82
  $feed_category = $feed_category->get_label();
83
+
84
  if (substr($feed_category, 0, strlen($category_tag)) == $category_tag)
85
  {
86
  $type = substr($feed_category, strlen($category_tag));
87
+
88
  break;
89
  }
90
  }
91
  }
92
+
93
  if ($type != null && $id != null)
94
  {
95
  $feed_list[$id] = array(
102
  }
103
  }
104
  }
105
+
106
  if ($feed_list != null)
107
  {
108
  $sponsor_list = $feed_list;
109
  }
110
  }
111
+
112
+ $synved_connect['sponsor-list'] = $sponsor_list;
113
  }
114
+
115
  if ($filter != null)
116
  {
117
  $final_list = array();
118
+
119
  foreach ($sponsor_list as $sponsor_key => $sponsor_item)
120
  {
121
  foreach ($filter as $filter_key => $filter_value)
123
  if (isset($sponsor_item[$filter_key]))
124
  {
125
  $sponsor_value = $sponsor_item[$filter_key];
126
+
127
  if (synved_connect_key_item_match($sponsor_value, $filter_value))
128
  {
129
  $final_list[$sponsor_key] = $sponsor_item;
131
  }
132
  }
133
  }
134
+
135
  $sponsor_list = $final_list;
136
  }
137
+
138
  $sponsor_keys = array_keys($sponsor_list);
139
+
140
  foreach ($sponsor_keys as $sponsor_key)
141
  {
142
+ $sponsor_list[$sponsor_key]['id'] = $sponsor_key;
143
  }
144
+
145
  return $sponsor_list;
146
  }
147
 
150
  $sponsor_list = synved_connect_sponsor_list($filter);
151
  $sponsor_keys = array_keys($sponsor_list);
152
  $count = count($sponsor_keys);
153
+
154
  $index = rand(0, $count - 1);
155
  $sponsor_id = $sponsor_keys[$index];
156
+
157
  return $sponsor_id;
158
  }
159
 
160
  function synved_connect_sponsor_item_by_id($sponsor_id, $filter = null)
161
  {
162
  $sponsor_list = synved_connect_sponsor_list($filter);
163
+
164
  if ($sponsor_id != null && isset($sponsor_list[$sponsor_id]))
165
  {
166
  $sponsor = $sponsor_list[$sponsor_id];
167
+
168
  return $sponsor;
169
  }
170
+
171
  return null;
172
  }
173
 
174
  function synved_connect_sponsor_item_pick($filter = null)
175
  {
176
  $sponsor_id = synved_connect_sponsor_id_pick($filter);
177
+
178
  return synved_connect_sponsor_item_by_id($sponsor_id);
179
  }
180
 
181
  function synved_connect_sponsor_item($component = null, $filter = null)
182
  {
183
  $sponsor = null;
184
+
185
+ // for now it is valid to have null $component
186
  //if ($component != null)
187
  {
188
  $sponsor_id = synved_connect_id_get($component);
189
  $sponsor = synved_connect_sponsor_item_by_id($sponsor_id, $filter);
190
  }
191
+
192
  return $sponsor;
193
  }
194
 
198
  {
199
  $sponsor_item = synved_connect_sponsor_item();
200
  }
201
+
202
  if ($sponsor_item == null)
203
  {
204
  return null;
205
  }
206
+
207
  $sponsor_label = isset($sponsor_item['label']) ? $sponsor_item['label'] : null;
208
  $sponsor_tip = isset($sponsor_item['tip']) ? $sponsor_item['tip'] : null;
209
  $sponsor_link = isset($sponsor_item['link']) ? $sponsor_item['link'] : null;
210
+
211
  return '<a class="synved-connect-link" href="' . $sponsor_link . '" target="_blank" title="' . $sponsor_tip . '">' . $sponsor_label . '</a>';
212
  }
213
 
216
  if ($sponsor_item == null)
217
  {
218
  $sponsor_item = synved_connect_sponsor_item();
219
+
220
  if ($sponsor_item == null)
221
  {
222
  $sponsor_item = synved_connect_sponsor_item_pick();
223
  }
224
  }
225
+
226
  if ($sponsor_item == null)
227
  {
228
  return null;
229
  }
230
+
231
  $sponsor_type = isset($sponsor_item['type']) ? $sponsor_item['type'] : null;
232
  $sponsor_text = isset($sponsor_item['text']) ? $sponsor_item['text'] : null;
233
  $sponsor_markup = isset($sponsor_item['markup']) ? $sponsor_item['markup'] : null;
234
  $sponsor_link = synved_connect_sponsor_link($sponsor_item);
235
+
236
  if ($sponsor_text == null)
237
  {
238
  if ($sponsor_type == 'credit')
244
  return null;
245
  }
246
  }
247
+
248
  if ($sponsor_markup == null)
249
  {
250
  if ($sponsor_type == 'credit')
256
  $sponsor_markup = '<div class="%%class%%">%%content%%</div>';
257
  }
258
  }
259
+
260
  $sponsor_class = 'sponsor-holder';
261
+
262
  if ($sponsor_type != null)
263
  {
264
  $sponsor_class .= ' sponsor-type-' . $sponsor_type;
265
  }
266
+
267
  $sponsor_markup = str_replace('%%class%%', $sponsor_class, $sponsor_markup);
268
+
269
  $sponsor_content = str_replace('%%link%%', $sponsor_link, $sponsor_text);
270
  $sponsor_content = str_replace('%%content%%', $sponsor_content, $sponsor_markup);
271
+
272
  return $sponsor_content;
273
  }
274
 
synved-social/synved-social-setup.php CHANGED
@@ -586,7 +586,7 @@ function synved_social_path($path = null)
586
 
587
  if ($root != null)
588
  {
589
- if (substr($root, -1) != '/' && $path[0] != '/')
590
  {
591
  $root .= '/';
592
  }
586
 
587
  if ($root != null)
588
  {
589
+ if (substr($root, -1) != '/' && isset($path) && $path[0] != '/')
590
  {
591
  $root .= '/';
592
  }
synved-social/synved-social.php CHANGED
@@ -39,77 +39,77 @@ function synved_social_version_string()
39
  return SYNVED_SOCIAL_VERSION_STRING;
40
  }
41
 
42
- class SynvedSocialWidget extends WP_Widget
43
  {
44
- function __construct($id_base = false, $name = null, $widget_options = array(), $control_options = array() )
45
  {
46
  if ($name == null)
47
  {
48
  $name = 'Social Media Feather';
49
  }
50
-
51
  parent::__construct($id_base, $name, $widget_options, $control_options);
52
  }
53
 
54
- function widget($args, $instance)
55
  {
56
  extract($args); /* before/after widget, before/after title (defined by themes). */
57
  extract($instance);
58
 
59
  echo $before_widget;
60
-
61
  if ($title != null)
62
  {
63
- echo $before_title . $title . $after_title;
64
  }
65
 
66
  echo '<div>';
67
-
68
  $params = array();
69
  $params['alignment'] = 'none';
70
-
71
  if ($icon_skin != 'default')
72
  {
73
  $params['skin'] = $icon_skin;
74
  }
75
-
76
  if ($icon_size != 'default')
77
  {
78
  $params['size'] = $icon_size;
79
  }
80
-
81
  if ($icon_spacing !== null && $icon_spacing !== '')
82
  {
83
  $params['spacing'] = $icon_spacing;
84
  }
85
-
86
  $this->render_social_markup($params);
87
 
88
  echo '</div>';
89
- echo $after_widget;
90
  }
91
-
92
  function get_defaults()
93
  {
94
  return array('icon_skin' => 'default', 'icon_size' => 'default', 'icon_spacing' => '');
95
  }
96
-
97
  function render_social_markup($params = null)
98
  {
99
  }
100
 
101
- function update($new_instance, $old_instance)
102
  {
103
  $instance = $old_instance;
104
  $instance['title'] = strip_tags($new_instance['title']);
105
  $instance['icon_skin'] = strip_tags($new_instance['icon_skin']);
106
  $instance['icon_size'] = strip_tags($new_instance['icon_size']);
107
  $instance['icon_spacing'] = strip_tags($new_instance['icon_spacing']);
108
-
109
  return $instance;
110
  }
111
 
112
- function form($instance)
113
  {
114
  $defaults = $this->get_defaults();
115
  $instance = wp_parse_args((array) $instance, $defaults);
@@ -120,16 +120,16 @@ class SynvedSocialWidget extends WP_Widget
120
  </p>
121
  <p>
122
  <label for="<?php echo $this->get_field_id('icon_skin'); ?>"><?php echo(__('Icon Skin', 'social-media-feather')) ?>:</label>
123
- <?php
124
  $params = array(
125
  'tip' => '',
126
  'output_name' => $this->get_field_name('icon_skin'),
127
  'value' => $instance['icon_skin'],
128
  'set_before' => array(array('default' => __('Use Default'))),
129
  );
130
-
131
  $item = synved_option_item('synved_social', 'icon_skin');
132
-
133
  if ($item != null)
134
  {
135
  // XXX a bit unorthodox...
@@ -137,23 +137,23 @@ class SynvedSocialWidget extends WP_Widget
137
  {
138
  $item = clone $item;
139
  }
140
-
141
  unset($item['render']);
142
-
143
- synved_option_render_item('synved_social', 'icon_skin', $item, true, $params, 'widget');
144
  }
145
  ?>
146
  <br/>
147
  <label for="<?php echo $this->get_field_id('icon_size'); ?>"><?php echo(__('Icon Size', 'social-media-feather')) ?>:</label>
148
- <?php
149
  $params = array(
150
  'tip' => '',
151
  'output_name' => $this->get_field_name('icon_size'),
152
  'value' => $instance['icon_size'],
153
  'set_before' => array(array('default' => __('Use Default'))),
154
  );
155
-
156
- synved_option_render_item('synved_social', 'icon_size', null, true, $params, 'widget');
157
  ?>
158
  <br/>
159
  <label for="<?php echo $this->get_field_id('icon_spacing'); ?>"><?php echo(__('Icon Spacing', 'social-media-feather')) ?>:</label>
@@ -163,40 +163,40 @@ class SynvedSocialWidget extends WP_Widget
163
  }
164
  }
165
 
166
- class SynvedSocialShareWidget extends SynvedSocialWidget
167
  {
168
- function __construct()
169
  {
170
  parent::__construct('synved_social_share', __('Social Media Feather: Sharing', 'social-media-feather'));
171
  }
172
-
173
  function get_defaults()
174
  {
175
  $defaults = parent::get_defaults();
176
-
177
  return array_merge($defaults, array('title' => __('Sharing', 'social-media-feather')));
178
  }
179
-
180
  function render_social_markup($params = null)
181
  {
182
  echo synved_social_share_markup(null, null, $params);
183
  }
184
  }
185
 
186
- class SynvedSocialFollowWidget extends SynvedSocialWidget
187
  {
188
- function __construct()
189
  {
190
  parent::__construct('synved_social_follow', __('Social Media Feather: Follow Us', 'social-media-feather'));
191
  }
192
-
193
  function get_defaults()
194
  {
195
  $defaults = parent::get_defaults();
196
-
197
  return array_merge($defaults, array('title' => __('Follow Us', 'social-media-feather')));
198
  }
199
-
200
  function render_social_markup($params = null)
201
  {
202
  echo synved_social_follow_markup(null, null, $params);
@@ -207,12 +207,12 @@ class SynvedSocialFollowWidget extends SynvedSocialWidget
207
  function synved_social_service_provider_list($context, $raw = false)
208
  {
209
  $provider_list = array();
210
-
211
  if ($context == 'share')
212
  {
213
  $provider_list = array(
214
  'facebook' => array(
215
- 'link' => 'http://www.facebook.com/sharer.php?u=%%url%%&t=%%title%%&s=100&p[url]=%%url%%&p[images][0]=%%image%%&p[title]=%%title%%',
216
  'title' => __('Share on Facebook')
217
  ),
218
  'twitter' => array(
@@ -220,19 +220,19 @@ function synved_social_service_provider_list($context, $raw = false)
220
  'title' => __('Share on Twitter'),
221
  ),
222
  'reddit' => array(
223
- 'link' => 'http://www.reddit.com/submit?url=%%url%%&title=%%title%%',
224
  'title' => __('Share on Reddit'),
225
  ),
226
  'pinterest' => array(
227
- 'link' => 'http://pinterest.com/pin/create/button/?url=%%url%%&media=%%image%%&description=%%title%%',
228
  'title' => __('Pin it with Pinterest'),
229
  ),
230
  'linkedin' => array(
231
- 'link' => 'http://www.linkedin.com/shareArticle?mini=true&url=%%url%%&title=%%title%%',
232
  'title' => __('Share on Linkedin'),
233
  ),
234
  'tumblr' => array(
235
- 'link' => 'http://tumblr.com/share?s=&v=3&t=%%title%%&u=%%url%%',
236
  'title' => __('Share on tumblr'),
237
  'default-display' => false,
238
  ),
@@ -254,40 +254,40 @@ function synved_social_service_provider_list($context, $raw = false)
254
  'title' => __('Follow us on Twitter'),
255
  ),
256
  'pinterest' => array(
257
- 'link' => 'http://pinterest.com/MyUserName/',
258
  'title' => __('Our board on Pinterest'),
259
  'default-display' => false,
260
  ),
261
  'linkedin' => array(
262
- 'link' => 'http://www.linkedin.com/in/yourid',
263
  'title' => __('Find us on Linkedin'),
264
  ),
265
  'rss' => array(
266
  'label' => 'RSS',
267
- 'link' => 'http://feeds.feedburner.com/MyFeedName',
268
  'title' => __('Subscribe to our RSS Feed'),
269
  ),
270
  'youtube' => array(
271
- 'link' => 'http://www.youtube.com/MyYouTubeName',
272
  'title' => __('Find us on YouTube'),
273
  ),
274
  'vimeo' => array(
275
- 'link' => 'http://vimeo.com/MyVimeoName',
276
  'title' => __('Find us on vimeo'),
277
  'default-display' => false,
278
  ),
279
  'tumblr' => array(
280
- 'link' => 'http://myname.tumblr.com',
281
  'title' => __('Find us on tumblr'),
282
  'default-display' => false,
283
  ),
284
  'instagram' => array(
285
- 'link' => 'http://instagram.com/myusername',
286
  'title' => __('Check out our instagram feed'),
287
  'default-display' => false,
288
  ),
289
  'flickr' => array(
290
- 'link' => 'http://www.flickr.com/photos/myusername/',
291
  'title' => __('Check out our flickr feed'),
292
  'default-display' => false,
293
  ),
@@ -303,41 +303,41 @@ function synved_social_service_provider_list($context, $raw = false)
303
  ),
304
  );
305
  }
306
-
307
  $return_list = $provider_list;
308
-
309
  if ($raw == false)
310
  {
311
  global $synved_social;
312
-
313
  $list_name = 'provider_list' . '_' . $context;
314
-
315
  if (!isset($synved_social[$list_name]) || $synved_social[$list_name] == null)
316
  {
317
  $return_list = array();
318
-
319
  foreach ($provider_list as $provider_name => $provider_item)
320
  {
321
  $display = synved_option_get('synved_social', $provider_name . '_display');
322
  $link = synved_option_get('synved_social', $provider_name . '_' . $context . '_link');
323
  $title = synved_option_get('synved_social', $provider_name . '_' . $context . '_title');
324
-
325
  if ($display === null || in_array($display, array($context, 'both')))
326
  {
327
  if ($link != null)
328
  {
329
  $provider_item['link'] = $link;
330
  }
331
-
332
  if ($title != null)
333
  {
334
  $provider_item['title'] = $title;
335
  }
336
-
337
  $return_list[$provider_name] = $provider_item;
338
  }
339
  }
340
-
341
  $synved_social[$list_name] = $return_list;
342
  }
343
  else
@@ -345,54 +345,54 @@ function synved_social_service_provider_list($context, $raw = false)
345
  $return_list = $synved_social[$list_name];
346
  }
347
  }
348
-
349
  return apply_filters('synved_social_service_provider_list', $return_list, $context, $raw);
350
  }
351
 
352
  function synved_social_icon_skin_list()
353
  {
354
  global $synved_social;
355
-
356
  if (!isset($synved_social['skin_list']) || $synved_social['skin_list'] == null)
357
  {
358
  $path = synved_social_path();
359
  $uri = synved_social_path_uri();
360
-
361
  $icons = array(
362
  'regular' => array(
363
- 'label' => __('Regular'),
364
- 'image' => $uri . '/image/social/regular/preview.png',
365
- 'folder' => '/image/social/regular/',
366
- 'path' => $path . '/image/social/regular/',
367
  'uri' => $uri . '/image/social/regular/'
368
  )
369
  );
370
-
371
  $icons_extra = null;
372
-
373
  if (function_exists('synved_social_addon_extra_icons_get'))
374
  {
375
  $icons_extra = synved_social_addon_extra_icons_get();
376
  $icons = array_merge($icons, $icons_extra);
377
  }
378
-
379
  $icons = apply_filters('synved_social_icon_skin_list', $icons);
380
-
381
  foreach ($icons as $skin_name => $skin)
382
  {
383
  $icons[$skin_name]['name'] = $skin_name;
384
  }
385
-
386
  $synved_social['skin_list'] = $icons;
387
  }
388
-
389
  return $synved_social['skin_list'];
390
  }
391
 
392
  function synved_social_icon_skin_get($name = null)
393
  {
394
  $icons = synved_social_icon_skin_list();
395
-
396
  if ($name != null && !isset($icons[$name]))
397
  {
398
  foreach ($icons as $skin_name => $skin)
@@ -400,29 +400,29 @@ function synved_social_icon_skin_get($name = null)
400
  if (strtolower($name) == strtolower($skin['label']))
401
  {
402
  $name = $skin_name;
403
-
404
  break;
405
  }
406
  }
407
  }
408
-
409
  if ($name == null || !isset($icons[$name]))
410
  {
411
  $selected = synved_option_get('synved_social', 'icon_skin');
412
-
413
  $name = $selected;
414
  }
415
-
416
  if (isset($icons[$name]))
417
  {
418
  return $icons[$name];
419
  }
420
-
421
  if (isset($icons['regular']))
422
  {
423
  return $icons['regular'];
424
  }
425
-
426
  return null;
427
  }
428
 
@@ -435,17 +435,17 @@ function synved_social_icon_skin_current()
435
  function synved_social_icon_skin_set($name, $skin)
436
  {
437
  global $synved_social;
438
-
439
  // ensure the global is set
440
  synved_social_icon_skin_list();
441
-
442
  if (isset($synved_social['skin_list']) && $synved_social['skin_list'] != null)
443
  {
444
  if (!isset($synved_social['skin_list'][$name]))
445
  {
446
  $synved_social['skin_list'][$name] = array();
447
  }
448
-
449
  foreach ($skin as $key => $value)
450
  {
451
  $synved_social['skin_list'][$name][$key] = $value;
@@ -459,11 +459,11 @@ function synved_social_icon_skin_get_size_list($skin)
459
  {
460
  return $skin['size-list'];
461
  }
462
-
463
  if (isset($skin['name']))
464
  {
465
  $skin_fresh = synved_social_icon_skin_get($skin['name']);
466
-
467
  if (isset($skin['path']) && isset($skin_fresh['path']) && $skin['path'] == $skin_fresh['path'])
468
  {
469
  if (isset($skin_fresh['size-list']))
@@ -472,32 +472,32 @@ function synved_social_icon_skin_get_size_list($skin)
472
  }
473
  }
474
  }
475
-
476
  $path = synved_social_path();
477
  $skin_path = isset($skin['path']) ? $skin['path'] : ($path . '/image/social/regular/');
478
-
479
  $sizes = glob($skin_path . '*', GLOB_ONLYDIR);
480
  $sizes = array_map('basename', $sizes);
481
  $size_list = array();
482
-
483
  foreach ($sizes as $size_dir)
484
  {
485
  $size_parts = explode('x', $size_dir);
486
  $size_width = (int) $size_parts[0];
487
-
488
  if ($size_width != null)
489
  {
490
  $size_list[] = $size_width;
491
  }
492
  }
493
-
494
  sort($size_list, SORT_NUMERIC);
495
-
496
  if (isset($skin['name']))
497
  {
498
  synved_social_icon_skin_set($skin['name'], array('size-list' => $size_list));
499
  }
500
-
501
  return $size_list;
502
  }
503
 
@@ -506,15 +506,15 @@ function synved_social_icon_skin_get_image_list_raw($skin, $name_list, $forced_s
506
  $path = synved_social_path();
507
  $uri = synved_social_path_uri();
508
  $skin_default = synved_social_icon_skin_get('regular');
509
-
510
  $skin_default_path = isset($skin_default['path']) ? $skin_default['path'] : ($path . '/image/social/regular/');
511
  $skin_default_uri = isset($skin_default['uri']) ? $skin_default['uri'] : ($uri . '/image/social/regular/');
512
  $skin_sel_path = isset($skin['path']) ? $skin['path'] : ($path . '/image/social/regular/');
513
  $skin_sel_uri = isset($skin['uri']) ? $skin['uri'] : ($uri . '/image/social/regular/');
514
-
515
  $default_size_list = synved_social_icon_skin_get_size_list($skin_default);
516
  $sel_size_list = synved_social_icon_skin_get_size_list($skin);
517
-
518
  $skin_list = array(
519
  array(
520
  'path' => $skin_sel_path,
@@ -527,9 +527,9 @@ function synved_social_icon_skin_get_image_list_raw($skin, $name_list, $forced_s
527
  'list' => $default_size_list,
528
  ),
529
  );
530
-
531
  $image_list = array();
532
-
533
  foreach ($name_list as $name)
534
  {
535
  foreach ($skin_list as $skin)
@@ -538,10 +538,10 @@ function synved_social_icon_skin_get_image_list_raw($skin, $name_list, $forced_s
538
  $skin_uri = $skin['uri'];
539
  $size_list = $skin['list'];
540
  $size_count = count($size_list);
541
-
542
  $image_size_list = array();
543
  $image_size_list_skipped = array();
544
-
545
  for ($i = 0; $i < $size_count; $i++)
546
  {
547
  $image_size = $size_list[$i];
@@ -549,7 +549,7 @@ function synved_social_icon_skin_get_image_list_raw($skin, $name_list, $forced_s
549
  $size_name = $image_size . 'x' . $image_size;
550
  $image_path = $skin_path . $size_name . $image_sub;
551
  $image_uri = $skin_uri . $size_name . $image_sub;
552
-
553
  if (file_exists($image_path))
554
  {
555
  $image_size_meta = array(
@@ -558,15 +558,15 @@ function synved_social_icon_skin_get_image_list_raw($skin, $name_list, $forced_s
558
  'path' => $image_path,
559
  'uri' => $image_uri,
560
  );
561
-
562
  foreach ($image_size_list_skipped as $image_size_skipped)
563
  {
564
  $image_size_list[$image_size_skipped] = $image_size_meta;
565
  }
566
-
567
  $image_size_skipped = array();
568
  $image_size_list[$image_size] = $image_size_meta;
569
-
570
  if ($forced_size != null && ($image_size > $forced_size || $i == $size_count - 1) && !isset($image_size_list[$forced_size]))
571
  {
572
  $image_size_list[$forced_size] = $image_size_meta;
@@ -577,16 +577,16 @@ function synved_social_icon_skin_get_image_list_raw($skin, $name_list, $forced_s
577
  $image_size_skipped[] = $image_size;
578
  }
579
  }
580
-
581
  if ($image_size_list != null)
582
  {
583
  break;
584
  }
585
  }
586
-
587
  $image_list[$name] = $image_size_list;
588
  }
589
-
590
  return $image_list;
591
  }
592
 
@@ -594,7 +594,7 @@ function synved_social_icon_skin_get_image_list($skin, $name_list, $forced_size
594
  {
595
  $image_list = synved_social_icon_skin_get_image_list_raw($skin, $name_list, $forced_size);
596
  $image_list = apply_filters('synved_social_skin_image_list', $image_list, $skin, $name_list, $forced_size);
597
-
598
  return $image_list;
599
  }
600
 
@@ -606,10 +606,10 @@ function synved_social_button_list_shortcode($atts, $content = null, $code = '',
606
  $params = shortcode_atts($params_def, $atts, 'feather_' . $context);
607
  $vars = array_filter($vars);
608
  $params = array_filter($params);
609
-
610
  $vars = apply_filters('synved_social_shortcode_variable_list', $vars, $context, $atts);
611
- $params = apply_filters('synved_social_shortcode_parameter_list', $params, $context, $atts);
612
-
613
  if ($context == 'share')
614
  {
615
  return synved_social_share_markup($vars, null, $params);
@@ -618,7 +618,7 @@ function synved_social_button_list_shortcode($atts, $content = null, $code = '',
618
  {
619
  return synved_social_follow_markup($vars, null, $params);
620
  }
621
-
622
  return null;
623
  }
624
 
@@ -638,15 +638,15 @@ function synved_social_button_list_markup_item_out($out_item)
638
  $tag = isset($out_item['tag']) ? $out_item['tag'] : null;
639
  $content = isset($out_item['content']) ? $out_item['content'] : null;
640
  $list = isset($out_item['child-list']) ? $out_item['child-list'] : null;
641
-
642
  unset($out_item['tag']);
643
  unset($out_item['content']);
644
  unset($out_item['child-list']);
645
-
646
  if ($tag != null)
647
  {
648
  $out .= '<' . $tag;
649
-
650
  foreach ($out_item as $attr_name => $attr_value)
651
  {
652
  if ($attr_name != null && $attr_value !== null)
@@ -660,11 +660,11 @@ function synved_social_button_list_markup_item_out($out_item)
660
  {
661
  $attr_value = esc_attr($attr_value);
662
  }
663
-
664
  $out .= ' ' . $attr_name . '="' . $attr_value . '"';
665
  }
666
  }
667
-
668
  if ($list != null || $content != null)
669
  {
670
  $out .= '>';
@@ -674,7 +674,7 @@ function synved_social_button_list_markup_item_out($out_item)
674
  $out .= ' />';
675
  }
676
  }
677
-
678
  if ($list != null)
679
  {
680
  foreach ($list as $child)
@@ -682,7 +682,7 @@ function synved_social_button_list_markup_item_out($out_item)
682
  $out .= synved_social_button_list_markup_item_out($child);
683
  }
684
  }
685
-
686
  if ($content != null)
687
  {
688
  $out .= $content;
@@ -692,14 +692,14 @@ function synved_social_button_list_markup_item_out($out_item)
692
  {
693
  $out .= '</' . $tag . '>';
694
  }
695
-
696
  return $out;
697
  }
698
 
699
  function synved_social_button_list_markup($context, $vars = null, $buttons = null, $params = null)
700
  {
701
  $buttons_default = synved_social_service_provider_list($context);
702
-
703
  if ($buttons == null)
704
  {
705
  $buttons = $buttons_default;
@@ -707,7 +707,7 @@ function synved_social_button_list_markup($context, $vars = null, $buttons = nul
707
  else
708
  {
709
  $keys = array_keys($buttons);
710
-
711
  foreach ($keys as $key)
712
  {
713
  if ($buttons[$key] == null && isset($buttons_default[$key]))
@@ -716,40 +716,40 @@ function synved_social_button_list_markup($context, $vars = null, $buttons = nul
716
  }
717
  }
718
  }
719
-
720
  $id = get_the_ID();
721
-
722
  if ($id == null)
723
  {
724
  global $post;
725
-
726
  if ($post != null)
727
  {
728
  $id = $post->ID;
729
  }
730
  }
731
-
732
  if (!isset($vars['url']) || !isset($vars['short_url']))
733
  {
734
  $full_url = synved_option_get('synved_social', 'share_full_url');
735
  $home_url = home_url();
736
  $req_uri = $_SERVER['REQUEST_URI'];
737
-
738
  $path = parse_url($home_url, PHP_URL_PATH);
739
  $path_len = strlen($path);
740
-
741
  if (strtolower(substr($req_uri, 0, $path_len)) == strtolower($path))
742
  {
743
  $req_uri = substr($req_uri, $path_len);
744
  }
745
-
746
  $url = home_url($req_uri);
747
  $short_url = $url;
748
-
749
  if ($id != null && in_the_loop())
750
  {
751
  $post_full_url = strtolower(get_post_meta($id, 'synved_social_share_full_url', true));
752
-
753
  if ($post_full_url != null)
754
  {
755
  if ($post_full_url == 'yes')
@@ -762,7 +762,7 @@ function synved_social_button_list_markup($context, $vars = null, $buttons = nul
762
  }
763
  }
764
  }
765
-
766
  //if (!$full_url)
767
  {
768
  if ($id != null && in_the_loop())
@@ -770,10 +770,10 @@ function synved_social_button_list_markup($context, $vars = null, $buttons = nul
770
  $use_shortlinks = synved_option_get('synved_social', 'use_shortlinks');
771
  $url = get_permalink($id);
772
  $short_url = wp_get_shortlink($id);
773
-
774
  if ($short_url != null)
775
  {
776
- if ($use_shortlinks && function_exists('wp_get_shortlink'))
777
  {
778
  $url = $short_url;
779
  }
@@ -788,26 +788,26 @@ function synved_social_button_list_markup($context, $vars = null, $buttons = nul
788
  $url = $home_url;
789
  }
790
  }
791
-
792
  if (!isset($vars['url']))
793
  {
794
  $vars['url'] = $url;
795
  }
796
-
797
  if (!isset($vars['short_url']))
798
  {
799
  $vars['short_url'] = $short_url;
800
  }
801
  }
802
-
803
  if (!isset($vars['image']))
804
  {
805
  $image_src = null;
806
-
807
  if ($id != null)
808
  {
809
  $image_id = get_post_thumbnail_id($id);
810
-
811
  if ($image_id != null)
812
  {
813
  $src = wp_get_attachment_image_src($image_id, 'full');
@@ -817,17 +817,17 @@ function synved_social_button_list_markup($context, $vars = null, $buttons = nul
817
  {
818
  $post = get_post($id);
819
  $match = null;
820
-
821
  if (preg_match('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $match) > 0)
822
  {
823
  $image_src = $match[1];
824
  }
825
  }
826
  }
827
-
828
  $vars['image'] = $image_src;
829
  }
830
-
831
  if (!isset($vars['title']))
832
  {
833
  $title = get_the_title();
@@ -835,115 +835,115 @@ function synved_social_button_list_markup($context, $vars = null, $buttons = nul
835
  $title = preg_replace('/\\<\\s*([^[:alpha:]\\/])/', '&lt;$1', $title);
836
  $vars['title'] = html_entity_decode(wp_strip_all_tags($title));
837
  }
838
-
839
  if (!isset($vars['message']))
840
  {
841
  $message = synved_option_get('synved_social', 'share_message_default');
842
-
843
  if ($message == null)
844
  {
845
  $message = __('Hey check this out', 'social-media-feather');
846
  }
847
-
848
  $vars['message'] = $message;
849
  }
850
-
851
  if (!isset($vars['author_wp']))
852
  {
853
  if ($id != null && in_the_loop())
854
  {
855
  $author = get_the_author();
856
-
857
  if ($author != null)
858
  {
859
  $vars['author_wp'] = $author;
860
  }
861
  }
862
  }
863
-
864
  if (!isset($vars['author']))
865
  {
866
  if ($id != null && in_the_loop())
867
  {
868
  $author = get_the_author_meta('_synved_twitter_handle');
869
-
870
  if ($author == null)
871
  {
872
  $author = get_the_author_meta('twitter');
873
  }
874
-
875
  if ($author == null)
876
  {
877
  $author = get_the_author();
878
  }
879
-
880
  if ($author != null)
881
  {
882
  $vars['author'] = $author;
883
  }
884
  }
885
  }
886
-
887
  if (!isset($vars['date']))
888
  {
889
  if ($id != null && in_the_loop())
890
  {
891
  $date = get_the_date('', $id);
892
-
893
  if ($date != null)
894
  {
895
  $vars['date'] = $date;
896
  }
897
  }
898
  }
899
-
900
  if (isset($vars['url']) && !isset($vars['url_trimmed']))
901
  {
902
  $url_trimmed = trim($vars['url']);
903
-
904
  while (substr($url_trimmed, -1) == '/')
905
  {
906
  $url_trimmed = substr($url_trimmed, 0, -1);
907
  }
908
-
909
  while (strtolower(substr($url_trimmed, -3)) == '%2f')
910
  {
911
  $url_trimmed = substr($url_trimmed, 0, -3);
912
  }
913
-
914
  $vars['url_trimmed'] = $url_trimmed;
915
  }
916
-
917
  if (isset($params['class']) && !is_array($params['class']))
918
  {
919
  $class = explode(' ', $params['class']);
920
  $params['class'] = array_map('trim', $class);
921
  }
922
-
923
  if (isset($params['show']) && !is_array($params['show']))
924
  {
925
  $show = explode(',', $params['show']);
926
  $params['show'] = array_map('trim', $show);
927
  }
928
-
929
  if (isset($params['hide']) && !is_array($params['hide']))
930
  {
931
  $hide = explode(',', $params['hide']);
932
  $params['hide'] = array_map('trim', $hide);
933
  }
934
-
935
  $vars = apply_filters('synved_social_markup_variable_list', $vars, $context, $params);
936
  $params = apply_filters('synved_social_markup_parameter_list', $params, $context, $vars);
937
-
938
  if ($vars != null)
939
  {
940
  $vars = array_map('wp_kses_decode_entities', $vars);
941
  $vars = urlencode_deep($vars);
942
-
943
  // urlencode_deep converts space characters to + rather than %20 which messes things up
944
  $vars['message'] = str_ireplace('+', '%20', $vars['message']);
945
  $vars['title'] = str_ireplace('+', '%20', $vars['title']);
946
-
947
  // urlencode_deep tries to be smart and apostrophes (') to %19 not %27 and double quotes (") to their equivalent open/closed counterparts which doesn't work on most social networks sharings
948
  $vars['message'] = str_ireplace('%18', '%27', $vars['message']);
949
  $vars['title'] = str_ireplace('%18', '%27', $vars['title']);
@@ -954,31 +954,31 @@ function synved_social_button_list_markup($context, $vars = null, $buttons = nul
954
  $vars['message'] = str_ireplace('%1d', '%22', $vars['message']);
955
  $vars['title'] = str_ireplace('%1d', '%22', $vars['title']);
956
  }
957
-
958
  $path = synved_social_path();
959
  $uri = synved_social_path_uri();
960
  $skin = synved_social_icon_skin_current();
961
-
962
  if (isset($params['skin']))
963
  {
964
  $skin = synved_social_icon_skin_get($params['skin']);
965
  }
966
-
967
  $skin_path = isset($skin['path']) ? $skin['path'] : ($path . '/image/social/regular/');
968
  $skin_uri = isset($skin['uri']) ? $skin['uri'] : ($uri . '/image/social/regular/');
969
-
970
  $icon_size = synved_option_get('synved_social', 'icon_size');
971
  $size = 48;
972
-
973
  if ($icon_size != null)
974
  {
975
  $size = $icon_size;
976
  }
977
-
978
  if (isset($params['size']))
979
  {
980
  $size = $params['size'];
981
-
982
  if (is_string($size))
983
  {
984
  $size = strtolower($size);
@@ -986,7 +986,7 @@ function synved_social_button_list_markup($context, $vars = null, $buttons = nul
986
  $size = (int) $size_parts[0];
987
  }
988
  }
989
-
990
  $icon_spacing = synved_option_get('synved_social', 'icon_spacing');
991
  $buttons_container = synved_option_get('synved_social', 'buttons_container');
992
  $buttons_container_type = synved_option_get('synved_social', 'buttons_container_type');
@@ -996,37 +996,37 @@ function synved_social_button_list_markup($context, $vars = null, $buttons = nul
996
  $container = 'none';
997
  $container_type = 'basic';
998
  $alignment = 'none';
999
-
1000
  if ($icon_spacing != null)
1001
  {
1002
  $spacing = $icon_spacing;
1003
  }
1004
-
1005
  if (isset($params['spacing']))
1006
  {
1007
  $spacing = $params['spacing'];
1008
  }
1009
-
1010
  if ($buttons_container != null)
1011
  {
1012
  $container = $buttons_container;
1013
  }
1014
-
1015
  if ($buttons_container_type != null)
1016
  {
1017
  $container_type = $buttons_container_type;
1018
  }
1019
-
1020
  if ($buttons_alignment != null)
1021
  {
1022
  $alignment = $buttons_alignment;
1023
  }
1024
-
1025
  if (isset($params['alignment']))
1026
  {
1027
  $alignment = $params['alignment'];
1028
  }
1029
-
1030
  if ($alignment != 'none')
1031
  {
1032
  if ($container == 'none')
@@ -1038,50 +1038,50 @@ function synved_social_button_list_markup($context, $vars = null, $buttons = nul
1038
  $container = 'both';
1039
  }
1040
  }
1041
-
1042
  // Allow parameters to override container after we decide a default based on selected alignment
1043
  if (isset($params['container']))
1044
  {
1045
  $container = $params['container'];
1046
  }
1047
-
1048
  if ($alignment != 'none')
1049
  {
1050
  $container_type = 'block';
1051
  }
1052
-
1053
  // Allow parameters to override container after we decide a default based on selected alignment
1054
  if (isset($params['container_type']))
1055
  {
1056
  $container_type = $params['container_type'];
1057
  }
1058
-
1059
  $class = isset($params['class']) ? $params['class'] : null;
1060
  $show = isset($params['show']) ? $params['show'] : null;
1061
  $hide = isset($params['hide']) ? $params['hide'] : null;
1062
-
1063
  if ($show != null)
1064
  {
1065
  $button_list = array();
1066
-
1067
  foreach ($show as $button_key)
1068
  {
1069
  if (isset($buttons[$button_key]))
1070
  {
1071
  $button_list[$button_key] = $buttons[$button_key];
1072
-
1073
  unset($buttons[$button_key]);
1074
  }
1075
  }
1076
-
1077
  foreach ($buttons as $button_key => $button_item)
1078
  {
1079
  $button_list[$button_key] = $button_item;
1080
  }
1081
-
1082
  $buttons = $button_list;
1083
  }
1084
-
1085
  if ($hide != null)
1086
  {
1087
  foreach ($hide as $button_key)
@@ -1092,56 +1092,56 @@ function synved_social_button_list_markup($context, $vars = null, $buttons = nul
1092
  }
1093
  }
1094
  }
1095
-
1096
  $out_list = array();
1097
  $out_params = array();
1098
  $image_list = array();
1099
  $icon_resolution = synved_option_get('synved_social', 'icon_resolution');
1100
  $resolutions = array('normal' => $size, 'hidef' => $size * 2);
1101
-
1102
  if (is_feed())
1103
  {
1104
  $icon_resolution = 'single';
1105
  }
1106
-
1107
  if ($icon_resolution == 'single')
1108
  {
1109
  $resolutions = array('single' => $size * 2);
1110
  }
1111
-
1112
  foreach ($resolutions as $resolution_name => $resolution_size)
1113
  {
1114
  $image_list[$resolution_name] = synved_social_icon_skin_get_image_list($skin, array_keys($buttons), $resolution_size);
1115
  }
1116
-
1117
  $index = 0;
1118
  $count = count($buttons);
1119
-
1120
  foreach ($buttons as $button_key => $button_item)
1121
  {
1122
  $href = $button_item['link'];
1123
  $title = $button_item['title'];
1124
-
1125
  $matches = null;
1126
-
1127
  if (preg_match_all('/%%(\\w+)%%/', $href, $matches, PREG_SET_ORDER) > 0)
1128
  {
1129
  foreach ($matches as $match)
1130
  {
1131
  $var_key = $match[1];
1132
  $replace = null;
1133
-
1134
  if (isset($vars[$var_key]))
1135
  {
1136
  $replace = $vars[$var_key];
1137
  }
1138
-
1139
  $href = str_replace($match[0], $replace, $href);
1140
  }
1141
  }
1142
-
1143
  $icon_sizes = $resolutions;
1144
-
1145
  foreach ($icon_sizes as $icon_def => $icon_size)
1146
  {
1147
  $image = $image_list[$icon_def][$button_key];
@@ -1149,36 +1149,36 @@ function synved_social_button_list_markup($context, $vars = null, $buttons = nul
1149
  $image_sub = $image_size['sub'];
1150
  $image_path = $image_size['path'];
1151
  $image_uri = $image_size['uri'];
1152
-
1153
  if (!file_exists($image_path))
1154
  {
1155
  $size_list = array_keys($image);
1156
  $image_path = apply_filters('synved_social_button_image_path', $image_path, $image_uri, $icon_size, $image_sub, $skin_path, $skin_uri, $size_list);
1157
  $image_uri = apply_filters('synved_social_button_image_uri', $image_uri, $image_path, $icon_size, $image_sub, $skin_path, $skin_uri, $size_list);
1158
  }
1159
-
1160
  $style = 'margin:0;';
1161
-
1162
  if (true)
1163
  {
1164
  $style .= 'margin-bottom:' . $spacing . 'px;';
1165
  }
1166
-
1167
  if ($index < $count - 1 || $layout_rtl)
1168
  {
1169
  $style .= 'margin-right:' . $spacing . 'px;';
1170
  }
1171
-
1172
  $class_extra = null;
1173
-
1174
  if ($class != null)
1175
  {
1176
  $class_extra = ' ' . implode(' ', $class);
1177
  }
1178
-
1179
  // don't use "nofancybox" because some plugins/themes interpret it as enabling fancybox
1180
  $class_extra .= ' nolightbox';
1181
-
1182
  $out_button = array(
1183
  'tag' => 'a',
1184
  'class' => 'synved-social-button synved-social-button-' . $context . ' synved-social-size-' . $size . ' synved-social-resolution-' . $icon_def . ' synved-social-provider-' . $button_key . $class_extra,
@@ -1201,16 +1201,16 @@ function synved_social_button_list_markup($context, $vars = null, $buttons = nul
1201
  )
1202
  )
1203
  );
1204
-
1205
  $out_list[$icon_def][$button_key] = $out_button;
1206
  $out_params[$icon_def][$button_key] = array('icon-resolution' => $icon_def);
1207
  }
1208
-
1209
  $index++;
1210
  }
1211
-
1212
  $out = null;
1213
-
1214
  if ($out_list != null)
1215
  {
1216
  foreach ($out_list as $def_key => $def_list)
@@ -1218,23 +1218,23 @@ function synved_social_button_list_markup($context, $vars = null, $buttons = nul
1218
  $out_list[$def_key] = apply_filters('synved_social_button_list_markup', $def_list, $out_params[$def_key], $context, $vars, $params);
1219
  }
1220
  }
1221
-
1222
  if ($out_list != null)
1223
  {
1224
  $container_tag = 'span';
1225
-
1226
  if ($container_type == 'block')
1227
  {
1228
  $container_tag = 'div';
1229
  }
1230
-
1231
  if ($container != 'none' && ($container == 'both' || $container == $context))
1232
  {
1233
  $container_style = $alignment != 'none' ? ' style="text-align: ' . $alignment . '"' : null;
1234
-
1235
  $out .= '<' . $container_tag . ' class="synved-social-container synved-social-container-' . $context . '"' . $container_style . '>';
1236
  }
1237
-
1238
  foreach ($out_list as $def_key => $def_list)
1239
  {
1240
  foreach ($def_list as $button_key => $out_item)
@@ -1242,18 +1242,18 @@ function synved_social_button_list_markup($context, $vars = null, $buttons = nul
1242
  $out .= synved_social_button_list_markup_item_out($out_item);
1243
  }
1244
  }
1245
-
1246
  if (synved_option_get('synved_social', 'show_credit'))
1247
  {
1248
  $out .= '<a class="synved-social-credit" target="_blank" rel="nofollow" title="' . __('WordPress Social Media Feather', 'social-media-feather') . '" href="http://synved.com/wordpress-social-media-feather/" style="color:#444; text-decoration:none; font-size:8px; margin-left:5px;vertical-align:10px;white-space:nowrap;"><span>' . __('by ', 'social-media-feather') . '</span><img style="display: inline;margin:0;padding:0;width:16px;height:16px;" width="16" height="16" alt="feather" src="' . $uri . '/image/icon.png" /></a>';
1249
  }
1250
-
1251
  if ($container != 'none' && ($container == 'both' || $container == $context))
1252
  {
1253
  $out .= '</' . $container_tag . '>';
1254
  }
1255
  }
1256
-
1257
  return $out;
1258
  }
1259
 
39
  return SYNVED_SOCIAL_VERSION_STRING;
40
  }
41
 
42
+ class SynvedSocialWidget extends WP_Widget
43
  {
44
+ function __construct($id_base = false, $name = null, $widget_options = array(), $control_options = array() )
45
  {
46
  if ($name == null)
47
  {
48
  $name = 'Social Media Feather';
49
  }
50
+
51
  parent::__construct($id_base, $name, $widget_options, $control_options);
52
  }
53
 
54
+ function widget($args, $instance)
55
  {
56
  extract($args); /* before/after widget, before/after title (defined by themes). */
57
  extract($instance);
58
 
59
  echo $before_widget;
60
+
61
  if ($title != null)
62
  {
63
+ echo $before_title . $title . $after_title;
64
  }
65
 
66
  echo '<div>';
67
+
68
  $params = array();
69
  $params['alignment'] = 'none';
70
+
71
  if ($icon_skin != 'default')
72
  {
73
  $params['skin'] = $icon_skin;
74
  }
75
+
76
  if ($icon_size != 'default')
77
  {
78
  $params['size'] = $icon_size;
79
  }
80
+
81
  if ($icon_spacing !== null && $icon_spacing !== '')
82
  {
83
  $params['spacing'] = $icon_spacing;
84
  }
85
+
86
  $this->render_social_markup($params);
87
 
88
  echo '</div>';
89
+ echo $after_widget;
90
  }
91
+
92
  function get_defaults()
93
  {
94
  return array('icon_skin' => 'default', 'icon_size' => 'default', 'icon_spacing' => '');
95
  }
96
+
97
  function render_social_markup($params = null)
98
  {
99
  }
100
 
101
+ function update($new_instance, $old_instance)
102
  {
103
  $instance = $old_instance;
104
  $instance['title'] = strip_tags($new_instance['title']);
105
  $instance['icon_skin'] = strip_tags($new_instance['icon_skin']);
106
  $instance['icon_size'] = strip_tags($new_instance['icon_size']);
107
  $instance['icon_spacing'] = strip_tags($new_instance['icon_spacing']);
108
+
109
  return $instance;
110
  }
111
 
112
+ function form($instance)
113
  {
114
  $defaults = $this->get_defaults();
115
  $instance = wp_parse_args((array) $instance, $defaults);
120
  </p>
121
  <p>
122
  <label for="<?php echo $this->get_field_id('icon_skin'); ?>"><?php echo(__('Icon Skin', 'social-media-feather')) ?>:</label>
123
+ <?php
124
  $params = array(
125
  'tip' => '',
126
  'output_name' => $this->get_field_name('icon_skin'),
127
  'value' => $instance['icon_skin'],
128
  'set_before' => array(array('default' => __('Use Default'))),
129
  );
130
+
131
  $item = synved_option_item('synved_social', 'icon_skin');
132
+
133
  if ($item != null)
134
  {
135
  // XXX a bit unorthodox...
137
  {
138
  $item = clone $item;
139
  }
140
+
141
  unset($item['render']);
142
+
143
+ synved_option_render_item('synved_social', 'icon_skin', $item, true, $params, 'widget');
144
  }
145
  ?>
146
  <br/>
147
  <label for="<?php echo $this->get_field_id('icon_size'); ?>"><?php echo(__('Icon Size', 'social-media-feather')) ?>:</label>
148
+ <?php
149
  $params = array(
150
  'tip' => '',
151
  'output_name' => $this->get_field_name('icon_size'),
152
  'value' => $instance['icon_size'],
153
  'set_before' => array(array('default' => __('Use Default'))),
154
  );
155
+
156
+ synved_option_render_item('synved_social', 'icon_size', null, true, $params, 'widget');
157
  ?>
158
  <br/>
159
  <label for="<?php echo $this->get_field_id('icon_spacing'); ?>"><?php echo(__('Icon Spacing', 'social-media-feather')) ?>:</label>
163
  }
164
  }
165
 
166
+ class SynvedSocialShareWidget extends SynvedSocialWidget
167
  {
168
+ function __construct()
169
  {
170
  parent::__construct('synved_social_share', __('Social Media Feather: Sharing', 'social-media-feather'));
171
  }
172
+
173
  function get_defaults()
174
  {
175
  $defaults = parent::get_defaults();
176
+
177
  return array_merge($defaults, array('title' => __('Sharing', 'social-media-feather')));
178
  }
179
+
180
  function render_social_markup($params = null)
181
  {
182
  echo synved_social_share_markup(null, null, $params);
183
  }
184
  }
185
 
186
+ class SynvedSocialFollowWidget extends SynvedSocialWidget
187
  {
188
+ function __construct()
189
  {
190
  parent::__construct('synved_social_follow', __('Social Media Feather: Follow Us', 'social-media-feather'));
191
  }
192
+
193
  function get_defaults()
194
  {
195
  $defaults = parent::get_defaults();
196
+
197
  return array_merge($defaults, array('title' => __('Follow Us', 'social-media-feather')));
198
  }
199
+
200
  function render_social_markup($params = null)
201
  {
202
  echo synved_social_follow_markup(null, null, $params);
207
  function synved_social_service_provider_list($context, $raw = false)
208
  {
209
  $provider_list = array();
210
+
211
  if ($context == 'share')
212
  {
213
  $provider_list = array(
214
  'facebook' => array(
215
+ 'link' => 'https://www.facebook.com/sharer.php?u=%%url%%&t=%%title%%&s=100&p[url]=%%url%%&p[images][0]=%%image%%&p[title]=%%title%%',
216
  'title' => __('Share on Facebook')
217
  ),
218
  'twitter' => array(
220
  'title' => __('Share on Twitter'),
221
  ),
222
  'reddit' => array(
223
+ 'link' => 'https://www.reddit.com/submit?url=%%url%%&title=%%title%%',
224
  'title' => __('Share on Reddit'),
225
  ),
226
  'pinterest' => array(
227
+ 'link' => 'https://pinterest.com/pin/create/button/?url=%%url%%&media=%%image%%&description=%%title%%',
228
  'title' => __('Pin it with Pinterest'),
229
  ),
230
  'linkedin' => array(
231
+ 'link' => 'https://www.linkedin.com/shareArticle?mini=true&url=%%url%%&title=%%title%%',
232
  'title' => __('Share on Linkedin'),
233
  ),
234
  'tumblr' => array(
235
+ 'link' => 'https://tumblr.com/share?s=&v=3&t=%%title%%&u=%%url%%',
236
  'title' => __('Share on tumblr'),
237
  'default-display' => false,
238
  ),
254
  'title' => __('Follow us on Twitter'),
255
  ),
256
  'pinterest' => array(
257
+ 'link' => 'https://pinterest.com/MyUserName/',
258
  'title' => __('Our board on Pinterest'),
259
  'default-display' => false,
260
  ),
261
  'linkedin' => array(
262
+ 'link' => 'https://www.linkedin.com/in/yourid',
263
  'title' => __('Find us on Linkedin'),
264
  ),
265
  'rss' => array(
266
  'label' => 'RSS',
267
+ 'link' => 'https://feeds.feedburner.com/MyFeedName',
268
  'title' => __('Subscribe to our RSS Feed'),
269
  ),
270
  'youtube' => array(
271
+ 'link' => 'https://www.youtube.com/MyYouTubeName',
272
  'title' => __('Find us on YouTube'),
273
  ),
274
  'vimeo' => array(
275
+ 'link' => 'https://vimeo.com/MyVimeoName',
276
  'title' => __('Find us on vimeo'),
277
  'default-display' => false,
278
  ),
279
  'tumblr' => array(
280
+ 'link' => 'https://myname.tumblr.com',
281
  'title' => __('Find us on tumblr'),
282
  'default-display' => false,
283
  ),
284
  'instagram' => array(
285
+ 'link' => 'https://instagram.com/myusername',
286
  'title' => __('Check out our instagram feed'),
287
  'default-display' => false,
288
  ),
289
  'flickr' => array(
290
+ 'link' => 'https://www.flickr.com/photos/myusername/',
291
  'title' => __('Check out our flickr feed'),
292
  'default-display' => false,
293
  ),
303
  ),
304
  );
305
  }
306
+
307
  $return_list = $provider_list;
308
+
309
  if ($raw == false)
310
  {
311
  global $synved_social;
312
+
313
  $list_name = 'provider_list' . '_' . $context;
314
+
315
  if (!isset($synved_social[$list_name]) || $synved_social[$list_name] == null)
316
  {
317
  $return_list = array();
318
+
319
  foreach ($provider_list as $provider_name => $provider_item)
320
  {
321
  $display = synved_option_get('synved_social', $provider_name . '_display');
322
  $link = synved_option_get('synved_social', $provider_name . '_' . $context . '_link');
323
  $title = synved_option_get('synved_social', $provider_name . '_' . $context . '_title');
324
+
325
  if ($display === null || in_array($display, array($context, 'both')))
326
  {
327
  if ($link != null)
328
  {
329
  $provider_item['link'] = $link;
330
  }
331
+
332
  if ($title != null)
333
  {
334
  $provider_item['title'] = $title;
335
  }
336
+
337
  $return_list[$provider_name] = $provider_item;
338
  }
339
  }
340
+
341
  $synved_social[$list_name] = $return_list;
342
  }
343
  else
345
  $return_list = $synved_social[$list_name];
346
  }
347
  }
348
+
349
  return apply_filters('synved_social_service_provider_list', $return_list, $context, $raw);
350
  }
351
 
352
  function synved_social_icon_skin_list()
353
  {
354
  global $synved_social;
355
+
356
  if (!isset($synved_social['skin_list']) || $synved_social['skin_list'] == null)
357
  {
358
  $path = synved_social_path();
359
  $uri = synved_social_path_uri();
360
+
361
  $icons = array(
362
  'regular' => array(
363
+ 'label' => __('Regular'),
364
+ 'image' => $uri . '/image/social/regular/preview.png',
365
+ 'folder' => '/image/social/regular/',
366
+ 'path' => $path . '/image/social/regular/',
367
  'uri' => $uri . '/image/social/regular/'
368
  )
369
  );
370
+
371
  $icons_extra = null;
372
+
373
  if (function_exists('synved_social_addon_extra_icons_get'))
374
  {
375
  $icons_extra = synved_social_addon_extra_icons_get();
376
  $icons = array_merge($icons, $icons_extra);
377
  }
378
+
379
  $icons = apply_filters('synved_social_icon_skin_list', $icons);
380
+
381
  foreach ($icons as $skin_name => $skin)
382
  {
383
  $icons[$skin_name]['name'] = $skin_name;
384
  }
385
+
386
  $synved_social['skin_list'] = $icons;
387
  }
388
+
389
  return $synved_social['skin_list'];
390
  }
391
 
392
  function synved_social_icon_skin_get($name = null)
393
  {
394
  $icons = synved_social_icon_skin_list();
395
+
396
  if ($name != null && !isset($icons[$name]))
397
  {
398
  foreach ($icons as $skin_name => $skin)
400
  if (strtolower($name) == strtolower($skin['label']))
401
  {
402
  $name = $skin_name;
403
+
404
  break;
405
  }
406
  }
407
  }
408
+
409
  if ($name == null || !isset($icons[$name]))
410
  {
411
  $selected = synved_option_get('synved_social', 'icon_skin');
412
+
413
  $name = $selected;
414
  }
415
+
416
  if (isset($icons[$name]))
417
  {
418
  return $icons[$name];
419
  }
420
+
421
  if (isset($icons['regular']))
422
  {
423
  return $icons['regular'];
424
  }
425
+
426
  return null;
427
  }
428
 
435
  function synved_social_icon_skin_set($name, $skin)
436
  {
437
  global $synved_social;
438
+
439
  // ensure the global is set
440
  synved_social_icon_skin_list();
441
+
442
  if (isset($synved_social['skin_list']) && $synved_social['skin_list'] != null)
443
  {
444
  if (!isset($synved_social['skin_list'][$name]))
445
  {
446
  $synved_social['skin_list'][$name] = array();
447
  }
448
+
449
  foreach ($skin as $key => $value)
450
  {
451
  $synved_social['skin_list'][$name][$key] = $value;
459
  {
460
  return $skin['size-list'];
461
  }
462
+
463
  if (isset($skin['name']))
464
  {
465
  $skin_fresh = synved_social_icon_skin_get($skin['name']);
466
+
467
  if (isset($skin['path']) && isset($skin_fresh['path']) && $skin['path'] == $skin_fresh['path'])
468
  {
469
  if (isset($skin_fresh['size-list']))
472
  }
473
  }
474
  }
475
+
476
  $path = synved_social_path();
477
  $skin_path = isset($skin['path']) ? $skin['path'] : ($path . '/image/social/regular/');
478
+
479
  $sizes = glob($skin_path . '*', GLOB_ONLYDIR);
480
  $sizes = array_map('basename', $sizes);
481
  $size_list = array();
482
+
483
  foreach ($sizes as $size_dir)
484
  {
485
  $size_parts = explode('x', $size_dir);
486
  $size_width = (int) $size_parts[0];
487
+
488
  if ($size_width != null)
489
  {
490
  $size_list[] = $size_width;
491
  }
492
  }
493
+
494
  sort($size_list, SORT_NUMERIC);
495
+
496
  if (isset($skin['name']))
497
  {
498
  synved_social_icon_skin_set($skin['name'], array('size-list' => $size_list));
499
  }
500
+
501
  return $size_list;
502
  }
503
 
506
  $path = synved_social_path();
507
  $uri = synved_social_path_uri();
508
  $skin_default = synved_social_icon_skin_get('regular');
509
+
510
  $skin_default_path = isset($skin_default['path']) ? $skin_default['path'] : ($path . '/image/social/regular/');
511
  $skin_default_uri = isset($skin_default['uri']) ? $skin_default['uri'] : ($uri . '/image/social/regular/');
512
  $skin_sel_path = isset($skin['path']) ? $skin['path'] : ($path . '/image/social/regular/');
513
  $skin_sel_uri = isset($skin['uri']) ? $skin['uri'] : ($uri . '/image/social/regular/');
514
+
515
  $default_size_list = synved_social_icon_skin_get_size_list($skin_default);
516
  $sel_size_list = synved_social_icon_skin_get_size_list($skin);
517
+
518
  $skin_list = array(
519
  array(
520
  'path' => $skin_sel_path,
527
  'list' => $default_size_list,
528
  ),
529
  );
530
+
531
  $image_list = array();
532
+
533
  foreach ($name_list as $name)
534
  {
535
  foreach ($skin_list as $skin)
538
  $skin_uri = $skin['uri'];
539
  $size_list = $skin['list'];
540
  $size_count = count($size_list);
541
+
542
  $image_size_list = array();
543
  $image_size_list_skipped = array();
544
+
545
  for ($i = 0; $i < $size_count; $i++)
546
  {
547
  $image_size = $size_list[$i];
549
  $size_name = $image_size . 'x' . $image_size;
550
  $image_path = $skin_path . $size_name . $image_sub;
551
  $image_uri = $skin_uri . $size_name . $image_sub;
552
+
553
  if (file_exists($image_path))
554
  {
555
  $image_size_meta = array(
558
  'path' => $image_path,
559
  'uri' => $image_uri,
560
  );
561
+
562
  foreach ($image_size_list_skipped as $image_size_skipped)
563
  {
564
  $image_size_list[$image_size_skipped] = $image_size_meta;
565
  }
566
+
567
  $image_size_skipped = array();
568
  $image_size_list[$image_size] = $image_size_meta;
569
+
570
  if ($forced_size != null && ($image_size > $forced_size || $i == $size_count - 1) && !isset($image_size_list[$forced_size]))
571
  {
572
  $image_size_list[$forced_size] = $image_size_meta;
577
  $image_size_skipped[] = $image_size;
578
  }
579
  }
580
+
581
  if ($image_size_list != null)
582
  {
583
  break;
584
  }
585
  }
586
+
587
  $image_list[$name] = $image_size_list;
588
  }
589
+
590
  return $image_list;
591
  }
592
 
594
  {
595
  $image_list = synved_social_icon_skin_get_image_list_raw($skin, $name_list, $forced_size);
596
  $image_list = apply_filters('synved_social_skin_image_list', $image_list, $skin, $name_list, $forced_size);
597
+
598
  return $image_list;
599
  }
600
 
606
  $params = shortcode_atts($params_def, $atts, 'feather_' . $context);
607
  $vars = array_filter($vars);
608
  $params = array_filter($params);
609
+
610
  $vars = apply_filters('synved_social_shortcode_variable_list', $vars, $context, $atts);
611
+ $params = apply_filters('synved_social_shortcode_parameter_list', $params, $context, $atts);
612
+
613
  if ($context == 'share')
614
  {
615
  return synved_social_share_markup($vars, null, $params);
618
  {
619
  return synved_social_follow_markup($vars, null, $params);
620
  }
621
+
622
  return null;
623
  }
624
 
638
  $tag = isset($out_item['tag']) ? $out_item['tag'] : null;
639
  $content = isset($out_item['content']) ? $out_item['content'] : null;
640
  $list = isset($out_item['child-list']) ? $out_item['child-list'] : null;
641
+
642
  unset($out_item['tag']);
643
  unset($out_item['content']);
644
  unset($out_item['child-list']);
645
+
646
  if ($tag != null)
647
  {
648
  $out .= '<' . $tag;
649
+
650
  foreach ($out_item as $attr_name => $attr_value)
651
  {
652
  if ($attr_name != null && $attr_value !== null)
660
  {
661
  $attr_value = esc_attr($attr_value);
662
  }
663
+
664
  $out .= ' ' . $attr_name . '="' . $attr_value . '"';
665
  }
666
  }
667
+
668
  if ($list != null || $content != null)
669
  {
670
  $out .= '>';
674
  $out .= ' />';
675
  }
676
  }
677
+
678
  if ($list != null)
679
  {
680
  foreach ($list as $child)
682
  $out .= synved_social_button_list_markup_item_out($child);
683
  }
684
  }
685
+
686
  if ($content != null)
687
  {
688
  $out .= $content;
692
  {
693
  $out .= '</' . $tag . '>';
694
  }
695
+
696
  return $out;
697
  }
698
 
699
  function synved_social_button_list_markup($context, $vars = null, $buttons = null, $params = null)
700
  {
701
  $buttons_default = synved_social_service_provider_list($context);
702
+
703
  if ($buttons == null)
704
  {
705
  $buttons = $buttons_default;
707
  else
708
  {
709
  $keys = array_keys($buttons);
710
+
711
  foreach ($keys as $key)
712
  {
713
  if ($buttons[$key] == null && isset($buttons_default[$key]))
716
  }
717
  }
718
  }
719
+
720
  $id = get_the_ID();
721
+
722
  if ($id == null)
723
  {
724
  global $post;
725
+
726
  if ($post != null)
727
  {
728
  $id = $post->ID;
729
  }
730
  }
731
+
732
  if (!isset($vars['url']) || !isset($vars['short_url']))
733
  {
734
  $full_url = synved_option_get('synved_social', 'share_full_url');
735
  $home_url = home_url();
736
  $req_uri = $_SERVER['REQUEST_URI'];
737
+
738
  $path = parse_url($home_url, PHP_URL_PATH);
739
  $path_len = strlen($path);
740
+
741
  if (strtolower(substr($req_uri, 0, $path_len)) == strtolower($path))
742
  {
743
  $req_uri = substr($req_uri, $path_len);
744
  }
745
+
746
  $url = home_url($req_uri);
747
  $short_url = $url;
748
+
749
  if ($id != null && in_the_loop())
750
  {
751
  $post_full_url = strtolower(get_post_meta($id, 'synved_social_share_full_url', true));
752
+
753
  if ($post_full_url != null)
754
  {
755
  if ($post_full_url == 'yes')
762
  }
763
  }
764
  }
765
+
766
  //if (!$full_url)
767
  {
768
  if ($id != null && in_the_loop())
770
  $use_shortlinks = synved_option_get('synved_social', 'use_shortlinks');
771
  $url = get_permalink($id);
772
  $short_url = wp_get_shortlink($id);
773
+
774
  if ($short_url != null)
775
  {
776
+ if ($use_shortlinks && function_exists('wp_get_shortlink'))
777
  {
778
  $url = $short_url;
779
  }
788
  $url = $home_url;
789
  }
790
  }
791
+
792
  if (!isset($vars['url']))
793
  {
794
  $vars['url'] = $url;
795
  }
796
+
797
  if (!isset($vars['short_url']))
798
  {
799
  $vars['short_url'] = $short_url;
800
  }
801
  }
802
+
803
  if (!isset($vars['image']))
804
  {
805
  $image_src = null;
806
+
807
  if ($id != null)
808
  {
809
  $image_id = get_post_thumbnail_id($id);
810
+
811
  if ($image_id != null)
812
  {
813
  $src = wp_get_attachment_image_src($image_id, 'full');
817
  {
818
  $post = get_post($id);
819
  $match = null;
820
+
821
  if (preg_match('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $match) > 0)
822
  {
823
  $image_src = $match[1];
824
  }
825
  }
826
  }
827
+
828
  $vars['image'] = $image_src;
829
  }
830
+
831
  if (!isset($vars['title']))
832
  {
833
  $title = get_the_title();
835
  $title = preg_replace('/\\<\\s*([^[:alpha:]\\/])/', '&lt;$1', $title);
836
  $vars['title'] = html_entity_decode(wp_strip_all_tags($title));
837
  }
838
+
839
  if (!isset($vars['message']))
840
  {
841
  $message = synved_option_get('synved_social', 'share_message_default');
842
+
843
  if ($message == null)
844
  {
845
  $message = __('Hey check this out', 'social-media-feather');
846
  }
847
+
848
  $vars['message'] = $message;
849
  }
850
+
851
  if (!isset($vars['author_wp']))
852
  {
853
  if ($id != null && in_the_loop())
854
  {
855
  $author = get_the_author();
856
+
857
  if ($author != null)
858
  {
859
  $vars['author_wp'] = $author;
860
  }
861
  }
862
  }
863
+
864
  if (!isset($vars['author']))
865
  {
866
  if ($id != null && in_the_loop())
867
  {
868
  $author = get_the_author_meta('_synved_twitter_handle');
869
+
870
  if ($author == null)
871
  {
872
  $author = get_the_author_meta('twitter');
873
  }
874
+
875
  if ($author == null)
876
  {
877
  $author = get_the_author();
878
  }
879
+
880
  if ($author != null)
881
  {
882
  $vars['author'] = $author;
883
  }
884
  }
885
  }
886
+
887
  if (!isset($vars['date']))
888
  {
889
  if ($id != null && in_the_loop())
890
  {
891
  $date = get_the_date('', $id);
892
+
893
  if ($date != null)
894
  {
895
  $vars['date'] = $date;
896
  }
897
  }
898
  }
899
+
900
  if (isset($vars['url']) && !isset($vars['url_trimmed']))
901
  {
902
  $url_trimmed = trim($vars['url']);
903
+
904
  while (substr($url_trimmed, -1) == '/')
905
  {
906
  $url_trimmed = substr($url_trimmed, 0, -1);
907
  }
908
+
909
  while (strtolower(substr($url_trimmed, -3)) == '%2f')
910
  {
911
  $url_trimmed = substr($url_trimmed, 0, -3);
912
  }
913
+
914
  $vars['url_trimmed'] = $url_trimmed;
915
  }
916
+
917
  if (isset($params['class']) && !is_array($params['class']))
918
  {
919
  $class = explode(' ', $params['class']);
920
  $params['class'] = array_map('trim', $class);
921
  }
922
+
923
  if (isset($params['show']) && !is_array($params['show']))
924
  {
925
  $show = explode(',', $params['show']);
926
  $params['show'] = array_map('trim', $show);
927
  }
928
+
929
  if (isset($params['hide']) && !is_array($params['hide']))
930
  {
931
  $hide = explode(',', $params['hide']);
932
  $params['hide'] = array_map('trim', $hide);
933
  }
934
+
935
  $vars = apply_filters('synved_social_markup_variable_list', $vars, $context, $params);
936
  $params = apply_filters('synved_social_markup_parameter_list', $params, $context, $vars);
937
+
938
  if ($vars != null)
939
  {
940
  $vars = array_map('wp_kses_decode_entities', $vars);
941
  $vars = urlencode_deep($vars);
942
+
943
  // urlencode_deep converts space characters to + rather than %20 which messes things up
944
  $vars['message'] = str_ireplace('+', '%20', $vars['message']);
945
  $vars['title'] = str_ireplace('+', '%20', $vars['title']);
946
+
947
  // urlencode_deep tries to be smart and apostrophes (') to %19 not %27 and double quotes (") to their equivalent open/closed counterparts which doesn't work on most social networks sharings
948
  $vars['message'] = str_ireplace('%18', '%27', $vars['message']);
949
  $vars['title'] = str_ireplace('%18', '%27', $vars['title']);
954
  $vars['message'] = str_ireplace('%1d', '%22', $vars['message']);
955
  $vars['title'] = str_ireplace('%1d', '%22', $vars['title']);
956
  }
957
+
958
  $path = synved_social_path();
959
  $uri = synved_social_path_uri();
960
  $skin = synved_social_icon_skin_current();
961
+
962
  if (isset($params['skin']))
963
  {
964
  $skin = synved_social_icon_skin_get($params['skin']);
965
  }
966
+
967
  $skin_path = isset($skin['path']) ? $skin['path'] : ($path . '/image/social/regular/');
968
  $skin_uri = isset($skin['uri']) ? $skin['uri'] : ($uri . '/image/social/regular/');
969
+
970
  $icon_size = synved_option_get('synved_social', 'icon_size');
971
  $size = 48;
972
+
973
  if ($icon_size != null)
974
  {
975
  $size = $icon_size;
976
  }
977
+
978
  if (isset($params['size']))
979
  {
980
  $size = $params['size'];
981
+
982
  if (is_string($size))
983
  {
984
  $size = strtolower($size);
986
  $size = (int) $size_parts[0];
987
  }
988
  }
989
+
990
  $icon_spacing = synved_option_get('synved_social', 'icon_spacing');
991
  $buttons_container = synved_option_get('synved_social', 'buttons_container');
992
  $buttons_container_type = synved_option_get('synved_social', 'buttons_container_type');
996
  $container = 'none';
997
  $container_type = 'basic';
998
  $alignment = 'none';
999
+
1000
  if ($icon_spacing != null)
1001
  {
1002
  $spacing = $icon_spacing;
1003
  }
1004
+
1005
  if (isset($params['spacing']))
1006
  {
1007
  $spacing = $params['spacing'];
1008
  }
1009
+
1010
  if ($buttons_container != null)
1011
  {
1012
  $container = $buttons_container;
1013
  }
1014
+
1015
  if ($buttons_container_type != null)
1016
  {
1017
  $container_type = $buttons_container_type;
1018
  }
1019
+
1020
  if ($buttons_alignment != null)
1021
  {
1022
  $alignment = $buttons_alignment;
1023
  }
1024
+
1025
  if (isset($params['alignment']))
1026
  {
1027
  $alignment = $params['alignment'];
1028
  }
1029
+
1030
  if ($alignment != 'none')
1031
  {
1032
  if ($container == 'none')
1038
  $container = 'both';
1039
  }
1040
  }
1041
+
1042
  // Allow parameters to override container after we decide a default based on selected alignment
1043
  if (isset($params['container']))
1044
  {
1045
  $container = $params['container'];
1046
  }
1047
+
1048
  if ($alignment != 'none')
1049
  {
1050
  $container_type = 'block';
1051
  }
1052
+
1053
  // Allow parameters to override container after we decide a default based on selected alignment
1054
  if (isset($params['container_type']))
1055
  {
1056
  $container_type = $params['container_type'];
1057
  }
1058
+
1059
  $class = isset($params['class']) ? $params['class'] : null;
1060
  $show = isset($params['show']) ? $params['show'] : null;
1061
  $hide = isset($params['hide']) ? $params['hide'] : null;
1062
+
1063
  if ($show != null)
1064
  {
1065
  $button_list = array();
1066
+
1067
  foreach ($show as $button_key)
1068
  {
1069
  if (isset($buttons[$button_key]))
1070
  {
1071
  $button_list[$button_key] = $buttons[$button_key];
1072
+
1073
  unset($buttons[$button_key]);
1074
  }
1075
  }
1076
+
1077
  foreach ($buttons as $button_key => $button_item)
1078
  {
1079
  $button_list[$button_key] = $button_item;
1080
  }
1081
+
1082
  $buttons = $button_list;
1083
  }
1084
+
1085
  if ($hide != null)
1086
  {
1087
  foreach ($hide as $button_key)
1092
  }
1093
  }
1094
  }
1095
+
1096
  $out_list = array();
1097
  $out_params = array();
1098
  $image_list = array();
1099
  $icon_resolution = synved_option_get('synved_social', 'icon_resolution');
1100
  $resolutions = array('normal' => $size, 'hidef' => $size * 2);
1101
+
1102
  if (is_feed())
1103
  {
1104
  $icon_resolution = 'single';
1105
  }
1106
+
1107
  if ($icon_resolution == 'single')
1108
  {
1109
  $resolutions = array('single' => $size * 2);
1110
  }
1111
+
1112
  foreach ($resolutions as $resolution_name => $resolution_size)
1113
  {
1114
  $image_list[$resolution_name] = synved_social_icon_skin_get_image_list($skin, array_keys($buttons), $resolution_size);
1115
  }
1116
+
1117
  $index = 0;
1118
  $count = count($buttons);
1119
+
1120
  foreach ($buttons as $button_key => $button_item)
1121
  {
1122
  $href = $button_item['link'];
1123
  $title = $button_item['title'];
1124
+
1125
  $matches = null;
1126
+
1127
  if (preg_match_all('/%%(\\w+)%%/', $href, $matches, PREG_SET_ORDER) > 0)
1128
  {
1129
  foreach ($matches as $match)
1130
  {
1131
  $var_key = $match[1];
1132
  $replace = null;
1133
+
1134
  if (isset($vars[$var_key]))
1135
  {
1136
  $replace = $vars[$var_key];
1137
  }
1138
+
1139
  $href = str_replace($match[0], $replace, $href);
1140
  }
1141
  }
1142
+
1143
  $icon_sizes = $resolutions;
1144
+
1145
  foreach ($icon_sizes as $icon_def => $icon_size)
1146
  {
1147
  $image = $image_list[$icon_def][$button_key];
1149
  $image_sub = $image_size['sub'];
1150
  $image_path = $image_size['path'];
1151
  $image_uri = $image_size['uri'];
1152
+
1153
  if (!file_exists($image_path))
1154
  {
1155
  $size_list = array_keys($image);
1156
  $image_path = apply_filters('synved_social_button_image_path', $image_path, $image_uri, $icon_size, $image_sub, $skin_path, $skin_uri, $size_list);
1157
  $image_uri = apply_filters('synved_social_button_image_uri', $image_uri, $image_path, $icon_size, $image_sub, $skin_path, $skin_uri, $size_list);
1158
  }
1159
+
1160
  $style = 'margin:0;';
1161
+
1162
  if (true)
1163
  {
1164
  $style .= 'margin-bottom:' . $spacing . 'px;';
1165
  }
1166
+
1167
  if ($index < $count - 1 || $layout_rtl)
1168
  {
1169
  $style .= 'margin-right:' . $spacing . 'px;';
1170
  }
1171
+
1172
  $class_extra = null;
1173
+
1174
  if ($class != null)
1175
  {
1176
  $class_extra = ' ' . implode(' ', $class);
1177
  }
1178
+
1179
  // don't use "nofancybox" because some plugins/themes interpret it as enabling fancybox
1180
  $class_extra .= ' nolightbox';
1181
+
1182
  $out_button = array(
1183
  'tag' => 'a',
1184
  'class' => 'synved-social-button synved-social-button-' . $context . ' synved-social-size-' . $size . ' synved-social-resolution-' . $icon_def . ' synved-social-provider-' . $button_key . $class_extra,
1201
  )
1202
  )
1203
  );
1204
+
1205
  $out_list[$icon_def][$button_key] = $out_button;
1206
  $out_params[$icon_def][$button_key] = array('icon-resolution' => $icon_def);
1207
  }
1208
+
1209
  $index++;
1210
  }
1211
+
1212
  $out = null;
1213
+
1214
  if ($out_list != null)
1215
  {
1216
  foreach ($out_list as $def_key => $def_list)
1218
  $out_list[$def_key] = apply_filters('synved_social_button_list_markup', $def_list, $out_params[$def_key], $context, $vars, $params);
1219
  }
1220
  }
1221
+
1222
  if ($out_list != null)
1223
  {
1224
  $container_tag = 'span';
1225
+
1226
  if ($container_type == 'block')
1227
  {
1228
  $container_tag = 'div';
1229
  }
1230
+
1231
  if ($container != 'none' && ($container == 'both' || $container == $context))
1232
  {
1233
  $container_style = $alignment != 'none' ? ' style="text-align: ' . $alignment . '"' : null;
1234
+
1235
  $out .= '<' . $container_tag . ' class="synved-social-container synved-social-container-' . $context . '"' . $container_style . '>';
1236
  }
1237
+
1238
  foreach ($out_list as $def_key => $def_list)
1239
  {
1240
  foreach ($def_list as $button_key => $out_item)
1242
  $out .= synved_social_button_list_markup_item_out($out_item);
1243
  }
1244
  }
1245
+
1246
  if (synved_option_get('synved_social', 'show_credit'))
1247
  {
1248
  $out .= '<a class="synved-social-credit" target="_blank" rel="nofollow" title="' . __('WordPress Social Media Feather', 'social-media-feather') . '" href="http://synved.com/wordpress-social-media-feather/" style="color:#444; text-decoration:none; font-size:8px; margin-left:5px;vertical-align:10px;white-space:nowrap;"><span>' . __('by ', 'social-media-feather') . '</span><img style="display: inline;margin:0;padding:0;width:16px;height:16px;" width="16" height="16" alt="feather" src="' . $uri . '/image/icon.png" /></a>';
1249
  }
1250
+
1251
  if ($container != 'none' && ($container == 'both' || $container == $context))
1252
  {
1253
  $out .= '</' . $container_tag . '>';
1254
  }
1255
  }
1256
+
1257
  return $out;
1258
  }
1259