Social Media Share Buttons | MashShare - Version 3.3.9

Version Description

  • New: Create filters to allow customizing the refresh times
  • Fix: Sporadic connection issues in post editor
  • Fix: Pinterest and google share count not correct for https websites
  • Fix: Remove inline css on AMP site
Download this release

Release Info

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

Code changes from version 3.3.8 to 3.3.9

includes/admin/admin-actions.php CHANGED
@@ -61,17 +61,19 @@ add_action ('wp_ajax_mashsb_update_order', 'mashsb_save_order');
61
  *
62
  * @todo check if blocking=>false is working as expected
63
  * @global array $post
 
 
64
  */
65
- function mashsb_rescrape_fb_debugger(){
66
- global $post;
67
- if (!isset($post)){
68
- return;
69
- }
70
- $url = get_permalink($post->ID);
71
- $args = array('timeout' => 5, 'blocking' => false);
72
- $body = wp_remote_retrieve_body( wp_remote_get('https://graph.facebook.com/?id=' . $url, $args) );
73
- }
74
- add_action('save_post', 'mashsb_rescrape_fb_debugger' );
75
 
76
  /**
77
  * Purge the MashShare Cache
@@ -82,9 +84,16 @@ add_action('save_post', 'mashsb_rescrape_fb_debugger' );
82
  function mashsb_purge_cache(){
83
  global $post;
84
 
 
 
 
 
 
 
85
  if (!isset($post)){
86
  return;
87
  }
 
88
 
89
  update_post_meta($post->ID, 'mashsb_timestamp', '');
90
  }
61
  *
62
  * @todo check if blocking=>false is working as expected
63
  * @global array $post
64
+ *
65
+ * @removed for testing
66
  */
67
+ //function mashsb_rescrape_fb_debugger(){
68
+ // global $post;
69
+ // if (!isset($post)){
70
+ // return;
71
+ // }
72
+ // $url = get_permalink($post->ID);
73
+ // $args = array('timeout' => 5, 'blocking' => false);
74
+ // $body = wp_remote_retrieve_body( wp_remote_get('https://graph.facebook.com/?id=' . $url, $args) );
75
+ //}
76
+ //add_action('save_post', 'mashsb_rescrape_fb_debugger' );
77
 
