Simple Social Media Share Buttons – Social Sharing for Everyone - Version 2.1.0

Version Description

  • Please upgrade immediately. Bug fixes and improvements.

=

Download this release

Release Info

Developer hiddenpearls
Plugin Icon 128x128 Simple Social Media Share Buttons – Social Sharing for Everyone
Version 2.1.0
Comparing to
See all releases

Code changes from version 2.0.22 to 2.1.0

assets/js/admin.js CHANGED
@@ -136,7 +136,6 @@
136
  //widget js
137
  $(document).on('click', '.get_fb_token', function () {
138
  var fb_content = $(this).parent().parent().parent().parent();
139
- console.log(fb_content);
140
  var client_id = $(fb_content).find('.fb_app_id').val().trim();
141
  var secret_key = $(fb_content).find('.fb_secret_key').val().trim();
142
 
@@ -213,17 +212,6 @@
213
  }
214
  });
215
 
216
- $(document).on('click', '.show_google_check', function () {
217
- var widget_content = $(this).parent().parent();
218
- if ($(this).is(':checked')) {
219
- // $('.show_google_plus').css('display', 'block');
220
- $(widget_content).find('.show_google_plus').css('display', 'block');
221
- } else {
222
- $(widget_content).find('.show_google_plus').css('display', 'none');
223
- }
224
-
225
- });
226
-
227
 
228
  $(document).on('click', '.show_youtube_check', function () {
229
  var widget_content = $(this).parent().parent();
@@ -247,15 +235,15 @@
247
 
248
  });
249
 
250
- $(document).on('click', '.pinterest_count_check', function () {
251
 
252
- var pinterest_content = $(this).parent().parent();
253
- if ($(this).is(':checked')) {
254
- $(pinterest_content).find('.pinterest_api_key').css('display', 'block');
255
- } else {
256
- $(pinterest_content).find('.pinterest_api_key').css('display', 'none');
257
- }
258
- });
259
 
