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

Version Description

Various Admin Panel improvements

Download this release

Release Info

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

Code changes from version 8.10.4 to 8.10.5

Files changed (4) hide show
  1. admin.php +73 -42
  2. public.php +7 -3
  3. readme.txt +7 -1
  4. shareaholic.php +5 -3
admin.php CHANGED
@@ -13,8 +13,10 @@
13
  class ShareaholicAdmin {
14
 
15
  const ACTIVATE_TIMESTAMP_OPTION = 'shareaholic_activate_timestamp';
16
- const REVIEW_PERIOD = 259200; // 3 days in seconds
17
- const REVIEW_DISMISS_OPTION = 'shareaholic_review_dismiss';
 
 
18
 
19
  /**
20
  * Loads before all else
@@ -35,19 +37,86 @@ class ShareaholicAdmin {
35
  }
36
 
37
  /**
38
- * Check if the current user has dismissed the review message
39
  *
40
  */
41
  public static function check_review_dismissal() {
 
 
 
 
42
  if (!is_admin() ||
43
  !current_user_can('manage_options') ||
44
  !isset($_GET['_wpnonce']) ||
45
  !wp_verify_nonce($_GET['_wpnonce'], 'review-nonce') ||
 
46
  !isset($_GET[self::REVIEW_DISMISS_OPTION])) {
47
  return;
48
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
- add_site_option(self::REVIEW_DISMISS_OPTION, true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
52
 
53
  /**
@@ -109,44 +178,6 @@ JQUERY;
109
  }
110
  }
111
 
112
- /**
113
- * Check if we should display the review message days after the
114
- * plugin has been activated
115
- *
116
- */
117
- public static function check_plugin_review() {
118
- $activation_timestamp = get_site_option(self::ACTIVATE_TIMESTAMP_OPTION);
119
- $review_dismissal = get_site_option(self::REVIEW_DISMISS_OPTION);
120
-
121
- if ($review_dismissal == true) {
122
- return;
123
- }
124
-
125
- if (!$activation_timestamp) {
126
- $activation_timestamp = time();
127
- add_site_option(self::ACTIVATE_TIMESTAMP_OPTION, $activation_timestamp);
128
- }
129
-
130
- // display review message after a certain period of time after activation
131
- if (time() - $activation_timestamp > self::REVIEW_PERIOD) {
132
- add_action('admin_notices', array('ShareaholicAdmin', 'display_review_notice'));
133
- }
134
- }
135
-
136
- public static function display_review_notice() {
137
- $dismiss_url = wp_nonce_url('?'. self::REVIEW_DISMISS_OPTION .'=true', 'review-nonce');
138
-
139
- echo '
140
- <div class="notice notice-info" style="background-size: contain; background-position: right bottom; background-repeat: no-repeat; background-image: url(' . plugins_url('assets/img/happy-people-cover.png', __FILE__) . ');">
141
- <p style="background: rgba(255, 255, 255, 0.85); text-shadow: white 0px 0px 10px;">' . __('Hey there! we noticed that you have been using ', 'shareaholic') . '<a href="' . admin_url('admin.php?page=shareaholic-settings') . '">Shareaholic</a>' . __(' for some time now. That is so great. Could you please do us a BIG favor and give it a 5-star rating on WordPress? Just to help us spread the word and boost our motivation. ~ Your friends @ Shareaholic', 'shareaholic') . '
142
- <br />
143
- <br />
144
- <a onclick="location.href=\'' . esc_url($dismiss_url) . '\';" class="button button-primary" href="' . esc_url('https://wordpress.org/support/plugin/shareaholic/reviews/?rate=5#new-post') . '" target="_blank">' . __('Ok, you deserve it', 'shareaholic') . '</a>
145
- <a href="' . esc_url($dismiss_url) . '">' . __('No, maybe later', 'shareaholic') . '</a>
146
- </p>
147
- </div>';
148
- }
149
-
150
  /**
151
  * The function called during the admin_head action.
152
  *
13
  class ShareaholicAdmin {
14
 
15
  const ACTIVATE_TIMESTAMP_OPTION = 'shareaholic_activate_timestamp';
16
+ const REVIEW_DISMISS_OPTION = 'shareaholic_review_notice';
17
+ const REVIEW_FIRST_PERIOD = 259200; // 3 days in seconds
18
+ const REVIEW_LATER_PERIOD = 5184000; // 60 days in seconds
19
+ const REVIEW_FOREVER_PERIOD = 63113904; // 2 years in seconds
20
 
21
  /**
22
  * Loads before all else
37
  }
38
 
39
  /**
40
+ * Check review notice status for current user
41
  *
42
  */
43
  public static function check_review_dismissal() {
44
+
45
+ global $current_user;
46
+ $user_id = $current_user->ID;
47
+
48
  if (!is_admin() ||
49
  !current_user_can('manage_options') ||
50
  !isset($_GET['_wpnonce']) ||
51
  !wp_verify_nonce($_GET['_wpnonce'], 'review-nonce') ||
52
+ !isset($_GET['shr_defer_t']) ||
53
  !isset($_GET[self::REVIEW_DISMISS_OPTION])) {
54
  return;
55
  }
56
+
57
+ $the_meta_array = array (
58
+ 'dismiss_defer_period' => $_GET["shr_defer_t"],
59
+ 'dismiss_timestamp' => time()
60
+ );
61
+
62
+ update_user_meta($user_id, self::REVIEW_DISMISS_OPTION, $the_meta_array);
63
+ }
64
+
65
+ /**
66
+ * Check if we should display the review notice
67
+ *
68
+ */
69
+ public static function check_plugin_review() {
70
+
71
+ global $current_user;
72
+ $user_id = $current_user->ID;
73
+
74
+ $show_review_notice = false;
75
+ $activation_timestamp = get_site_option(self::ACTIVATE_TIMESTAMP_OPTION);
76
+ $review_dismissal_array = get_user_meta($user_id, self::REVIEW_DISMISS_OPTION, true);
77
+ $dismiss_defer_period = isset($review_dismissal_array['dismiss_defer_period']) ? $review_dismissal_array['dismiss_defer_period'] : 0;
78
+ $dismiss_timestamp = isset($review_dismissal_array['dismiss_timestamp']) ? $review_dismissal_array['dismiss_timestamp'] : time();
79
+
80
+ if ($dismiss_timestamp + $dismiss_defer_period <= time()) {
81
+ $show_review_notice = true;
82
+ }
83
+
84
+ if (!$activation_timestamp) {
85
+ $activation_timestamp = time();
86
+ add_site_option(self::ACTIVATE_TIMESTAMP_OPTION, $activation_timestamp);
87
+ }
88
+
89
+ // display review message after a certain period of time after activation
90
+ if ((time() - $activation_timestamp > self::REVIEW_FIRST_PERIOD) && $show_review_notice == true) {
91
+ add_action('admin_notices', array('ShareaholicAdmin', 'display_review_notice'));
92
+ }
93
+ }
94
 
95
+ public static function display_review_notice() {
96
+
97
+ $dismiss_forever = add_query_arg( array(
98
+ self::REVIEW_DISMISS_OPTION => true,
99
+ 'shr_defer_t' => self::REVIEW_FOREVER_PERIOD
100
+ ));
101
+
102
+ $dismiss_forlater = add_query_arg( array(
103
+ self::REVIEW_DISMISS_OPTION => true,
104
+ 'shr_defer_t' => self::REVIEW_LATER_PERIOD
105
+ ));
106
+
107
+ $dismiss_forever_url = wp_nonce_url($dismiss_forever, 'review-nonce');
108
+ $dismiss_forlater_url = wp_nonce_url($dismiss_forlater, 'review-nonce');
109
+
110
+ echo '
111
+ <div class="notice notice-info" style="background-size: contain; background-position: right bottom; background-repeat: no-repeat; background-image: url(' . plugins_url('assets/img/happy-people-cover.png', __FILE__) . ');">
112
+ <p style="background: rgba(255, 255, 255, 0.85); text-shadow: white 0px 0px 10px;">' . __('Hey there! We noticed that you have had some success using ', 'shareaholic') . '<a href="' . admin_url('admin.php?page=shareaholic-settings') . '">Shareaholic</a>' . __(' — awesome! Could you please do us a BIG favor and give us a quick 5-star rating on WordPress? Just to help us spread the word and boost our motivation. We would really appreciate it 🙂 ~ Your friends @ Shareaholic', 'shareaholic') . '
113
+ <br />
114
+ <br />
115
+ <a onclick="location.href=\'' . $dismiss_forever_url . '\';" class="button button-primary" href="' . esc_url('https://wordpress.org/support/plugin/shareaholic/reviews/?rate=5#new-post') . '" target="_blank">' . __('Ok, you deserve it', 'shareaholic') . '</a> &nbsp;
116
+ <a href="' . $dismiss_forlater_url . '">' . __('No, maybe later', 'shareaholic') . '</a> &nbsp;
117
+ <a href="' . $dismiss_forever_url . '">' . __('I already did', 'shareaholic') . '</a>
118
+ </p>
119
+ </div>';
120
  }
121
 
122
  /**
178
  }
179
  }
180
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  /**
182
  * The function called during the admin_head action.
183
  *
public.php CHANGED
@@ -569,8 +569,8 @@ class ShareaholicPublic {
569
  $server_side_share_count_status = "on";
570
  } else {
571
  $server_side_share_count_status = "off";
572
- }
573
-
574
  if (ShareaholicUtilities::has_accepted_terms_of_service() == 1){
575
  $tos_status = "accepted";
576
  } else {
@@ -613,12 +613,16 @@ class ShareaholicPublic {
613
  'app_locations' => array (
614
  'share_buttons' => ShareaholicUtilities::get_option('share_buttons'),
615
  'recommendations' => ShareaholicUtilities::get_option('recommendations'),
 
 
616
  ),
617
  'advanced_settings' => array (
618
  'server_side_share_count_api' => $server_side_share_count_status,
 
 
619
  )
620
  );
621
-
622
  header('Content-Type: application/json');
623
  echo json_encode($info);
624
  exit;
569
  $server_side_share_count_status = "on";
570
  } else {
571
  $server_side_share_count_status = "off";
572
+ }
573
+
574
  if (ShareaholicUtilities::has_accepted_terms_of_service() == 1){
575
  $tos_status = "accepted";
576
  } else {
613
  'app_locations' => array (
614
  'share_buttons' => ShareaholicUtilities::get_option('share_buttons'),
615
  'recommendations' => ShareaholicUtilities::get_option('recommendations'),
616
+ 'recommendations_display_on_excerpts' => ShareaholicUtilities::get_option('recommendations_display_on_excerpts'),
617
+ 'share_buttons_display_on_excerpts' => ShareaholicUtilities::get_option('share_buttons_display_on_excerpts'),
618
  ),
619
  'advanced_settings' => array (
620
  'server_side_share_count_api' => $server_side_share_count_status,
621
+ 'enable_user_nicename' => ShareaholicUtilities::get_option('enable_user_nicename'),
622
+ 'disable_admin_bar_menu' => ShareaholicUtilities::get_option('disable_admin_bar_menu'),
623
  )
624
  );
625
+
626
  header('Content-Type: application/json');
627
  echo json_encode($info);
628
  exit;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: buttons, related posts, google analytics, share buttons, social sharing,
4
  Requires at least: 3.0
5
  Tested up to: 5.0
6
  Requires PHP: 5.2
7
- Stable tag: 8.10.4
8
 
9
 
10
  Improve Audience Engagement with Award Winning Site-Speed Optimized Social Tools: Share Buttons, Related Posts, Monetization & Google Analytics.
@@ -268,6 +268,9 @@ Each time you change Shareaholic's thumbnail dimensions like this, you will prob
268
 
269
  == Changelog ==
270
 
 
 
 
271
  = 8.10.4 (2018-12-21) =
272
  * Enhancement: [New Related Posts Themes](https://www.shareaholic.com/blog/new-related-content-widget-themes/) - two of which are inspired by Medium.com and Wired.com
273
  * Enhancement: [Related Posts Headline Customizer](https://www.shareaholic.com/website-tools/related-content/) - headline design can now be customized via the UI, including font typeface, size, color, etc
@@ -857,6 +860,9 @@ Each time you change Shareaholic's thumbnail dimensions like this, you will prob
857
  * Show Related Posts data status
858
 
859
  == Upgrade Notice ==
 
 
 
860
  = 8.10.4 =
861
  New themes, improved content syncing for more accurate Related Content and Analytics, refreshed Post-Share Prompt Slider design, Related Posts headline customizer and more!
862
 
4
  Requires at least: 3.0
5
  Tested up to: 5.0
6
  Requires PHP: 5.2
7
+ Stable tag: 8.10.5
8
 
9
 
10
  Improve Audience Engagement with Award Winning Site-Speed Optimized Social Tools: Share Buttons, Related Posts, Monetization & Google Analytics.
268
 
269
  == Changelog ==
270
 
271
+ = 8.10.5 (2018-12-26) =
272
+ * Various Admin Panel improvements
273
+
274
  = 8.10.4 (2018-12-21) =
275
  * Enhancement: [New Related Posts Themes](https://www.shareaholic.com/blog/new-related-content-widget-themes/) - two of which are inspired by Medium.com and Wired.com
276
  * Enhancement: [Related Posts Headline Customizer](https://www.shareaholic.com/website-tools/related-content/) - headline design can now be customized via the UI, including font typeface, size, color, etc
860
  * Show Related Posts data status
861
 
862
  == Upgrade Notice ==
863
+ = 8.10.5 =
864
+ Various Admin Panel improvements
865
+
866
  = 8.10.4 =
867
  New themes, improved content syncing for more accurate Related Content and Analytics, refreshed Post-Share Prompt Slider design, Related Posts headline customizer and more!
868
 
shareaholic.php CHANGED
@@ -3,14 +3,14 @@
3
  * The main file!
4
  *
5
  * @package shareaholic
6
- * @version 8.10.4
7
  */
8
 
9
  /*
10
  Plugin Name: Fast Share Buttons, Analytics, Related Posts and More
11
  Plugin URI: https://www.shareaholic.com/website-tools/
12
  Description: The award winning all-in-one Social Media and Related Posts solution for WordPress. Get found on social and grow your following. See <a href="admin.php?page=shareaholic-settings">configuration panel</a> for settings.
13
- Version: 8.10.4
14
  Author: Shareaholic
15
  Author URI: https://www.shareaholic.com
16
  Text Domain: shareaholic
@@ -61,7 +61,7 @@ if (!class_exists('Shareaholic')) {
61
  const API_URL = 'https://web.shareaholic.com'; // uses static IPs for firewall whitelisting
62
  const CM_API_URL = 'https://cm-web.shareaholic.com'; // uses static IPs for firewall whitelisting
63
 
64
- const VERSION = '8.10.4';
65
 
66
  /**
67
  * Starts off as false so that ::get_instance() returns
@@ -270,6 +270,8 @@ if (!class_exists('Shareaholic')) {
270
  ShareaholicUtilities::log_event("Uninstall");
271
  ShareaholicUtilities::delete_api_key();
272
  delete_option('shareaholic_settings');
 
 
273
  ShareaholicUtilities::delete_mutex();
274
  }
275
  }
3
  * The main file!
4
  *
5
  * @package shareaholic
6
+ * @version 8.10.5
7
  */
8
 
9
  /*
10
  Plugin Name: Fast Share Buttons, Analytics, Related Posts and More
11
  Plugin URI: https://www.shareaholic.com/website-tools/
12
  Description: The award winning all-in-one Social Media and Related Posts solution for WordPress. Get found on social and grow your following. See <a href="admin.php?page=shareaholic-settings">configuration panel</a> for settings.
13
+ Version: 8.10.5
14
  Author: Shareaholic
15
  Author URI: https://www.shareaholic.com
16
  Text Domain: shareaholic
61
  const API_URL = 'https://web.shareaholic.com'; // uses static IPs for firewall whitelisting
62
  const CM_API_URL = 'https://cm-web.shareaholic.com'; // uses static IPs for firewall whitelisting
63
 
64
+ const VERSION = '8.10.5';
65
 
66
  /**
67
  * Starts off as false so that ::get_instance() returns
270
  ShareaholicUtilities::log_event("Uninstall");
271
  ShareaholicUtilities::delete_api_key();
272
  delete_option('shareaholic_settings');
273
+ delete_option('shareaholic_activate_timestamp');
274
+ delete_option('shareaholic_review_dismiss'); // legacy flag for reviews; can remove later
275
  ShareaholicUtilities::delete_mutex();
276
  }
277
  }