Add Twitter, Facebook Like, Google plus one Social share - Version 2.3.0

Version Description

  • Added Pinterest share option.
  • Fix for the "Tweet" text in the excerpt.
  • couple of W3C validator fixes.
Download this release

Release Info

Developer BeingMaverick
Plugin Icon wp plugin Add Twitter, Facebook Like, Google plus one Social share
Version 2.3.0
Comparing to
See all releases

Code changes from version 2.2.1 to 2.3.0

Files changed (4) hide show
  1. readme.txt +17 -3
  2. tf_admin_page.php +30 -9
  3. tf_display.php +121 -5
  4. twitter-facebook-share.php +1 -1
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Add Twitter, Facebook Like, Google plus one Social share ===
2
  Contributors: beingmaverick
3
  Plugin Site: http://www.searchtechword.com
4
- Tags: Facebook like, twitter button, twitter share,LinkedIn, Google +1 button, Google plus one, Stumbleupon, social share, twitter facebook share,stumbleupon, LinkedIn share, floating sharebar, facebook, +1
5
  Requires at least: 2.8
6
  Tested up to: 3.3.1
7
- Stable tag: 2.2.1
8
 
9
  == Description ==
10
  <br />
@@ -12,7 +12,7 @@ Stable tag: 2.2.1
12
  [Plugin Home Page](http://www.searchtechword.com/2011/06/wordpress-plugin-add-twitter-facebook-google-plus-one-share)
13
  <br />
14
  <br />
15
- This plugin is the most efficient way to integrate the important social share buttons like twitter, facebook like, google +1 (plus one), LinkedIn and stumbleupon in three different position and styles.
16
 
17
  * Automatically display the social share buttons Above the post, below the post, both above and below or floating left side of post.
18
 
@@ -37,6 +37,8 @@ Option to load the script in header as well, if you wish to.
37
 
38
  * Option to disable on Mobile Devices (iPad, iPhone, Blackberry, Nokia, Android, Opera Mini)
39
 
 
 
40
 
41
  == Installation ==
42
 
@@ -49,6 +51,9 @@ Very easy to install, similar to rest of the plugins.
49
 
50
  == Frequently Asked Questions ==
51
 
 
 
 
52
  If you have any doubts or question or want to customise the plugin then get in touch with me at
53
  [SearchTechWord Wordpress Plugin](http://www.searchtechword.com/about-searchtechword/)<br />
54
  I will try and help as much as possible and answer all your queries. I am ready to add to more features if you demand for the same, all free of cost. Always there to help you.
@@ -59,6 +64,11 @@ You can Check Screen Shots on my website. I use the same plugin to display Socia
59
 
60
  == Changelog ==
61
 
 
 
 
 
 
62
  = 2.2.1 =
63
  * Fixed a minor bug for disable mobile device display.
64
 
@@ -96,6 +106,10 @@ You can Check Screen Shots on my website. I use the same plugin to display Socia
96
 
97
  == Upgrade Notice ==
98
 
 
 
 
 
99
  = 2.2.1 =
100
 
101
  Minor bug fixed for disable mobile device display.
1
  === Add Twitter, Facebook Like, Google plus one Social share ===
2
  Contributors: beingmaverick
3
  Plugin Site: http://www.searchtechword.com
4
+ Tags: Facebook like, twitter button, twitter share,LinkedIn, Google +1 button, Google plus one, Stumbleupon, social share, twitter facebook share,stumbleupon, LinkedIn share, floating sharebar, facebook, +1, pinterest button, pinterest share
5
  Requires at least: 2.8
6
  Tested up to: 3.3.1
7
+ Stable tag: 2.3.0
8
 
9
  == Description ==
10
  <br />
12
  [Plugin Home Page](http://www.searchtechword.com/2011/06/wordpress-plugin-add-twitter-facebook-google-plus-one-share)
13
  <br />
14
  <br />
15
+ This plugin is the most efficient way to integrate the important social share buttons like twitter, facebook like, google +1 (plus one), LinkedIn, stumbleupon and Pinterest in three different position and styles.
16
 
17
  * Automatically display the social share buttons Above the post, below the post, both above and below or floating left side of post.
18
 
37
 
38
  * Option to disable on Mobile Devices (iPad, iPhone, Blackberry, Nokia, Android, Opera Mini)
39
 
40
+ * Advanced image search for Pinterest sharing. (searches post thumbnail, then attached image to post and lastly any image inserted in the post content (picks up first image found).
41
+
42
 
43
  == Installation ==
44
 
51
 
52
  == Frequently Asked Questions ==
53
 
54
+ [FAQs for the plugin]
55
+ (http://www.searchtechword.com/2012/01/faq-for-wordpress-plugin-twitter-facebook-google-plus-one-social-share/)<br />
56
+
57
  If you have any doubts or question or want to customise the plugin then get in touch with me at
58
  [SearchTechWord Wordpress Plugin](http://www.searchtechword.com/about-searchtechword/)<br />
59
  I will try and help as much as possible and answer all your queries. I am ready to add to more features if you demand for the same, all free of cost. Always there to help you.
64
 
65
  == Changelog ==
66
 
67
+ = 2.3.0 =
68
+ * Added Pinterest share option.
69
+ * Fix for the "Tweet" text in the excerpt.
70
+ * couple of W3C validator fixes.
71
+
72
  = 2.2.1 =
73
  * Fixed a minor bug for disable mobile device display.
74
 
106
 
107
  == Upgrade Notice ==
108
 
109
+ = 2.3.0 =
110
+
111
+ Pinterest share option added | "Tweet" word in excerpt fix | W3c Validator fixes
112
+
113
  = 2.2.1 =
114
 
115
  Minor bug fixed for disable mobile device display.
tf_admin_page.php CHANGED
@@ -20,7 +20,8 @@ $active_buttons = array(
20
  'twitter'=>'Twitter',
21
  'stumbleupon'=>'Stumbleupon',
22
  'Google_plusone'=>'Google PlusOne',
23
- 'linkedin'=>'LinkedIn'
 
24
  );
25
 
26
  $show_in = array(
@@ -63,10 +64,12 @@ $show_in = array(
63
  $option['twitter_count'] = (isset($_POST['twitter_facebook_share_twitter_count']) and $_POST['twitter_facebook_share_twitter_count']=='on') ? true : false;
64
  $option['google_count'] = (isset($_POST['twitter_facebook_share_google_count']) and $_POST['twitter_facebook_share_google_count']=='on') ? true : false;
65
  $option['linkedin_count'] = (isset($_POST['twitter_facebook_share_linkedin_count']) and $_POST['twitter_facebook_share_linkedin_count']=='on') ? true : false;
 
66
  $option['google_width'] = esc_html($_POST['twitter_facebook_share_google_width']);
67
  $option['facebook_like_width'] = esc_html($_POST['twitter_facebook_share_facebook_like_width']);
68
  $option['twitter_width'] = esc_html($_POST['twitter_facebook_share_twitter_width']);
69
  $option['linkedin_width'] = esc_html($_POST['twitter_facebook_share_linkedin_width']);
 
70
  $option['stumbleupon_width'] = esc_html($_POST['twitter_facebook_share_stumbleupon_width']);
71
  update_option($option_name, $option);
72
  // Put a settings updated message on the screen
@@ -95,6 +98,7 @@ $show_in = array(
95
  $google_count = ($option['google_count']) ? 'checked="checked"' : '';
96
  $twitter_count = ($option['twitter_count']) ? 'checked="checked"' : '';
97
  $linkedin_count = ($option['linkedin_count']) ? 'checked="checked"' : '';
 
98
 
99
  $out .= '
100
  <div class="wrap">
@@ -232,9 +236,9 @@ $show_in = array(
232
  <td style="padding-bottom:20px;">
233
  <input type="text" name="twitter_facebook_share_google_width" value="'.stripslashes($option['google_width']).'" size="5">px<br />
234
  </td>
235
- <td style="padding-bottom:20px; padding-right:10px;" valign="top">'.__("Stumbleupon Button width", 'menu-test' ).':</td>
236
  <td style="padding-bottom:20px;">
237
- <input type="text" name="twitter_facebook_share_stumbleupon_width" value="'.stripslashes($option['stumbleupon_width']).'" size="10"> px <br />
238
  </td>
239
  </tr>
240
  <tr><td style="padding-bottom:20px; padding-right:10px;" valign="top">'.__("Twitter Button width", 'menu-test' ).':</td>
@@ -245,20 +249,29 @@ $show_in = array(
245
  <td style="padding-bottom:20px;">
246
  <input type="text" name="twitter_facebook_share_linkedin_width" value="'.stripslashes($option['linkedin_width']).'" size="5"> px <br />
247
  </td>
 
 
 
 
248
  </tr>
249
  <tr><td style="padding-bottom:20px; padding-right:10px;" valign="top">'.__("Google +1 counter", 'menu-test' ).':</td>
250
  <td style="padding-bottom:20px;">
251
  <input type="checkbox" name="twitter_facebook_share_google_count" '.$google_count.' />
252
  </td>
253
- <td style="padding-bottom:20px; padding-right:10px;" valign="top">'.__("LinkedIn counter", 'menu-test' ).':</td>
254
  <td style="padding-bottom:20px;">
255
- <input type="checkbox" name="twitter_facebook_share_linkedin_count" '.$linkedin_count.' />
256
  </td>
257
  </tr>
258
  <tr><td style="padding-bottom:20px; padding-right:10px;" valign="top">'.__("Twitter counter", 'menu-test' ).':</td>
259
  <td style="padding-bottom:20px;">
260
  <input type="checkbox" name="twitter_facebook_share_twitter_count" '.$twitter_count.' />
261
- </td></tr>
 
 
 
 
 
262
  </table>
263
  </div>
264
  </div>
@@ -277,7 +290,7 @@ $show_in = array(
277
  <div class="inside">
278
  <table>
279
  <tr><td align="justify">
280
- <p >If you liked the plugin and was useful to your site then please support to keep this project up and running. Maintenance and enhancement do cost. Show your appreciation and love.</p> </td></tr>
281
  <tr>
282
  <td align="center">
283
  <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
@@ -367,6 +380,9 @@ function twitter_facebook_share_get_options_stored () {
367
  if (!isset($option['linkedin_width'])) {
368
  $option['linkedin_width'] = '105';
369
  }
 
 
 
370
  if (!isset($option['stumbleupon_width'])) {
371
  $option['stumbleupon_width'] = '85';
372
  }
@@ -376,6 +392,9 @@ function twitter_facebook_share_get_options_stored () {
376
  if (!isset($option['linkedin_count'])) {
377
  $option['linkedin_count'] = true;
378
  }
 
 
 
379
  if (!isset($option['google_count'])) {
380
  $option['google_count'] = true;
381
  }
@@ -385,8 +404,8 @@ function twitter_facebook_share_get_options_stored () {
385
  function twitter_facebook_share_get_options_default ($position='above', $border='flat', $color='#F0F4F9',$left_space='60px',$bottom_space='40%', $float_position='fixed') {
386
  $option = array();
387
  $option['auto'] = true;
388
- $option['active_buttons'] = array('facebook_like'=>true, 'twitter'=>true, 'stumbleupon'=>true, 'Google_plusone'=>true, 'linkedin'=>true);
389
- $option['show_in'] = array('posts'=>true, 'pages'=>true, 'home_page'=>true, 'tags'=>true, 'categories'=>true, 'authors'=>true, 'search'=>true,'date_arch'=>true);
390
  $option['position'] = $position;
391
  $option['border'] = $border;
392
  $option['bkcolor'] = true;
@@ -399,11 +418,13 @@ function twitter_facebook_share_get_options_default ($position='above', $border=
399
  $option['facebook_like_width'] = '85';
400
  $option['twitter_width'] = '95';
401
  $option['linkedin_width'] = '105';
 
402
  $option['stumbleupon_width'] = '85';
403
  $option['google_width'] = '80';
404
  $option['google_count'] = true;
405
  $option['twitter_count'] = true;
406
  $option['linkedin_count'] = true;
 
407
  return $option;
408
  }
409
  ?>
20
  'twitter'=>'Twitter',
21
  'stumbleupon'=>'Stumbleupon',
22
  'Google_plusone'=>'Google PlusOne',
23
+ 'linkedin'=>'LinkedIn',
24
+ 'pinterest'=>'Pinterest'
25
  );
26
 
27
  $show_in = array(
64
  $option['twitter_count'] = (isset($_POST['twitter_facebook_share_twitter_count']) and $_POST['twitter_facebook_share_twitter_count']=='on') ? true : false;
65
  $option['google_count'] = (isset($_POST['twitter_facebook_share_google_count']) and $_POST['twitter_facebook_share_google_count']=='on') ? true : false;
66
  $option['linkedin_count'] = (isset($_POST['twitter_facebook_share_linkedin_count']) and $_POST['twitter_facebook_share_linkedin_count']=='on') ? true : false;
67
+ $option['pinterest_count'] = (isset($_POST['twitter_facebook_share_pinterest_count']) and $_POST['twitter_facebook_share_pinterest_count']=='on') ? true : false;
68
  $option['google_width'] = esc_html($_POST['twitter_facebook_share_google_width']);
69
  $option['facebook_like_width'] = esc_html($_POST['twitter_facebook_share_facebook_like_width']);
70
  $option['twitter_width'] = esc_html($_POST['twitter_facebook_share_twitter_width']);
71
  $option['linkedin_width'] = esc_html($_POST['twitter_facebook_share_linkedin_width']);
72
+ $option['pinterest_width'] = esc_html($_POST['twitter_facebook_share_pinterest_width']);
73
  $option['stumbleupon_width'] = esc_html($_POST['twitter_facebook_share_stumbleupon_width']);
74
  update_option($option_name, $option);
75
  // Put a settings updated message on the screen
98
  $google_count = ($option['google_count']) ? 'checked="checked"' : '';
99
  $twitter_count = ($option['twitter_count']) ? 'checked="checked"' : '';
100
  $linkedin_count = ($option['linkedin_count']) ? 'checked="checked"' : '';
101
+ $pinterest_count = ($option['pinterest_count']) ? 'checked="checked"' : '';
102
 
103
  $out .= '
104
  <div class="wrap">
236
  <td style="padding-bottom:20px;">
237
  <input type="text" name="twitter_facebook_share_google_width" value="'.stripslashes($option['google_width']).'" size="5">px<br />
238
  </td>
239
+ <td style="padding-bottom:20px; padding-left:5px; padding-right:10px;" valign="top">'.__("Stumbleupon Button width", 'menu-test' ).':</td>
240
  <td style="padding-bottom:20px;">
241
+ <input type="text" name="twitter_facebook_share_stumbleupon_width" value="'.stripslashes($option['stumbleupon_width']).'" size="5"> px <br />
242
  </td>
243
  </tr>
244
  <tr><td style="padding-bottom:20px; padding-right:10px;" valign="top">'.__("Twitter Button width", 'menu-test' ).':</td>
249
  <td style="padding-bottom:20px;">
250
  <input type="text" name="twitter_facebook_share_linkedin_width" value="'.stripslashes($option['linkedin_width']).'" size="5"> px <br />
251
  </td>
252
+ <td style="padding-bottom:20px; padding-left:5px; padding-right:10px;" valign="top">'.__("Pinterest Button width", 'menu-test' ).':</td>
253
+ <td style="padding-bottom:20px;">
254
+ <input type="text" name="twitter_facebook_share_pinterest_width" value="'.stripslashes($option['pinterest_width']).'" size="5"> px <br />
255
+ </td>
256
  </tr>
257
  <tr><td style="padding-bottom:20px; padding-right:10px;" valign="top">'.__("Google +1 counter", 'menu-test' ).':</td>
258
  <td style="padding-bottom:20px;">
259
  <input type="checkbox" name="twitter_facebook_share_google_count" '.$google_count.' />
260
  </td>
261
+ <td style="padding-bottom:20px; padding-right:10px;" valign="top">'.__("Pinterest counter", 'menu-test' ).':</td>
262
  <td style="padding-bottom:20px;">
263
+ <input type="checkbox" name="twitter_facebook_share_pinterest_count" '.$pinterest_count.' />
264
  </td>
265
  </tr>
266
  <tr><td style="padding-bottom:20px; padding-right:10px;" valign="top">'.__("Twitter counter", 'menu-test' ).':</td>
267
  <td style="padding-bottom:20px;">
268
  <input type="checkbox" name="twitter_facebook_share_twitter_count" '.$twitter_count.' />
269
+ </td>
270
+ <td style="padding-bottom:20px; padding-right:10px;" valign="top">'.__("LinkedIn counter", 'menu-test' ).':</td>
271
+ <td style="padding-bottom:20px;">
272
+ <input type="checkbox" name="twitter_facebook_share_linkedin_count" '.$linkedin_count.' />
273
+ </td>
274
+ </tr>
275
  </table>
276
  </div>
277
  </div>
290
  <div class="inside">
291
  <table>
292
  <tr><td align="justify">
293
+ <p >If you liked the plugin and was useful to your site then please consider donating. All donations go to a <strong>Child Education Charity</strong>. Show your appreciation and love.</p> </td></tr>
294
  <tr>
295
  <td align="center">
296
  <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
380
  if (!isset($option['linkedin_width'])) {
381
  $option['linkedin_width'] = '105';
382
  }
383
+ if (!isset($option['pinterest_width'])) {
384
+ $option['pinterest_width'] = '105';
385
+ }
386
  if (!isset($option['stumbleupon_width'])) {
387
  $option['stumbleupon_width'] = '85';
388
  }
392
  if (!isset($option['linkedin_count'])) {
393
  $option['linkedin_count'] = true;
394
  }
395
+ if (!isset($option['pinterest_count'])) {
396
+ $option['pinterest_count'] = true;
397
+ }
398
  if (!isset($option['google_count'])) {
399
  $option['google_count'] = true;
400
  }
404
  function twitter_facebook_share_get_options_default ($position='above', $border='flat', $color='#F0F4F9',$left_space='60px',$bottom_space='40%', $float_position='fixed') {
405
  $option = array();
406
  $option['auto'] = true;
407
+ $option['active_buttons'] = array('facebook_like'=>true, 'twitter'=>true, 'stumbleupon'=>true, 'Google_plusone'=>true, 'linkedin'=>true,'pinterest'=>false);
408
+ $option['show_in'] = array('posts'=>true, 'pages'=>true, 'home_page'=>false, 'tags'=>true, 'categories'=>true, 'authors'=>true, 'search'=>true,'date_arch'=>true);
409
  $option['position'] = $position;
410
  $option['border'] = $border;
411
  $option['bkcolor'] = true;
418
  $option['facebook_like_width'] = '85';
419
  $option['twitter_width'] = '95';
420
  $option['linkedin_width'] = '105';
421
+ $option['pinterest_width'] = '105';
422
  $option['stumbleupon_width'] = '85';
423
  $option['google_width'] = '80';
424
  $option['google_count'] = true;
425
  $option['twitter_count'] = true;
426
  $option['linkedin_count'] = true;
427
+ $option['pinterest_count'] = true;
428
  return $option;
429
  }
430
  ?>
tf_display.php CHANGED
@@ -28,6 +28,9 @@ function twitter_facebook_share_init() {
28
  if ($option['active_buttons']['linkedin']==true) {
29
  wp_enqueue_script('twitter_facebook_share_linkedin', 'http://platform.linkedin.com/in.js','','',$option['jsload']);
30
  }
 
 
 
31
 
32
  wp_enqueue_style('tfg_style', '/wp-content/plugins/twitter-facebook-google-plusone-share/tfg_style.css');
33
 
@@ -47,6 +50,16 @@ function kc_twitter_facebook_excerpt($content)
47
  function kc_twitter_facebook($content, $filter)
48
  {
49
  global $single;
 
 
 
 
 
 
 
 
 
 
50
 
51
  $option = twitter_facebook_share_get_options_stored();
52
  $custom_disable = get_post_custom_values('disable_social_share');
@@ -57,6 +70,7 @@ function kc_twitter_facebook($content, $filter)
57
  }
58
  if (is_single() && ($option['show_in']['posts']) && ($custom_disable[0] != 'yes')) {
59
  $output = kc_social_share('auto');
 
60
  if ($option['position'] == 'above')
61
  return $output . $content;
62
  if ($option['position'] == 'below')
@@ -68,6 +82,7 @@ function kc_twitter_facebook($content, $filter)
68
  }
69
  if (is_home() && ($option['show_in']['home_page'])){
70
  $output = kc_social_share('auto');
 
71
  if ($option['position'] == 'above')
72
  return $output . $content;
73
  if ($option['position'] == 'below')
@@ -79,6 +94,7 @@ function kc_twitter_facebook($content, $filter)
79
  }
80
  if (is_page() && ($option['show_in']['pages']) && ($custom_disable[0] != 'yes')) {
81
  $output = kc_social_share('auto');
 
82
  if ($option['position'] == 'above')
83
  return $output . $content;
84
  if ($option['position'] == 'below')
@@ -90,6 +106,7 @@ function kc_twitter_facebook($content, $filter)
90
  }
91
  if (is_category() && ($option['show_in']['categories'])) {
92
  $output = kc_social_share('auto');
 
93
  if ($option['position'] == 'above')
94
  return $output . $content;
95
  if ($option['position'] == 'below')
@@ -101,6 +118,7 @@ function kc_twitter_facebook($content, $filter)
101
  }
102
  if (is_tag() && ($option['show_in']['tags'])) {
103
  $output = kc_social_share('auto');
 
104
  if ($option['position'] == 'above')
105
  return $output . $content;
106
  if ($option['position'] == 'below')
@@ -112,6 +130,7 @@ function kc_twitter_facebook($content, $filter)
112
  }
113
  if (is_author() && ($option['show_in']['authors'])) {
114
  $output = kc_social_share('auto');
 
115
  if ($option['position'] == 'above')
116
  return $output . $content;
117
  if ($option['position'] == 'below')
@@ -123,6 +142,7 @@ function kc_twitter_facebook($content, $filter)
123
  }
124
  if (is_search() && ($option['show_in']['search'])) {
125
  $output = kc_social_share('auto');
 
126
  if ($option['position'] == 'above')
127
  return $output . $content;
128
  if ($option['position'] == 'below')
@@ -134,6 +154,7 @@ function kc_twitter_facebook($content, $filter)
134
  }
135
  if (is_date() && ($option['show_in']['date_arch'])) {
136
  $output = kc_social_share('auto');
 
137
  if ($option['position'] == 'above')
138
  return $output . $content;
139
  if ($option['position'] == 'below')
@@ -164,6 +185,7 @@ function kc_add_social_share()
164
 
165
  function kc_social_share($source)
166
  {
 
167
  //GET ARRAY OF STORED VALUES
168
  $option = twitter_facebook_share_get_options_stored();
169
  if (empty($option['bkcolor_value']))
@@ -190,7 +212,7 @@ function kc_social_share($source)
190
  if ($option['active_buttons']['facebook_like']==true) {
191
  $output .= '
192
  <div class="buttons">
193
- <iframe src="http://www.facebook.com/plugins/like.php?href=' . urlencode($post_link) . '&amp;layout=box_count&amp;show_faces=false&amp;action=like&amp;font=verdana&amp;colorscheme=light" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:60px;" allowTransparency="true"></iframe>
194
  </div>';
195
  }
196
 
@@ -214,13 +236,17 @@ function kc_social_share($source)
214
  <g:plusone size="tall" href="'. $post_link .'"></g:plusone>
215
  </div>';
216
  }
217
-
 
 
218
  if ($option['active_buttons']['stumbleupon']==true) {
219
  $output .= '
220
  <div class="buttons"><script src="http://www.stumbleupon.com/hostedbadge.php?s=5&amp;r='.$post_link.'"></script></div>';
221
  }
222
- if ($option['active_buttons']['linkedin']==true) {
223
- $output .= '<div class="buttons" style="padding-left:0px;"><script type="in/share" data-url="' . $post_link . '" data-counter="top"></script></div>';
 
 
224
  }
225
  $output .= '</div><div style="clear:both"></div>';
226
  return $output;
@@ -233,7 +259,7 @@ function kc_social_share($source)
233
  if ($option['active_buttons']['facebook_like']==true) {
234
  $output .= '
235
  <div style="float:left; width:' .$option['facebook_like_width']. 'px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
236
- <iframe src="http://www.facebook.com/plugins/like.php?href=' . urlencode($post_link) . '&amp;layout=button_count&amp;show_faces=false&amp;width='.$option['facebook_like_width'].'&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width='.$option['facebook_like_width'].'px; height:21px;" allowTransparency="true"></iframe></div>';
237
  }
238
 
239
  if ($option['active_buttons']['Google_plusone']==true) {
@@ -262,6 +288,11 @@ function kc_social_share($source)
262
  $counter = ($option['linkedin_count']) ? 'right' : '';
263
  $output .= '<div style="float:left; width:' .$option['linkedin_width']. 'px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script type="in/share" data-url="' . $post_link . '" data-counter="' .$counter. '"></script></div>';
264
  }
 
 
 
 
 
265
  if ($option['active_buttons']['stumbleupon']==true) {
266
  $output .= '
267
  <div style="float:left; width:' .$option['stumbleupon_width']. 'px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r='.$post_link.'"></script></div>';
@@ -298,6 +329,91 @@ echo "\n\n<!-- Thumbnail for facebook like -->\n<link rel=\"image_src\" href=\"$
298
  else
299
  $thumb = $default;
300
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301
 
302
  function is_mobile_device()
303
  {
28
  if ($option['active_buttons']['linkedin']==true) {
29
  wp_enqueue_script('twitter_facebook_share_linkedin', 'http://platform.linkedin.com/in.js','','',$option['jsload']);
30
  }
31
+ if ($option['active_buttons']['pinterest']==true) {
32
+ wp_enqueue_script('twitter_facebook_share_pinterest', 'http://assets.pinterest.com/js/pinit.js','','',$option['jsload']);
33
+ }
34
 
35
  wp_enqueue_style('tfg_style', '/wp-content/plugins/twitter-facebook-google-plusone-share/tfg_style.css');
36
 
50
  function kc_twitter_facebook($content, $filter)
51
  {
52
  global $single;
53
+ static $last_execution = '';
54
+
55
+ if ($filter=='the_excerpt' and $last_execution=='the_content') {
56
+ remove_filter('the_content', 'kc_twitter_facebook_contents');
57
+ $last_execution = 'the_excerpt';
58
+ return the_excerpt();
59
+ }
60
+ if ($filter=='the_excerpt' and $last_execution=='the_excerpt') {
61
+ add_filter('the_content', 'kc_twitter_facebook_contents');
62
+ }
63
 
64
  $option = twitter_facebook_share_get_options_stored();
65
  $custom_disable = get_post_custom_values('disable_social_share');
70
  }
71
  if (is_single() && ($option['show_in']['posts']) && ($custom_disable[0] != 'yes')) {
72
  $output = kc_social_share('auto');
73
+ $last_execution = $filter;
74
  if ($option['position'] == 'above')
75
  return $output . $content;
76
  if ($option['position'] == 'below')
82
  }
83
  if (is_home() && ($option['show_in']['home_page'])){
84
  $output = kc_social_share('auto');
85
+ $last_execution = $filter;
86
  if ($option['position'] == 'above')
87
  return $output . $content;
88
  if ($option['position'] == 'below')
94
  }
95
  if (is_page() && ($option['show_in']['pages']) && ($custom_disable[0] != 'yes')) {
96
  $output = kc_social_share('auto');
97
+ $last_execution = $filter;
98
  if ($option['position'] == 'above')
99
  return $output . $content;
100
  if ($option['position'] == 'below')
106
  }
107
  if (is_category() && ($option['show_in']['categories'])) {
108
  $output = kc_social_share('auto');
109
+ $last_execution = $filter;
110
  if ($option['position'] == 'above')
111
  return $output . $content;
112
  if ($option['position'] == 'below')
118
  }
119
  if (is_tag() && ($option['show_in']['tags'])) {
120
  $output = kc_social_share('auto');
121
+ $last_execution = $filter;
122
  if ($option['position'] == 'above')
123
  return $output . $content;
124
  if ($option['position'] == 'below')
130
  }
131
  if (is_author() && ($option['show_in']['authors'])) {
132
  $output = kc_social_share('auto');
133
+ $last_execution = $filter;
134
  if ($option['position'] == 'above')
135
  return $output . $content;
136
  if ($option['position'] == 'below')
142
  }
143
  if (is_search() && ($option['show_in']['search'])) {
144
  $output = kc_social_share('auto');
145
+ $last_execution = $filter;
146
  if ($option['position'] == 'above')
147
  return $output . $content;
148
  if ($option['position'] == 'below')
154
  }
155
  if (is_date() && ($option['show_in']['date_arch'])) {
156
  $output = kc_social_share('auto');
157
+ $last_execution = $filter;
158
  if ($option['position'] == 'above')
159
  return $output . $content;
160
  if ($option['position'] == 'below')
185
 
186
  function kc_social_share($source)
187
  {
188
+ global $posts;
189
  //GET ARRAY OF STORED VALUES
190
  $option = twitter_facebook_share_get_options_stored();
191
  if (empty($option['bkcolor_value']))
212
  if ($option['active_buttons']['facebook_like']==true) {
213
  $output .= '
214
  <div class="buttons">
215
+ <iframe src="http://www.facebook.com/plugins/like.php?href=' . urlencode($post_link) . '&amp;layout=box_count&amp;show_faces=false&amp;action=like&amp;font=verdana&amp;colorscheme=light" style="border:none; overflow:hidden; width:50px; height:65px;"></iframe>
216
  </div>';
217
  }
218
 
236
  <g:plusone size="tall" href="'. $post_link .'"></g:plusone>
237
  </div>';
238
  }
239
+ if ($option['active_buttons']['linkedin']==true) {
240
+ $output .= '<div class="buttons" style="padding-left:0px;"><script type="in/share" data-url="' . $post_link . '" data-counter="top"></script></div>';
241
+ }
242
  if ($option['active_buttons']['stumbleupon']==true) {
243
  $output .= '
244
  <div class="buttons"><script src="http://www.stumbleupon.com/hostedbadge.php?s=5&amp;r='.$post_link.'"></script></div>';
245
  }
246
+ if ($option['active_buttons']['pinterest']==true) {
247
+ $post_image = kc_get_image(array('post_id' => $post->ID));
248
+ $output .= '<div class="buttons" style="padding-left:0px;">
249
+ <a href="http://pinterest.com/pin/create/button/?url=' . urlencode($post_link) . '&media=' . urlencode($post_image) . '" class="pin-it-button" count-layout="vertical">Pin It</a></div>';
250
  }
251
  $output .= '</div><div style="clear:both"></div>';
252
  return $output;
259
  if ($option['active_buttons']['facebook_like']==true) {
260
  $output .= '
261
  <div style="float:left; width:' .$option['facebook_like_width']. 'px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
262
+ <iframe src="http://www.facebook.com/plugins/like.php?href=' . urlencode($post_link) . '&amp;layout=button_count&amp;show_faces=false&amp;width='.$option['facebook_like_width'].'&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" style="border:none; overflow:hidden; width='.$option['facebook_like_width'].'px; height:21px;"></iframe></div>';
263
  }
264
 
265
  if ($option['active_buttons']['Google_plusone']==true) {
288
  $counter = ($option['linkedin_count']) ? 'right' : '';
289
  $output .= '<div style="float:left; width:' .$option['linkedin_width']. 'px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script type="in/share" data-url="' . $post_link . '" data-counter="' .$counter. '"></script></div>';
290
  }
291
+ if ($option['active_buttons']['pinterest']==true) {
292
+ $post_image = kc_get_image();
293
+ $counter = ($option['pinterest_count']) ? 'horizontal' : 'none';
294
+ $output .= '<div style="float:left; width:' .$option['pinterest_width']. 'px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><a href="http://pinterest.com/pin/create/button/?url=' .urlencode($post_link) . '&media=' . urlencode($post_image) . '" class="pin-it-button" count-layout="' .$counter.'">Pin It</a></div>';
295
+ }
296
  if ($option['active_buttons']['stumbleupon']==true) {
297
  $output .= '
298
  <div style="float:left; width:' .$option['stumbleupon_width']. 'px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r='.$post_link.'"></script></div>';
329
  else
330
  $thumb = $default;
331
  }
332
+ /*
333
+ This script will go through different possible options to retrive the display image associated with each post.
334
+ */
335
+ function kc_get_image($args = array() )
336
+ {
337
+ global $post;
338
+
339
+ $defaults = array('post_id' => $post->ID);
340
+ $args = wp_parse_args( $args, $defaults );
341
+
342
+ /* Get the first image if it exists in post content. */
343
+ // $final_img = get_image_in_post_content($args);
344
+ $final_img = get_image_from_post_thumbnail($args);
345
+
346
+
347
+ if(!$final_img)
348
+ $final_img = get_image_from_attachments($args);
349
+
350
+ if(!$final_img)
351
+ $final_img = get_image_in_post_content($args);
352
+
353
+ $final_img = str_replace($url, '', $final_img);
354
+ return $final_img;
355
+ }
356
+
357
+ /* Function to search through post contents and return the first available image in the content.*/
358
+
359
+ function get_image_in_post_content($args = array() )
360
+ {
361
+ $display_img = '';
362
+ $url = get_bloginfo('url');
363
+ ob_start();
364
+ ob_end_clean();
365
+ $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', get_post_field( 'post_content', $args['post_id'] ), $matches);
366
+ $display_img = $matches [1] [0];
367
+ return $display_img;
368
+ }
369
+
370
+
371
+ /*
372
+ Function to find image using WP available function get_the_post_thumbnail().
373
+ Note: This function will be available only if your theme supports the same.
374
+ Post Thumbnail is a theme feature introduced with Version 2.9.
375
+
376
+ Themes have to declare their support for post images before the interface for assigning these images will appear on the Edit Post and Edit Page screens. They do this by putting the following in their functions.php file:
377
+
378
+ if ( function_exists( 'add_theme_support' ) ) {
379
+ add_theme_support( 'post-thumbnails' );
380
+ }
381
+ */
382
+
383
+ function get_image_from_post_thumbnail($args = array())
384
+ {
385
+ if (function_exists('has_post_thumbnail')) {
386
+ if (has_post_thumbnail( $args['post_id']))
387
+ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $args['post_id'] ), 'single-post-thumbnail' );
388
+ }
389
+ return $image[0];
390
+
391
+ }
392
+
393
+
394
+ function get_image_from_attachments($args = array())
395
+ {
396
+ if (function_exists('wp_get_attachment_image')) {
397
+ $children = get_children(
398
+ array(
399
+ 'post_parent'=> $args['post_id'],
400
+ 'post_type'=> 'attachment',
401
+ 'numberposts'=> 1,
402
+ 'post_status'=> 'inherit',
403
+ 'post_mime_type' => 'image',
404
+ 'order'=> 'ASC',
405
+ 'orderby'=> 'menu_order ASC'
406
+ )
407
+ );
408
+
409
+ if ( empty( $children ))
410
+ return false;
411
+
412
+ $image = wp_get_attachment_image_src( $children[0], 'thumbnail');
413
+ return $image;
414
+ }
415
+
416
+ }
417
 
418
  function is_mobile_device()
419
  {
twitter-facebook-share.php CHANGED
@@ -5,7 +5,7 @@ Description: WordPress plugin for twitter, facebook, Google +1 (plus one) and ot
5
  Author: Kunal Chichkar
6
  Author URI: http://www.searchtechword.com
7
  Plugin URI: http://www.searchtechword.com/2011/06/wordpress-plugin-add-twitter-facebook-google-plus-one-share
8
- Version: 2.2.1
9
  License: GPL
10
  */
11
  /*
5
  Author: Kunal Chichkar
6
  Author URI: http://www.searchtechword.com
7
  Plugin URI: http://www.searchtechword.com/2011/06/wordpress-plugin-add-twitter-facebook-google-plus-one-share
8
+ Version: 2.3.0
9
  License: GPL
10
  */
11
  /*