WP Socializer - Version 4.1.6

Version Description

  • Fix: Facebook share count is 0
  • New: Load both HTTP and HTTPS share count of the page.
Download this release

Release Info

Developer vaakash
Plugin Icon 128x128 WP Socializer
Version 4.1.6
Comparing to
See all releases

Code changes from version 4.1.5 to 4.1.6

core/lists.php CHANGED
@@ -777,6 +777,8 @@ class WPSR_Lists{
777
 
778
  if( $page == 'gsettings_facebook' ){
779
  return array(
 
 
780
  'facebook_lang' => 'en_US'
781
  );
782
  }
777
 
778
  if( $page == 'gsettings_facebook' ){
779
  return array(
780
+ 'facebook_app_id' => '',
781
+ 'facebook_app_secret' => '',
782
  'facebook_lang' => 'en_US'
783
  );
784
  }
core/share_counter.php CHANGED
@@ -7,7 +7,8 @@
7
  class WPSR_Share_Counter{
8
 
9
  public static $default_settings = array(
10
- 'counter_expiration' => 86400
 
11
  );
12
 
13
  public static function init(){
@@ -96,7 +97,24 @@ class WPSR_Share_Counter{
96
 
97
  public static function get_count( $id, $url ){
98
 
99
- $count = self::service_count( $id, $url );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  $formatted = self::format_count( $count );
101
 
102
  return array(
@@ -222,17 +240,26 @@ class WPSR_Share_Counter{
222
 
223
  public static function facebook_count( $url ){
224
 
225
- $api = 'https://graph.facebook.com/?id=' . $url;
 
 
 
 
 
 
 
 
 
226
  $data = self::remote_request_json( $api );
227
 
228
  if( $data == false ){
229
  return 0;
230
  }else{
231
- if( isset( $data->share->share_count ) ){
232
- return $data->share->share_count;
233
- }else{
234
- return 0;
235
- }
236
  }
237
 
238
  }
@@ -309,4 +336,6 @@ class WPSR_Share_Counter{
309
 
310
  }
311
 
312
- WPSR_Share_Counter::init();
 
 
7
  class WPSR_Share_Counter{
8
 
9
  public static $default_settings = array(
10
+ 'counter_expiration' => 86400,
11
+ 'counter_both_protocols' => 'no'
12
  );
13
 
14
  public static function init(){
97
 
98
  public static function get_count( $id, $url ){
99
 
100
+ $gs = WPSR_Lists::set_defaults( get_option( 'wpsr_general_settings' ), WPSR_Share_Counter::$default_settings );
101
+ $count = 0;
102
+
103
+ if( $gs[ 'counter_both_protocols' ] == 'yes' ){
104
+
105
+ $url_https = str_replace('http://', 'https://', $url);
106
+ $url_http = str_replace('https://', 'http://', $url_https);
107
+
108
+ $count_http = self::service_count( $id, $url_http );
109
+ $count_https = self::service_count( $id, $url_https );
110
+ $count = $count_http + $count_https;
111
+
112
+ }else{
113
+
114
+ $count = self::service_count( $id, $url );
115
+
116
+ }
117
+
118
  $formatted = self::format_count( $count );
119
 
120
  return array(
240
 
241
  public static function facebook_count( $url ){
242
 
243
+ $gs = WPSR_Lists::set_defaults( get_option( 'wpsr_general_settings' ), WPSR_Lists::defaults( 'gsettings_facebook' ) );
244
+ $fb_app_id = $gs[ 'facebook_app_id' ];
245
+ $fb_app_secret = $gs[ 'facebook_app_secret' ];
246
+ $app_token = '';
247
+
248
+ if( !empty( $fb_app_id ) && !empty( $fb_app_secret ) ){
249
+ $app_token = $fb_app_id . '|' . $fb_app_secret;
250
+ }
251
+
252
+ $api = 'https://graph.facebook.com/?id=' . $url . '&fields=engagement&access_token=' . $app_token;
253
  $data = self::remote_request_json( $api );
254
 
255
  if( $data == false ){
256
  return 0;
257
  }else{
258
+ $reaction_count = isset( $data->engagement->reaction_count ) ? intval( $data->engagement->reaction_count ) : 0;
259
+ $comment_count = isset( $data->engagement->comment_count ) ? intval( $data->engagement->comment_count ) : 0;
260
+ $share_count = isset( $data->engagement->share_count ) ? intval( $data->engagement->share_count ) : 0;
261
+ $sum = $reaction_count + $comment_count + $share_count;
262
+ return $sum;
263
  }
264
 
265
  }
336
 
337
  }
338
 
339
+ WPSR_Share_Counter::init();
340
+
341
+ ?>
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: vaakash
3
  Donate link: https://goo.gl/qMF3iE
4
  Tags: sharing, social media icons, share icons, share buttons, follow buttons, widgets, floating share buttons, profile buttons, mobile sharebar, profile icons, social bar, share counter, excerpt, shortcode, linkedin, pinterest, pocket, reddit, sharethis, addthis, whatsapp, tweet, vkontakte, socializer, wp socializer, weibo, line, mix, odnoklassniki, renren, skype
5
  Requires at least: 4.6
6
- Tested up to: 5.1
7
- Stable tag: 4.1.5
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -223,6 +223,10 @@ Please refer [this page](https://goo.gl/Ge7riC) for the full list of FAQs.
223
 
224
  == Changelog ==
225
 
 
 
 
 
226
  = 4.1.5 =
227
  * Fix: Google Plus icon, buttons, social count removed.
228
  * Fix: Social icons advanced settings not applied properly.
3
  Donate link: https://goo.gl/qMF3iE
4
  Tags: sharing, social media icons, share icons, share buttons, follow buttons, widgets, floating share buttons, profile buttons, mobile sharebar, profile icons, social bar, share counter, excerpt, shortcode, linkedin, pinterest, pocket, reddit, sharethis, addthis, whatsapp, tweet, vkontakte, socializer, wp socializer, weibo, line, mix, odnoklassniki, renren, skype
5
  Requires at least: 4.6
6
+ Tested up to: 5.1.1
7
+ Stable tag: 4.1.6
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
223
 
224
  == Changelog ==
225
 
226
+ = 4.1.6 =
227
+ * Fix: Facebook share count is 0
228
+ * New: Load both HTTP and HTTPS share count of the page.
229
+
230
  = 4.1.5 =
231
  * Fix: Google Plus icon, buttons, social count removed.
232
  * Fix: Social icons advanced settings not applied properly.
services/facebook.php CHANGED
@@ -201,6 +201,18 @@ class wpsr_service_facebook{
201
  $values = WPSR_Lists::set_defaults( $values, WPSR_Lists::defaults( 'gsettings_facebook' ) );
202
 
203
  $section1 = array(
 
 
 
 
 
 
 
 
 
 
 
 
204
  array( __( 'Facebook SDK language', 'wpsr' ), WPSR_Admin::field( 'select', array(
205
  'name' => 'facebook_lang',
206
  'value' => $values['facebook_lang'],
201
  $values = WPSR_Lists::set_defaults( $values, WPSR_Lists::defaults( 'gsettings_facebook' ) );
202
 
203
  $section1 = array(
204
+
205
+ array( __( 'Facebook App ID', 'wpsr' ), WPSR_Admin::field( 'text', array(
206
+ 'name' => 'facebook_app_id',
207
+ 'value' => $values['facebook_app_id'],
208
+ ))),
209
+
210
+ array( __( 'Facebook App secret', 'wpsr' ), WPSR_Admin::field( 'text', array(
211
+ 'name' => 'facebook_app_secret',
212
+ 'value' => $values['facebook_app_secret'],
213
+ 'helper' => 'You can find your facebook app ID and secret in <a href="https://developers.facebook.com/apps/" target="_blank">this page</a> under your app --> Settings --> Basic. Please create a new facebook app if there are no apps. This is used to retrieve facebook share/like count on the URLs.'
214
+ ))),
215
+
216
  array( __( 'Facebook SDK language', 'wpsr' ), WPSR_Admin::field( 'select', array(
217
  'name' => 'facebook_lang',
218
  'value' => $values['facebook_lang'],
services/share_counter.php CHANGED
@@ -128,6 +128,17 @@ class wpsr_service_share_counter{
128
  'value' => $values['counter_expiration'],
129
  'helper' => __( 'Enter the number of seconds to cache the social service counter in DB. Note: If duration is small, counter synchronization will be frequent and site can slow down. Ideal duration to cache the entries would be 86400 seconds ( 1 day ). Min duration which can be set is 1800 secs ( 1/2 hrs )', 'wpsr' ),
130
  ))),
 
 
 
 
 
 
 
 
 
 
 
131
  );
132
 
133
  WPSR_Admin::build_table( $section1, 'Counter settings' );
128
  'value' => $values['counter_expiration'],
129
  'helper' => __( 'Enter the number of seconds to cache the social service counter in DB. Note: If duration is small, counter synchronization will be frequent and site can slow down. Ideal duration to cache the entries would be 86400 seconds ( 1 day ). Min duration which can be set is 1800 secs ( 1/2 hrs )', 'wpsr' ),
130
  ))),
131
+
132
+ array( __( 'Load share count for both http and https URL of the page ?', 'wpsr' ), WPSR_Admin::field( 'select', array(
133
+ 'name' => 'counter_both_protocols',
134
+ 'value' => $values['counter_both_protocols'],
135
+ 'list' => array(
136
+ 'no' => 'No',
137
+ 'yes' => 'Yes'
138
+ ),
139
+ 'helper' => __( 'Note: This may slow down the first ajax request made by the page after the counter cache has expired as per the above setting', 'wpsr' )
140
+ ))),
141
+
142
  );
143
 
144
  WPSR_Admin::build_table( $section1, 'Counter settings' );
wpsr.php CHANGED
@@ -3,14 +3,14 @@
3
  * Plugin Name: WP Socializer
4
  * Plugin URI: https://www.aakashweb.com/wordpress-plugins/wp-socializer/
5
  * Description: WP Socializer is an all in one complete social media plugin to add native social media buttons, icons, floating sharebar, follow us buttons, profile icons, mobile sharebar and selected text share popups easily with complete control and customization.
6
- * Version: 4.1.5
7
  * Author: Aakash Chakravarthy
8
  * Author URI: https://www.aakashweb.com
9
  * Text Domain: wpsr
10
  * Domain Path: /languages
11
  */
12
 
13
- define( 'WPSR_VERSION', '4.1.5' );
14
  define( 'WPSR_PATH', plugin_dir_path( __FILE__ ) ); // All have trailing slash
15
  define( 'WPSR_URL', plugin_dir_url( __FILE__ ) );
16
  define( 'WPSR_ADMIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) . 'admin' ) );
3
  * Plugin Name: WP Socializer
4
  * Plugin URI: https://www.aakashweb.com/wordpress-plugins/wp-socializer/
5
  * Description: WP Socializer is an all in one complete social media plugin to add native social media buttons, icons, floating sharebar, follow us buttons, profile icons, mobile sharebar and selected text share popups easily with complete control and customization.
6
+ * Version: 4.1.6
7
  * Author: Aakash Chakravarthy
8
  * Author URI: https://www.aakashweb.com
9
  * Text Domain: wpsr
10
  * Domain Path: /languages
11
  */
12
 
13
+ define( 'WPSR_VERSION', '4.1.6' );
14
  define( 'WPSR_PATH', plugin_dir_path( __FILE__ ) ); // All have trailing slash
15
  define( 'WPSR_URL', plugin_dir_url( __FILE__ ) );
16
  define( 'WPSR_ADMIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) . 'admin' ) );