78
  /**
79
  * Purge the MashShare Cache
84
  function mashsb_purge_cache(){
85
  global $post;
86
 
87
+
88
+ // Stop WP from update data on autosave
89
+ if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE){
90
+ return;
91
+ }
92
+
93
  if (!isset($post)){
94
  return;
95
  }
96
+
97
 
98
  update_post_meta($post->ID, 'mashsb_timestamp', '');
99
  }
includes/mashengine.php CHANGED
@@ -207,12 +207,12 @@ class mashengine {
207
  } else {
208
  $RollingCurlX->addRequest( "http://public.newsharecounts.com/count.json?url=" . $this->url, $post_data, array($this, 'getCount'), array('twitter'), $headers );
209
  }
210
- $RollingCurlX->addRequest( "https://www.linkedin.com/countserv/count/share?format=json&url=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('linkedin'), $headers );
211
- $RollingCurlX->addRequest( "http://www.stumbleupon.com/services/1.01/badge.getinfo?url=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('stumbleupon'), $headers );
212
- $RollingCurlX->addRequest( "https://plusone.google.com/_/+1/fastbutton?url=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('google'), $headers );
213
- $RollingCurlX->addRequest( "http://api.pinterest.com/v1/urls/count.json?url=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('pinterest'), $headers );
214
- $RollingCurlX->addRequest( "https://api.bufferapp.com/1/links/shares.json?url=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('buffer'), $headers );
215
- $RollingCurlX->addRequest( "https://vk.com/share.php?act=count&index=1&url=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('vk'), $headers );
216
 
217
  $RollingCurlX->execute();
218
 
207
  } else {
208
  $RollingCurlX->addRequest( "http://public.newsharecounts.com/count.json?url=" . $this->url, $post_data, array($this, 'getCount'), array('twitter'), $headers );
209
  }
210
+ $RollingCurlX->addRequest( "https://www.linkedin.com/countserv/count/share?format=json&url=" . $this->url, $post_data, array($this, 'getCount'), array('linkedin'), $headers );
211
+ $RollingCurlX->addRequest( "http://www.stumbleupon.com/services/1.01/badge.getinfo?url=" . $this->url, $post_data, array($this, 'getCount'), array('stumbleupon'), $headers );
212
+ $RollingCurlX->addRequest( "https://plusone.google.com/_/+1/fastbutton?url=" . $this->url, $post_data, array($this, 'getCount'), array('google'), $headers );
213
+ $RollingCurlX->addRequest( "http://api.pinterest.com/v1/urls/count.json?url=" . $this->url, $post_data, array($this, 'getCount'), array('pinterest'), $headers );
214
+ $RollingCurlX->addRequest( "https://api.bufferapp.com/1/links/shares.json?url=" . $this->url, $post_data, array($this, 'getCount'), array('buffer'), $headers );
215
+ $RollingCurlX->addRequest( "https://vk.com/share.php?act=count&index=1&url=" . $this->url, $post_data, array($this, 'getCount'), array('vk'), $headers );
216
 
217
  $RollingCurlX->execute();
218
 
includes/sharecount-functions.php CHANGED
@@ -152,16 +152,20 @@ add_action( 'wp_ajax_nopriv_mashsb_refresh_cache', 'mashsb_ajax_refresh_cache' )
152
  function mashsb_get_expiration_method_async() {
153
  // post age in seconds
154
  $post_age = floor( date( 'U' ) - get_post_time( 'U', true ) );
 
 
 
 
155
 
156
- if( isset( $post_age ) && $post_age > 5184000 ) {
157
  // Post older than 60 days - expire cache after 12 hours
158
- $seconds = 43200;
159
- } else if( isset( $post_age ) && $post_age > 75600 ) {
160
  // Post older than 21 days - expire cache after 4 hours.
161
- $seconds = 14400;
162
  } else {
163
  // expire cache after one hour
164
- $seconds = 3600;
165
  }
166
 
167
  return $seconds;
152
  function mashsb_get_expiration_method_async() {
153
  // post age in seconds
154
  $post_age = floor( date( 'U' ) - get_post_time( 'U', true ) );
155
+
156
+ $three_months_period = apply_filters('mashsb_three_months', 5184000);
157
+
158
+ $three_weeks_period = apply_filters('mashsb_three_weeks', 1814400);
159
 
160
+ if( isset( $post_age ) && $post_age > $three_months_period ) {
161
  // Post older than 60 days - expire cache after 12 hours
162
+ $seconds = apply_filters('mashsb_refresh_60_days', 43200);
163
+ } else if( isset( $post_age ) && $post_age > $three_weeks_period ) {
164
  // Post older than 21 days - expire cache after 4 hours.
165
+ $seconds = apply_filters('mashsb_refresh_21_days', 14400);
166
  } else {
167
  // expire cache after one hour
168
+ $seconds = apply_filters('mashsb_refresh_1_hour', 3600);;
169
  }
170
 
171
  return $seconds;
includes/template-functions.php CHANGED
@@ -567,8 +567,11 @@ function mashsb_render_sharecounts( $customurl = '', $align = 'left' ) {
567
 
568
  // Get class names for buttons size
569
  $class_size = isset($mashsb_options['buttons_size']) ? ' ' . $mashsb_options['buttons_size'] : '';
 
 
 
570
 
571
- $html = '<div class="mashsb-count'.$class_size . '" style="float:' . $align . ';"><div class="counts mashsbcount">' . $sharecount . '</div><span class="mashsb-sharetext">' . $sharetitle . '</span></div>';
572
  return apply_filters('mashsb_share_count', $html);
573
  }
574
 
567
 
568
  // Get class names for buttons size
569
  $class_size = isset($mashsb_options['buttons_size']) ? ' ' . $mashsb_options['buttons_size'] : '';
570
+
571
+ // No inline style if it's amp
572
+ $style = !mashsb_is_amp_page() ? 'style="float:' . $align . ';"' : '';
573
 
574
+ $html = '<div class="mashsb-count'.$class_size . '" ' . $style . '><div class="counts mashsbcount">' . $sharecount . '</div><span class="mashsb-sharetext">' . $sharetitle . '</span></div>';
575
  return apply_filters('mashsb_share_count', $html);
576
  }
577
 
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.3.8
10
  * Text Domain: mashsb
11
  * Domain Path: /languages
12
  * Credits: Thanks go to Pippin Williamson and the edd team. When we started with Mashshare we decided to use the EDD code base and
@@ -37,7 +37,7 @@ if( !defined( 'ABSPATH' ) )
37
 
38
  // Plugin version
39
  if( !defined( 'MASHSB_VERSION' ) ) {
40
- define( 'MASHSB_VERSION', '3.3.8' );
41
  }
42
 
43
  // 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.3.9
10
  * Text Domain: mashsb
11
  * Domain Path: /languages
12
  * Credits: Thanks go to Pippin Williamson and the edd team. When we started with Mashshare we decided to use the EDD code base and
37
 
38
  // Plugin version
39
  if( !defined( 'MASHSB_VERSION' ) ) {
40
+ define( 'MASHSB_VERSION', '3.3.9' );
41
  }
42
 
43
  // Debug mode
readme.txt CHANGED
@@ -8,8 +8,8 @@ License: GPLv2 or later
8
  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
10
  Requires at least: 3.6+
11
- Tested up to: 4.7.2
12
- Stable tag: 3.3.8
13
 
14
  Social Media Share Buttons for Twitter, Facebook and other social networks. Highly customizable Social Media ecosystem
15
 
@@ -316,6 +316,12 @@ Read here more FAQ: [https://www.mashshare.net/faq/](https://www.mashshare.net/f
316
 
317
  == Changelog ==
318
 
 
 
 
 
 
 
319
  = 3.3.8 =
320
  * Fix: Zero shares are not shown with the use of the inline post plugin
321
  * Fix: jQuery nearest library not detected with older jQuery versions
8
  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
10
  Requires at least: 3.6+
11
+ Tested up to: 4.7.3
12
+ Stable tag: 3.3.9
13
 
14
  Social Media Share Buttons for Twitter, Facebook and other social networks. Highly customizable Social Media ecosystem
15
 
316
 
317
  == Changelog ==
318
 
319
+ = 3.3.9 =
320
+ * New: Create filters to allow customizing the refresh times
321
+ * Fix: Sporadic connection issues in post editor
322
+ * Fix: Pinterest and google share count not correct for https websites
323
+ * Fix: Remove inline css on AMP site
324
+
325
  = 3.3.8 =
326
  * Fix: Zero shares are not shown with the use of the inline post plugin
327
  * Fix: jQuery nearest library not detected with older jQuery versions