260
  $(document).on('click', '.show_instagram_check', function () {
261
  var widget_content = $(this).parent().parent();
136
  //widget js
137
  $(document).on('click', '.get_fb_token', function () {
138
  var fb_content = $(this).parent().parent().parent().parent();
 
139
  var client_id = $(fb_content).find('.fb_app_id').val().trim();
140
  var secret_key = $(fb_content).find('.fb_secret_key').val().trim();
141
 
212
  }
213
  });
214
 
 
 
 
 
 
 
 
 
 
 
 
215
 
216
  $(document).on('click', '.show_youtube_check', function () {
217
  var widget_content = $(this).parent().parent();
235
 
236
  });
237
 
238
+ // $(document).on('click', '.pinterest_count_check', function () {
239
 
240
+ // var pinterest_content = $(this).parent().parent();
241
+ // if ($(this).is(':checked')) {
242
+ // $(pinterest_content).find('.pinterest_api_key').css('display', 'block');
243
+ // } else {
244
+ // $(pinterest_content).find('.pinterest_api_key').css('display', 'none');
245
+ // }
246
+ // });
247
 
248
  $(document).on('click', '.show_instagram_check', function () {
249
  var widget_content = $(this).parent().parent();
classes/ssb-widget.php CHANGED
@@ -68,10 +68,6 @@ class Ssb_Follower_Widget extends WP_Widget {
68
  $twitter_api_key = $instance['twitter_api_key'];
69
  $twitter_secret_key = $instance['twitter_secret_key'];
70
 
71
- $google_id = $instance['google'];
72
- $google_show_counter = $instance['google_show_counter'];
73
- $google_text = $instance['google_text'];
74
-
75
  $youtube_id = $instance['youtube'];
76
  $youtube_show_counter = $instance['youtube_show_counter'];
77
  $youtube_text = $instance['youtube_text'];
@@ -85,16 +81,16 @@ class Ssb_Follower_Widget extends WP_Widget {
85
  $instagram_id = $instance['instagram'];
86
  $instagram_show_counter = $instance['instagram_show_counter'];
87
  $instagram_text = $instance['instagram_text'];
 
88
 
89
  $whatsapp = $instance['whatsapp'];
90
  $whatsapp_text = $instance['whatsapp_text'];
91
 
92
  $fb_likes = $this->get_facebook_likes_count( $facebook_id, $facebook_access_token, $facebook_show_counter );
93
  $twitter_follower = $this->get_twitter_followers( $twitter_id, $twitter_api_key, $twitter_secret_key, $twitter_show_counter );
94
- $google_follower = $this->get_google_plus_follower( $google_id, $google_show_counter );
95
  $youtube_subscriber = $this->get_youtube_subscriber( $youtube_id, $youtube_show_counter, $youtube_type );
96
- $pinterest_follower = $this->get_pinterest_followers( $pinterest_api_key, $pinterest_show_counter );
97
- $instagram_follower = $this->get_instagram_id_followers( $instagram_id, $instagram_show_counter );
98
 
99
  include SSB_PLUGIN_DIR . '/inc/ssb-widget-front.php';
100
  }
@@ -112,7 +108,6 @@ class Ssb_Follower_Widget extends WP_Widget {
112
  //first time run when instance create
113
  if ( 0 == count( $instance ) ) {
114
  $instance['facebook_text'] = __( 'Follow us on Facebook', 'simple-social-buttons' );
115
- $instance['google_text'] = __( 'Follow us on Google+', 'simple-social-buttons' );
116
  $instance['youtube_text'] = __( 'Subscribe us on Youtube', 'simple-social-buttons' );
117
  $instance['twitter_text'] = __( 'Follow us on Twitter', 'simple-social-buttons' );
118
  $instance['pinterest_text'] = __( 'Pin us on Pinterest', 'simple-social-buttons' );
@@ -145,10 +140,6 @@ class Ssb_Follower_Widget extends WP_Widget {
145
  $twitter_text = ! empty( $instance['twitter_text'] ) ? $instance['twitter_text'] : '';
146
  $twitter_secret_key = ! empty( $instance['twitter_secret_key'] ) ? $instance['twitter_secret_key'] : '';
147
 
148
- $google = ! empty( $instance['google'] ) ? $instance['google'] : '';
149
- $google_show_counter = ! empty( $instance['google_show_counter'] ) ? $instance['google_show_counter'] : '';
150
- $google_text = ! empty( $instance['google_text'] ) ? $instance['google_text'] : '';
151
-
152
  $youtube = ! empty( $instance['youtube'] ) ? $instance['youtube'] : '';
153
  $youtube_text = ! empty( $instance['youtube_text'] ) ? $instance['youtube_text'] : '';
154
  $youtube_type = ! empty( $instance['youtube_type'] ) ? $instance['youtube_type'] : '';
@@ -163,6 +154,7 @@ class Ssb_Follower_Widget extends WP_Widget {
163
  $instagram_user_id = ! empty( $instance['instagram_user_id'] ) ? $instance['instagram_user_id'] : '';
164
  $instagram_text = ! empty( $instance['instagram_text'] ) ? $instance['instagram_text'] : '';
165
  $instagram_show_counter = ! empty( $instance['instagram_show_counter'] ) ? $instance['instagram_show_counter'] : '';
 
166
 
167
  //whats app mobile number will store in $whatsapp
168
  $whatsapp = ! empty( $instance['whatsapp'] ) ? $instance['whatsapp'] : '';
@@ -188,7 +180,6 @@ class Ssb_Follower_Widget extends WP_Widget {
188
  // delete transiant wheb user update widget settings.
189
  delete_transient( 'ssb_follow_facebook_counter' );
190
  delete_transient( 'ssb_follow_twitter_counter' );
191
- delete_transient( 'ssb_follow_google_counter' );
192
  delete_transient( 'ssb_follow_youtube_counter' );
193
  delete_transient( 'ssb_follow_pinterest_counter' );
194
  delete_transient( 'ssb_follow_instagram_counter' );
@@ -220,10 +211,6 @@ class Ssb_Follower_Widget extends WP_Widget {
220
  $instance['twitter_show_counter'] = ( ! empty( $new_instance['twitter_show_counter'] ) ) ? strip_tags( $new_instance['twitter_show_counter'] ) : '0';
221
  $instance['twitter_text'] = sanitize_text_field( wp_unslash( $new_instance['twitter_text'] ) );
222
 
223
- $instance['google'] = sanitize_text_field( wp_unslash( $new_instance['google'] ) );
224
- $instance['google_show_counter'] = ( ! empty( $new_instance['google_show_counter'] ) ) ? strip_tags( $new_instance['google_show_counter'] ) : '0';
225
- $instance['google_text'] = sanitize_text_field( wp_unslash( $new_instance['google_text'] ) );
226
-
227
  $instance['youtube'] = sanitize_text_field( wp_unslash( $new_instance['youtube'] ) );
228
  $instance['youtube_show_counter'] = ( ! empty( $new_instance['youtube_show_counter'] ) ) ? strip_tags( $new_instance['youtube_show_counter'] ) : '0';
229
  $instance['youtube_text'] = sanitize_text_field( wp_unslash( $new_instance['youtube_text'] ) );
@@ -237,6 +224,7 @@ class Ssb_Follower_Widget extends WP_Widget {
237
  $instance['instagram'] = sanitize_text_field( wp_unslash( $new_instance['instagram'] ) );
238
  $instance['instagram_show_counter'] = ( ! empty( $new_instance['instagram_show_counter'] ) ) ? strip_tags( $new_instance['instagram_show_counter'] ) : '0';
239
  $instance['instagram_text'] = sanitize_text_field( wp_unslash( $new_instance['instagram_text'] ) );
 
240
 
241
  $instance['whatsapp'] = sanitize_text_field( wp_unslash( $new_instance['whatsapp'] ) );
242
  $instance['whatsapp_text'] = sanitize_text_field( wp_unslash( $new_instance['whatsapp_text'] ) );
@@ -374,53 +362,6 @@ class Ssb_Follower_Widget extends WP_Widget {
374
  }
375
  }
376
 
377
- /**
378
- * passing the google plus username return google+ follower
379
- *
380
- * @since 2.0.2
381
- *
382
- * @param $google_iD
383
- *
384
- * @return int
385
- */
386
- function get_google_plus_follower( $google_id, $show_counter ) {
387
-
388
-
389
- if ( $show_counter ) {
390
- if( '' == $google_id ){
391
- return 0;
392
- }
393
-
394
- if( '' == $google_id ){
395
- return 0;
396
- }
397
-
398
- if ( false === get_transient( 'ssb_follow_google_counter' ) ) {
399
- $json_feed_url = 'https://www.googleapis.com/plus/v1/people/' . $google_id . '?fields=circledByCount%2CplusOneCount&key=' . $this->api_key;
400
- $args = array( 'httpversion' => '1.1' );
401
- $json_feed = wp_remote_get( $json_feed_url, $args );
402
- if ( is_wp_error( $json_feed ) || 200 !== wp_remote_retrieve_response_code( $json_feed ) ) {
403
- return 0;
404
- }
405
-
406
- $result = json_decode( wp_remote_retrieve_body( $json_feed ) );
407
-
408
- $counter = isset( $result->circledByCount ) ? $result->circledByCount : 0;
409
-
410
- $counter = $this->format_number( $counter );
411
- if ( ! empty( $counter ) ) {
412
-
413
- set_transient( 'ssb_follow_google_counter', $counter, $this->cache_time );
414
- }
415
-
416
- return $counter;
417
- } else {
418
-
419
- return get_transient( 'ssb_follow_google_counter' );
420
- }
421
- }
422
- }
423
-
424
  /**
425
  * passing youtube channel id and access token return the channel subscriber counter
426
  * @since 2.0.2
@@ -477,25 +418,28 @@ class Ssb_Follower_Widget extends WP_Widget {
477
  *
478
  * @return int|string
479
  */
480
- function get_pinterest_followers( $access_token, $show_counter ) {
481
 
482
  if ( $show_counter ) {
483
- if( '' == $access_token ){
484
  return 0;
485
  }
486
 
487
  if ( false === get_transient( 'ssb_follow_pinterest_counter' ) ) {
488
- $json_feed_url = 'https://api.pinterest.com/v1/me/followers/?access_token=' . $access_token;
489
- $args = array( 'httpversion' => '1.1' );
 
 
 
490
  $json_feed = wp_remote_get( $json_feed_url, $args );
491
- //$result = json_decode( $json_feed['body'] );
492
  if ( is_wp_error( $json_feed ) || 200 !== wp_remote_retrieve_response_code( $json_feed ) ) {
493
  return 0;
494
  }
495
- $result = json_decode( wp_remote_retrieve_body( $json_feed ),true );
496
- $counter = count($result['data'] );
497
- $counter = $this->format_number( $counter );
498
-
 
499
  if ( ! empty( $counter ) ) {
500
 
501
  set_transient( 'ssb_follow_pinterest_counter', $counter, $this->cache_time );
@@ -518,26 +462,30 @@ class Ssb_Follower_Widget extends WP_Widget {
518
  *
519
  * @return int|string( insta follower )
520
  */
521
- function get_instagram_id_followers( $instagram_id, $show_counter ){
522
 
523
  if ( $show_counter ) {
524
- if( '' == $instagram_id ){
525
  return 0;
526
  }
527
 
528
  if ( false === get_transient( 'ssb_follow_instagram_counter' ) ) {
529
- $json_feed_url = "https://www.instagram.com/$instagram_id/?__a=1";
530
 
531
- $args = array( 'httpversion' => '1.1' );
 
 
 
532
  $json_feed = wp_remote_get( $json_feed_url, $args );
533
 
534
  if ( is_wp_error( $json_feed ) || 200 !== wp_remote_retrieve_response_code( $json_feed ) ) {
535
  return 0;
536
  }
537
- $result = json_decode( wp_remote_retrieve_body( $json_feed ) );
538
- $counter = isset( $result->user->followed_by->count ) ? $result->user->followed_by->count : 0;
539
- $counter = $this->format_number( $counter );
540
 
 
 
 
 
541
  if ( ! empty( $counter ) ) {
542
  set_transient( 'ssb_follow_instagram_counter', $counter, $this->cache_time );
543
  }
68
  $twitter_api_key = $instance['twitter_api_key'];
69
  $twitter_secret_key = $instance['twitter_secret_key'];
70
 
 
 
 
 
71
  $youtube_id = $instance['youtube'];
72
  $youtube_show_counter = $instance['youtube_show_counter'];
73
  $youtube_text = $instance['youtube_text'];
81
  $instagram_id = $instance['instagram'];
82
  $instagram_show_counter = $instance['instagram_show_counter'];
83
  $instagram_text = $instance['instagram_text'];
84
+ $instagram_access_token = $instance['instagram_access_token'];
85
 
86
  $whatsapp = $instance['whatsapp'];
87
  $whatsapp_text = $instance['whatsapp_text'];
88
 
89
  $fb_likes = $this->get_facebook_likes_count( $facebook_id, $facebook_access_token, $facebook_show_counter );
90
  $twitter_follower = $this->get_twitter_followers( $twitter_id, $twitter_api_key, $twitter_secret_key, $twitter_show_counter );
 
91
  $youtube_subscriber = $this->get_youtube_subscriber( $youtube_id, $youtube_show_counter, $youtube_type );
92
+ $pinterest_follower = $this->get_pinterest_followers( $pinterest_id, $pinterest_show_counter );
93
+ $instagram_follower = $this->get_instagram_id_followers( $instagram_access_token, $instagram_show_counter );
94
 
95
  include SSB_PLUGIN_DIR . '/inc/ssb-widget-front.php';
96
  }
108
  //first time run when instance create
109
  if ( 0 == count( $instance ) ) {
110
  $instance['facebook_text'] = __( 'Follow us on Facebook', 'simple-social-buttons' );
 
111
  $instance['youtube_text'] = __( 'Subscribe us on Youtube', 'simple-social-buttons' );
112
  $instance['twitter_text'] = __( 'Follow us on Twitter', 'simple-social-buttons' );
113
  $instance['pinterest_text'] = __( 'Pin us on Pinterest', 'simple-social-buttons' );
140
  $twitter_text = ! empty( $instance['twitter_text'] ) ? $instance['twitter_text'] : '';
141
  $twitter_secret_key = ! empty( $instance['twitter_secret_key'] ) ? $instance['twitter_secret_key'] : '';
142
 
 
 
 
 
143
  $youtube = ! empty( $instance['youtube'] ) ? $instance['youtube'] : '';
144
  $youtube_text = ! empty( $instance['youtube_text'] ) ? $instance['youtube_text'] : '';
145
  $youtube_type = ! empty( $instance['youtube_type'] ) ? $instance['youtube_type'] : '';
154
  $instagram_user_id = ! empty( $instance['instagram_user_id'] ) ? $instance['instagram_user_id'] : '';
155
  $instagram_text = ! empty( $instance['instagram_text'] ) ? $instance['instagram_text'] : '';
156
  $instagram_show_counter = ! empty( $instance['instagram_show_counter'] ) ? $instance['instagram_show_counter'] : '';
157
+ $instagram_access_token = ! empty( $instance['instagram_access_token'] ) ? $instance['instagram_access_token'] : '';
158
 
159
  //whats app mobile number will store in $whatsapp
160
  $whatsapp = ! empty( $instance['whatsapp'] ) ? $instance['whatsapp'] : '';
180
  // delete transiant wheb user update widget settings.
181
  delete_transient( 'ssb_follow_facebook_counter' );
182
  delete_transient( 'ssb_follow_twitter_counter' );
 
183
  delete_transient( 'ssb_follow_youtube_counter' );
184
  delete_transient( 'ssb_follow_pinterest_counter' );
185
  delete_transient( 'ssb_follow_instagram_counter' );
211
  $instance['twitter_show_counter'] = ( ! empty( $new_instance['twitter_show_counter'] ) ) ? strip_tags( $new_instance['twitter_show_counter'] ) : '0';
212
  $instance['twitter_text'] = sanitize_text_field( wp_unslash( $new_instance['twitter_text'] ) );
213
 
 
 
 
 
214
  $instance['youtube'] = sanitize_text_field( wp_unslash( $new_instance['youtube'] ) );
215
  $instance['youtube_show_counter'] = ( ! empty( $new_instance['youtube_show_counter'] ) ) ? strip_tags( $new_instance['youtube_show_counter'] ) : '0';
216
  $instance['youtube_text'] = sanitize_text_field( wp_unslash( $new_instance['youtube_text'] ) );
224
  $instance['instagram'] = sanitize_text_field( wp_unslash( $new_instance['instagram'] ) );
225
  $instance['instagram_show_counter'] = ( ! empty( $new_instance['instagram_show_counter'] ) ) ? strip_tags( $new_instance['instagram_show_counter'] ) : '0';
226
  $instance['instagram_text'] = sanitize_text_field( wp_unslash( $new_instance['instagram_text'] ) );
227
+ $instance['instagram_access_token'] = sanitize_text_field( wp_unslash( $new_instance['instagram_access_token'] ) );
228
 
229
  $instance['whatsapp'] = sanitize_text_field( wp_unslash( $new_instance['whatsapp'] ) );
230
  $instance['whatsapp_text'] = sanitize_text_field( wp_unslash( $new_instance['whatsapp_text'] ) );
362
  }
363
  }
364
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
365
  /**
366
  * passing youtube channel id and access token return the channel subscriber counter
367
  * @since 2.0.2
418
  *
419
  * @return int|string
420
  */
421
+ function get_pinterest_followers( $pinterest_id, $show_counter ) {
422
 
423
  if ( $show_counter ) {
424
+ if( '' == $pinterest_id ){
425
  return 0;
426
  }
427
 
428
  if ( false === get_transient( 'ssb_follow_pinterest_counter' ) ) {
429
+ $json_feed_url = 'https://www.pinterest.com/' . $pinterest_id;
430
+ $args = array(
431
+ 'httpversion' => '1.1',
432
+ 'timeout' => 60
433
+ );
434
  $json_feed = wp_remote_get( $json_feed_url, $args );
 
435
  if ( is_wp_error( $json_feed ) || 200 !== wp_remote_retrieve_response_code( $json_feed ) ) {
436
  return 0;
437
  }
438
+ $result = array();
439
+ $regex = '/property\=\"pinterestapp:followers\" name\=\"pinterestapp:followers\" content\=\"(.*?)" data-app/';
440
+ preg_match( $regex, wp_remote_retrieve_body( $json_feed ), $tags );
441
+ $counter = isset( $tags[1] ) ? intval( $tags[1] ) : 0;;
442
+ $counter = $this->format_number( $counter );
443
  if ( ! empty( $counter ) ) {
444
 
445
  set_transient( 'ssb_follow_pinterest_counter', $counter, $this->cache_time );
462
  *
463
  * @return int|string( insta follower )
464
  */
465
+ function get_instagram_id_followers( $access_token, $show_counter ){
466
 
467
  if ( $show_counter ) {
468
+ if( '' == $access_token ){
469
  return 0;
470
  }
471
 
472
  if ( false === get_transient( 'ssb_follow_instagram_counter' ) ) {
473
+ $json_feed_url = "https://api.instagram.com/v1/users/self/?access_token=". $access_token;
474
 
475
+ $args = array(
476
+ 'httpversion' => '1.1',
477
+ 'sslverify' => false,
478
+ 'timeout' => 60 );
479
  $json_feed = wp_remote_get( $json_feed_url, $args );
480
 
481
  if ( is_wp_error( $json_feed ) || 200 !== wp_remote_retrieve_response_code( $json_feed ) ) {
482
  return 0;
483
  }
 
 
 
484
 
485
+ $result = json_decode( wp_remote_retrieve_body( $json_feed ), true );
486
+ $counter = isset($result['data']['counts']['followed_by']) ? $result['data']['counts']['followed_by'] : 0;
487
+ $counter = $this->format_number( $counter );
488
+
489
  if ( ! empty( $counter ) ) {
490
  set_transient( 'ssb_follow_instagram_counter', $counter, $this->cache_time );
491
  }
inc/ssb-widget-fields.php CHANGED
@@ -9,8 +9,6 @@
9
  <br/>
10
  <input type="checkbox" value="1" class="show_twitter_check" name="<?php echo esc_attr( $this->get_field_name( 'show_twitter' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'show_twitter' ) ); ?>" <?php checked( $show_twitter);?>> <label for="<?php echo esc_attr( $this->get_field_id( 'show_twitter' ) ); ?>">Twitter</label>
11
  <br/>
12
- <input type="checkbox" value="1" class="show_google_check" name="<?php echo esc_attr( $this->get_field_name( 'show_google_plus' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'show_google_plus' ) );?>" <?php checked( $show_google_plus, 1);?> > <label for="<?php echo esc_attr( $this->get_field_id( 'show_google_plus' ) ); ?>">Google+</label>
13
- <br/>
14
  <input type="checkbox" value="1" class="show_youtube_check" name="<?php echo esc_attr( $this->get_field_name( 'show_youtube' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'show_youtube' ) ); ?>" <?php checked($show_youtube ,1);?> > <label for="<?php echo esc_attr( $this->get_field_id( 'show_youtube' ) ); ?>">YouTube</label>
15
  <br/>
16
  <input type="checkbox" value="1" class="show_pinterest_check" name="<?php echo esc_attr( $this->get_field_name( 'show_pinterest' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'show_pinterest' ) ); ?>" <?php checked($show_pinterest ,1);?> > <label for="<?php echo esc_attr( $this->get_field_id( 'show_pinterest' ) ); ?>">Pinterest</label>
@@ -28,7 +26,7 @@
28
  </p>
29
 
30
  <p>
31
- <label for="<?php echo esc_attr( $this->get_field_id( 'facebook_id' ) ); ?>">Facebook User ID:</label>
32
  <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'facebook_id' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'facebook_id' ) ); ?>" type="text" value="<?php echo esc_attr( $facebook_id ); ?>">
33
  </p>
34
  <p>
@@ -37,7 +35,8 @@
37
  value="1" <?php checked( $facebook_show_counter, 1 ) ?> class="fb_count_check" ><label for="<?php echo esc_attr( $this->get_field_id( 'facebook_show_counter' ) ) ?>"> Display Facebook like counter</label>
38
  </p>
39
  <p class="fb-error" style="color: red"></p>
40
- <div class="fb_api_key" style="display: <?php echo ( $display == $facebook_show_counter )? 'block' : 'none' ?>">
 
41
  <p>
42
  <label for="<?php echo esc_attr( $this->get_field_id( 'facebook_app_id' ) ); ?>"><?php esc_attr_e( 'Facebook App Id:', 'simple-social-buttons' ); ?>
43
  <input class="widefat fb_app_id" id="<?php echo esc_attr( $this->get_field_id( 'facebook_app_id' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'facebook_app_id' ) ); ?>" type="text" value="<?php echo esc_attr( $facebook_app_id ); ?>">
@@ -86,24 +85,6 @@
86
  </div>
87
  <hr/>
88
  </div>
89
- <!--google-->
90
- <div class="show_google_plus simpleshare-widget-settings" style="display: <?php echo ( $display == $show_google_plus )? 'block' : 'none' ?>">
91
- <h2><span>Google Plus</span></h2>
92
- <p>
93
-
94
- <label for="<?php echo esc_attr( $this->get_field_id( 'google_text' ) ); ?> "><?php esc_attr_e( 'Google+ Button Text:', 'simple-social-buttons' ); ?></label>
95
- <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'google_text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'google_text' ) ); ?>" type="text" value="<?php echo esc_attr( $google_text ); ?>" placeholder="Follow us on Google Plus">
96
-
97
- </p>
98
- <p class="google_text" style="display: block ">
99
- <label for="<?php echo esc_attr( $this->get_field_id( 'google' ) ); ?>"><?php esc_attr_e( 'Google+ User ID:', 'simple-social-buttons' ); ?></label>
100
- <p>
101
- <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'google' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'google' ) ); ?>" type="text" value="<?php echo esc_attr( $google ); ?>" placeholder="+username">
102
- <input type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'google_show_counter' ) ) ?>" id="<?php echo esc_attr( $this->get_field_id( 'google_show_counter' ) ) ?>" value="1" <?php checked( $google_show_counter, 1 ) ?> class="google_count_check" ><label for="<?php echo esc_attr( $this->get_field_id( 'google_show_counter' ) ) ?>"> Display Google Plus follower counter</label>
103
- </p>
104
- <hr/>
105
-
106
- </div>
107
  <!--youtube-->
108
  <div class="show_youtube simpleshare-widget-settings" style="display: <?php echo ( $display == $show_youtube )? 'block' : 'none' ?>">
109
  <h2><span>YouTube</span></h2>
@@ -142,7 +123,8 @@
142
  <input type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'pinterest_show_counter' ) ) ?>" id="<?php echo esc_attr( $this->get_field_id( 'pinterest_show_counter' ) ) ?>" value="1" <?php checked( $pinterest_show_counter, 1 ) ?> class="pinterest_count_check" >
143
  <label for="<?php echo esc_attr( $this->get_field_id( 'pinterest_show_counter' ) ) ?>">Display Pinterest follower counter</label>
144
  </p>
145
- <div class="pinterest_api_key" style="display: <?php echo ( $display == $pinterest_show_counter )? 'block' : 'none' ?>">
 
146
  <p>
147
  <label for="<?php echo esc_attr( $this->get_field_id( 'pinterest_api_key' ) ); ?>"><?php esc_attr_e( 'Printerest Access Token: ', 'simple-social-buttons' ); ?><a href="https://developers.pinterest.com/tools/access_token/" target="_blank">How to get the Pinterest access token</a>
148
  </label>
@@ -166,6 +148,13 @@
166
  <input type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'instagram_show_counter' ) ) ?>" id="<?php echo esc_attr( $this->get_field_id( 'instagram_show_counter' ) ) ?>" value="1" <?php checked( $instagram_show_counter, 1 ) ?> class="instagram_count_check" >
167
  <label for="<?php echo esc_attr( $this->get_field_id( 'instagram_show_counter' ) ) ?>">Display Instagram follower counter</label>
168
  </p>
 
 
 
 
 
 
 
169
 
170
  <hr/>
171
  </div>
9
  <br/>
10
  <input type="checkbox" value="1" class="show_twitter_check" name="<?php echo esc_attr( $this->get_field_name( 'show_twitter' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'show_twitter' ) ); ?>" <?php checked( $show_twitter);?>> <label for="<?php echo esc_attr( $this->get_field_id( 'show_twitter' ) ); ?>">Twitter</label>
11
  <br/>
 
 
12
  <input type="checkbox" value="1" class="show_youtube_check" name="<?php echo esc_attr( $this->get_field_name( 'show_youtube' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'show_youtube' ) ); ?>" <?php checked($show_youtube ,1);?> > <label for="<?php echo esc_attr( $this->get_field_id( 'show_youtube' ) ); ?>">YouTube</label>
13
  <br/>
14
  <input type="checkbox" value="1" class="show_pinterest_check" name="<?php echo esc_attr( $this->get_field_name( 'show_pinterest' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'show_pinterest' ) ); ?>" <?php checked($show_pinterest ,1);?> > <label for="<?php echo esc_attr( $this->get_field_id( 'show_pinterest' ) ); ?>">Pinterest</label>
26
  </p>
27
 
28
  <p>
29
+ <label for="<?php echo esc_attr( $this->get_field_id( 'facebook_id' ) ); ?>">Facebook Page Name:</label>
30
  <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'facebook_id' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'facebook_id' ) ); ?>" type="text" value="<?php echo esc_attr( $facebook_id ); ?>">
31
  </p>
32
  <p>
35
  value="1" <?php checked( $facebook_show_counter, 1 ) ?> class="fb_count_check" ><label for="<?php echo esc_attr( $this->get_field_id( 'facebook_show_counter' ) ) ?>"> Display Facebook like counter</label>
36
  </p>
37
  <p class="fb-error" style="color: red"></p>
38
+
39
+ <div class="fb_api_key" style="display:<?php echo ( $display == $facebook_show_counter )? 'block' : 'none' ?> ">
40
  <p>
41
  <label for="<?php echo esc_attr( $this->get_field_id( 'facebook_app_id' ) ); ?>"><?php esc_attr_e( 'Facebook App Id:', 'simple-social-buttons' ); ?>
42
  <input class="widefat fb_app_id" id="<?php echo esc_attr( $this->get_field_id( 'facebook_app_id' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'facebook_app_id' ) ); ?>" type="text" value="<?php echo esc_attr( $facebook_app_id ); ?>">
85
  </div>
86
  <hr/>
87
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  <!--youtube-->
89
  <div class="show_youtube simpleshare-widget-settings" style="display: <?php echo ( $display == $show_youtube )? 'block' : 'none' ?>">
90
  <h2><span>YouTube</span></h2>
123
  <input type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'pinterest_show_counter' ) ) ?>" id="<?php echo esc_attr( $this->get_field_id( 'pinterest_show_counter' ) ) ?>" value="1" <?php checked( $pinterest_show_counter, 1 ) ?> class="pinterest_count_check" >
124
  <label for="<?php echo esc_attr( $this->get_field_id( 'pinterest_show_counter' ) ) ?>">Display Pinterest follower counter</label>
125
  </p>
126
+ <?php // echo ( $display == $pinterest_show_counter )? 'block' : 'none' ?>
127
+ <div class="pinterest_api_key" style="display:none;visibility:hidden">
128
  <p>
129
  <label for="<?php echo esc_attr( $this->get_field_id( 'pinterest_api_key' ) ); ?>"><?php esc_attr_e( 'Printerest Access Token: ', 'simple-social-buttons' ); ?><a href="https://developers.pinterest.com/tools/access_token/" target="_blank">How to get the Pinterest access token</a>
130
  </label>
148
  <input type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'instagram_show_counter' ) ) ?>" id="<?php echo esc_attr( $this->get_field_id( 'instagram_show_counter' ) ) ?>" value="1" <?php checked( $instagram_show_counter, 1 ) ?> class="instagram_count_check" >
149
  <label for="<?php echo esc_attr( $this->get_field_id( 'instagram_show_counter' ) ) ?>">Display Instagram follower counter</label>
150
  </p>
151
+ <div class="instagram_api_key" style="display: <?php echo ( $display == $instagram_show_counter )? 'block' : 'none' ?>">
152
+ <p>
153
+ <label for="<?php echo esc_attr( $this->get_field_id( 'instagram_access_token' ) ); ?>"><?php esc_attr_e( 'Instagram Access Token: ', 'simple-social-buttons' ); ?><a href="https://instagram.pixelunion.net/" target="_blank">How to get the Instagram Access Token.</a>
154
+ </label>
155
+ <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'instagram_access_token' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'instagram_access_token' ) ); ?>" type="text" value="<?php echo esc_attr( $instagram_access_token ); ?>">
156
+ </p>
157
+ </div>
158
 
159
  <hr/>
160
  </div>
inc/utils.php CHANGED
@@ -253,4 +253,42 @@ function ssb_fetch_shares_via_curl_multi( $data, $options = array() ) {
253
  }
254
  }
255
  return $result;
256
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
253
  }
254
  }
255
  return $result;
256
+ }
257
+
258
+
259
+ /**
260
+ * Detect if mobile.
261
+ *
262
+ * @since 2.0.13
263
+ */
264
+ function is_mobile() {
265
+
266
+ $useragent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : 'none';
267
+
268
+ if ( preg_match( '/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i', $useragent ) || preg_match( '/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i', substr( $useragent, 0, 4 ) ) ) {
269
+ return true;
270
+ } else {
271
+ return false;
272
+ }
273
+ }
274
+
275
+ /**
276
+ * Generate Whats app shara link.
277
+ *
278
+ * @param String $url
279
+ * @return Srtring Final url after detection is it mobile or desktop.
280
+ * @since 2.0.23
281
+ */
282
+ function ssb_whats_app_share_link( $url ){
283
+ $whats_share_link = '';
284
+ if( is_mobile() ){
285
+ $whats_share_link = 'https://api.whatsapp.com/send?text=' . $url;
286
+ } else {
287
+ $whats_share_link = 'https://web.whatsapp.com/send?text=' . $url;
288
+ }
289
+
290
+ return $whats_share_link;
291
+ }
292
+
293
+
294
+
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://wpbrigade.com/
4
  Tags: Social share, Social buttons, Whatsapp, Viber, LinkedIn, facebook, google, twitter, pinterest, plus one
5
  Requires at least: 4.0
6
  Tested up to: 5.0
7
- Stable tag: 2.0.22
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -146,11 +146,16 @@ like_button_size = small(default), large
146
 
147
  == Upgrade Notice ==
148
 
149
- = 2.0.22 =
150
- * Please upgrade immediately. Bugfixes and improvements.
151
 
152
  == Changelog ==
153
 
 
 
 
 
 
154
  = 2.0.22 - 2019-02-08 =
155
  * Enhancement: Fix security issue.
156
 
4
  Tags: Social share, Social buttons, Whatsapp, Viber, LinkedIn, facebook, google, twitter, pinterest, plus one
5
  Requires at least: 4.0
6
  Tested up to: 5.0
7
+ Stable tag: 2.1.0
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
146
 
147
  == Upgrade Notice ==
148
 
149
+ = 2.1.0 =
150
+ * Please upgrade immediately. Bug fixes and improvements.
151
 
152
  == Changelog ==
153
 
154
+ = 2.1.0 - 2019-04-15 =
155
+ * Improvement: Whats App share link detection mobile and desktop
156
+ * Bug Fix: Undefined index in facebook link share function
157
+ * Bug Fix: Widget Count api big fixes
158
+
159
  = 2.0.22 - 2019-02-08 =
160
  * Enhancement: Fix security issue.
161
 
simple-social-buttons.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Simple Social Buttons
4
  * Plugin URI: http://www.WPBrigade.com/wordpress/plugins/simple-social-buttons/
5
  * Description: Simple Social Buttons adds an advanced set of social media sharing buttons to your WordPress sites, such as: Google +1, Facebook, WhatsApp, Viber, Twitter, Reddit, LinkedIn and Pinterest. This makes it the most <code>Flexible Social Sharing Plugin ever for Everyone.</code>
6
- * Version: 2.0.22
7
  * Author: WPBrigade
8
  * Author URI: http://www.WPBrigade.com/
9
  * Text Domain: simple-social-buttons
@@ -30,7 +30,7 @@
30
 
31
  class SimpleSocialButtonsPR {
32
  public $pluginName = 'Simple Social Buttons';
33
- public $pluginVersion = '2.0.22';
34
  public $pluginPrefix = 'ssb_pr_';
35
  public $hideCustomMetaKey = '_ssb_hide';
36
  private $fb_app_id = '891268654262273';
@@ -791,13 +791,13 @@ class SimpleSocialButtonsPR {
791
  break;
792
  case 'whatsapp':
793
  if ( $this->selected_theme == 'simple-icons' ) {
794
- $arrButtonsCode[] = ' <button onclick="javascript:window.open(this.dataset.href, \'_blank\' );return false;" class="ssb_whatsapp-icon simplesocial-whatsapp-share" data-href="https://api.whatsapp.com/send?text=' . $permalink . '"><span class="simplesocialtxt">
795
  <span class="icon"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 90 90" style="enable-background:new 0 0 90 90;" xml:space="preserve" class=""><g><g> <path id="WhatsApp" d="M90,43.841c0,24.213-19.779,43.841-44.182,43.841c-7.747,0-15.025-1.98-21.357-5.455L0,90l7.975-23.522 c-4.023-6.606-6.34-14.354-6.34-22.637C1.635,19.628,21.416,0,45.818,0C70.223,0,90,19.628,90,43.841z M45.818,6.982 c-20.484,0-37.146,16.535-37.146,36.859c0,8.065,2.629,15.534,7.076,21.61L11.107,79.14l14.275-4.537 c5.865,3.851,12.891,6.097,20.437,6.097c20.481,0,37.146-16.533,37.146-36.857S66.301,6.982,45.818,6.982z M68.129,53.938 c-0.273-0.447-0.994-0.717-2.076-1.254c-1.084-0.537-6.41-3.138-7.4-3.495c-0.993-0.358-1.717-0.538-2.438,0.537 c-0.721,1.076-2.797,3.495-3.43,4.212c-0.632,0.719-1.263,0.809-2.347,0.271c-1.082-0.537-4.571-1.673-8.708-5.333 c-3.219-2.848-5.393-6.364-6.025-7.441c-0.631-1.075-0.066-1.656,0.475-2.191c0.488-0.482,1.084-1.255,1.625-1.882 c0.543-0.628,0.723-1.075,1.082-1.793c0.363-0.717,0.182-1.344-0.09-1.883c-0.27-0.537-2.438-5.825-3.34-7.977 c-0.902-2.15-1.803-1.792-2.436-1.792c-0.631,0-1.354-0.09-2.076-0.09c-0.722,0-1.896,0.269-2.889,1.344 c-0.992,1.076-3.789,3.676-3.789,8.963c0,5.288,3.879,10.397,4.422,11.113c0.541,0.716,7.49,11.92,18.5,16.223 C58.2,65.771,58.2,64.336,60.186,64.156c1.984-0.179,6.406-2.599,7.312-5.107C68.398,56.537,68.398,54.386,68.129,53.938z"/> </g></g> </svg> </span>
796
  <span class="simplesocialtxt">Whatsapp</span>
797
  </button>';
798
  } else {
799
 
800
- $arrButtonsCode[] = '<button onclick="javascript:window.open(this.dataset.href, \'_blank\' );return false;" class="simplesocial-whatsapp-share" data-href="https://api.whatsapp.com/send?text=' . $permalink . '"><span class="simplesocialtxt">WhatsApp</span></button>';
801
  }
802
  break;
803
  case 'viber':
@@ -819,7 +819,7 @@ class SimpleSocialButtonsPR {
819
  break;
820
  case 'messenger':
821
  $link = urlencode( $permalink );
822
- $messenger_share_url = $this->is_mobile() ? "fb-messenger://share/?link=$link?app_id=$this->fb_app_id" : "http://www.facebook.com/dialog/send?app_id=$this->fb_app_id&redirect_uri=$link&link=$link&display=popup";
823
 
824
  if ( $this->selected_theme == 'simple-icons' ) {
825
  $arrButtonsCode[] = '<button onclick="javascript:window.open(this.dataset.href, \'_blank\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600\' );return false;" class="simplesocial-viber-share ssb_msng-icon" data-href=' . $messenger_share_url . '>
@@ -1401,13 +1401,13 @@ class SimpleSocialButtonsPR {
1401
  break;
1402
  case 'whatsapp':
1403
  if ( $this->selected_theme == 'simple-icons' ) {
1404
- $arrButtonsCode[] = ' <button onclick="javascript:window.open(this.dataset.href, \'_blank\' );return false;" class="simplesocial-whatsapp-share ssb_whatsapp-icon" data-href="https://api.whatsapp.com/send?text=' . $permalink . '"><span class="simplesocialtxt">
1405
  <span class="icon"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 90 90" style="enable-background:new 0 0 90 90;" xml:space="preserve" class=""><g><g> <path id="WhatsApp" d="M90,43.841c0,24.213-19.779,43.841-44.182,43.841c-7.747,0-15.025-1.98-21.357-5.455L0,90l7.975-23.522 c-4.023-6.606-6.34-14.354-6.34-22.637C1.635,19.628,21.416,0,45.818,0C70.223,0,90,19.628,90,43.841z M45.818,6.982 c-20.484,0-37.146,16.535-37.146,36.859c0,8.065,2.629,15.534,7.076,21.61L11.107,79.14l14.275-4.537 c5.865,3.851,12.891,6.097,20.437,6.097c20.481,0,37.146-16.533,37.146-36.857S66.301,6.982,45.818,6.982z M68.129,53.938 c-0.273-0.447-0.994-0.717-2.076-1.254c-1.084-0.537-6.41-3.138-7.4-3.495c-0.993-0.358-1.717-0.538-2.438,0.537 c-0.721,1.076-2.797,3.495-3.43,4.212c-0.632,0.719-1.263,0.809-2.347,0.271c-1.082-0.537-4.571-1.673-8.708-5.333 c-3.219-2.848-5.393-6.364-6.025-7.441c-0.631-1.075-0.066-1.656,0.475-2.191c0.488-0.482,1.084-1.255,1.625-1.882 c0.543-0.628,0.723-1.075,1.082-1.793c0.363-0.717,0.182-1.344-0.09-1.883c-0.27-0.537-2.438-5.825-3.34-7.977 c-0.902-2.15-1.803-1.792-2.436-1.792c-0.631,0-1.354-0.09-2.076-0.09c-0.722,0-1.896,0.269-2.889,1.344 c-0.992,1.076-3.789,3.676-3.789,8.963c0,5.288,3.879,10.397,4.422,11.113c0.541,0.716,7.49,11.92,18.5,16.223 C58.2,65.771,58.2,64.336,60.186,64.156c1.984-0.179,6.406-2.599,7.312-5.107C68.398,56.537,68.398,54.386,68.129,53.938z"/> </g></g> </svg> </span>
1406
  <span class="simplesocialtxt">Whatsapp</span>
1407
  </button>';
1408
  } else {
1409
 
1410
- $arrButtonsCode[] = '<button onclick="javascript:window.open(this.dataset.href, \'_blank\' );return false;" class="simplesocial-whatsapp-share" data-href="https://api.whatsapp.com/send?text=' . $permalink . '"><span class="simplesocialtxt">WhatsApp</span></button>';
1411
  }
1412
  break;
1413
 
@@ -1431,7 +1431,7 @@ class SimpleSocialButtonsPR {
1431
 
1432
  case 'messenger':
1433
  $link = urlencode( $permalink );
1434
- $messenger_share_url = $this->is_mobile() ? "fb-messenger://share/?link=$link?app_id=$this->fb_app_id" : "http://www.facebook.com/dialog/send?app_id=$this->fb_app_id&redirect_uri=$link&link=$link&display=popup";
1435
 
1436
  if ( $this->selected_theme == 'simple-icons' ) {
1437
  $arrButtonsCode[] = '<button onclick="javascript:window.open(this.dataset.href, \'_blank\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600\' );return false;" class="simplesocial-viber-share ssb_msng-icon" data-href=' . $messenger_share_url . '>
@@ -1712,21 +1712,7 @@ class SimpleSocialButtonsPR {
1712
  }
1713
  }
1714
 
1715
- /**
1716
- * Detect if mobile.
1717
- *
1718
- * @since 2.0.13
1719
- */
1720
- public function is_mobile() {
1721
-
1722
- $useragent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : 'none';
1723
 
1724
- if ( preg_match( '/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i', $useragent ) || preg_match( '/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i', substr( $useragent, 0, 4 ) ) ) {
1725
- return true;
1726
- } else {
1727
- return false;
1728
- }
1729
- }
1730
 
1731
  /**
1732
  * convert url http to https or vice versa
3
  * Plugin Name: Simple Social Buttons
4
  * Plugin URI: http://www.WPBrigade.com/wordpress/plugins/simple-social-buttons/
5
  * Description: Simple Social Buttons adds an advanced set of social media sharing buttons to your WordPress sites, such as: Google +1, Facebook, WhatsApp, Viber, Twitter, Reddit, LinkedIn and Pinterest. This makes it the most <code>Flexible Social Sharing Plugin ever for Everyone.</code>
6
+ * Version: 2.1.0
7
  * Author: WPBrigade
8
  * Author URI: http://www.WPBrigade.com/
9
  * Text Domain: simple-social-buttons
30
 
31
  class SimpleSocialButtonsPR {
32
  public $pluginName = 'Simple Social Buttons';
33
+ public $pluginVersion = '2.1.0';
34
  public $pluginPrefix = 'ssb_pr_';
35
  public $hideCustomMetaKey = '_ssb_hide';
36
  private $fb_app_id = '891268654262273';
791
  break;
792
  case 'whatsapp':
793
  if ( $this->selected_theme == 'simple-icons' ) {
794
+ $arrButtonsCode[] = ' <button onclick="javascript:window.open(this.dataset.href, \'_blank\' );return false;" class="ssb_whatsapp-icon simplesocial-whatsapp-share" data-href="' . ssb_whats_app_share_link( $permalink ). '"><span class="simplesocialtxt">
795
  <span class="icon"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 90 90" style="enable-background:new 0 0 90 90;" xml:space="preserve" class=""><g><g> <path id="WhatsApp" d="M90,43.841c0,24.213-19.779,43.841-44.182,43.841c-7.747,0-15.025-1.98-21.357-5.455L0,90l7.975-23.522 c-4.023-6.606-6.34-14.354-6.34-22.637C1.635,19.628,21.416,0,45.818,0C70.223,0,90,19.628,90,43.841z M45.818,6.982 c-20.484,0-37.146,16.535-37.146,36.859c0,8.065,2.629,15.534,7.076,21.61L11.107,79.14l14.275-4.537 c5.865,3.851,12.891,6.097,20.437,6.097c20.481,0,37.146-16.533,37.146-36.857S66.301,6.982,45.818,6.982z M68.129,53.938 c-0.273-0.447-0.994-0.717-2.076-1.254c-1.084-0.537-6.41-3.138-7.4-3.495c-0.993-0.358-1.717-0.538-2.438,0.537 c-0.721,1.076-2.797,3.495-3.43,4.212c-0.632,0.719-1.263,0.809-2.347,0.271c-1.082-0.537-4.571-1.673-8.708-5.333 c-3.219-2.848-5.393-6.364-6.025-7.441c-0.631-1.075-0.066-1.656,0.475-2.191c0.488-0.482,1.084-1.255,1.625-1.882 c0.543-0.628,0.723-1.075,1.082-1.793c0.363-0.717,0.182-1.344-0.09-1.883c-0.27-0.537-2.438-5.825-3.34-7.977 c-0.902-2.15-1.803-1.792-2.436-1.792c-0.631,0-1.354-0.09-2.076-0.09c-0.722,0-1.896,0.269-2.889,1.344 c-0.992,1.076-3.789,3.676-3.789,8.963c0,5.288,3.879,10.397,4.422,11.113c0.541,0.716,7.49,11.92,18.5,16.223 C58.2,65.771,58.2,64.336,60.186,64.156c1.984-0.179,6.406-2.599,7.312-5.107C68.398,56.537,68.398,54.386,68.129,53.938z"/> </g></g> </svg> </span>
796
  <span class="simplesocialtxt">Whatsapp</span>
797
  </button>';
798
  } else {
799
 
800
+ $arrButtonsCode[] = '<button onclick="javascript:window.open(this.dataset.href, \'_blank\' );return false;" class="simplesocial-whatsapp-share" data-href="https://api.whatsapp.com/send?text=' . ssb_whats_app_share_link( $permalink ) . '"><span class="simplesocialtxt">WhatsApp</span></button>';
801
  }
802
  break;
803
  case 'viber':
819
  break;
820
  case 'messenger':
821
  $link = urlencode( $permalink );
822
+ $messenger_share_url = is_mobile() ? "fb-messenger://share/?link=$link?app_id=$this->fb_app_id" : "http://www.facebook.com/dialog/send?app_id=$this->fb_app_id&redirect_uri=$link&link=$link&display=popup";
823
 
824
  if ( $this->selected_theme == 'simple-icons' ) {
825
  $arrButtonsCode[] = '<button onclick="javascript:window.open(this.dataset.href, \'_blank\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600\' );return false;" class="simplesocial-viber-share ssb_msng-icon" data-href=' . $messenger_share_url . '>
1401
  break;
1402
  case 'whatsapp':
1403
  if ( $this->selected_theme == 'simple-icons' ) {
1404
+ $arrButtonsCode[] = ' <button onclick="javascript:window.open(this.dataset.href, \'_blank\' );return false;" class="simplesocial-whatsapp-share ssb_whatsapp-icon" data-href="https://api.whatsapp.com/send?text=' . ssb_whats_app_share_link( $permalink ) . '"><span class="simplesocialtxt">
1405
  <span class="icon"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 90 90" style="enable-background:new 0 0 90 90;" xml:space="preserve" class=""><g><g> <path id="WhatsApp" d="M90,43.841c0,24.213-19.779,43.841-44.182,43.841c-7.747,0-15.025-1.98-21.357-5.455L0,90l7.975-23.522 c-4.023-6.606-6.34-14.354-6.34-22.637C1.635,19.628,21.416,0,45.818,0C70.223,0,90,19.628,90,43.841z M45.818,6.982 c-20.484,0-37.146,16.535-37.146,36.859c0,8.065,2.629,15.534,7.076,21.61L11.107,79.14l14.275-4.537 c5.865,3.851,12.891,6.097,20.437,6.097c20.481,0,37.146-16.533,37.146-36.857S66.301,6.982,45.818,6.982z M68.129,53.938 c-0.273-0.447-0.994-0.717-2.076-1.254c-1.084-0.537-6.41-3.138-7.4-3.495c-0.993-0.358-1.717-0.538-2.438,0.537 c-0.721,1.076-2.797,3.495-3.43,4.212c-0.632,0.719-1.263,0.809-2.347,0.271c-1.082-0.537-4.571-1.673-8.708-5.333 c-3.219-2.848-5.393-6.364-6.025-7.441c-0.631-1.075-0.066-1.656,0.475-2.191c0.488-0.482,1.084-1.255,1.625-1.882 c0.543-0.628,0.723-1.075,1.082-1.793c0.363-0.717,0.182-1.344-0.09-1.883c-0.27-0.537-2.438-5.825-3.34-7.977 c-0.902-2.15-1.803-1.792-2.436-1.792c-0.631,0-1.354-0.09-2.076-0.09c-0.722,0-1.896,0.269-2.889,1.344 c-0.992,1.076-3.789,3.676-3.789,8.963c0,5.288,3.879,10.397,4.422,11.113c0.541,0.716,7.49,11.92,18.5,16.223 C58.2,65.771,58.2,64.336,60.186,64.156c1.984-0.179,6.406-2.599,7.312-5.107C68.398,56.537,68.398,54.386,68.129,53.938z"/> </g></g> </svg> </span>
1406
  <span class="simplesocialtxt">Whatsapp</span>
1407
  </button>';
1408
  } else {
1409
 
1410
+ $arrButtonsCode[] = '<button onclick="javascript:window.open(this.dataset.href, \'_blank\' );return false;" class="simplesocial-whatsapp-share" data-href="https://api.whatsapp.com/send?text=' . ssb_whats_app_share_link( $permalink ) . '"><span class="simplesocialtxt">WhatsApp</span></button>';
1411
  }
1412
  break;
1413
 
1431
 
1432
  case 'messenger':
1433
  $link = urlencode( $permalink );
1434
+ $messenger_share_url = is_mobile() ? "fb-messenger://share/?link=$link?app_id=$this->fb_app_id" : "http://www.facebook.com/dialog/send?app_id=$this->fb_app_id&redirect_uri=$link&link=$link&display=popup";
1435
 
1436
  if ( $this->selected_theme == 'simple-icons' ) {
1437
  $arrButtonsCode[] = '<button onclick="javascript:window.open(this.dataset.href, \'_blank\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600\' );return false;" class="simplesocial-viber-share ssb_msng-icon" data-href=' . $messenger_share_url . '>
1712
  }
1713
  }
1714
 
 
 
 
 
 
 
 
 
1715
 
 
 
 
 
 
 
1716
 
1717
  /**
1718
  * convert url http to https or vice versa
ssb-social-counts/facebook.php CHANGED
@@ -5,8 +5,8 @@ function ssb_format_fbshare_response( $response ) {
5
 
6
  $formatted_response = json_decode( $response , true );
7
  $likes = isset( $formatted_response['og_object'] ) ? $formatted_response['og_object']['likes']['summary']['total_count'] : 0;
8
- $comments = $formatted_response['share']['comment_count'];
9
- $shares = $formatted_response['share']['share_count'];
10
  $total = $likes + $comments + $shares;
11
  return $total;
12
  }
5
 
6
  $formatted_response = json_decode( $response , true );
7
  $likes = isset( $formatted_response['og_object'] ) ? $formatted_response['og_object']['likes']['summary']['total_count'] : 0;
8
+ $comments = isset( $formatted_response['share']['comment_count'] ) ? $formatted_response['share']['comment_count'] : 0;
9
+ $shares = isset( $formatted_response['share']['share_count'] ) ? $formatted_response['share']['share_count'] : 0;
10
  $total = $likes + $comments + $shares;
11
  return $total;
12
  }