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

Version Description

  • Several bug fixes, in addition to -
  • Huge update! The plugin has been completely re-written from the ground up to be faster, simpler to use
  • Choose from snazzy new Related Post themes
  • Related Posts now come mobile optimized and responsive out of the box - Shareaholic automagically determines how many Related Posts to show given how much screen width it is given
  • Customize your "You may also like" Related Posts text
  • Option to exclude any URL from Related Posts
  • Choose from new Share button themes! (including vertical share buttons!)
  • Additional URL shortener options
Download this release

Release Info

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

Code changes from version 7.0.0.4 to 7.0.0.5

admin.php CHANGED
@@ -222,7 +222,8 @@ class ShareaholicAdmin {
222
 
223
  }
224
 
225
- ShareaholicUtilities::get_new_location_name_ids($settings['api_key']);
 
226
  self::draw_deprecation_warnings();
227
  self::draw_admin_form();
228
  self::draw_verify_api_key();
@@ -233,6 +234,7 @@ class ShareaholicAdmin {
233
  */
234
  public static function advanced_admin() {
235
  $settings = ShareaholicUtilities::get_settings();
 
236
 
237
  if (!ShareaholicUtilities::has_accepted_terms_of_service()) {
238
  ShareaholicUtilities::load_template('terms_of_service_modal', array(
@@ -252,7 +254,7 @@ class ShareaholicAdmin {
252
  }
253
  }
254
 
255
- if ($_POST['shareaholic']['api_key'] != $settings['api_key']) {
256
  ShareaholicUtilities::get_new_location_name_ids($_POST['shareaholic']['api_key']);
257
  }
258
 
@@ -318,4 +320,4 @@ class ShareaholicAdmin {
318
  }
319
  }
320
  }
321
- ?>
222
 
223
  }
224
 
225
+ $api_key = ShareaholicUtilities::get_or_create_api_key();
226
+ ShareaholicUtilities::get_new_location_name_ids($api_key);
227
  self::draw_deprecation_warnings();
228
  self::draw_admin_form();
229
  self::draw_verify_api_key();
234
  */
235
  public static function advanced_admin() {
236
  $settings = ShareaholicUtilities::get_settings();
237
+ $api_key = ShareaholicUtilities::get_or_create_api_key();
238
 
239
  if (!ShareaholicUtilities::has_accepted_terms_of_service()) {
240
  ShareaholicUtilities::load_template('terms_of_service_modal', array(
254
  }
255
  }
256
 
257
+ if ($_POST['shareaholic']['api_key'] != $api_key) {
258
  ShareaholicUtilities::get_new_location_name_ids($_POST['shareaholic']['api_key']);
259
  }
260
 
320
  }
321
  }
322
  }
323
+ ?>
assets/img/circle_green.png ADDED
Binary file
assets/img/circle_yellow.png ADDED
Binary file
curl.php CHANGED
@@ -37,12 +37,40 @@ class ShareaholicCurl {
37
  return self::send_request_with_wp($url, $data, $data_type, 'GET');
38
  }
39
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  private static function send_request_with_wp($url, $data, $data_type, $method) {
 
 
 
 
 
41
  if ($method == 'GET') {
42
  $response = wp_remote_get($url, array('body' => $data));
43
  } elseif ($method == 'POST') {
44
- $response = wp_remote_post($url, array('body' => $data));
 
 
 
 
 
 
 
 
 
 
45
  }
 
46
  $result = $response['body'];
47
  return ShareaholicUtilities::object_to_array(json_decode($result)) ?
48
  ShareaholicUtilities::object_to_array(json_decode($result)) : $result;
37
  return self::send_request_with_wp($url, $data, $data_type, 'GET');
38
  }
39
 
