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

Version Description

  • Bug fix for Facebook Like on IE
  • Support https sites
  • Final fix for "Tweet" and "Pin It" test in excerpt
  • Couple of other small fixes.
Download this release

Release Info

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

Code changes from version 2.3.0 to 2.4.0

Files changed (5) hide show
  1. readme.txt +12 -1
  2. tf_admin_page.php +24 -1
  3. tf_display.php +29 -20
  4. tfg_style.css +1 -5
  5. twitter-facebook-share.php +2 -3
readme.txt CHANGED
@@ -1,10 +1,11 @@
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 />
@@ -64,6 +65,12 @@ You can Check Screen Shots on my website. I use the same plugin to display Socia
64
65
== Changelog ==
66
67
= 2.3.0 =
68
* Added Pinterest share option.
69
* Fix for the "Tweet" text in the excerpt.
@@ -106,6 +113,10 @@ You can Check Screen Shots on my website. I use the same plugin to display Socia
106
107
== Upgrade Notice ==
108
109
= 2.3.0 =
110
111
Pinterest share option added | "Tweet" word in excerpt fix | W3c Validator fixes
1
=== Add Twitter, Facebook Like, Google plus one Social share ===
2
Contributors: beingmaverick
3
Plugin Site: http://www.searchtechword.com
4
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=86FHBFVUYN45J
5
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
6
Requires at least: 2.8
7
Tested up to: 3.3.1
8
+ Stable tag: 2.4.0
9
10
== Description ==
11
<br />
65
66
== Changelog ==
67
68
+ = 2.4.0 =
69
+ * Bug fix for Facebook Like on IE
70
+ * Support https sites
71
+ * Final fix for "Tweet" and "Pin It" test in excerpt
72
+ * Couple of other small fixes.
73
+
74
= 2.3.0 =
75
* Added Pinterest share option.
76
* Fix for the "Tweet" text in the excerpt.
113
114
== Upgrade Notice ==
115
116
+ = 2.4.0 =
117
+
118
+ Bug fix for Facebook like on IE | Support for https sites | Couple of other bug fixes
119
+
120
= 2.3.0 =
121
122
Pinterest share option added | "Tweet" word in excerpt fix | W3c Validator fixes
tf_admin_page.php CHANGED
@@ -4,7 +4,7 @@ The main admin page for this plugin. The logic for different user input and form
4
*/
5
6
function kc_twitter_facebook_admin_menu() {
7
- add_options_page('TF Social Share', 'TF Social Share', 'administrator',
8
'kc-social-share', 'kc_twitter_facebook_admin_page');
9
}
10
@@ -312,11 +312,34 @@ $show_in = array(
312
<ul>
313
<li>Shortcode <strong>[tfg_social_share]</strong> to add the social share bar to specific pages.</li>
314
<li>Custom field "<strong>disable_social_share</strong>" with value "yes" to exclude specific post or pages.</li>
315
</td></tr>
316
</tr>
317
</table>
318
</div>
319
</div>
320
321
</div>
322
';
4
*/
5
6
function kc_twitter_facebook_admin_menu() {
7
+ add_options_page('TF Social Share', 'TF Social Share', 'manage_options',
8
'kc-social-share', 'kc_twitter_facebook_admin_page');
9
}
10
312
<ul>
313
<li>Shortcode <strong>[tfg_social_share]</strong> to add the social share bar to specific pages.</li>
314
<li>Custom field "<strong>disable_social_share</strong>" with value "yes" to exclude specific post or pages.</li>
315
+ </ul>
316
</td></tr>
317
</tr>
318
</table>
319
</div>
320
</div>
321
+ <div class="postbox">
322
+ <h3>'.__("Show Your Love", 'menu-test' ).'</h3>
323
+ <div class="inside">
324
+ <table>
325
+ <tr>
326
+ <p>If you are happy with the plugin please show your love by liking us on social network<p>
327
+ </tr>
328
+ <tr><td style="padding-right:10px;">
329
+ <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
330
+ <div class="g-plusone" data-annotation="none" data-href="http://www.searchtechword.com/"></div>
331
+ </td>
332
+ <td style="width:50px;">
333
+ <a href="https://twitter.com/searchtechword" class="twitter-follow-button" data-show-count="false" data-lang="en">Follow @searchtechword</a>
334
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
335
+ </td>
336
+ </tr>
337
+ <tr>
338
+ <iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fsearchtechword&amp;width=200&amp;height=62&amp;colorscheme=light&amp;show_faces=false&amp;border_color&amp;stream=false&amp;header=true" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:200px; height:62px;" allowTransparency="true"></iframe>
339
+ </tr>
340
+ </table>
341
+ </div>
342
+ </div>
343
344
</div>
345
';
tf_display.php CHANGED
@@ -19,17 +19,17 @@ function twitter_facebook_share_init() {
19
}
20
21
if ($option['active_buttons']['twitter']==true) {
22
- wp_enqueue_script('twitter_facebook_share_twitter', 'http://platform.twitter.com/widgets.js','','',$option['jsload']);
23
}
24
25
if ($option['active_buttons']['Google_plusone']==true) {
26
- wp_enqueue_script('twitter_facebook_share_google', 'http://apis.google.com/js/plusone.js','','',$option['jsload']);
27
}
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');
@@ -212,7 +212,7 @@ function kc_social_share($source)
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
@@ -220,12 +220,12 @@ function kc_social_share($source)
220
if ($option['twitter_id'] != ''){
221
$output .= '
222
<div class="buttons">
223
- <a href="http://twitter.com/share" class="twitter-share-button" data-url="'. $post_link .'" data-text="'. $post_title . '" data-count="vertical" data-via="'. $option['twitter_id'] . '">Tweet</a>
224
</div>';
225
} else {
226
$output .= '
227
<div class="buttons">
228
- <a href="http://twitter.com/share" class="twitter-share-button" data-url="'. $post_link .'" data-text="'. $post_title . '" data-count="vertical">Tweet</a>
229
</div>';
230
}
231
}
@@ -241,12 +241,12 @@ function kc_social_share($source)
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,7 +259,7 @@ function kc_social_share($source)
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) {
@@ -275,12 +275,12 @@ function kc_social_share($source)
275
if ($option['twitter_id'] != ''){
276
$output .= '
277
<div style="float:left; width:' .$option['twitter_width']. 'px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
278
- <a href="http://twitter.com/share" class="twitter-share-button" data-url="'. $post_link .'" data-text="'. $post_title . '" data-count="'.$data_count.'" data-via="'. $option['twitter_id'] . '">Tweet</a>
279
</div>';
280
} else {
281
$output .= '
282
<div style="float:left; width:' .$option['twitter_width']. 'px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
283
- <a href="http://twitter.com/share" class="twitter-share-button" data-url="'. $post_link .'" data-text="'. $post_title . '" data-count="'.$data_count.'">Tweet</a>
284
</div>';
285
}
286
}
@@ -289,13 +289,13 @@ function kc_social_share($source)
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>';
299
}
300
301
$output .= '
@@ -316,9 +316,10 @@ function tfg_social_share_shortcode () {
316
echo $output;
317
}
318
319
- function fb_like_thumbnails()
320
{
321
- global $posts;
322
$default = '';
323
$content = $posts[0]->post_content; // $posts is an array, fetch the first element
324
$output = preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $content, $matches);
@@ -328,11 +329,19 @@ echo "\n\n<!-- Thumbnail for facebook like -->\n<link rel=\"image_src\" href=\"$
328
}
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
19
}
20
21
if ($option['active_buttons']['twitter']==true) {
22
+ wp_enqueue_script('twitter_facebook_share_twitter', 'http'.(is_ssl()?'s':'').'://platform.twitter.com/widgets.js','','',$option['jsload']);
23
}
24
25
if ($option['active_buttons']['Google_plusone']==true) {
26
+ wp_enqueue_script('twitter_facebook_share_google', 'http'.(is_ssl()?'s':'').'://apis.google.com/js/plusone.js','','',$option['jsload']);
27
}
28
if ($option['active_buttons']['linkedin']==true) {
29
+ wp_enqueue_script('twitter_facebook_share_linkedin', 'http'.(is_ssl()?'s':'').'://platform.linkedin.com/in.js','','',$option['jsload']);
30
}
31
if ($option['active_buttons']['pinterest']==true) {
32
+ wp_enqueue_script('twitter_facebook_share_pinterest', 'http'.(is_ssl()?'s':'').'://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');
212
if ($option['active_buttons']['facebook_like']==true) {
213
$output .= '
214
<div class="buttons">
215
+ <iframe src="http'.(is_ssl()?'s':'').'://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" allowTransparency="true" style="border:none; overflow:hidden; width:50px; height:65px;"></iframe>
216
</div>';
217
}
218
220
if ($option['twitter_id'] != ''){
221
$output .= '
222
<div class="buttons">
223
+ <a href="http'.(is_ssl()?'s':'').'://twitter.com/share" class="twitter-share-button" data-url="'. $post_link .'" data-text="'. $post_title . '" data-count="vertical" data-via="'. $option['twitter_id'] . '"></a>
224
</div>';
225
} else {
226
$output .= '
227
<div class="buttons">
228
+ <a href="http'.(is_ssl()?'s':'').'://twitter.com/share" class="twitter-share-button" data-url="'. $post_link .'" data-text="'. $post_title . '" data-count="vertical"></a>
229
</div>';
230
}
231
}
241
}
242
if ($option['active_buttons']['stumbleupon']==true) {
243
$output .= '
244
+ <div class="buttons"><script src="http'.(is_ssl()?'s':'').'://www.stumbleupon.com/hostedbadge.php?s=5&amp;r='.$post_link.'"></script></div>';
245
}
246
if ($option['active_buttons']['pinterest']==true) {
247
+ $post_image = tf_get_image(array('post_id' => $post->ID));
248
+ $output .= '<div class="buttons" style="padding-left:5px;">
249
+ <a href="http'.(is_ssl()?'s':'').'://pinterest.com/pin/create/button/?url=' . $post_link . '&media=' . $post_image . '" class="pin-it-button" count-layout="vertical"></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'.(is_ssl()?'s':'').'://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" allowTransparency="true" 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) {
275
if ($option['twitter_id'] != ''){
276
$output .= '
277
<div style="float:left; width:' .$option['twitter_width']. 'px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
278
+ <a href="http'.(is_ssl()?'s':'').'://twitter.com/share" class="twitter-share-button" data-url="'. $post_link .'" data-text="'. $post_title . '" data-count="'.$data_count.'" data-via="'. $option['twitter_id'] . '"></a>
279
</div>';
280
} else {
281
$output .= '
282
<div style="float:left; width:' .$option['twitter_width']. 'px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
283
+ <a href="http'.(is_ssl()?'s':'').'://twitter.com/share" class="twitter-share-button" data-url="'. $post_link .'" data-text="'. $post_title . '" data-count="'.$data_count.'"></a>
284
</div>';
285
}
286
}
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 = tf_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'.(is_ssl()?'s':'').'://pinterest.com/pin/create/button/?url=' . $post_link . '&media=' . $post_image . '" class="pin-it-button" count-layout="' .$counter.'"></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'.(is_ssl()?'s':'').'://www.stumbleupon.com/hostedbadge.php?s=1&amp;r='.$post_link.'"></script></div>';
299
}
300
301
$output .= '
316
echo $output;
317
}
318
319
+ function kc_fb_like_thumbnails()
320
{
321
+ //global $posts;
322
+ /*
323
$default = '';
324
$content = $posts[0]->post_content; // $posts is an array, fetch the first element
325
$output = preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $content, $matches);
329
}
330
else
331
$thumb = $default;
332
+ */
333
+
334
+ $thumb = tf_get_image();
335
+ if(!empty($thumb))
336
+ {
337
+ echo "\n\n<!-- Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End Facebook Like Thumbnail -->\n\n";
338
+ }
339
+
340
}
341
/*
342
This script will go through different possible options to retrive the display image associated with each post.
343
*/
344
+ function tf_get_image($args = array() )
345
{
346
global $post;
347
tfg_style.css CHANGED
@@ -1,10 +1,8 @@
1
/* CSS Document */
2
-
3
#leftcontainerBox {
4
float:left;
5
z-index: 1000;
6
}
7
-
8
#leftcontainerBox .buttons {
9
float:left;
10
clear:both;
@@ -14,10 +12,8 @@ height:60px;
14
padding-bottom:2px;
15
padding-left:3px;
16
}
17
-
18
.bottomcontainerBox {
19
float:left;
20
height:30px;
21
width:100%;
22
- }
23
-
1
/* CSS Document */
2
#leftcontainerBox {
3
float:left;
4
z-index: 1000;
5
}
6
#leftcontainerBox .buttons {
7
float:left;
8
clear:both;
12
padding-bottom:2px;
13
padding-left:3px;
14
}
15
.bottomcontainerBox {
16
float:left;
17
height:30px;
18
width:100%;
19
+ }
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.3.0
9
License: GPL
10
*/
11
/*
@@ -45,7 +45,6 @@ function kc_twitter_facebook_remove() {
45
/* Deletes the database field */
46
delete_option('twitter_facebook_share');
47
}
48
-
49
if(is_admin())
50
{
51
add_action('admin_menu', 'kc_twitter_facebook_admin_menu');
@@ -54,7 +53,7 @@ else
54
{
55
add_action('init', 'twitter_facebook_share_init');
56
add_shortcode('tfg_social_share', 'tfg_social_share_shortcode' );
57
- add_action('wp_head', 'fb_like_thumbnails');
58
$option = twitter_facebook_share_get_options_stored();
59
if($option['auto'] == true)
60
{
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.4.0
9
License: GPL
10
*/
11
/*
45
/* Deletes the database field */
46
delete_option('twitter_facebook_share');
47
}
48
if(is_admin())
49
{
50
add_action('admin_menu', 'kc_twitter_facebook_admin_menu');
53
{
54
add_action('init', 'twitter_facebook_share_init');
55
add_shortcode('tfg_social_share', 'tfg_social_share_shortcode' );
56
+ add_action('wp_head', 'kc_fb_like_thumbnails');
57
$option = twitter_facebook_share_get_options_stored();
58
if($option['auto'] == true)
59
{