WordPress Social Tools, Related Posts, Monetization – Shareaholic - Version 7.6.0.8

Version Description

  • Enhancement: Added Google API key to authenticate API calls for Google Plus share counts for improved the reliability
Download this release

Release Info

Developer hngu_shareaholic
Plugin Icon 128x128 WordPress Social Tools, Related Posts, Monetization – Shareaholic
Version 7.6.0.8
Comparing to
See all releases

Code changes from version 7.6.0.7 to 7.6.0.8

lib/social-share-counts/share_count.php CHANGED
@@ -52,7 +52,7 @@ abstract class ShareaholicShareCount {
52
  'callback' => 'linkedin_count_callback',
53
  ),
54
  'google_plus' => array(
55
- 'url' => 'https://clients6.google.com/rpc',
56
  'method' => 'POST',
57
  'timeout' => 2,
58
  'headers' => array('Content-Type' => 'application/json'),
@@ -97,7 +97,7 @@ abstract class ShareaholicShareCount {
97
  'callback' => 'vk_count_callback',
98
  ),
99
  'odnoklassniki' => array(
100
- 'url' => 'http://www.odnoklassniki.ru/dk?st.cmd=extLike&uid=odklcnt0&ref=%s',
101
  'method' => 'GET',
102
  'timeout' => 1,
103
  'callback' => 'odnoklassniki_count_callback',
@@ -135,6 +135,34 @@ abstract class ShareaholicShareCount {
135
  return false;
136
  }
137
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
 
139
  /**
140
  * Callback function for facebook count API
@@ -217,6 +245,11 @@ abstract class ShareaholicShareCount {
217
  )
218
  );
219
 
 
 
 
 
 
220
  $config['google_plus']['body'] = $post_fields;
221
  }
222
 
52
  'callback' => 'linkedin_count_callback',
53
  ),
54
  'google_plus' => array(
55
+ 'url' => 'https://clients6.google.com/rpc?key=AIzaSyCKSbrvQasunBoV16zDH9R33D88CeLr9gQ',
56
  'method' => 'POST',
57
  'timeout' => 2,
58
  'headers' => array('Content-Type' => 'application/json'),
97
  'callback' => 'vk_count_callback',
98
  ),
99
  'odnoklassniki' => array(
100
+ 'url' => 'http://ok.ru/dk?st.cmd=extLike&uid=odklcnt0&ref=%s',
101
  'method' => 'GET',
102
  'timeout' => 1,
103
  'callback' => 'odnoklassniki_count_callback',
135
  return false;
136
  }
137
 
138
+ /**
139
+ * Get the client's ip address
140
+ *
141
+ * NOTE: this function does not care if the IP is spoofed. This is used
142
+ * only by the google plus count API to separate server side calls in order
143
+ * to prevent usage limits. Under normal conditions, a request from a user's
144
+ * browser to this API should not involve any spoofing.
145
+ *
146
+ * @return {Mixed} An IP address as string or false otherwise
147
+ */
148
+ public function get_client_ip() {
149
+ $ip = NULL;
150
+
151
+ if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
152
+ //check for ip from share internet
153
+ $ip = $_SERVER['HTTP_CLIENT_IP'];
154
+ }
155
+ elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
156
+ // Check for the Proxy User
157
+ $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
158
+ }
159
+ else {
160
+ $ip = $_SERVER['REMOTE_ADDR'];
161
+ }
162
+
163
+ return $ip;
164
+ }
165
+
166
 