40
+ /**
41
+ *
42
+ * Performs a request using the methods built into WordPress, which account for
43
+ * various PHP eccenctricities.
44
+ *
45
+ * @param string $url
46
+ * @param array $data an associative array of the data
47
+ * @param string $data_type either an empty string or 'json'
48
+ * @param string $method the HTTP verb to be used
49
+ *
50
+ * @return array the returned data json decoded
51
+ */
52
  private static function send_request_with_wp($url, $data, $data_type, $method) {
53
+ ShareaholicUtilities::log($url);
54
+ ShareaholicUtilities::log($data);
55
+ ShareaholicUtilities::log($data_type);
56
+ ShareaholicUtilities::log($method);
57
+ ShareaholicUtilities::log('-----------------');
58
  if ($method == 'GET') {
59
  $response = wp_remote_get($url, array('body' => $data));
60
  } elseif ($method == 'POST') {
61
+ $request = array();
62
+ if ($data_type == 'json') {
63
+ $request['headers'] = array(
64
+ 'Content-Type' => 'application/json'
65
+ );
66
+ $request['body'] = json_encode($data);
67
+ } else {
68
+ $request['body'] = $data;
69
+ }
70
+ $request['headers']['Accept'] = 'application/json';
71
+ $response = wp_remote_post($url, $request);
72
  }
73
+
74
  $result = $response['body'];
75
  return ShareaholicUtilities::object_to_array(json_decode($result)) ?
76
  ShareaholicUtilities::object_to_array(json_decode($result)) : $result;
deprecation.php CHANGED
@@ -68,4 +68,4 @@ class ShareaholicDeprecation {
68
  }
69
 
70
 
71
- ?>
68
  }
69
 
70
 
71
+ ?>
global_functions.php CHANGED
@@ -34,4 +34,4 @@ function get_shr_like_buttonset($position) {
34
  echo ShareaholicPublic::canvas($id, 'share_buttons');
35
  }
36
 
37
- ?>
34
  echo ShareaholicPublic::canvas($id, 'share_buttons');
35
  }
36
 
37
+ ?>
notifier.php CHANGED
@@ -24,7 +24,7 @@ class ShareaholicNotifier {
24
  $url = get_permalink($post_id);
25
  $tags = wp_get_post_tags($post_id, array('fields' => 'name'));
26
 
27
- $categories = array_map(array(self, 'post_notify_iterator'), get_the_category($post_id));
28
 
29
  if (has_post_thumbnail($post_id)) {
30
  $featured_image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'large');
@@ -70,7 +70,7 @@ class ShareaholicNotifier {
70
  $url = self::URL . '/notify';
71
  $response = ShareaholicCurl::post($url, $notification, 'json');
72
 
73
- if ($response['result'] == 'success') {
74
  return true;
75
  } else {
76
  return false;
@@ -78,4 +78,4 @@ class ShareaholicNotifier {
78
  }
79
  }
80
 
81
- ?>
24
  $url = get_permalink($post_id);
25
  $tags = wp_get_post_tags($post_id, array('fields' => 'name'));
26
 
27
+ $categories = array_map(array('ShareaholicNotifier', 'post_notify_iterator'), get_the_category($post_id));
28
 
29
  if (has_post_thumbnail($post_id)) {
30
  $featured_image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'large');
70
  $url = self::URL . '/notify';
71
  $response = ShareaholicCurl::post($url, $notification, 'json');
72
 
73
+ if ($response && $response['result'] == 'success') {
74
  return true;
75
  } else {
76
  return false;
78
  }
79
  }
80
 
81
+ ?>
public.php CHANGED
@@ -195,9 +195,9 @@ class ShareaholicPublic {
195
  return "<div class='shareaholic-canvas'
196
  data-app-id='$id'
197
  data-app='$app'
198
- data-title='" . urlencode($post->post_title) . "'
199
  data-link='" . get_permalink($post->ID) . "'
200
- data-summary='" . urlencode($post->post_excerpt) . "'></div>";
201
  }
202
  }
203
 
195
  return "<div class='shareaholic-canvas'
196
  data-app-id='$id'
197
  data-app='$app'
198
+ data-title='" . htmlspecialchars($post->post_title, ENT_QUOTES) . "'
199
  data-link='" . get_permalink($post->ID) . "'
200
+ data-summary='" . urlencode(strip_tags(strip_shortcodes($post->post_excerpt))) . "'></div>";
201
  }
202
  }
203
 
query_string_builder.php CHANGED
@@ -121,4 +121,4 @@ class ShareaholicQueryStringBuilder {
121
  }
122
  }
123
 
124
- ?>
121
  }
122
  }
123
 
124
+ ?>
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, tweet button, twitter button, fark, buffer, myspace, orkut, netlog, hubspot, weheartit, printfriendly, yammer, 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, shortcode, yaarp, yarpp, nrelate, outbrain, linkwithin, related content, related posts, related, popular posts, popular, thumbnails, recommendations
4
  Requires at least: 2.7
