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

Version Description

  • Added option to disable on Mobile device
Download this release

Release Info

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

Code changes from version 2.1.0 to 2.2.0

Files changed (4) hide show
  1. readme.txt +13 -4
  2. tf_admin_page.php +11 -0
  3. tf_display.php +39 -1
  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 (plus one) button, Google plus one, Stumbleupon, social share, twitter facebook share, google +1 share
5
- Requires at least: 2.8+
6
- Tested up to: 3.2
7
- Stable tag: 2.1.0
8
 
9
  == Description ==
10
  <br />
@@ -35,6 +35,8 @@ Option to load the script in header as well, if you wish to.
35
 
36
  * Option to manually display the share box at any position.
37
 
 
 
38
 
39
  == Installation ==
40
 
@@ -57,6 +59,9 @@ You can Check Screen Shots on my website. I use the same plugin to display Socia
57
 
58
  == Changelog ==
59
 
 
 
 
60
  = 2.1.0 =
61
  * Added LinkedIn Share button
62
 
@@ -88,6 +93,10 @@ You can Check Screen Shots on my website. I use the same plugin to display Socia
88
 
89
  == Upgrade Notice ==
90
 
 
 
 
 
91
  = 2.1.0 =
92
 
93
  Added LinkedIn Share button
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.0
8
 
9
  == Description ==
10
  <br />
35
 
36
  * Option to manually display the share box at any position.
37
 
38
+ * Option to disable on Mobile Devices (iPad, iPhone, Blackberry, Nokia, Android, Opera Mini)
39
+
40
 
41
  == Installation ==
42
 
59
 
60
  == Changelog ==
61
 
62
+ = 2.2.0 =
63
+ * Added option to disable on Mobile device
64
+
65
  = 2.1.0 =
66
  * Added LinkedIn Share button
67
 
93
 
94
  == Upgrade Notice ==
95
 
96
+ = 2.2.0 =
97
+
98
+ Option to disable on Mobile devices.
99
+
100
  = 2.1.0 =
101
 
102
  Added LinkedIn Share button