167
  /**
168
  * Callback function for facebook count API
245
  )
246
  );
247
 
248
+ $ip = $this->get_client_ip();
249
+ if ($ip && !empty($ip)) {
250
+ $post_fields[0]['params']['userIp'] = $ip;
251
+ }
252
+
253
  $config['google_plus']['body'] = $post_fields;
254
  }
255
 
public_js.php CHANGED
@@ -25,8 +25,10 @@ class ShareaholicPublicJS {
25
  $config = array(
26
  'apps' => array(),
27
  'endpoints' => array(
28
- 'local_recs_url' => admin_url('admin-ajax.php') . '?action=shareaholic_permalink_related'
29
- )
 
 
30
  );
31
  $functions_map = self::get_function_definitions();
32
  $share_buttons = self::get_share_buttons_config();
25
  $config = array(
26
  'apps' => array(),
27
  'endpoints' => array(
28
+ 'local_recs_url' => admin_url('admin-ajax.php') . '?action=shareaholic_permalink_related',
29
+ 'share_counts_url' => admin_url('admin-ajax.php') . '?action=shareaholic_share_counts_api'
30
+ ),
31
+ 'user' => ShareaholicUtilities::user_info()
32
  );
33
  $functions_map = self::get_function_definitions();
34
  $share_buttons = self::get_share_buttons_config();
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: shareaholic
3
  Tags: sexybookmarks, shareaholic, shareholic, facebook, twitter, linkedin, URL Shortener, bitly, tinyurl, Goo.gl, Google+1, Google Analytics, Google Plus, Google, Instapaper, Wish List, Digg, Gmail, Google Bookmarks, Translate, Tumblr, AIM, Yahoo Messenger, Delicious, StumbleUpon, mister wong, evernote, add this, addtoany, share this, sharethis, share and follow, share and enjoy, sharing is sexy, sharing is caring, yahoo, reddit, hackernews, houzz, yummly, tweet button, twitter button, fark, buffer, myspace, orkut, netlog, hubspot, weheartit, printfriendly, yammer, wanelo, pinterest, google translate, bookmarks, social, email button, social share, socialize, sociable, sharebar, bookmark button, share button, social bookmarking, bookmarks menu, bookmarking, share, seo, analytics, stats, sharing, facebook like, facebook recommend, WPMU, mutisite, sumome, shortcode, yaarp, yarpp, nrelate, outbrain, linkwithin, related content, related posts, related, popular posts, popular, thumbnails, recommendations
4
  Requires at least: 3.0
5
  Tested up to: 4.1
6
- Stable tag: 7.6.0.7
7
 
8
  The easiest, most effective way to grow your website traffic, effectively engage your audience, monetize, and gain insights for free.
9
 
@@ -169,6 +169,9 @@ Please see here: [Usage & Installation Instructions](http://support.shareaholic.
169
 
170
  == Changelog ==
171
 
 
 
 
172
  = 7.6.0.7 =
173
  * Enhancement: Improved welcome email copy
174
  * Localization
@@ -1181,6 +1184,9 @@ Please see here: [Usage & Installation Instructions](http://support.shareaholic.
1181
 
1182
  == Upgrade Notice ==
1183
 
 
 
 
1184
  = 7.6.0.7 =
1185
 
1186
  Many improvements and bug fixes.
3
  Tags: sexybookmarks, shareaholic, shareholic, facebook, twitter, linkedin, URL Shortener, bitly, tinyurl, Goo.gl, Google+1, Google Analytics, Google Plus, Google, Instapaper, Wish List, Digg, Gmail, Google Bookmarks, Translate, Tumblr, AIM, Yahoo Messenger, Delicious, StumbleUpon, mister wong, evernote, add this, addtoany, share this, sharethis, share and follow, share and enjoy, sharing is sexy, sharing is caring, yahoo, reddit, hackernews, houzz, yummly, tweet button, twitter button, fark, buffer, myspace, orkut, netlog, hubspot, weheartit, printfriendly, yammer, wanelo, pinterest, google translate, bookmarks, social, email button, social share, socialize, sociable, sharebar, bookmark button, share button, social bookmarking, bookmarks menu, bookmarking, share, seo, analytics, stats, sharing, facebook like, facebook recommend, WPMU, mutisite, sumome, shortcode, yaarp, yarpp, nrelate, outbrain, linkwithin, related content, related posts, related, popular posts, popular, thumbnails, recommendations
4
  Requires at least: 3.0
5
  Tested up to: 4.1
6
+ Stable tag: 7.6.0.8
7
 
8
  The easiest, most effective way to grow your website traffic, effectively engage your audience, monetize, and gain insights for free.
9
 
169
 
170
  == Changelog ==
171
 
172
+ = 7.6.0.8 =
173
+ * Enhancement: Added Google API key to authenticate API calls for Google Plus share counts for improved the reliability
174
+
175
  = 7.6.0.7 =
176
  * Enhancement: Improved welcome email copy
177
  * Localization
1184
 
1185
  == Upgrade Notice ==
1186
 
1187
+ = 7.6.0.8 =
1188
+ Added Google API key to authenticate API calls for Google Plus share counts for improved the reliability
1189
+
1190
  = 7.6.0.7 =
1191
 
1192
  Many improvements and bug fixes.
shareaholic.php CHANGED
@@ -3,14 +3,14 @@
3
  * The main file!
4
  *
5
  * @package shareaholic
6
- * @version 7.6.0.7
7
  */