5
  Tested up to: 3.5.2
6
- Stable tag: 7.0.0.4
7
 
8
  Adds an attractive social bookmarking menu and related content widget to your posts, pages, index, or any combination of the three.
9
 
@@ -141,7 +141,7 @@ Please see here: [Usage & Installation Instructions](https://shareaholic.com/too
141
 
142
  == Changelog ==
143
 
144
- = 7.0.0.4 =
145
  * Several bug fixes, in addition to -
146
  * Huge update! The plugin has been completely re-written from the ground up to be faster, simpler to use
147
  * Choose from snazzy new Related Post themes
@@ -870,7 +870,7 @@ Please see here: [Usage & Installation Instructions](https://shareaholic.com/too
870
 
871
  == Upgrade Notice ==
872
 
873
- = 7.0.0.4 =
874
  * Huge update! Completely re-written from the ground up to be faster and with a new simple interface! Includes brand new Share button themes (including vertical share buttons!) and Related posts themes. Related Posts now come mobile optimized and responsive out of the box - Shareaholic automagically determines how many Related Posts to show given how much screen width it is given. You can now even customize your "You may also like" text and exclude URLs.
875
 
876
  = 6.1.3.5 =
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, tweet button, twitter button, fark, buffer, myspace, orkut, netlog, hubspot, weheartit, printfriendly, yammer, 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, shortcode, yaarp, yarpp, nrelate, outbrain, linkwithin, related content, related posts, related, popular posts, popular, thumbnails, recommendations
4
  Requires at least: 2.7
5
  Tested up to: 3.5.2
6
+ Stable tag: 7.0.0.5
7
 
8
  Adds an attractive social bookmarking menu and related content widget to your posts, pages, index, or any combination of the three.
9
 
141
 
142
  == Changelog ==
143
 
144
+ = 7.0.0.5 =
145
  * Several bug fixes, in addition to -
146
  * Huge update! The plugin has been completely re-written from the ground up to be faster, simpler to use
147
  * Choose from snazzy new Related Post themes
870
 
871
  == Upgrade Notice ==
872
 
873
+ = 7.0.0.5 =
874
  * Huge update! Completely re-written from the ground up to be faster and with a new simple interface! Includes brand new Share button themes (including vertical share buttons!) and Related posts themes. Related Posts now come mobile optimized and responsive out of the box - Shareaholic automagically determines how many Related Posts to show given how much screen width it is given. You can now even customize your "You may also like" text and exclude URLs.
875
 
876
  = 6.1.3.5 =
shareaholic.php CHANGED
@@ -8,7 +8,7 @@
8
  Plugin Name: Shareaholic | share buttons, analytics, related content
9
  Plugin URI: https://shareaholic.com/publishers/
10
  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.
11
- Version: 7.0.0.4
12
  Author: Shareaholic
13
  Author URI: https://shareaholic.com
14
  Credits & Thanks: https://shareaholic.com/tools/wordpress/credits
@@ -39,7 +39,7 @@ require_once(SHAREAHOLIC_DIR . '/deprecation.php');
39
  */
40
  class Shareaholic {
41
  const URL = 'https://shareaholic.com';
42
- const VERSION = '7.0.0.4';
43
  private static $instance = false;
44
 
45
  /**
@@ -95,16 +95,20 @@ class Shareaholic {
95
 
96
  /**
97
  * Runs any update code if the version is different from what's
98
- * stored in the settings.
 
99
  */
100
  public static function update() {
101
- if (!ShareaholicUtilities::has_accepted_terms_of_service()) {
102
- add_action('admin_notices', array('ShareaholicAdmin', 'show_terms_of_service'));
103
- } else {
104
- if (ShareaholicUtilities::get_version() != self::VERSION) {
105
- ShareaholicUtilities::log_event("Upgrade", array ('previous_plugin_version' => ShareaholicUtilities::get_version()));
106
- ShareaholicUtilities::perform_update();
107
- ShareaholicUtilities::set_version(self::VERSION);
 
 
 
108
  }
109
  }
110
  }
8
  Plugin Name: Shareaholic | share buttons, analytics, related content
9
  Plugin URI: https://shareaholic.com/publishers/
10
  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.
11
+ Version: 7.0.0.5
12
  Author: Shareaholic
13
  Author URI: https://shareaholic.com
14
  Credits & Thanks: https://shareaholic.com/tools/wordpress/credits
39
  */
40
  class Shareaholic {
41
  const URL = 'https://shareaholic.com';
42
+ const VERSION = '7.0.0.5';
43
  private static $instance = false;
44
 
45
  /**
95
 
96
  /**
97
  * Runs any update code if the version is different from what's
98
+ * stored in the settings. This will only run if we are on the
99
+ * shareaholic admin page to minimize any concurrency issues.
100
  */
101
  public static function update() {
102
+ if (isset($_GET['page']) && preg_match('/shareaholic/', $_GET['page'])) {
103
+ if (!ShareaholicUtilities::has_accepted_terms_of_service()) {
104
+ add_action('admin_notices', array('ShareaholicAdmin', 'show_terms_of_service'));
105
+ } else {
106
+ if (ShareaholicUtilities::get_version() != self::VERSION) {
107
+ ShareaholicUtilities::log_event("Upgrade", array ('previous_plugin_version' => ShareaholicUtilities::get_version()));
108
+ ShareaholicUtilities::perform_update();
109
+ ShareaholicUtilities::set_version(self::VERSION);
110
+ ShareaholicUtilities::recommendations_status_check();
111
+ }
112
  }
113
  }
114
  }
six_to_seven.php CHANGED
@@ -381,4 +381,4 @@ class ShareaholicSixToSeven {
381
  }
382
  }
383
 
384
- ?>
381
  }
382
  }
383
 
384
+ ?>
utilities.php CHANGED
@@ -307,7 +307,8 @@ class ShareaholicUtilities {
307
  return true;
308
  }
309
 
310
- $result = ShareaholicCurl::get(Shareaholic::URL . '/publisher_tools/' . $settings['api_key'] . '/verified');
 
311
 
312
  if ($result == 'true') {
313
  ShareaholicUtilities::update_options(array(
@@ -334,17 +335,33 @@ class ShareaholicUtilities {
334
  update_option('shareaholic_settings', $settings);
335
  }
336
 
 
 
 
 
 
 
 
337
  public static function get_new_location_name_ids($api_key) {
338
  $publisher_configuration = ShareaholicCurl::get(Shareaholic::URL . "/publisher_tools/{$api_key}.json");
339
  $result = array();
340
 
 
341
  if ($publisher_configuration) {
342
  foreach (array('share_buttons', 'recommendations') as $app) {
343
- foreach ($publisher_configuration['apps'][$app]['locations'] as $id => $location) {
344
- $result[$app][$location['name']] = $id;
 
 
 
 
345
  }
346
  }
347
 
 
 
 
 
348
  self::update_location_name_ids($result);
349
  }
350
  }
307
  return true;
308
  }
309
 
310
+ $api_key = self::get_or_create_api_key();
311
+ $result = ShareaholicCurl::get(Shareaholic::URL . '/publisher_tools/' . $api_key . '/verified');
312
 
313
  if ($result == 'true') {
314
  ShareaholicUtilities::update_options(array(
335
  update_option('shareaholic_settings', $settings);
336
  }
337
 
338
+ /**
339
+ *
340
+ * Loads the locations names and their respective ids for an api key
341
+ * and sets them in the shareaholic settings.'
342
+ *
343
+ * @param string $api_key
344
+ */
345
  public static function get_new_location_name_ids($api_key) {
346
  $publisher_configuration = ShareaholicCurl::get(Shareaholic::URL . "/publisher_tools/{$api_key}.json");
347
  $result = array();
348
 
349
+ $load_fail_template = false;
350
  if ($publisher_configuration) {
351
  foreach (array('share_buttons', 'recommendations') as $app) {
352
+ if (isset($publisher_configuration['apps'][$app]['locations'])) {
353
+ foreach ($publisher_configuration['apps'][$app]['locations'] as $id => $location) {
354
+ $result[$app][$location['name']] = $id;
355
+ }
356
+ } else {
357
+ $load_fail_template = true;
358
  }
359
  }
360
 
361
+ if ($load_fail_template) {
362
+ ShareaholicUtilities::load_template('failed_to_create_api_key_modal');
363
+ }
364
+
365
  self::update_location_name_ids($result);
366
  }
367
  }