tf_admin_page.php CHANGED
@@ -54,6 +54,7 @@ $show_in = array(
54
 
55
  $option['bkcolor_value'] = esc_html($_POST['twitter_facebook_share_bkcolor_value']);
56
  $option['jsload'] = (isset($_POST['twitter_facebook_share_javascript_load']) and $_POST['twitter_facebook_share_javascript_load']=='on') ? true : false;
 
57
 
58
  $option['twitter_id'] = esc_html($_POST['twitter_facebook_share_twitter_id']);
59
  $option['left_space'] = esc_html($_POST['twitter_facebook_share_left_space']);
@@ -89,6 +90,7 @@ $show_in = array(
89
 
90
  $bkcolor = ($option['bkcolor']) ? 'checked="checked"' : '';
91
  $jsload = ($option['jsload']) ? 'checked="checked"' : '';
 
92
  $auto = ($option['auto']) ? 'checked="checked"' : '';
93
  $google_count = ($option['google_count']) ? 'checked="checked"' : '';
94
  $twitter_count = ($option['twitter_count']) ? 'checked="checked"' : '';
@@ -177,6 +179,11 @@ $show_in = array(
177
  <input type="checkbox" name="twitter_facebook_share_javascript_load" '.$jsload.' />
178
  <span class="description">'.__("(Recommended, else loaded in header)", 'menu-test' ).'</span>
179
  </td></tr>
 
 
 
 
 
180
  <tr><td style="padding-bottom:20px;" valign="top">'.__("Your Twitter ID", 'menu-test' ).':</td>
181
  <td style="padding-bottom:20px;">
182
  <input type="text" name="twitter_facebook_share_twitter_id" value="'.$option['twitter_id'].'" size="30">
@@ -344,6 +351,9 @@ function twitter_facebook_share_get_options_stored () {
344
  if (!isset($option['jsload'])) {
345
  $option['jsload'] = true;
346
  }
 
 
 
347
 
348
  if (!isset($option['facebook_like_width'])) {
349
  $option['facebook_like_width'] = '85';
@@ -382,6 +392,7 @@ function twitter_facebook_share_get_options_default ($position='above', $border=
382
  $option['bkcolor'] = true;
383
  $option['bkcolor_value'] = $color;
384
  $option['jsload'] = true;
 
385
  $option['left_space'] = $left_space;
386
  $option['bottom_space'] = $bottom_space;
387
  $option['float_position'] = $float_position;
54
 
55
  $option['bkcolor_value'] = esc_html($_POST['twitter_facebook_share_bkcolor_value']);
56
  $option['jsload'] = (isset($_POST['twitter_facebook_share_javascript_load']) and $_POST['twitter_facebook_share_javascript_load']=='on') ? true : false;
57
+ $option['mobdev'] = (isset($_POST['twitter_facebook_share_mobile_device']) and $_POST['twitter_facebook_share_mobile_device']=='on') ? true : false;
58
 
59
  $option['twitter_id'] = esc_html($_POST['twitter_facebook_share_twitter_id']);
60
  $option['left_space'] = esc_html($_POST['twitter_facebook_share_left_space']);
90
 
91
  $bkcolor = ($option['bkcolor']) ? 'checked="checked"' : '';
92
  $jsload = ($option['jsload']) ? 'checked="checked"' : '';
93
+ $mobdev = ($option['mobdev']) ? 'checked="checked"' : '';
94
  $auto = ($option['auto']) ? 'checked="checked"' : '';
95
  $google_count = ($option['google_count']) ? 'checked="checked"' : '';
96
  $twitter_count = ($option['twitter_count']) ? 'checked="checked"' : '';
179
  <input type="checkbox" name="twitter_facebook_share_javascript_load" '.$jsload.' />
180
  <span class="description">'.__("(Recommended, else loaded in header)", 'menu-test' ).'</span>
181
  </td></tr>
182
+ <tr><td style="padding-bottom:20px;" valign="top">'.__("Disable on Mobile Device", 'menu-test' ).':</td>
183
+ <td style="padding-bottom:20px;">
184
+ <input type="checkbox" name="twitter_facebook_share_mobile_device" '.$mobdev.' />
185
+ <span class="description">'.__("(Disable on iPad,iPhone,Blackberry,Nokia,Opera Mini and Android)", 'menu-test' ).'</span>
186
+ </td></tr>
187
  <tr><td style="padding-bottom:20px;" valign="top">'.__("Your Twitter ID", 'menu-test' ).':</td>
188
  <td style="padding-bottom:20px;">
189
  <input type="text" name="twitter_facebook_share_twitter_id" value="'.$option['twitter_id'].'" size="30">
351
  if (!isset($option['jsload'])) {
352
  $option['jsload'] = true;
353
  }
354
+ if (!isset($option['mobdev'])) {
355
+ $option['mobdev'] = true;
356
+ }
357
 
358
  if (!isset($option['facebook_like_width'])) {
359
  $option['facebook_like_width'] = '85';
392
  $option['bkcolor'] = true;
393
  $option['bkcolor_value'] = $color;
394
  $option['jsload'] = true;
395
+ $option['mobdev'] = true;
396
  $option['left_space'] = $left_space;
397
  $option['bottom_space'] = $bottom_space;
398
  $option['float_position'] = $float_position;
tf_display.php CHANGED
@@ -12,6 +12,8 @@ function twitter_facebook_share_init() {
12
 
13
  //GET ARRAY OF STORED VALUES
14
  $option = twitter_facebook_share_get_options_stored();
 
 
15
 
16
  if ($option['active_buttons']['twitter']==true) {
17
  wp_enqueue_script('twitter_facebook_share_twitter', 'http://platform.twitter.com/widgets.js','','',$option['jsload']);
@@ -25,6 +27,7 @@ function twitter_facebook_share_init() {
25
  }
26
 
27
  wp_enqueue_style('tfg_style', '/wp-content/plugins/twitter-facebook-google-plusone-share/tfg_style.css');
 
28
 
29
  }
30
 
@@ -44,6 +47,8 @@ function kc_twitter_facebook($content, $filter)
44
 
45
  $option = twitter_facebook_share_get_options_stored();
46
  $custom_disable = get_post_custom_values('disable_social_share');
 
 
47
  if (is_single() && ($option['show_in']['posts']) && ($custom_disable[0] != 'yes')) {
48
  $output = kc_social_share('auto');
49
  if ($option['position'] == 'above')
@@ -131,15 +136,20 @@ function kc_twitter_facebook($content, $filter)
131
  return $output . $content;
132
  if ($option['position'] == 'both')
133
  return $output . $content . $output;
134
- }
 
135
  return $content;
136
  }
137
 
138
  // Function to manually display related posts.
139
  function kc_add_social_share()
140
  {
 
 
 
141
  $output = kc_social_share('manual');
142
  echo $output;
 
143
  }
144
 
145
 
@@ -257,8 +267,13 @@ function kc_social_share($source)
257
  }
258
 
259
  function tfg_social_share_shortcode () {
 
 
 
 
260
  $output = kc_social_share('shortcode');
261
  echo $output;
 
262
  }
263
 
264
  function fb_like_thumbnails()
@@ -274,4 +289,27 @@ echo "\n\n<!-- Thumbnail for facebook like -->\n<link rel=\"image_src\" href=\"$
274
  else
275
  $thumb = $default;
276
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
  ?>
12
 
13
  //GET ARRAY OF STORED VALUES
14
  $option = twitter_facebook_share_get_options_stored();
15
+ if ($option['mobdev']==true){
16
+ if (!is_mobile_device()){
17
 
18
  if ($option['active_buttons']['twitter']==true) {
19
  wp_enqueue_script('twitter_facebook_share_twitter', 'http://platform.twitter.com/widgets.js','','',$option['jsload']);
27
  }
28
 
29
  wp_enqueue_style('tfg_style', '/wp-content/plugins/twitter-facebook-google-plusone-share/tfg_style.css');
30
+ }}
31
 
32
  }
33
 
47
 
48
  $option = twitter_facebook_share_get_options_stored();
49
  $custom_disable = get_post_custom_values('disable_social_share');
50
+ if ($option['mobdev']==true){
51
+ if (!is_mobile_device()) {
52
  if (is_single() && ($option['show_in']['posts']) && ($custom_disable[0] != 'yes')) {
53
  $output = kc_social_share('auto');
54
  if ($option['position'] == 'above')
136
  return $output . $content;
137
  if ($option['position'] == 'both')
138
  return $output . $content . $output;
139
+ }
140
+ }}
141
  return $content;
142
  }
143
 
144
  // Function to manually display related posts.
145
  function kc_add_social_share()
146
  {
147
+ $option = twitter_facebook_share_get_options_stored();
148
+ if ($option['mobdev']==true){
149
+ if (!is_mobile_device()) {
150
  $output = kc_social_share('manual');
151
  echo $output;
152
+ }}
153
  }
154
 
155
 
267
  }
268
 
269
  function tfg_social_share_shortcode () {
270
+ $option = twitter_facebook_share_get_options_stored();
271
+ if ($option['mobdev']==true){
272
+ if (!is_mobile_device())
273
+ {
274
  $output = kc_social_share('shortcode');
275
  echo $output;
276
+ }}
277
  }
278
 
279
  function fb_like_thumbnails()
289
  else
290
  $thumb = $default;
291
  }
292
+
293
+ function is_mobile_device()
294
+ {
295
+ if (strpos( $_SERVER['HTTP_USER_AGENT'] , 'iPhone') )
296
+ return true;
297
+ if (strpos( $_SERVER['HTTP_USER_AGENT'] , 'iPad') )
298
+ return true;
299
+ if (strpos( $_SERVER['HTTP_USER_AGENT'] , 'iPod') )
300
+ return true;
301
+ if (strpos( $_SERVER['HTTP_USER_AGENT'] , 'Nokia') )
302
+ return true;
303
+ if (strpos( $_SERVER['HTTP_USER_AGENT'] , 'Opera Mini') )
304
+ return true;
305
+ if (strpos( $_SERVER['HTTP_USER_AGENT'] , 'Opera Mobi') )
306
+ return true;
307
+ if (strpos( $_SERVER['HTTP_USER_AGENT'] , 'SonyEricsson') )
308
+ return true;
309
+ if (strpos( $_SERVER['HTTP_USER_AGENT'] , 'BlackBerry') )
310
+ return true;
311
+ if (strpos( $_SERVER['HTTP_USER_AGENT'] , 'Mobile Safari') )
312
+ return true;
313
+ return false;
314
+ }
315
  ?>
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.1.0
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.2.0
9
  License: GPL
10
  */
11
  /*