8
 
9
  /*
10
  Plugin Name: Shareaholic | share buttons, analytics, related content
11
  Plugin URI: https://shareaholic.com/publishers/
12
  Description: Whether you want to get people sharing, grow your fans, make money, or know who's reading your content, Shareaholic will help you get it done. See <a href="admin.php?page=shareaholic-settings">configuration panel</a> for more settings.
13
- Version: 7.6.0.7
14
  Author: Shareaholic
15
  Author URI: https://shareaholic.com
16
  Text Domain: shareaholic
@@ -64,7 +64,7 @@ if (!class_exists('Shareaholic')) {
64
  const CM_API_URL = 'https://cm-web.shareaholic.com'; // uses static IPs for firewall whitelisting
65
  const REC_API_URL = 'http://recommendations.shareaholic.com';
66
 
67
- const VERSION = '7.6.0.7';
68
 
69
  /**
70
  * Starts off as false so that ::get_instance() returns
3
  * The main file!
4
  *
5
  * @package shareaholic
6
+ * @version 7.6.0.8
7
  */
8
 
9
  /*
10
  Plugin Name: Shareaholic | share buttons, analytics, related content
11
  Plugin URI: https://shareaholic.com/publishers/
12
  Description: Whether you want to get people sharing, grow your fans, make money, or know who's reading your content, Shareaholic will help you get it done. See <a href="admin.php?page=shareaholic-settings">configuration panel</a> for more settings.
13
+ Version: 7.6.0.8
14
  Author: Shareaholic
15
  Author URI: https://shareaholic.com
16
  Text Domain: shareaholic
64
  const CM_API_URL = 'https://cm-web.shareaholic.com'; // uses static IPs for firewall whitelisting
65
  const REC_API_URL = 'http://recommendations.shareaholic.com';
66
 
67
+ const VERSION = '7.6.0.8';
68
 
69
  /**
70
  * Starts off as false so that ::get_instance() returns
utilities.php CHANGED
@@ -1291,4 +1291,38 @@ class ShareaholicUtilities {
1291
  }
1292
  }
1293
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1294
  }
1291
  }
1292
  }
1293
  }
1294
+
1295
+ public static function user_info() {
1296
+ $current_user = wp_get_current_user();
1297
+
1298
+ if ( !($current_user instanceof WP_User) || !is_user_logged_in()) {
1299
+ return array();
1300
+ }
1301
+
1302
+ $capabilities = $current_user->get_role_caps();
1303
+ $roles = $current_user->roles;
1304
+
1305
+ return array(
1306
+ 'roles' => $current_user->roles,
1307
+ 'capabilities' => array(
1308
+ 'switch_themes' => $capabilities['switch_themes'],
1309
+ 'edit_themes' => $capabilities['edit_themes'],
1310
+ 'activate_plugins' => $capabilities['activate_plugins'],
1311
+ 'edit_plugins' => $capabilities['edit_plugins'],
1312
+ 'manage_options' => $capabilities['manage_options'],
1313
+ 'unfiltered_html' => $capabilities['unfiltered_html'],
1314
+ 'edit_dashboard' => $capabilities['edit_dashboard'],
1315
+ 'update_plugins' => $capabilities['update_plugins'],
1316
+ 'delete_plugins' => $capabilities['delete_plugins'],
1317
+ 'install_plugins' => $capabilities['install_plugins'],
1318
+ 'update_themes' => $capabilities['update_themes'],
1319
+ 'install_themes' => $capabilities['install_themes'],
1320
+ 'update_core' => $capabilities['update_core'],
1321
+ 'edit_theme_options' => $capabilities['edit_theme_options'],
1322
+ 'delete_themes' => $capabilities['delete_themes'],
1323
+ 'administrator' => $capabilities['administrator']
1324
+ ),
1325
+ 'is_super_admin' => is_super_admin()
1326
+ );
1327
+ }
1328
  }