Social Media Share Buttons | MashShare - Version 3.6.2

Version Description

  • New: Necessary change because of new facebook API
  • New: Remove mashengine
  • New: Remove GDPR option. Not needed any longer as all shares are collected via sharedcount.com
  • New: Add admin notice notifying user of new facebook API.
Download this release

Release Info

Developer ReneHermi
Plugin Icon 128x128 Social Media Share Buttons | MashShare
Version 3.6.2
Comparing to
See all releases

Code changes from version 3.6.1 to 3.6.2

includes/admin/admin-notices.php CHANGED
@@ -49,6 +49,8 @@ function mashsb_admin_messages() {
49
 
50
  mashsb_show_update_notice_gdpr();
51
 
 
 
52
  // Rate Limit warning
53
  // if( mashsb_is_admin_page() && mashsb_rate_limit_exceeded() ) {
54
  // echo '<div class="error">';
@@ -444,7 +446,7 @@ function mashsb_show_update_notice_gdpr() {
444
 
445
 
446
  $message = sprintf(__( '<h2 style="color:white;">MashShare GDPR Compliance</h2>'
447
- . 'MashShare uses new sharedcount.com integration to be GDPR compliant. <br>Register for sharedcount.com at <a href="'.admin_url().'admin.php?page=mashsb-settings" style="color:white;">MashShare > Settings > Share Count</a><br><br>For collecting Twitter shares get the <a href="https://mashshare.net/downloads/mashshare-social-networks-addon/?utm_source=wp-admin&utm_medium=gdpr-notice&utm_campaign=gdpr-notice" target="_blank">Social Network Add-On</a>'
448
  , 'mashsb' ),
449
  admin_url() . 'admin.php?page=mashsb-settings'
450
  );
@@ -472,3 +474,44 @@ function mashsb_hide_gdpr_notice(){
472
  update_option( 'mashsb_show_update_notice_gdpr1', 'no' );
473
  }
474
  add_action ('mashsb_hide_gdpr_notice', 'mashsb_hide_gdpr_notice');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
  mashsb_show_update_notice_gdpr();
51
 
52
+ mashsb_show_new_fb_api();
53
+
54
  // Rate Limit warning
55
  // if( mashsb_is_admin_page() && mashsb_rate_limit_exceeded() ) {
56
  // echo '<div class="error">';
446
 
447
 
448
  $message = sprintf(__( '<h2 style="color:white;">MashShare GDPR Compliance</h2>'
449
+ . 'MashShare uses new sharedcount.com integration to be GDPR compliant. <br>Activate sharedcount.com at <a href="'.admin_url().'admin.php?page=mashsb-settings#mashsb_settingsgeneral_header" style="color:white;">MashShare > Settings > General > Share Count</a><br><br>For collecting Twitter shares get the <a href="https://mashshare.net/downloads/mashshare-social-networks-addon/?utm_source=wp-admin&utm_medium=gdpr-notice&utm_campaign=gdpr-notice" target="_blank">Social Network Add-On</a>'
450
  , 'mashsb' ),
451
  admin_url() . 'admin.php?page=mashsb-settings'
452
  );
474
  update_option( 'mashsb_show_update_notice_gdpr1', 'no' );
475
  }
476
  add_action ('mashsb_hide_gdpr_notice', 'mashsb_hide_gdpr_notice');
477
+
478
+
479
+
480
+ /**
481
+ * Show notice for new FB API
482
+ * @since 3.5.3.0
483
+ */
484
+ function mashsb_show_new_fb_api() {
485
+
486
+
487
+ $message = sprintf(__( '<h2 style="color:white;">MashShare: Facebook API Changes</h2>'
488
+ . 'Facebook shut down its old API endpoint so you need to switch over to sharedcount.com integration to get the latest Facebook share count. <br>Add sharedcount.com API key at <a href="'.admin_url().'admin.php?page=mashsb-settings#mashsb_settingsgeneral_header" style="color:white;">MashShare > Settings > General > Share Count</a><br>'
489
+ , 'mashsb' ),
490
+ admin_url() . 'admin.php?page=mashsb-settings'
491
+ );
492
+
493
+ if( get_option( 'mashsb_show_new_fb_api' ) === 'no' ) {
494
+ return false;
495
+ }
496
+
497
+ // admin notice after updating Mashshare
498
+ echo '<div class="mashsb-notice-gdpr mashsb_update_notice_gdpr update-nag" style="background-color: red;color: white;padding: 20px;margin-top: 20px;border: 3px solid white;">' . $message .
499
+ '<p><a href="'.admin_url().'admin.php?page=mashsb-settings&mashsb-action=hide_fb_api_notice" class="mashsb_hide_fb_api" title="I got it" style="text-decoration:none;color:white;">- I Understand! Do Not Show This Message Again -</a></a>'.
500
+ '</div>';
501
+
502
+
503
+ }
504
+
505
+ /**
506
+ * Hide FB API notice
507
+ *
508
+ * @global array $mashsb_options
509
+ */
510
+ function mashsb_hide_fb_api_notice(){
511
+ global $mashsb_options;
512
+ // Get all settings
513
+ update_option( 'mashsb_show_new_fb_api', 'no' );
514
+ }
515
+ add_action ('mashsb_hide_fb_api_notice', 'mashsb_hide_fb_api_notice');
516
+
517
+
includes/admin/settings/register-settings.php CHANGED
@@ -124,10 +124,11 @@ function mashsb_get_registered_settings() {
124
  'mashsb_sharemethod' => array(
125
  'id' => 'mashsb_sharemethod',
126
  'name' => __( 'Share Count', 'mashsb' ),
127
- 'desc' => __( '- <i>MashEngine</i> collects shares by direct request to social networks.<br><br><i>SharedCount.com</i> is a third party service free for up to 10.000 daily requests. It collects shares for Facebook, Pinterest, Stumbleupon. (For GDPR compliance you should select the sharedcount.com service.)<br><br>Twitter count is aggreagated via <a href="https://twitcount.com" target="_blank" rel="external nofollow">https://twitcount.com</a>. You must sign up with your Twitter account for this free service to get the twitter share count. Visit the site http://twitcount.com, fill in your website domain and click on <i>Sign up</i>. <br><br><strong>Note: You need <a href="https://mashshare.net/downloads/mashshare-social-networks-addon/" target="_blank">MashShare Social Network Add-On</a> for enabling Twitter count.</strong>', 'mashsb' ),
 
128
  'type' => 'select',
129
  'options' => array(
130
- 'mashengine' => 'MashEngine',
131
  'sharedcount' => 'Sharedcount.com'
132
  )
133
  ),
@@ -187,12 +188,12 @@ function mashsb_get_registered_settings() {
187
  'type' => 'text',
188
  'size' => 'medium'
189
  ),
190
- 'disable_sharecount' => array(
191
- 'id' => 'disable_sharecount',
192
- 'name' => __( 'Activate GDPR/DSGVO compliance', 'mashsb' ),
193
- 'desc' => __( 'Use this if share counts should not be counted. You need to disable share counts if you want to be GDPR compliant, because the share count agregation is collecting shares from third party social networks. Default: false', 'mashsb' ),
194
- 'type' => 'checkbox'
195
- ),
196
  'hide_sharecount' => array(
197
  'id' => 'hide_sharecount',
198
  'name' => __( 'Hide Sharecount', 'mashsb' ),
124
  'mashsb_sharemethod' => array(
125
  'id' => 'mashsb_sharemethod',
126
  'name' => __( 'Share Count', 'mashsb' ),
127
+ //'desc' => __( '- <i>MashEngine</i> collects shares by direct request to social networks.<br><br><i>SharedCount.com</i> is a third party service free for up to 10.000 daily requests. It collects shares for Facebook, Pinterest, Stumbleupon. (For GDPR compliance you should select the sharedcount.com service.)<br><br>Twitter count is aggreagated via <a href="https://twitcount.com" target="_blank" rel="external nofollow">https://twitcount.com</a>. You must sign up with your Twitter account for this free service to get the twitter share count. Visit the site http://twitcount.com, fill in your website domain and click on <i>Sign up</i>. <br><br><strong>Note: You need <a href="https://mashshare.net/downloads/mashshare-social-networks-addon/" target="_blank">MashShare Social Network Add-On</a> for enabling Twitter count.</strong>', 'mashsb' ),
128
+ 'desc' => __( '- <i>SharedCount.com</i> is a third party service free for up to 10.000 daily requests. It collects shares for Facebook.<br><br>Twitter count is aggreagated via <a href="https://twitcount.com" target="_blank" rel="external nofollow">https://twitcount.com</a>. You must sign up with your Twitter account for this free service to get the twitter share count. Visit the site http://twitcount.com, fill in your website domain and click on <i>Sign up</i>. <br><br><strong>Note: You need <a href="https://mashshare.net/downloads/mashshare-social-networks-addon/" target="_blank">MashShare Social Network Add-On</a> for enabling Twitter count.</strong>', 'mashsb' ),
129
  'type' => 'select',
130
  'options' => array(
131
+ //'mashengine' => 'MashEngine',
132
  'sharedcount' => 'Sharedcount.com'
133
  )
134
  ),
188
  'type' => 'text',
189
  'size' => 'medium'
190
  ),
191
+ // 'disable_sharecount' => array(
192
+ // 'id' => 'disable_sharecount',
193
+ // 'name' => __( 'Activate GDPR/DSGVO compliance', 'mashsb' ),
194
+ // 'desc' => __( 'Use this if share counts should not be counted. You need to disable share counts if you want to be GDPR compliant, because the share count agregation is collecting shares from third party social networks. Default: false', 'mashsb' ),
195
+ // 'type' => 'checkbox'
196
+ // ),
197
  'hide_sharecount' => array(
198
  'id' => 'hide_sharecount',
199
  'name' => __( 'Hide Sharecount', 'mashsb' ),
includes/install.php CHANGED
@@ -101,7 +101,7 @@ function mashsb_install() {
101
  'button_margin' => '1',
102
  'text_align_center' => '1',
103
  'mashsharer_round' => '1',
104
- 'disable_sharecount' => '1'
105
  );
106
  update_option( 'mashsb_settings', $settings_default );
107
  }
101
  'button_margin' => '1',
102
  'text_align_center' => '1',
103
  'mashsharer_round' => '1',
104
+ //'disable_sharecount' => '1'
105
  );
106
  update_option( 'mashsb_settings', $settings_default );
107
  }
