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

Version Description

  • Admin Bar is now configurable
  • Shareaholic.js is now included earlier on the page to load apps faster
  • Bugfix: fixed "non-static method" and "array to string conversion" warnings -- affected servers running newer versions of PHP
  • Related Content
    • Bugfix: Related Content data processing status is now correct
    • Bugfix: Initiate Related Content crawl after site ID is set and not prior to
    • Support for "WordPress SEO by Yoast" plugin meta keywords
    • Support for "Add Meta Tags" plugin meta keywords
  • Analytics
    • Several high impact enhancements to greatly improve data accuracy
Download this release

Release Info

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

Code changes from version 7.2.0.0 to 7.2.1.0

admin.php CHANGED
@@ -283,7 +283,7 @@ class ShareaholicAdmin {
283
  if(isset($_POST['already_submitted']) && $_POST['already_submitted'] == 'Y' &&
284
  check_admin_referer($action, 'nonce_field')) {
285
  echo "<div class='updated settings_updated'><p><strong>". sprintf(__('Settings successfully saved', 'shareaholic')) . "</strong></p></div>";
286
- foreach (array('disable_tracking', 'disable_og_tags') as $setting) {
287
  if (isset($settings[$setting]) &&
288
  !isset($_POST['shareaholic'][$setting]) &&
289
  $settings[$setting] == 'on') {
@@ -308,6 +308,10 @@ class ShareaholicAdmin {
308
  if (isset($_POST['shareaholic']['disable_og_tags'])) {
309
  ShareaholicUtilities::update_options(array('disable_og_tags' => $_POST['shareaholic']['disable_og_tags']));
310
  }
 
 
 
 
311
  }
312
 
313
  ShareaholicUtilities::load_template('advanced_settings', array(
@@ -369,4 +373,4 @@ class ShareaholicAdmin {
369
  }
370
  }
371
  }
372
- ?>
283
  if(isset($_POST['already_submitted']) && $_POST['already_submitted'] == 'Y' &&
284
  check_admin_referer($action, 'nonce_field')) {
285
  echo "<div class='updated settings_updated'><p><strong>". sprintf(__('Settings successfully saved', 'shareaholic')) . "</strong></p></div>";
286
+ foreach (array('disable_tracking', 'disable_og_tags', 'disable_admin_bar_menu') as $setting) {
287
  if (isset($settings[$setting]) &&
288
  !isset($_POST['shareaholic'][$setting]) &&
289
  $settings[$setting] == 'on') {
308
  if (isset($_POST['shareaholic']['disable_og_tags'])) {
309
  ShareaholicUtilities::update_options(array('disable_og_tags' => $_POST['shareaholic']['disable_og_tags']));
310
  }
311
+
312
+ if (isset($_POST['shareaholic']['disable_admin_bar_menu'])) {
313
+ ShareaholicUtilities::update_options(array('disable_admin_bar_menu' => $_POST['shareaholic']['disable_admin_bar_menu']));
314
+ }
315
  }
316
 
317
  ShareaholicUtilities::load_template('advanced_settings', array(
373
  }
374
  }
375
  }
376
+ ?>
public.php CHANGED
@@ -114,15 +114,16 @@ class ShareaholicPublic {
114
  }
115
 
116
  // Get post tags
117
- $keywords = implode(', ', wp_get_post_tags( $id, array('fields' => 'names') ) );
118
-
119
  // Get post categories
120
- $categories = get_the_category($id);
 
121
  $separator = ', ';
122
  $output = '';
123
 
124
- if($categories) {
125
- foreach($categories as $category) {
126
  if ($category->cat_name != "Uncategorized") {
127
  $output .= $separator.$category->cat_name;
128
  }
@@ -137,10 +138,30 @@ class ShareaholicPublic {
137
  $keywords .= $categories;
138
  }
139
 
140
- // Support for All in One SEO Pack keywords
141
- $keywords .= ', '.stripslashes(get_post_meta($post->ID, '_aioseop_keywords', true));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
 
143
- // Encode & trim appropriately
144
  $keywords = trim(trim(strtolower(trim(htmlspecialchars(htmlspecialchars_decode($keywords), ENT_QUOTES))), ","));
145
 
146
  // Unique keywords
114
  }
115
 
116
  // Get post tags
117
+ $keywords = implode(', ', wp_get_post_tags( $id, array('fields' => 'names') ) );
118
+
119
  // Get post categories
120
+ $categories_array = get_the_category($id);
121
+ $categories = '';
122
  $separator = ', ';
123
  $output = '';
124
 
125
+ if($categories_array) {
126
+ foreach($categories_array as $category) {
127
  if ($category->cat_name != "Uncategorized") {
128
  $output .= $separator.$category->cat_name;
129
  }
138
  $keywords .= $categories;
139
  }
140
 
141
+ // Support for "All in One SEO Pack" plugin keywords
142
+ if (get_post_meta($post->ID, '_aioseop_keywords') != NULL){
143
+ $keywords .= ', '.stripslashes(get_post_meta($post->ID, '_aioseop_keywords', true));
144
+ }
145
+
146
+ // Support for "WordPress SEO by Yoast" plugin keywords
147
+ if (get_post_meta($post->ID, '_yoast_wpseo_focuskw') != NULL){
148
+ $keywords .= ', '.stripslashes(get_post_meta($post->ID, '_yoast_wpseo_focuskw', true));
149
+ }
150
+
151
+ if (get_post_meta($post->ID, '_yoast_wpseo_metakeywords') != NULL){
152
+ $keywords .= ', '.stripslashes(get_post_meta($post->ID, '_yoast_wpseo_metakeywords', true));
153
+ }
154
+
155
+ // Support for "Add Meta Tags" plugin keywords
156
+ if (get_post_meta($post->ID, '_amt_keywords') != NULL){
157
+ $keywords .= ', '.stripslashes(get_post_meta($post->ID, '_amt_keywords', true));
158
+ }
159
+
160
+ if (get_post_meta($post->ID, '_amt_news_keywords') != NULL){
161
+ $keywords .= ', '.stripslashes(get_post_meta($post->ID, '_amt_news_keywords', true));
162
+ }
163
 
164
+ // Encode, lowercase & trim appropriately
165
  $keywords = trim(trim(strtolower(trim(htmlspecialchars(htmlspecialchars_decode($keywords), ENT_QUOTES))), ","));
166
 
167
  // Unique keywords
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  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, 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, 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.8
6
- Stable tag: 7.2.0.0
7
 
8
  Adds an attractive social bookmarking menu and related content widget to your posts, pages, index, or any combination of the three.
9
 
@@ -19,6 +19,7 @@ Three powerful apps to amplify your content and create conversations, across the
19
  * Share Counters for Twitter, Facebook, LinkedIn, etc
20
  * Official support for Google's URL shortener (goo.gl) and Google Analytics
21
  * Localized in 15+ languages
 
22
 
23
  = Share Buttons =
24
 
@@ -151,6 +152,18 @@ Please see here: [Usage & Installation Instructions](https://shareaholic.com/too
151
 
152
  == Changelog ==
153
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  = 7.2.0.0 =
155
  * Miscellaneous bug fixes and performance enhancements to Related Content
156
  * New Admin Bar options!
@@ -998,6 +1011,9 @@ Please see here: [Usage & Installation Instructions](https://shareaholic.com/too
998
 
999
  == Upgrade Notice ==
1000
 
 
 
 
1001
  = 7.2.0.0 =
1002
  New Admin Bar options + miscellaneous bug fixes and performance enhancements to Related Content
1003
 
2
  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, 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, 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.8.1
6
+ Stable tag: 7.2.1.0
7
 
8
  Adds an attractive social bookmarking menu and related content widget to your posts, pages, index, or any combination of the three.
9
 
19
  * Share Counters for Twitter, Facebook, LinkedIn, etc
20
  * Official support for Google's URL shortener (goo.gl) and Google Analytics
21
  * Localized in 15+ languages
22
+ * Related Content support for post keywords specified in "All in One SEO Pack", "WordPress SEO by Yoast", etc plugins
23
 
24
  = Share Buttons =
25
 
152
 
153
  == Changelog ==
154
 
155
+ = 7.2.1.0 =
156
+ * Admin Bar is now configurable
157
+ * Shareaholic.js is now included earlier on the page to load apps faster
158
+ * Bugfix: fixed "non-static method" and "array to string conversion" warnings -- affected servers running newer versions of PHP
159
+ * Related Content
160
+ * Bugfix: Related Content data processing status is now correct
161
+ * Bugfix: Initiate Related Content crawl *after* site ID is set and not prior to
162
+ * Support for "WordPress SEO by Yoast" plugin meta keywords
163
+ * Support for "Add Meta Tags" plugin meta keywords
164
+ * Analytics
165
+ * Several high impact enhancements to greatly improve data accuracy
166
+
167
  = 7.2.0.0 =
168
  * Miscellaneous bug fixes and performance enhancements to Related Content
169
  * New Admin Bar options!
1011
 
1012
  == Upgrade Notice ==
1013
 
1014
+ = 7.2.1.0 =
1015
+ The Admin Bar is now configurable and we also fixed the Related Content data processing status indicator. Also includes miscellaneous plugin performance enhancements.
1016
+
1017
  = 7.2.0.0 =
1018
  New Admin Bar options + miscellaneous bug fixes and performance enhancements to Related Content
1019
 
shareaholic.php CHANGED
@@ -3,14 +3,14 @@
3
  * The main file!
4
  *
5
  * @package shareaholic
6
- * @version 7.2.0.0
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.2.0.0
14
  Author: Shareaholic
15
  Author URI: https://shareaholic.com
16
  Text Domain: shareaholic
@@ -55,7 +55,9 @@ class Shareaholic {
55
  const URL = 'https://shareaholic.com';
56
  const API_URL = 'https://web.shareaholic.com'; // uses static IPs for firewall whitelisting
57
  const CM_API_URL = 'https://cm-web.shareaholic.com'; // uses static IPs for firewall whitelisting
58
- const VERSION = '7.2.0.0';
 
 
59
 
60
  /**
61
  * Starts off as false so that ::get_instance() returns
@@ -71,7 +73,7 @@ class Shareaholic {
71
 
72
  add_action('init', array('ShareaholicPublic', 'init'));
73
  add_action('the_content', array('ShareaholicPublic', 'draw_canvases'));
74
- add_action('wp_head', array('ShareaholicPublic', 'wp_head'));
75
  add_shortcode('shareaholic', array('ShareaholicPublic', 'shortcode'));
76
 
77
  add_action('plugins_loaded', array($this, 'shareaholic_init'));
3
  * The main file!
4
  *
5
  * @package shareaholic
6
+ * @version 7.2.1.0
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.2.1.0
14
  Author: Shareaholic
15
  Author URI: https://shareaholic.com
16
  Text Domain: shareaholic
55
  const URL = 'https://shareaholic.com';
56
  const API_URL = 'https://web.shareaholic.com'; // uses static IPs for firewall whitelisting
57
  const CM_API_URL = 'https://cm-web.shareaholic.com'; // uses static IPs for firewall whitelisting
58
+ const REC_API_URL = 'http://recommendations.shareaholic.com';
59
+
60
+ const VERSION = '7.2.1.0';
61
 
62
  /**
63
  * Starts off as false so that ::get_instance() returns
73
 
74
  add_action('init', array('ShareaholicPublic', 'init'));
75
  add_action('the_content', array('ShareaholicPublic', 'draw_canvases'));
76
+ add_action('wp_head', array('ShareaholicPublic', 'wp_head'), 5);
77
  add_shortcode('shareaholic', array('ShareaholicPublic', 'shortcode'));
78
 
79
  add_action('plugins_loaded', array($this, 'shareaholic_init'));
six_to_seven.php CHANGED
@@ -29,7 +29,6 @@ class ShareaholicSixToSeven {
29
  $new_classicbookmarks_locations = self::transform_classicbookmarks_locations($classicbookmarks_configuration, $sexybookmarks_configuration);
30
  $new_top_bar_configuration = self::transform_top_bar_configuration($top_bar_configuration);
31
 
32
-
33
  $location_names = array_map(array('self', 'grab_location_iterator'), $new_share_buttons_configuration['locations_attributes']);
34
  // if sexybookmarks are off or not on the bottom
35
  if ($sexybookmarks_configuration['sexybookmark'] != '1' ||
@@ -65,8 +64,13 @@ class ShareaholicSixToSeven {
65
  null;
66
 
67
  $verification_key = md5(mt_rand());
 
68
  list($turned_on_share_buttons_locations, $turned_off_share_buttons_locations) = self::pad_locations($new_share_buttons_configuration);
69
  list($turned_on_recommendations_locations, $turned_off_recommendations_locations) = self::pad_locations($new_recommendations_configuration);
 
 
 
 
70
  $new_configuration = array(
71
  'configuration_publisher' => array(
72
  'share_buttons_attributes' => $new_share_buttons_configuration,
29
  $new_classicbookmarks_locations = self::transform_classicbookmarks_locations($classicbookmarks_configuration, $sexybookmarks_configuration);
30
  $new_top_bar_configuration = self::transform_top_bar_configuration($top_bar_configuration);
31
 
 
32
  $location_names = array_map(array('self', 'grab_location_iterator'), $new_share_buttons_configuration['locations_attributes']);
33
  // if sexybookmarks are off or not on the bottom
34
  if ($sexybookmarks_configuration['sexybookmark'] != '1' ||
64
  null;
65
 
66
  $verification_key = md5(mt_rand());
67
+
68
  list($turned_on_share_buttons_locations, $turned_off_share_buttons_locations) = self::pad_locations($new_share_buttons_configuration);
69
  list($turned_on_recommendations_locations, $turned_off_recommendations_locations) = self::pad_locations($new_recommendations_configuration);
70
+
71
+ // print_r($new_share_buttons_configuration);
72
+ // print_r($new_recommendations_configuration);
73
+
74
  $new_configuration = array(
75
  'configuration_publisher' => array(
76
  'share_buttons_attributes' => $new_share_buttons_configuration,
templates/advanced_settings.php CHANGED
@@ -22,8 +22,14 @@
22
  <?php if (isset($settings['disable_og_tags'])) { ?>
23
  <?php echo ($settings['disable_og_tags'] == 'on' ? 'checked' : '') ?>
24
  <?php } ?>>
25
- <label style="display: inline-block; font-size:12px;" for="og_tags"><?php echo sprintf(__('Do not automatically include <code>Open Graph</code> tags', 'shareaholic')); ?> <?php echo sprintf(__('(it is recommended NOT to disable open graph tags)', 'shareaholic')); ?></label>
26
-
 
 
 
 
 
 
27
  <div class='clear' style="padding-top:10px;"></div>
28
  <input type='submit' onclick="this.value='<?php echo sprintf(__('Saving Changes...', 'shareaholic')); ?>';" value='<?php echo sprintf(__('Save Changes', 'shareaholic')); ?>'>
29
  </fieldset>
@@ -46,7 +52,7 @@
46
  <div class='clear'></div>
47
 
48
  <fieldset class="app">
49
- <legend><h2><?php _e('Shareaholic Site ID', 'shareaholic'); ?></h2></legend>
50
  <?php if (ShareaholicUtilities::get_option('api_key')){
51
  echo '<code>'.ShareaholicUtilities::get_option('api_key').'</code>';
52
  } else {
22
  <?php if (isset($settings['disable_og_tags'])) { ?>
23
  <?php echo ($settings['disable_og_tags'] == 'on' ? 'checked' : '') ?>
24
  <?php } ?>>
25
+ <label style="display: inline-block; font-size:12px;" for="og_tags"><?php echo sprintf(__('Disable <code>Open Graph</code> tags', 'shareaholic')); ?> <?php echo sprintf(__('(it is recommended NOT to disable open graph tags)', 'shareaholic')); ?></label>
26
+ <br />
27
+ <input type='checkbox' id='admin_bar' name='shareaholic[disable_admin_bar_menu]' class='check'
28
+ <?php if (isset($settings['disable_admin_bar_menu'])) { ?>
29
+ <?php echo ($settings['disable_admin_bar_menu'] == 'on' ? 'checked' : '') ?>
30
+ <?php } ?>>
31
+ <label style="display: inline-block; font-size:12px;" for="admin_bar"><?php echo sprintf(__('Disable Admin Bar Menu', 'shareaholic')); ?></label>
32
+
33
  <div class='clear' style="padding-top:10px;"></div>
34
  <input type='submit' onclick="this.value='<?php echo sprintf(__('Saving Changes...', 'shareaholic')); ?>';" value='<?php echo sprintf(__('Save Changes', 'shareaholic')); ?>'>
35
  </fieldset>
52
  <div class='clear'></div>
53
 
54
  <fieldset class="app">
55
+ <legend><h2><?php _e('Your Shareaholic Site ID', 'shareaholic'); ?></h2></legend>
56
  <?php if (ShareaholicUtilities::get_option('api_key')){
57
  echo '<code>'.ShareaholicUtilities::get_option('api_key').'</code>';
58
  } else {
templates/script_tag.php CHANGED
@@ -1,3 +1,4 @@
 
1
  <script type='text/javascript' data-cfasync='false'>
2
  //<![CDATA[
3
  (function() {
1
+ <!-- This site is powered by Shareaholic - https://shareaholic.com -->
2
  <script type='text/javascript' data-cfasync='false'>
3
  //<![CDATA[
4
  (function() {
utilities.php CHANGED
@@ -69,7 +69,7 @@ class ShareaholicUtilities {
69
  }
70
 
71
  /**
72
- * Returns the defaults we want becuase PHP does not allow
73
  * arrays in class constants.
74
  *
75
  * @return array
@@ -77,6 +77,7 @@ class ShareaholicUtilities {
77
  private static function defaults() {
78
  return array(
79
  'disable_tracking' => 'off',
 
80
  'api_key' => '',
81
  'verification_key' => '',
82
  );
@@ -98,10 +99,10 @@ class ShareaholicUtilities {
98
  *
99
  */
100
 
101
- function admin_bar_extended() {
102
  global $wp_admin_bar;
103
 
104
- if(!current_user_can('update_plugins') || !is_admin_bar_showing())
105
  return;
106
 
107
  $wp_admin_bar->add_menu(array(
@@ -342,8 +343,7 @@ class ShareaholicUtilities {
342
  }
343
 
344
  /**
345
- * Returns the appropriate asset path for something from our
346
- * rails app.
347
  *
348
  * @param string $asset
349
  * @return string
@@ -447,19 +447,28 @@ class ShareaholicUtilities {
447
  * @param array $array
448
  */
449
  public static function turn_on_locations($array, $turn_off_array = array()) {
450
- foreach($array as $app => $ids) {
451
- foreach($ids as $name => $id) {
452
- self::update_options(array(
453
- $app => array($name => 'on')
454
- ));
 
 
 
 
 
455
  }
456
  }
457
-
458
- foreach($turn_off_array as $app => $ids) {
459
- foreach($ids as $name => $id) {
460
- self::update_options(array(
461
- $app => array($name => 'off')
462
- ));
 
 
 
 
463
  }
464
  }
465
  }
@@ -555,6 +564,7 @@ class ShareaholicUtilities {
555
  delete_option('shareaholic_settings');
556
 
557
  $verification_key = md5(mt_rand());
 
558
  $turned_on_share_buttons_locations = array(
559
  array('name' => 'post_below_content', 'counter' => 'badge-counter'),
560
  array('name' => 'page_below_content', 'counter' => 'badge-counter'),
@@ -925,7 +935,7 @@ class ShareaholicUtilities {
925
  *
926
  * @return array Where header => header value
927
  */
928
- public function add_header_xua($headers)
929
  {
930
  if(!isset($headers['X-UA-Compatible'])) {
931
  $headers['X-UA-Compatible'] = 'IE=edge,chrome=1';
@@ -937,7 +947,7 @@ class ShareaholicUtilities {
937
  * Draws xua meta tag
938
  *
939
  */
940
- public function draw_meta_xua()
941
  {
942
  echo '<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">';
943
  }
@@ -962,25 +972,24 @@ class ShareaholicUtilities {
962
  }
963
 
964
  /**
965
- * This is a wrapper for the Recommendations Status API
966
  *
967
  */
968
  public static function recommendations_status_check() {
969
- $recommendations_status_api_url = Shareaholic::API_URL . "/v2/recommendations/status?url=" . get_bloginfo('url');
970
- $response = ShareaholicCurl::get($recommendations_status_api_url);
971
- if(is_array($response) && array_key_exists('body', $response)) {
972
- $body = $response['body'];
973
- if (is_array($body) && $body['code'] == 200) {
974
- if ($body['data'][0]['status_code'] < 3) {
975
- return "processing";
976
- } else {
977
  return "ready";
 
 
978
  }
979
  } else {
980
  return "unknown";
981
  }
982
  }
983
  }
984
-
985
  }
986
  ?>
69
  }
70
 
71
  /**
72
+ * Returns the defaults we want because PHP does not allow
73
  * arrays in class constants.
74
  *
75
  * @return array
77
  private static function defaults() {
78
  return array(
79
  'disable_tracking' => 'off',
80
+ 'disable_admin_bar_menu' => 'off',
81
  'api_key' => '',
82
  'verification_key' => '',
83
  );
99
  *
100
  */
101
 
102
+ public static function admin_bar_extended() {
103
  global $wp_admin_bar;
104
 
105
+ if(!current_user_can('update_plugins') || !is_admin_bar_showing() || self::get_option('disable_admin_bar_menu') == "on")
106
  return;
107
 
108
  $wp_admin_bar->add_menu(array(
343
  }
344
 
345
  /**
346
+ * Returns the appropriate asset path for environment
 
347
  *
348
  * @param string $asset
349
  * @return string
447
  * @param array $array
448
  */
449
  public static function turn_on_locations($array, $turn_off_array = array()) {
450
+
451
+ if (is_array($array)) {
452
+ foreach($array as $app => $ids) {
453
+ if (is_array($ids)) {
454
+ foreach($ids as $name => $id) {
455
+ self::update_options(array(
456
+ $app => array($name => 'on')
457
+ ));
458
+ }
459
+ }
460
  }
461
  }
462
+
463
+ if (is_array($turn_off_array)) {
464
+ foreach($turn_off_array as $app => $ids) {
465
+ if (is_array($ids)) {
466
+ foreach($ids as $name => $id) {
467
+ self::update_options(array(
468
+ $app => array($name => 'off')
469
+ ));
470
+ }
471
+ }
472
  }
473
  }
474
  }
564
  delete_option('shareaholic_settings');
565
 
566
  $verification_key = md5(mt_rand());
567
+
568
  $turned_on_share_buttons_locations = array(
569
  array('name' => 'post_below_content', 'counter' => 'badge-counter'),
570
  array('name' => 'page_below_content', 'counter' => 'badge-counter'),
935
  *
936
  * @return array Where header => header value
937
  */
938
+ public static function add_header_xua($headers)
939
  {
940
  if(!isset($headers['X-UA-Compatible'])) {
941
  $headers['X-UA-Compatible'] = 'IE=edge,chrome=1';
947
  * Draws xua meta tag
948
  *
949
  */
950
+ public static function draw_meta_xua()
951
  {
952
  echo '<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">';
953
  }
972
  }
973
 
974
  /**
975
+ * This is a wrapper for the Recommendations API
976
  *
977
  */
978
  public static function recommendations_status_check() {
979
+ if (self::get_option('api_key') != NULL){
980
+ $recommendations_url = Shareaholic::REC_API_URL . "/v3/recommend?url=" . urlencode(get_bloginfo('url')) . "&internal=6&sponsored=3&apiKey=" . self::get_option('api_key');
981
+ $response = ShareaholicCurl::get($recommendations_url);
982
+ if(is_array($response) && array_key_exists('response', $response)) {
983
+ $body = $response['response'];
984
+ if (is_array($body) && $body['code'] == 200) {
 
 
985
  return "ready";
986
+ } else {
987
+ return "processing";
988
  }
989
  } else {
990
  return "unknown";
991
  }
992
  }
993
  }
 
994
  }
995
  ?>