includes/scripts.php CHANGED
@@ -71,9 +71,7 @@ function mashsb_load_scripts( $hook ) {
71
  wp_enqueue_script( 'mashsb', $js_dir . 'mashsb' . $suffix . '.js', array('jquery'), MASHSB_VERSION, $in_footer );
72
 
73
  $status = apply_filters('mashsbStatus', false);
74
-
75
- //!isset( $mashsb_options['disable_sharecount'] ) ? $shareresult = getSharedcount( $url ) : $shareresult = 0;
76
-
77
  $refresh = mashsb_is_cache_refresh() ? 1 : 0;
78
 
79
  wp_localize_script( 'mashsb', 'mashsb', array(
71
  wp_enqueue_script( 'mashsb', $js_dir . 'mashsb' . $suffix . '.js', array('jquery'), MASHSB_VERSION, $in_footer );
72
 
73
  $status = apply_filters('mashsbStatus', false);
74
+
 
 
75
  $refresh = mashsb_is_cache_refresh() ? 1 : 0;
76
 
77
  wp_localize_script( 'mashsb', 'mashsb', array(
includes/sharedcount.class.php CHANGED
@@ -146,6 +146,7 @@ class mashsbSharedcount {
146
  $counts = array();
147
  //$counts = $this->_curl( 'http://' . $domain . "/?url=" . $this->url . "&apikey=" . $this->apikey );
148
  $counts = $this->_curl( 'https://api.sharedcount.com/v1.0/?url=' . $this->url . "&apikey=" . $this->apikey );
 
149
  if( isset( $counts["Error"] ) && isset( $counts['Domain'] ) && $counts["Type"] === "domain_apikey_mismatch" ) {
150
  $this->update_sharedcount_domain( $counts['Domain'] );
151
  return 0;
@@ -157,7 +158,9 @@ class mashsbSharedcount {
157
  mashdebug()->error( "Facebook total count: " . $counts['Facebook']['total_count'] );
158
  MASHSB()->logger->info( "URL: " . urldecode( $this->url ) . " API Key:" . $this->apikey . " sharedcount.com FB total_count: " . $counts['Facebook']['total_count'] . " FB share_count:" . $counts['Facebook']['share_count'] . " G+:" . $counts['GooglePlusOne'] . " Linkedin:" . $counts['LinkedIn'] . " Stumble: " . $counts['StumbleUpon'] . " Pinterest: " . $counts['Pinterest'] );
159
 
160
- $return = array_merge($counts, array('Twitter' => $this->getTwitterShares()));
 
 
161
  return $return;
162
  } catch ( Exception $e ) {
163
  mashdebug()->error( "error: " . $counts );
@@ -176,7 +179,7 @@ class mashsbSharedcount {
176
  private function getTwitterShares(){
177
  if ( class_exists( 'mashnetTwitter')){
178
  $twitter = new mashnetTwitter($this->url);
179
- return $twitter->getTwitterShares();
180
  }
181
  return 0;
182
  }
146
  $counts = array();
147
  //$counts = $this->_curl( 'http://' . $domain . "/?url=" . $this->url . "&apikey=" . $this->apikey );
148
  $counts = $this->_curl( 'https://api.sharedcount.com/v1.0/?url=' . $this->url . "&apikey=" . $this->apikey );
149
+
150
  if( isset( $counts["Error"] ) && isset( $counts['Domain'] ) && $counts["Type"] === "domain_apikey_mismatch" ) {
151
  $this->update_sharedcount_domain( $counts['Domain'] );
152
  return 0;
158
  mashdebug()->error( "Facebook total count: " . $counts['Facebook']['total_count'] );
159
  MASHSB()->logger->info( "URL: " . urldecode( $this->url ) . " API Key:" . $this->apikey . " sharedcount.com FB total_count: " . $counts['Facebook']['total_count'] . " FB share_count:" . $counts['Facebook']['share_count'] . " G+:" . $counts['GooglePlusOne'] . " Linkedin:" . $counts['LinkedIn'] . " Stumble: " . $counts['StumbleUpon'] . " Pinterest: " . $counts['Pinterest'] );
160
 
161
+ $return = is_array($counts) ? array_merge($counts, array('Twitter' => $this->getTwitterShares())) : array('Twitter' => $this->getTwitterShares());
162
+
163
+
164
  return $return;
165
  } catch ( Exception $e ) {
166
  mashdebug()->error( "error: " . $counts );
179
  private function getTwitterShares(){
180
  if ( class_exists( 'mashnetTwitter')){
181
  $twitter = new mashnetTwitter($this->url);
182
+ return empty($twitter->getTwitterShares()) ? 0 : $twitter->getTwitterShares();
183
  }
184
  return 0;
185
  }
includes/template-functions.php CHANGED
@@ -220,8 +220,8 @@ function getSharedcount( $url ) {
220
 
221
  // Its request limited
222
  if ( mashsb_is_req_limited() ){
223
- $mashsb_debug[] = 'Rate limit reached: Return Share from custom meta field.';
224
- return get_post_meta( $post->ID, 'mashsb_shares', true ) + getFakecount();
225
  }
226
 
227
  // free some memory
220
 
221
  // Its request limited
222
  if ( mashsb_is_req_limited() ){
223
+ $mashsb_debug[] = 'Rate limit reached: Return Share from custom meta field.';
224
+ return (int)get_post_meta( $post->ID, 'mashsb_shares', true ) + getFakecount();
225
  }
226
 
227
  // free some memory
mashshare.php CHANGED
@@ -6,7 +6,7 @@
6
  * Description: Mashshare is a Share functionality inspired by the the great website Mashable for Facebook and Twitter. More networks available.
7
  * Author: René Hermenau
8
  * Author URI: https://www.mashshare.net
9
- * Version: 3.6.1
10
  * Text Domain: mashsb
11
  * Domain Path: /languages
12
 
@@ -35,7 +35,7 @@ if( !defined( 'ABSPATH' ) )
35
 
36
  // Plugin version
37
  if( !defined( 'MASHSB_VERSION' ) ) {
38
- define( 'MASHSB_VERSION', '3.6.1' );
39
  }
40
 
41
  // Debug mode
6
  * Description: Mashshare is a Share functionality inspired by the the great website Mashable for Facebook and Twitter. More networks available.
7
  * Author: René Hermenau
8
  * Author URI: https://www.mashshare.net
9
+ * Version: 3.6.2
10
  * Text Domain: mashsb
11
  * Domain Path: /languages
12
 
35
 
36
  // Plugin version
37
  if( !defined( 'MASHSB_VERSION' ) ) {
38
+ define( 'MASHSB_VERSION', '3.6.2' );
39
  }
40
 
41
  // Debug mode
readme.txt CHANGED
@@ -9,7 +9,7 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Tags: Share buttons, Social Sharing, social media, Facebook, Twitter, Subscribe, Traffic posts, pages, widget, social share buttons, analytics, email, dsgvo
10
  Requires at least: 3.6+
11
  Tested up to: 5.1
12
- Stable tag: 3.6.1
13
  Requires PHP: 5.2
14
 
15
  Social Media Share Buttons for Twitter, Facebook and other social networks. Highly customizable Social Media ecosystem
@@ -250,8 +250,15 @@ Read here more about this: http://docs.mashshare.net/article/10-facebook-is-show
250
 
251
  == Changelog ==
252
 
 
 
 
 
 
 
253
  = 3.6.1 =
254
  * Fix: Whatsapp and mail button not opening any longer after recent chrom update when noopener attribute is used.
 
255
  * New: Support WordPress 5.1
256
 
257
  = 3.6.0 =
@@ -300,7 +307,10 @@ https://www.mashshare.net/changelog/
300
 
301
  == Upgrade Notice ==
302
 
303
- = 3.6.1 =
304
- * Fix: Whatsapp and mail button not opening any longer after recent chrom update
 
 
 
305
 
306
 
9
  Tags: Share buttons, Social Sharing, social media, Facebook, Twitter, Subscribe, Traffic posts, pages, widget, social share buttons, analytics, email, dsgvo
10
  Requires at least: 3.6+
11
  Tested up to: 5.1
12
+ Stable tag: 3.6.2
13
  Requires PHP: 5.2
14
 
15
  Social Media Share Buttons for Twitter, Facebook and other social networks. Highly customizable Social Media ecosystem
250
 
251
  == Changelog ==
252
 
253
+ = 3.6.2 =
254
+ * New: Necessary change because of new facebook API
255
+ * New: Remove mashengine
256
+ * New: Remove GDPR option. Not needed any longer as all shares are collected via sharedcount.com
257
+ * New: Add admin notice notifying user of new facebook API.
258
+
259
  = 3.6.1 =
260
  * Fix: Whatsapp and mail button not opening any longer after recent chrom update when noopener attribute is used.
261
+ * Fix: PHP Warning: A non-numeric value encountered...
262
  * New: Support WordPress 5.1
263
 
264
  = 3.6.0 =
307
 
308
  == Upgrade Notice ==
309
 
310
+ = 3.6.2 =
311
+ * New: Necessary change because of new facebook API
312
+ * New: Remove mashengine
313
+ * New: Remove GDPR option. Not needed any longer as all shares are collected via sharedcount.com
314
+ * New: Add admin notice notifying user of new facebook API.
315
 
316
 
uninstall.php CHANGED
@@ -33,6 +33,7 @@ if( mashsb_get_option( 'uninstall_on_delete' ) ) {
33
  delete_option( 'mashsb_valid_fb_api_key');
34
  delete_option( 'mashsb_show_update_notice_gdpr');
35
  delete_option( 'mashsb_show_update_notice_gdpr1');
 
36
 
37
 
38
  /* Delete all post meta options */
33
  delete_option( 'mashsb_valid_fb_api_key');
34
  delete_option( 'mashsb_show_update_notice_gdpr');
35
  delete_option( 'mashsb_show_update_notice_gdpr1');
36
+ delete_option( 'mashsb_show_new_fb_api');
37
 
38
 
39
  /* Delete all post meta options */