Social Media Share Buttons | MashShare - Version 3.5.0

Version Description

  • New: Tested up to WordPress 4.9.5
  • New: Improved share count aggregation
  • New: Add rel="noopener" to all network buttons
  • Tweak: Remove opt-in notice
  • Tweak: Remove rate limit notice
  • Fix: Calls to networks api are still made when sharecount is disabled
Download this release

Release Info

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

Code changes from version 3.4.8 to 3.5.0

assets/js/mashsb-admin.js CHANGED
@@ -70,6 +70,7 @@ jQuery(document).ready(function ($) {
70
  // //console.log(e);
71
  })
72
  }
 
73
 
74
  $('#mashsb_fb_auth').click(function (e) {
75
  e.preventDefault();
70
  // //console.log(e);
71
  })
72
  }
73
+
74
 
75
  $('#mashsb_fb_auth').click(function (e) {
76
  e.preventDefault();
assets/js/mashsb.js CHANGED
@@ -1,102 +1,208 @@
1
  var strict;
2
 
3
  jQuery(document).ready(function ($) {
4
-
5
- /* Show Whatsapp button on mobile devices iPhones and Android only */
6
- if(navigator.userAgent.match(/(iPhone)/i) || navigator.userAgent.match(/(Android)/i)){
7
- $('.mashicon-whatsapp').show();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  }
9
-
 
10
  // pinterest button logic
11
- $('body')
12
- .off('click', '.mashicon-pinterest')
13
- .on('click', '.mashicon-pinterest', function (e) {
14
- e.preventDefault();
15
- console.log('preventDefault:' + e);
16
- winWidth = 520;
17
- winHeight = 350;
18
- var winTop = (screen.height / 2) - (winHeight / 2);
19
- var winLeft = (screen.width / 2) - (winWidth / 2);
20
- var url = $(this).attr('data-mashsb-url');
21
-
22
- window.open(url, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight + ',resizable=yes');
23
-
24
- });
25
-
26
- /* Load Pinterest Popup window
27
- *
28
- * @param string html container
29
- * @returns void
30
- */
31
- function load_pinterest(html) {
32
-
33
- mashnet_load_pinterest_body();
34
-
35
- jQuery('.mashnet_pinterest_header').fadeIn(500);
36
- jQuery('.mashnet_pinterest_inner').html(html);
37
-
38
- /* Close Pinterest popup*/
39
- jQuery('.mashnet_pinterest_close').click(function (e) {
40
  e.preventDefault();
41
- jQuery('.mashnet_pinterest_header').hide();
 
 
 
 
 
 
 
 
42
  });
43
- }
44
 
45
- /**
46
- * Load pinterest wrapper
47
- *
48
- * @returns voids
49
- */
50
- function load_pinterest_body() {
51
- var winWidth = window.innerWidth;
52
- var popupWidth = 350;
53
- var popupHeight = 310;
54
-
55
- /* Load Pinterest popup into body of page */
56
- if (winWidth <= 330)
57
- var popupWidth = 310;
58
- if (winWidth > 400)
59
- var popupWidth = 390;
60
- if (winWidth > 500)
61
- var popupWidth = 490;
62
-
63
- var winTop = (window.innerHeight / 2) - (popupHeight / 2);
64
- var winLeft = (window.innerWidth / 2) - (popupWidth / 2);
65
- var struct = '<div class="mashnet_pinterest_header" style="position:fixed;z-index:999999;max-width:' + popupWidth + 'px; margin-left:' + winLeft + 'px;top:' + winTop + 'px;">\n\
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  <div class="mashnet_pinit_wrapper" style="background-color:white;"><span class="mashnet_pin_it">Pin it! </span><span class="mashnet_pinicon"></span> \n\
67
  <div class="mashnet_pinterest_close" style="float:right;"><a href="#">X</a></div></div>\n\
68
  <div class="mashnet_pinterest_inner"></div>\n\
69
  </div>\n\
70
  ';
71
 
72
- jQuery('body').append(struct);
73
- }
74
 
75
- /* Get all images on site
76
- *
77
- * @return html
78
- * */
79
- function get_images(url) {
80
-
81
- var allImages = jQuery('img').not("[nopin='nopin']");
82
- var html = '';
83
- var url = '';
84
-
85
- var largeImages = allImages.filter(function () {
86
- return (jQuery(this).width() > 70) || (jQuery(this).height() > 70)
87
- })
88
- for (i = 0; i < largeImages.length; i++) {
89
- html += '<li><a target="_blank" id="mashnetPinterestPopup" href="https://pinterest.com/pin/create/button/?url=' + encodeURIComponent(window.location.href) + '%2F&media=' + largeImages[i].src + '&description=' + largeImages[i].alt + '"><img src="' + largeImages[i].src + '"></a></li>';
90
- }
91
  }
92
-
 
93
 
94
  // check the sharecount caching method
95
- mashsb_check_cache();
96
-
97
  // Fix for the inline post plugin which removes the zero share count
98
- if ($('.mashsbcount').text() == ''){
99
- $('.mashsbcount').text(0);
100
  }
101
 
102
  /**
@@ -105,7 +211,7 @@ jQuery(document).ready(function ($) {
105
  */
106
  function mashsb_check_cache() {
107
  setTimeout(function () {
108
- if (typeof(mashsb) && mashsb.refresh == "1") {
109
  mashsb_update_cache();
110
  }
111
 
@@ -247,14 +353,14 @@ jQuery(document).ready(function ($) {
247
 
248
  // how many times to update the value, and how much to increment the value on each update
249
  var loops = Math.ceil(settings.speed / settings.refreshInterval),
250
- increment = (settings.to - settings.from) / loops;
251
 
252
  // references & variables that will change with each update
253
  var self = this,
254
- $self = $(this),
255
- loopCount = 0,
256
- value = settings.from,
257
- data = $self.data('countTo') || {};
258
 
259
  $self.data('countTo', data);
260
 
@@ -315,7 +421,8 @@ jQuery(document).ready(function ($) {
315
 
316
  }(jQuery));
317
 
318
- /* Start the counter
 
319
  *
320
  */
321
  if (typeof mashsb !== 'undefined' && mashsb.animate_shares == 1 && $('.mashsbcount').length) {
@@ -336,7 +443,7 @@ jQuery(document).ready(function ($) {
336
  (function ($, d) {
337
  $.fn.nearest = function (selector) {
338
  var self, nearest, el, s, p,
339
- hasQsa = d.querySelectorAll;
340
 
341
  function update(el) {
342
  nearest = nearest ? nearest.add(el) : $(el);
1
  var strict;
2
 
3
  jQuery(document).ready(function ($) {
4
+
5
+ /* Show Whatsapp button on mobile devices iPhones and Android only */
6
+ if (navigator.userAgent.match(/(iPhone)/i) || navigator.userAgent.match(/(Android)/i)) {
7
+ $('.mashicon-whatsapp').show();
8
+ }
9
+
10
+ /**
11
+ * Get facebook share count vi js client request
12
+ *
13
+ * @returns {undefined}
14
+ */
15
+ var mashsb_get_fb_shares = function ()
16
+ {
17
+
18
+
19
+ if (document.querySelector('.mashsb-buttons') === null) {
20
+ return false;
21
+ }
22
+
23
+ if ('undefined' !== typeof (mashsb.refresh) && mashsb.refresh === '0') {
24
+ return false;
25
+ }
26
+
27
+ if ('undefined' === typeof (mashsb.share_url) && mashsb.share_url !== '') {
28
+ return false;
29
+ }
30
+
31
+ if ('undefined' === typeof (mashsb.postid) && mashsb.postid !== '') {
32
+ return false;
33
+ }
34
+
35
+ if (mashsb_is_rate_limit()) {
36
+ return false;
37
+ }
38
+
39
+ //mashsb.share_url = 'https://www.google.de';
40
+
41
+ var facebookGraphURL = 'https://graph.facebook.com/?id=' + mashsb.share_url;
42
+ $.ajax({
43
+ type: 'GET',
44
+ url: facebookGraphURL,
45
+ dataType: 'json',
46
+ success: function (data) {
47
+ mashsb_set_fb_sharecount(data);
48
+ console.log(data);
49
+ },
50
+ error: function (e) {
51
+ console.log(e)
52
+ }
53
+ })
54
+
55
+
56
+ }
57
+ // Make sure page has been loaded completely before requesting any shares via ajax
58
+ // This also prevents hitting the server too often
59
+ setTimeout(mashsb_get_fb_shares, 3000);
60
+
61
+ /**
62
+ * If page is older than 30 second it's cached. So do not call FB API again
63
+ * @returns {Boolean}
64
+ */
65
+ function mashsb_is_rate_limit() {
66
+
67
+ if ("undefined" === typeof (mashsb.servertime)) {
68
+ return true;
69
+ }
70
+
71
+ var serverTime = Number(mashsb.servertime);
72
+ var clientTime = Math.floor(Date.now() / 1000);
73
+
74
+ if (clientTime > (serverTime + 30)) {
75
+ console.log('rate limited: ' + (serverTime + 30));
76
+ return true;
77
+ } else {
78
+ console.log('not rate limited: ' + (serverTime + 30));
79
+ return false;
80
+ }
81
+ }
82
+
83
+ /**
84
+ * Store FB return data in mashshare cache vi js client request
85
+ * @returns {undefined}
86
+ */
87
+ function mashsb_set_fb_sharecount(result) {
88
+
89
+ if ('undefined' === typeof (result.share)) {
90
+ console.log('No valid result' + result);
91
+ return false;
92
+ }
93
+
94
+ var data = {
95
+ action: 'mashsb_set_fb_shares',
96
+ shares: result.share,
97
+ postid: mashsb.postid,
98
+ url: mashsb.share_url,
99
+ nonce: mashsb.nonce
100
+ }
101
+
102
+ $.ajax({
103
+ type: "post",
104
+ url: mashsb.ajaxurl,
105
+ data: data,
106
+ success: function (res) {
107
+ console.log('Save fb results: ' + res);
108
+ },
109
+ error: function (e) {
110
+ console.log('Unknown error ' + e)
111
+ }
112
+ })
113
  }
114
+
115
+
116
  // pinterest button logic
117
+ $('body')
118
+ .off('click', '.mashicon-pinterest')
119
+ .on('click', '.mashicon-pinterest', function (e) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  e.preventDefault();
121
+ console.log('preventDefault:' + e);
122
+ winWidth = 520;
123
+ winHeight = 350;
124
+ var winTop = (screen.height / 2) - (winHeight / 2);
125
+ var winLeft = (screen.width / 2) - (winWidth / 2);
126
+ var url = $(this).attr('data-mashsb-url');
127
+
128
+ window.open(url, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight + ',resizable=yes');
129
+
130
  });
 
131
 
132
+ /* Load Pinterest Popup window
133
+ *
134
+ * @param string html container
135
+ * @returns void
136
+ */
137
+ function load_pinterest(html) {
138
+
139
+ mashnet_load_pinterest_body();
140
+
141
+ jQuery('.mashnet_pinterest_header').fadeIn(500);
142
+ jQuery('.mashnet_pinterest_inner').html(html);
143
+
144
+ /* Close Pinterest popup*/
145
+ jQuery('.mashnet_pinterest_close').click(function (e) {
146
+ e.preventDefault();
147
+ jQuery('.mashnet_pinterest_header').hide();
148
+ });
149
+ }
150
+
151
+ /**
152
+ * Load pinterest wrapper
153
+ *
154
+ * @returns voids
155
+ */
156
+ function load_pinterest_body() {
157
+ var winWidth = window.innerWidth;
158
+ var popupWidth = 350;
159
+ var popupHeight = 310;
160
+
161
+ /* Load Pinterest popup into body of page */
162
+ if (winWidth <= 330)
163
+ var popupWidth = 310;
164
+ if (winWidth > 400)
165
+ var popupWidth = 390;
166
+ if (winWidth > 500)
167
+ var popupWidth = 490;
168
+
169
+ var winTop = (window.innerHeight / 2) - (popupHeight / 2);
170
+ var winLeft = (window.innerWidth / 2) - (popupWidth / 2);
171
+ var struct = '<div class="mashnet_pinterest_header" style="position:fixed;z-index:999999;max-width:' + popupWidth + 'px; margin-left:' + winLeft + 'px;top:' + winTop + 'px;">\n\
172
  <div class="mashnet_pinit_wrapper" style="background-color:white;"><span class="mashnet_pin_it">Pin it! </span><span class="mashnet_pinicon"></span> \n\
173
  <div class="mashnet_pinterest_close" style="float:right;"><a href="#">X</a></div></div>\n\
174
  <div class="mashnet_pinterest_inner"></div>\n\
175
  </div>\n\
176
  ';
177
 
178
+ jQuery('body').append(struct);
179
+ }
180
 
181
+ /* Get all images on site
182
+ *
183
+ * @return html
184
+ * */
185
+ function get_images(url) {
186
+
187
+ var allImages = jQuery('img').not("[nopin='nopin']");
188
+ var html = '';
189
+ var url = '';
190
+
191
+ var largeImages = allImages.filter(function () {
192
+ return (jQuery(this).width() > 70) || (jQuery(this).height() > 70)
193
+ })
194
+ for (i = 0; i < largeImages.length; i++) {
195
+ html += '<li><a target="_blank" rel="noopener" id="mashnetPinterestPopup" href="https://pinterest.com/pin/create/button/?url=' + encodeURIComponent(window.location.href) + '%2F&media=' + largeImages[i].src + '&description=' + largeImages[i].alt + '"><img src="' + largeImages[i].src + '"></a></li>';
 
196
  }
197
+ }
198
+
199
 
200
  // check the sharecount caching method
201
+ //mashsb_check_cache();
202
+
203
  // Fix for the inline post plugin which removes the zero share count
204
+ if ($('.mashsbcount').text() == '') {
205
+ $('.mashsbcount').text(0);
206
  }
207
 
208
  /**
211
  */
212
  function mashsb_check_cache() {
213
  setTimeout(function () {
214
+ if (typeof (mashsb) && mashsb.refresh == "1") {
215
  mashsb_update_cache();
216
  }
217
 
353
 
354
  // how many times to update the value, and how much to increment the value on each update
355
  var loops = Math.ceil(settings.speed / settings.refreshInterval),
356
+ increment = (settings.to - settings.from) / loops;
357
 
358
  // references & variables that will change with each update
359
  var self = this,
360
+ $self = $(this),
361
+ loopCount = 0,
362
+ value = settings.from,
363
+ data = $self.data('countTo') || {};
364
 
365
  $self.data('countTo', data);
366
 
421
 
422
  }(jQuery));
423
 
424
+ /*
425
+ * Start the counter
426
  *
427
  */
428
  if (typeof mashsb !== 'undefined' && mashsb.animate_shares == 1 && $('.mashsbcount').length) {
443
  (function ($, d) {
444
  $.fn.nearest = function (selector) {
445
  var self, nearest, el, s, p,
446
+ hasQsa = d.querySelectorAll;
447
 
448
  function update(el) {
449
  nearest = nearest ? nearest.add(el) : $(el);
assets/js/mashsb.min.js CHANGED
@@ -1 +1 @@
1
- var strict;jQuery(document).ready(function(a){function b(){setTimeout(function(){"1"==mashsb.refresh&&c()},6e3)}function c(){var a=window.location.href;a+=a.indexOf("?")>-1?"&mashsb-refresh":"?mashsb-refresh";var b=new XMLHttpRequest;b.open("GET",a,!0),b.send()}function d(a){if("undefined"!=typeof mashsb&&1==mashsb.round_shares){if(a>1e6)return shares=Math.round(a/1e6*10)/10+"M",shares;if(a>1e3)return shares=Math.round(a/1e3*10)/10+"k",shares}return a.toFixed(0)}(navigator.userAgent.match(/(iPhone)/i)||navigator.userAgent.match(/(Android)/i))&&a(".mashicon-whatsapp").show(),a("body").off("click",".mashicon-pinterest").on("click",".mashicon-pinterest",function(b){b.preventDefault(),console.log("preventDefault:"+b),winWidth=520,winHeight=350;var c=screen.height/2-winHeight/2,d=screen.width/2-winWidth/2,e=a(this).attr("data-mashsb-url");window.open(e,"sharer","top="+c+",left="+d+",toolbar=0,status=0,width="+winWidth+",height="+winHeight+",resizable=yes")}),b(),""==a(".mashsbcount").text()&&a(".mashsbcount").text(0),a(".onoffswitch").on("click",function(){var b=a(this).parents(".mashsb-container");b.find(".onoffswitch").hide(),b.find(".secondary-shares").show(),b.find(".onoffswitch2").show()}),a(".onoffswitch2").on("click",function(){var b=a(this).parents(".mashsb-container");b.find(".onoffswitch").show(),b.find(".secondary-shares").hide()}),"undefined"==typeof lashare_fb&&"undefined"!=typeof mashsb&&a(".mashicon-facebook").click(function(b){winWidth=520,winHeight=550;var c=screen.height/2-winHeight/2,d=screen.width/2-winWidth/2,e=a(this).attr("href");return window.open(e,"sharer","top="+c+",left="+d+",toolbar=0,status=0,width="+winWidth+",height="+winHeight),b.preventDefault(b),!1}),"undefined"!=typeof mashsb&&a(".mashicon-twitter").click(function(b){winWidth=520,winHeight=350;var c=screen.height/2-winHeight/2,d=screen.width/2-winWidth/2,e=a(this).attr("href");return"1"===mashsb.twitter_popup&&window.open(e,"sharer","top="+c+",left="+d+",toolbar=0,status=0,width="+winWidth+",height="+winHeight),b.preventDefault(),!1}),"undefined"!=typeof mashsb&&"content"===mashsb.subscribe&&(a(".mashicon-subscribe").not(".trigger_active").nearest(".mashsb-toggle-container").hide(),a(".mashicon-subscribe").click(function(){var b=a(this);return b.hasClass("trigger_active")?(a(b).nearest(".mashsb-toggle-container").slideToggle("fast"),b.removeClass("trigger_active")):(a(".trigger_active").nearest(".mashsb-toggle-container").slideToggle("slow"),a(".trigger_active").removeClass("trigger_active"),a(b).nearest(".mashsb-toggle-container").slideToggle("fast"),b.addClass("trigger_active")),!1})),"undefined"!=typeof mashsb&&"link"===mashsb.subscribe&&a(".mashicon-subscribe").click(function(){var b=mashsb.subscribe_url;a(this).attr("href",b)}),function(a){a.fn.countTo=function(b){return b=b||{},a(this).each(function(){function c(){k+=g,j++,d(k),"function"==typeof e.onUpdate&&e.onUpdate.call(h,k),j>=f&&(i.removeData("countTo"),clearInterval(l.interval),k=e.to,"function"==typeof e.onComplete&&e.onComplete.call(h,k))}function d(a){var b=e.formatter.call(h,a,e);i.text(b)}var e=a.extend({},a.fn.countTo.defaults,{from:a(this).data("from"),to:a(this).data("to"),speed:a(this).data("speed"),refreshInterval:a(this).data("refresh-interval"),decimals:a(this).data("decimals")},b),f=Math.ceil(e.speed/e.refreshInterval),g=(e.to-e.from)/f,h=this,i=a(this),j=0,k=e.from,l=i.data("countTo")||{};i.data("countTo",l),l.interval&&clearInterval(l.interval),l.interval=setInterval(c,e.refreshInterval),d(k)})},a.fn.countTo.defaults={from:0,to:0,speed:1e3,refreshInterval:100,decimals:0,formatter:d,onUpdate:null,onComplete:null}}(jQuery),"undefined"!=typeof mashsb&&1==mashsb.animate_shares&&a(".mashsbcount").length&&a(".mashsbcount").countTo({from:0,to:mashsb.shares,speed:1e3,refreshInterval:100})}),function(a,b){a.fn.nearest=function(c){function d(b){f=f?f.add(b):a(b)}var e,f,g,h,i,j=b.querySelectorAll;return this.each(function(){e=this,a.each(c.split(","),function(){if(h=a.trim(this),h.indexOf("#"))for(i=e.parentNode;i;){if(g=j?i.querySelectorAll(h):a(i).find(h),g.length){d(g);break}i=i.parentNode}else d(j?b.querySelectorAll(h):a(h))})}),f||a()}}(jQuery,document);
1
+ var strict;jQuery(document).ready(function(a){function b(){if("undefined"==typeof mashsb.servertime)return!0;var a=Number(mashsb.servertime),b=Math.floor(Date.now()/1e3);return b>a+30?(console.log("rate limited: "+(a+30)),!0):(console.log("not rate limited: "+(a+30)),!1)}function c(b){if("undefined"==typeof b.share)return console.log("No valid result"+b),!1;var c={action:"mashsb_set_fb_shares",shares:b.share,postid:mashsb.postid,url:mashsb.share_url,nonce:mashsb.nonce};a.ajax({type:"post",url:mashsb.ajaxurl,data:c,success:function(a){console.log("Save fb results: "+a)},error:function(a){console.log("Unknown error "+a)}})}function d(a){if("undefined"!=typeof mashsb&&1==mashsb.round_shares){if(a>1e6)return shares=Math.round(a/1e6*10)/10+"M",shares;if(a>1e3)return shares=Math.round(a/1e3*10)/10+"k",shares}return a.toFixed(0)}(navigator.userAgent.match(/(iPhone)/i)||navigator.userAgent.match(/(Android)/i))&&a(".mashicon-whatsapp").show();var e=function(){if(null===document.querySelector(".mashsb-buttons"))return!1;if("undefined"!=typeof mashsb.refresh&&"0"===mashsb.refresh)return!1;if("undefined"==typeof mashsb.share_url&&""!==mashsb.share_url)return!1;if("undefined"==typeof mashsb.postid&&""!==mashsb.postid)return!1;if(b())return!1;var d="https://graph.facebook.com/?id="+mashsb.share_url;a.ajax({type:"GET",url:d,dataType:"json",success:function(a){c(a),console.log(a)},error:function(a){console.log(a)}})};setTimeout(e,3e3),a("body").off("click",".mashicon-pinterest").on("click",".mashicon-pinterest",function(b){b.preventDefault(),console.log("preventDefault:"+b),winWidth=520,winHeight=350;var c=screen.height/2-winHeight/2,d=screen.width/2-winWidth/2,e=a(this).attr("data-mashsb-url");window.open(e,"sharer","top="+c+",left="+d+",toolbar=0,status=0,width="+winWidth+",height="+winHeight+",resizable=yes")}),""==a(".mashsbcount").text()&&a(".mashsbcount").text(0),a(".onoffswitch").on("click",function(){var b=a(this).parents(".mashsb-container");b.find(".onoffswitch").hide(),b.find(".secondary-shares").show(),b.find(".onoffswitch2").show()}),a(".onoffswitch2").on("click",function(){var b=a(this).parents(".mashsb-container");b.find(".onoffswitch").show(),b.find(".secondary-shares").hide()}),"undefined"==typeof lashare_fb&&"undefined"!=typeof mashsb&&a(".mashicon-facebook").click(function(b){winWidth=520,winHeight=550;var c=screen.height/2-winHeight/2,d=screen.width/2-winWidth/2,e=a(this).attr("href");return window.open(e,"sharer","top="+c+",left="+d+",toolbar=0,status=0,width="+winWidth+",height="+winHeight),b.preventDefault(b),!1}),"undefined"!=typeof mashsb&&a(".mashicon-twitter").click(function(b){winWidth=520,winHeight=350;var c=screen.height/2-winHeight/2,d=screen.width/2-winWidth/2,e=a(this).attr("href");return"1"===mashsb.twitter_popup&&window.open(e,"sharer","top="+c+",left="+d+",toolbar=0,status=0,width="+winWidth+",height="+winHeight),b.preventDefault(),!1}),"undefined"!=typeof mashsb&&"content"===mashsb.subscribe&&(a(".mashicon-subscribe").not(".trigger_active").nearest(".mashsb-toggle-container").hide(),a(".mashicon-subscribe").click(function(){var b=a(this);return b.hasClass("trigger_active")?(a(b).nearest(".mashsb-toggle-container").slideToggle("fast"),b.removeClass("trigger_active")):(a(".trigger_active").nearest(".mashsb-toggle-container").slideToggle("slow"),a(".trigger_active").removeClass("trigger_active"),a(b).nearest(".mashsb-toggle-container").slideToggle("fast"),b.addClass("trigger_active")),!1})),"undefined"!=typeof mashsb&&"link"===mashsb.subscribe&&a(".mashicon-subscribe").click(function(){var b=mashsb.subscribe_url;a(this).attr("href",b)}),function(a){a.fn.countTo=function(b){return b=b||{},a(this).each(function(){function c(){k+=g,j++,d(k),"function"==typeof e.onUpdate&&e.onUpdate.call(h,k),j>=f&&(i.removeData("countTo"),clearInterval(l.interval),k=e.to,"function"==typeof e.onComplete&&e.onComplete.call(h,k))}function d(a){var b=e.formatter.call(h,a,e);i.text(b)}var e=a.extend({},a.fn.countTo.defaults,{from:a(this).data("from"),to:a(this).data("to"),speed:a(this).data("speed"),refreshInterval:a(this).data("refresh-interval"),decimals:a(this).data("decimals")},b),f=Math.ceil(e.speed/e.refreshInterval),g=(e.to-e.from)/f,h=this,i=a(this),j=0,k=e.from,l=i.data("countTo")||{};i.data("countTo",l),l.interval&&clearInterval(l.interval),l.interval=setInterval(c,e.refreshInterval),d(k)})},a.fn.countTo.defaults={from:0,to:0,speed:1e3,refreshInterval:100,decimals:0,formatter:d,onUpdate:null,onComplete:null}}(jQuery),"undefined"!=typeof mashsb&&1==mashsb.animate_shares&&a(".mashsbcount").length&&a(".mashsbcount").countTo({from:0,to:mashsb.shares,speed:1e3,refreshInterval:100})}),function(a,b){a.fn.nearest=function(c){function d(b){f=f?f.add(b):a(b)}var e,f,g,h,i,j=b.querySelectorAll;return this.each(function(){e=this,a.each(c.split(","),function(){if(h=a.trim(this),h.indexOf("#"))for(i=e.parentNode;i;){if(g=j?i.querySelectorAll(h):a(i).find(h),g.length){d(g);break}i=i.parentNode}else d(j?b.querySelectorAll(h):a(h))})}),f||a()}}(jQuery,document);
includes/MASHSB_SL_Plugin_Updater.php CHANGED
@@ -175,14 +175,14 @@ class MASHSB_SL_Plugin_Updater {
175
 
176
  if ( empty( $version_info->download_link ) ) {
177
  printf(
178
- __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd' ),
179
  esc_html( $version_info->name ),
180
  esc_url( $changelog_link ),
181
  esc_html( $version_info->new_version )
182
  );
183
  } else {
184
  printf(
185
- __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd' ),
186
  esc_html( $version_info->name ),
187
  esc_url( $changelog_link ),
188
  esc_html( $version_info->new_version ),
175
 
176
  if ( empty( $version_info->download_link ) ) {
177
  printf(
178
+ __( 'There is a new version of %1$s available. <a target="_blank" rel="noopener" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd' ),
179
  esc_html( $version_info->name ),
180
  esc_url( $changelog_link ),
181
  esc_html( $version_info->new_version )
182
  );
183
  } else {
184
  printf(
185
+ __( 'There is a new version of %1$s available. <a target="_blank" rel="noopener" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd' ),
186
  esc_html( $version_info->name ),
187
  esc_url( $changelog_link ),
188
  esc_html( $version_info->new_version ),
includes/actions.php CHANGED
@@ -1,76 +1,79 @@
1
- <?php
2
- /**
3
- * Front-end Actions
4
- *
5
- * @package MASHSB
6
- * @subpackage Functions
7
- * @copyright Copyright (c) 2015, Pippin Williamson, René Hermenau
8
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- * @since 2.5.1
10
- */
11
-
12
- // Exit if accessed directly
13
- if ( ! defined( 'ABSPATH' ) ) exit;
14
-
15
- /**
16
- * Hooks MASHSB actions, when present in the $_GET superglobal. Every mashsb_action
17
- * present in $_GET is called using WordPress's do_action function. These
18
- * functions are called on init.
19
- *
20
- * @since 1.0
21
- * @return void
22
- */
23
- function mashsb_get_actions() {
24
- if ( isset( $_GET['mashsb_action'] ) ) {
25
- do_action( 'mashsb_' . $_GET['mashsb_action'], $_GET );
26
- }
27
- }
28
- add_action( 'init', 'mashsb_get_actions' );
29
-
30
- /**
31
- * Hooks MASHSB actions, when present in the $_POST superglobal. Every mashsb_action
32
- * present in $_POST is called using WordPress's do_action function. These
33
- * functions are called on init.
34
- *
35
- * @since 1.0
36
- * @return void
37
- */
38
- function mashsb_post_actions() {
39
- if ( isset( $_POST['mashsb_action'] ) ) {
40
- do_action( 'mashsb_' . $_POST['mashsb_action'], $_POST );
41
- }
42
- }
43
- add_action( 'init', 'mashsb_post_actions' );
44
-
45
- /**
46
- * Force cache refresh via GET REQUEST
47
- *
48
- * @global array $mashsb_options
49
- * @return boolean true for cache refresh
50
- */
51
- function mashsb_force_cache_refresh() {
52
- global $mashsb_options;
53
-
54
- // Needed for testing (phpunit)
55
- if (MASHSB_DEBUG || isset( $mashsb_options['disable_cache'] ) ){
56
- mashsb()->logger->info('mashsb_force_cache_refresh() -> Debug mode enabled');
57
- return true;
58
- }
59
-
60
- $caching_method = !empty($mashsb_options['caching_method']) ? $mashsb_options['caching_method'] : 'refresh_loading';
61
-
62
- // Old method and less performant - Cache is rebuild during pageload
63
- if($caching_method == 'refresh_loading'){
64
- if (mashsb_is_cache_refresh()){
65
- return true;
66
- }
67
- }
68
-
69
- // New method - Cache will be rebuild after complete pageloading and will be initiated via ajax.
70
- if( isset( $_GET['mashsb-refresh'] ) && $caching_method == 'async_cache' ) {
71
- MASHSB()->logger->info('Force Cache Refresh');
72
- return true;
73
- }
74
- }
75
- add_action( 'init', 'mashsb_force_cache_refresh' );
76
-
 
 
 
1
+ <?php
2
+ /**
3
+ * Front-end Actions
4
+ *
5
+ * @package MASHSB
6
+ * @subpackage Functions
7
+ * @copyright Copyright (c) 2015, Pippin Williamson, René Hermenau
8
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+ * @since 2.5.1
10
+ */
11
+
12
+ // Exit if accessed directly
13
+ if ( ! defined( 'ABSPATH' ) ) exit;
14
+
15
+ /**
16
+ * Hooks MASHSB actions, when present in the $_GET superglobal. Every mashsb_action
17
+ * present in $_GET is called using WordPress's do_action function. These
18
+ * functions are called on init.
19
+ *
20
+ * @since 1.0
21
+ * @return void
22
+ */
23
+ function mashsb_get_actions() {
24
+ if ( isset( $_GET['mashsb_action'] ) ) {
25
+ do_action( 'mashsb_' . $_GET['mashsb_action'], $_GET );
26
+ }
27
+ }
28
+ add_action( 'init', 'mashsb_get_actions' );
29
+
30
+ /**
31
+ * Hooks MASHSB actions, when present in the $_POST superglobal. Every mashsb_action
32
+ * present in $_POST is called using WordPress's do_action function. These
33
+ * functions are called on init.
34
+ *
35
+ * @since 1.0
36
+ * @return void
37
+ */
38
+ function mashsb_post_actions() {
39
+ if ( isset( $_POST['mashsb_action'] ) ) {
40
+ do_action( 'mashsb_' . $_POST['mashsb_action'], $_POST );
41
+ }
42
+ }
43
+ add_action( 'init', 'mashsb_post_actions' );
44
+
45
+ /**
46
+ * Force cache refresh via GET REQUEST
47
+ *
48
+ * @global array $mashsb_options
49
+ * @return boolean true for cache refresh
50
+ */
51
+ function mashsb_force_cache_refresh() {
52
+ global $mashsb_options;
53
+
54
+ // Needed for testing (phpunit)
55
+ if (MASHSB_DEBUG || isset( $mashsb_options['disable_cache'] ) ){
56
+ mashsb()->logger->info('mashsb_force_cache_refresh() -> Debug mode enabled');
57
+ return true;
58
+ }
59
+
60
+ $caching_method = !empty($mashsb_options['caching_method']) ? $mashsb_options['caching_method'] : 'refresh_loading';
61
+
62
+ // Old method and less performant - Cache is rebuild during pageload
63
+ if($caching_method == 'refresh_loading'){
64
+ if (mashsb_is_cache_refresh()){
65
+ return true;
66
+ }
67
+ }
68
+
69
+ // New method - Cache will be rebuild after complete pageloading and will be initiated via ajax.
70
+ if( isset( $_GET['mashsb-refresh'] ) && $caching_method == 'async_cache' ) {
71
+ MASHSB()->logger->info('Force Cache Refresh');
72
+ return true;
73
+ }
74
+
75
+ return false;
76
+ }
77
+ //add_action( 'init', 'mashsb_force_cache_refresh' );
78
+ add_action( 'wp_ajax_mashsb_force_cache_refresh', 'mashsb_force_cache_refresh' );
79
+ add_action( 'wp_ajax_nopriv_mashsb_force_cache_refresh', 'mashsb_force_cache_refresh' );
includes/admin/add-ons.php CHANGED
@@ -25,9 +25,9 @@ function mashsb_add_ons_page() {
25
  <div class="wrap" id="mashsb-add-ons">
26
  <h2>
27
  <?php _e( 'Add Ons for Mashshare', 'mashsb' ); ?>
28
- &nbsp;&mdash;&nbsp;<a href="https://www.mashshare.net" class="button-primary" title="<?php _e( 'Visit Website', 'mashsb' ); ?>" target="_blank"><?php _e( 'See Details', 'mashsb' ); ?></a>
29
  </h2>
30
- <p><?php _e( 'These add-ons extend the functionality of Mashshare.', 'mashsb' ); ?></p>
31
  <?php echo mashsb_add_ons_get_feed(); ?>
32
  </div>
33
  <?php
@@ -52,7 +52,7 @@ function mashsb_add_ons_get_feed() {
52
  }
53
  } else {
54
  $cache = '<div class="error"><p>' . __( 'There was an error retrieving the Mashshare addon list from the server. Please try again later.', 'mashsb' ) . '
55
- <br>Visit instead the Mashshare Addon Website <a href="https://www.mashshare.net" class="button-primary" title="Mashshare Add ons" target="_blank"> Get Add-Ons </a></div>';
56
  }
57
  }
58
  return $cache;
25
  <div class="wrap" id="mashsb-add-ons">
26
  <h2>
27
  <?php _e( 'Add Ons for Mashshare', 'mashsb' ); ?>
28
+ &nbsp;&mdash;&nbsp;<a href="https://www.mashshare.net" class="button-primary" title="<?php _e( 'Visit Website', 'mashsb' ); ?>" target="_blank" rel="noopener"><?php _e( 'See Details', 'mashsb' ); ?></a>
29
  </h2>
30
+ <p><?php _e( 'These add-ons extend the functionality of MashShare.', 'mashsb' ); ?></p>
31
  <?php echo mashsb_add_ons_get_feed(); ?>
32
  </div>
33
  <?php
52
  }
53
  } else {
54
  $cache = '<div class="error"><p>' . __( 'There was an error retrieving the Mashshare addon list from the server. Please try again later.', 'mashsb' ) . '
55
+ <br>Visit instead the Mashshare Addon Website <a href="https://www.mashshare.net" class="button-primary" title="Mashshare Add ons" target="_blank" rel="noopener"> Get Add-Ons </a></div>';
56
  }
57
  }
58
  return $cache;
includes/admin/admin-actions.php CHANGED
@@ -56,25 +56,6 @@ function mashsb_save_order(){
56
  }
57
  add_action ('wp_ajax_mashsb_update_order', 'mashsb_save_order');
58
 
59
- /**
60
- * Force Facebook to rescrape site content after saving post
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
80
  *
56
  }
57
  add_action ('wp_ajax_mashsb_update_order', 'mashsb_save_order');
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  /**
60
  * Purge the MashShare Cache
61
  *
includes/admin/admin-notices.php CHANGED
@@ -50,8 +50,7 @@ function mashsb_admin_messages() {
50
  // Rate Limit warning
51
  // if( mashsb_is_admin_page() && mashsb_rate_limit_exceeded() ) {
52
  // echo '<div class="error">';
53
- // //echo '<p>' . sprintf(__('Your website exceeded the Facebook rate limit. Share count requests to Facebook and other networks will be delayed for 30min and the Share Count will not grow during this time. If you see this notice often consider to change <strong>MashShare Caching Method</strong> to <a href="%s">Refresh while Loading</a> and use a higher cache expiration. Also create an facebook access token and add it in <a href="%s">Settings->Facebook User Access Token</a> MashShare tries again to request shares in ' . mashsbGetRemainingRateLimitTime() , 'mashsb'), admin_url() . 'admin.php?page=mashsb-settings#mashsb_settingsgeneral_header', admin_url() . 'admin.php?page=mashsb-settings#mashsb_settingsservices_header') . '</p>';
54
- // echo '<p>' . sprintf(__('Your website exceeded the Facebook rate limit. Share count requests to Facebook and other networks will be delayed for 30min and the Share Count will not grow during this time. If you see this notice often consider to change <strong>MashShare Caching Method</strong> to <a href="%s">Refresh while Loading</a> and use a higher cache expiration. MashShare tries again to get shares in ' . mashsbGetRemainingRateLimitTime() , 'mashsb'), admin_url() . 'admin.php?page=mashsb-settings#mashsb_settingsgeneral_header', admin_url() . 'admin.php?page=mashsb-settings#mashsb_settingsservices_header') . '</p>';
55
  // echo '</div>';
56
  // }
57
  // Access Token expired
@@ -78,7 +77,7 @@ function mashsb_admin_messages() {
78
 
79
  if( mashsb_is_admin_page() && !mashsb_curl_installed() ) {
80
  echo '<div class="error">';
81
- echo '<p>' . sprintf(__('MashShare needs the PHP extension cURL and curl_multi_init() which is not installed on your server. Please <a href="%s" target="_blank">install and activate</a> it to be able to collect share count of your posts.', 'mashsb'), 'https://www.google.com/search?btnG=1&pws=0&q=enable+curl+on+php') . '</p>';
82
  echo '</div>';
83
  }
84
 
50
  // Rate Limit warning
51
  // if( mashsb_is_admin_page() && mashsb_rate_limit_exceeded() ) {
52
  // echo '<div class="error">';
53
+ // echo '<p>' . sprintf(__('Your website exceeded the Facebook rate limit. Share count requests to Facebook and other networks will be delayed for 60min and the Share Count will not grow during this time. If you get this notice often consider to change <strong>MashShare Caching Method</strong> to <a href="%s">Refresh while Loading</a> and use a higher cache expiration. MashShare tries again to get shares in ' . mashsbGetRemainingRateLimitTime() , 'mashsb'), admin_url() . 'admin.php?page=mashsb-settings#mashsb_settingsgeneral_header', admin_url() . 'admin.php?page=mashsb-settings#mashsb_settingsservices_header') . '</p>';
 
54
  // echo '</div>';
55
  // }
56
  // Access Token expired
77
 
78
  if( mashsb_is_admin_page() && !mashsb_curl_installed() ) {
79
  echo '<div class="error">';
80
+ echo '<p>' . sprintf(__('MashShare needs the PHP extension cURL and curl_multi_init() which is not installed on your server. Please <a href="%s" target="_blank" rel="noopener">install and activate</a> it to be able to collect share count of your posts.', 'mashsb'), 'https://www.google.com/search?btnG=1&pws=0&q=enable+curl+on+php') . '</p>';
81
  echo '</div>';
82
  }
83
 
includes/admin/meta-box/inc/fields/custom-html.php CHANGED
@@ -34,7 +34,7 @@ class MASHSB_RWMB_Custom_Html_Field extends MASHSB_RWMB_Field {
34
  //var_dump( $post );
35
  if( isset( $post ) && $post->post_status == "publish" ) {
36
  $url = get_permalink( $post->ID );
37
- return '<a href="https://developers.facebook.com/tools/debug/og/object?q=' . $url . '" target="_blank"> Validate Open Graph data </a>';
38
  } else {
39
  return '';
40
  }
34
  //var_dump( $post );
35
  if( isset( $post ) && $post->post_status == "publish" ) {
36
  $url = get_permalink( $post->ID );
37
+ return '<a href="https://developers.facebook.com/tools/debug/og/object?q=' . $url . '" target="_blank" rel="noopener"> Validate Open Graph data </a>';
38
  } else {
39
  return '';
40
  }
includes/admin/meta-box/inc/fields/file.php CHANGED
@@ -156,7 +156,7 @@ class MASHSB_RWMB_File_Field extends MASHSB_RWMB_Field
156
  <li id="item_%s">
157
  <div class="mashsb-rwmb-icon">%s</div>
158
  <div class="mashsb-rwmb-info">
159
- <a href="%s" target="_blank">%s</a>
160
  <p>%s</p>
161
  <a title="%s" href="%s" target="_blank">%s</a> |
162
  <a title="%s" class="mashsb-rwmb-delete-file" href="#" data-attachment_id="%s">%s</a>
156
  <li id="item_%s">
157
  <div class="mashsb-rwmb-icon">%s</div>
158
  <div class="mashsb-rwmb-info">
159
+ <a href="%s" target="_blank" rel="noopener">%s</a>
160
  <p>%s</p>
161
  <a title="%s" href="%s" target="_blank">%s</a> |
162
  <a title="%s" class="mashsb-rwmb-delete-file" href="#" data-attachment_id="%s">%s</a>
includes/admin/meta-box/inc/fields/force-creation.php CHANGED
@@ -32,7 +32,7 @@ class MASHSB_RWMB_Force_Creation_Field extends MASHSB_RWMB_Field {
32
  //var_dump( $post );
33
  if( isset( $post ) && $post->post_status == "publish" ) {
34
  $url = get_permalink( $post->ID );
35
- return '<a href="' . $url . '?mashsb-refresh" target="_blank" class="button-small"> Get Shares & Shortlinks </a>' . $field['helper'];
36
  } else {
37
  return '';
38
  }
32
  //var_dump( $post );
33
  if( isset( $post ) && $post->post_status == "publish" ) {
34
  $url = get_permalink( $post->ID );
35
+ return '<a href="' . $url . '?mashsb-refresh" target="_blank" rel="noopener" class="button-small"> Get Shares & Shortlinks </a>' . $field['helper'];
36
  } else {
37
  return '';
38
  }
includes/admin/meta-box/inc/fields/image.php CHANGED
@@ -127,7 +127,7 @@ class MASHSB_RWMB_Image_Field extends MASHSB_RWMB_File_Field
127
  <li id="item_%s">
128
  <img src="%s" />
129
  <div class="mashsb-rwmb-image-bar">
130
- <a title="%s" class="mashsb-rwmb-edit-file" href="%s" target="_blank">%s</a> |
131
  <a title="%s" class="mashsb-rwmb-delete-file" href="#" data-attachment_id="%s">&times;</a>
132
  </div>
133
  </li>
127
  <li id="item_%s">
128
  <img src="%s" />
129
  <div class="mashsb-rwmb-image-bar">
130
+ <a title="%s" class="mashsb-rwmb-edit-file" href="%s" target="_blank" rel="noopener">%s</a> |
131
  <a title="%s" class="mashsb-rwmb-delete-file" href="#" data-attachment_id="%s">&times;</a>
132
  </div>
133
  </li>
includes/admin/meta-box/inc/fields/validate-og.php CHANGED
@@ -34,7 +34,7 @@ class MASHSB_RWMB_Validate_Og_Field extends MASHSB_RWMB_Field {
34
  //var_dump( $post );
35
  if( isset( $post ) && $post->post_status == "publish" ) {
36
  $url = get_permalink( $post->ID );
37
- return '<a href="https://developers.facebook.com/tools/debug/og/object?q=' . $url . '" target="_blank" class="button-small"> Validate Open Graph data </a>' . $field['helper'];
38
  } else {
39
  return '';
40
  }
34
  //var_dump( $post );
35
  if( isset( $post ) && $post->post_status == "publish" ) {
36
  $url = get_permalink( $post->ID );
37
+ return '<a href="https://developers.facebook.com/tools/debug/og/object?q=' . $url . '" target="_blank" rel="noopener" class="button-small"> Validate Open Graph data </a>' . $field['helper'];
38
  } else {
39
  return '';
40
  }
includes/admin/settings/metabox-settings.php CHANGED
@@ -106,7 +106,7 @@ function mashsb_meta_boxes( $meta_boxes ) {
106
  ),
107
  // Setup the pinterest optimized image
108
  array(
109
- 'name' => '<span class="mashicon mashicon-pinterest"></span> ' . __( 'Pinterest Image', 'mashsb' ) . '<a class="mashsb-helper" href="#"></a><div class="mashsb-message" style="display: none;">'.sprintf(__('Get the <a href="%s" target="_blank">Network Add-On</a> to make use of the Pinterest Features','mashsb'),'https://www.mashshare.net/pricing/?utm_source=meta_box&utm_medium=core_plugin&utm_campaign=pinterest_helper').'</div>',
110
  'desc' => __( 'Pinned images need to be more vertical than horizontal in orientation. Use an aspect ratio of 2:3 to 1:3.5 and a minimum width of 600 pixels. So an image that is 600 pixels wide should be between 900 and 2100 pixels tall.', 'mashsb' ),
111
  'id' => $prefix . 'pinterest_image',
112
  'type' => 'image_advanced',
@@ -116,7 +116,7 @@ function mashsb_meta_boxes( $meta_boxes ) {
116
  ),
117
  // Setup the pinterest description
118
  array(
119
- 'name' => '<span class="mashicon mashicon-pinterest"></span> ' . __('Pinterest Description', 'mashsb' ) . '<a class="mashsb-helper" href="#"></a><div class="mashsb-message" style="display: none;">'.sprintf(__('Get the <a href="%s" target="_blank">Network Add-On</a> to make use of the Pinterest Features','mashsb'),'https://www.mashshare.net/pricing/?utm_source=meta_box&utm_medium=core_plugin&utm_campaign=pinterest_helper').'</div>',
120
  'desc' => __( 'Place a customized message that will be used when this post is shared on Pinterest. Leave this blank to use the ', 'mashsb' ) . (mashsb_yoast_active() ? __( 'Yoast SEO title', 'mashsb' ) : __( 'the post title', 'mashsb' )),
121
  'id' => $prefix . 'pinterest_description',
122
  'type' => 'textarea',
106
  ),
107
  // Setup the pinterest optimized image
108
  array(
109
+ 'name' => '<span class="mashicon mashicon-pinterest"></span> ' . __( 'Pinterest Image', 'mashsb' ) . '<a class="mashsb-helper" href="#"></a><div class="mashsb-message" style="display: none;">'.sprintf(__('Get the <a href="%s" target="_blank" rel="noopener">Network Add-On</a> to make use of the Pinterest Features','mashsb'),'https://www.mashshare.net/pricing/?utm_source=meta_box&utm_medium=core_plugin&utm_campaign=pinterest_helper').'</div>',
110
  'desc' => __( 'Pinned images need to be more vertical than horizontal in orientation. Use an aspect ratio of 2:3 to 1:3.5 and a minimum width of 600 pixels. So an image that is 600 pixels wide should be between 900 and 2100 pixels tall.', 'mashsb' ),
111
  'id' => $prefix . 'pinterest_image',
112
  'type' => 'image_advanced',
116
  ),
117
  // Setup the pinterest description
118
  array(
119
+ 'name' => '<span class="mashicon mashicon-pinterest"></span> ' . __('Pinterest Description', 'mashsb' ) . '<a class="mashsb-helper" href="#"></a><div class="mashsb-message" style="display: none;">'.sprintf(__('Get the <a href="%s" target="_blank" rel="noopener">Network Add-On</a> to make use of the Pinterest Features','mashsb'),'https://www.mashshare.net/pricing/?utm_source=meta_box&utm_medium=core_plugin&utm_campaign=pinterest_helper').'</div>',
120
  'desc' => __( 'Place a customized message that will be used when this post is shared on Pinterest. Leave this blank to use the ', 'mashsb' ) . (mashsb_yoast_active() ? __( 'Yoast SEO title', 'mashsb' ) : __( 'the post title', 'mashsb' )),
121
  'id' => $prefix . 'pinterest_description',
122
  'type' => 'textarea',
includes/admin/settings/register-settings.php CHANGED
@@ -237,7 +237,7 @@ function mashsb_get_registered_settings() {
237
  'allow_tracking' => array(
238
  'id' => 'allow_tracking',
239
  'name' => __( 'Allow Usage Tracking', 'mashsb' ),
240
- 'desc' => sprintf( __( 'Allow Mashshare to track plugin usage? Opt-in to tracking and our newsletter and immediately be emailed a <strong>20%% discount to the Mashshare shop</strong>, valid towards the <a href="%s" target="_blank">purchase of Add-Ons</a>. No sensitive data is tracked.', 'mashsb' ), 'https://www.mashshare.net/add-ons/?utm_source=' . substr( md5( get_bloginfo( 'name' ) ), 0, 10 ) . '&utm_medium=admin&utm_term=setting&utm_campaign=MASHSBUsageTracking' ),
241
  'type' => 'checkbox'
242
  ),
243
  'is_main_query' => array(
@@ -1987,7 +1987,7 @@ function mashsb_ratelimit_callback() {
1987
 
1988
  }
1989
 
1990
- /**
1991
  * Helper function to determine if adverts and add-on ressources are hidden
1992
  *
1993
  * @return bool
237
  'allow_tracking' => array(
238
  'id' => 'allow_tracking',
239
  'name' => __( 'Allow Usage Tracking', 'mashsb' ),
240
+ 'desc' => sprintf( __( 'Allow Mashshare to track plugin usage? Opt-in to tracking and our newsletter and immediately be emailed a <strong>20%% discount to the Mashshare shop</strong>, valid towards the <a href="%s" target="_blank" rel="noopener">purchase of Add-Ons</a>. No sensitive data is tracked.', 'mashsb' ), 'https://www.mashshare.net/add-ons/?utm_source=' . substr( md5( get_bloginfo( 'name' ) ), 0, 10 ) . '&utm_medium=admin&utm_term=setting&utm_campaign=MASHSBUsageTracking' ),
241
  'type' => 'checkbox'
242
  ),
243
  'is_main_query' => array(
1987
 
1988
  }
1989
 
1990
+ /**
1991
  * Helper function to determine if adverts and add-on ressources are hidden
1992
  *
1993
  * @return bool
includes/admin/tracking.php CHANGED
@@ -271,4 +271,4 @@ class MASHSB_Tracking {
271
  }
272
 
273
  }
274
- $mashsb_tracking = new MASHSB_Tracking;
271
  }
272
 
273
  }
274
+ //$mashsb_tracking = new MASHSB_Tracking;
includes/admin/welcome.php CHANGED
@@ -150,7 +150,7 @@ class MASHSB_Welcome {
150
  $this->tabs();
151
  ?>
152
  <?php if (isset($_GET['redirect'])) {?>
153
- <p class="about-description mashsb-notice" style="background-color:#00abed;color:white;padding:20px;margin-top:20px;"><?php _e( 'Facebook and Twitter Share Buttons successfully enabled on all your posts! <br> You can use the steps below to customize MashShare:', 'mashsb' ); ?></p>
154
  <?php } ?>
155
  <div class="changelog clear">
156
  <h1><?php _e( 'Create Your First Social Sharing Button', 'mashsb' ); ?></h1>
150
  $this->tabs();
151
  ?>
152
  <?php if (isset($_GET['redirect'])) {?>
153
+ <p class="about-description mashsb-notice" style="background-color:#00abed;color:white;padding:20px;margin-top:20px;border:3px solid white;"><?php _e( '<strong>Facebook</strong> and <strong>Twitter Share Buttons</strong> successfully enabled on all your posts! <br> You can use the steps below to customize MashShare.', 'mashsb' ); ?></p>
154
  <?php } ?>
155
  <div class="changelog clear">
156
  <h1><?php _e( 'Create Your First Social Sharing Button', 'mashsb' ); ?></h1>
includes/debug/debug.php CHANGED
@@ -4,16 +4,18 @@
4
  * @global type $mashsb_options
5
  */
6
  function mashsbOutputDebug() {
7
- global $mashsb_options, $mashsb_error;
8
 
9
- if (empty($mashsb_error)){
10
  return '';
11
  }
12
 
13
  if (current_user_can('install_plugins') && isset($mashsb_options['debug_mode'])) {
14
- echo '<div class="mash-debug" style="display:block;z-index:250000;font-size:11px;text-align:center;">';
15
- foreach ($mashsb_error as $key => $value){
16
- echo $key . ' ' . date( 'H:m:s.u', time()). ' ' . $value . '<br />';
 
 
17
  }
18
  echo '</div>';
19
  }
4
  * @global type $mashsb_options
5
  */
6
  function mashsbOutputDebug() {
7
+ global $mashsb_options, $mashsb_debug;
8
 
9
+ if (empty($mashsb_debug)){
10
  return '';
11
  }
12
 
13
  if (current_user_can('install_plugins') && isset($mashsb_options['debug_mode'])) {
14
+ echo '<div class="mash-debug" style="display:block;z-index:250000;font-size:12px;text-align:center;">';
15
+ echo 'MashShare Debug Mode.<br><br>';
16
+ foreach ($mashsb_debug as $key => $value){
17
+ //echo $key . ' ' . date( 'H:m:s.u', time()). ' ' . $value . '<br />';
18
+ echo $value . '<br />';
19
  }
20
  echo '</div>';
21
  }
includes/mashengine.php CHANGED
@@ -10,6 +10,7 @@ class mashengine {
10
  private $debug_notices;
11
 
12
  function __construct( $url, $timeout = 10 ) {
 
13
  // remove http and https
14
  $url_host_path = preg_replace( "(^https?://)", "", $url );
15
  // build new urls
@@ -67,10 +68,10 @@ class mashengine {
67
  case $fb_mode === 'likes':
68
  //if( empty( $mashsb_options['fb_access_token_new'] ) ) {
69
  if( isset( $mashsb_options['cumulate_http_https'] ) ) {
70
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
71
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
72
  } else {
73
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->url, $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
74
  }
75
  //}
76
  // else {
@@ -85,10 +86,10 @@ class mashengine {
85
  case $fb_mode === 'total':
86
  //if( empty( $mashsb_options['fb_access_token_new'] ) ) {
87
  if( isset( $mashsb_options['cumulate_http_https'] ) ) {
88
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('facebook_total'), $headers );
89
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('facebook_total'), $headers );
90
  } else {
91
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->url, $post_data, array($this, 'getCount'), array('facebook_total'), $headers );
92
  }
93
  // } else {
94
  // if( isset( $mashsb_options['cumulate_http_https'] ) ) {
@@ -102,10 +103,10 @@ class mashengine {
102
  default:
103
  //if( empty( $mashsb_options['fb_access_token_new'] ) ) {
104
  if( isset( $mashsb_options['cumulate_http_https'] ) ) {
105
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('facebook_shares'), $headers );
106
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('facebook_shares'), $headers );
107
  } else {
108
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->url, $post_data, array($this, 'getCount'), array('facebook_shares'), $headers );
109
  }
110
  // } else {
111
  // if( isset( $mashsb_options['cumulate_http_https'] ) ) {
@@ -205,17 +206,17 @@ class mashengine {
205
  if( isset( $mashsb_options['cumulate_http_https'] ) ) {
206
  $RollingCurlX->addRequest( "http://public.newsharecounts.com/count.json?url=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('twitter'), $headers );
207
  $RollingCurlX->addRequest( "http://public.newsharecounts.com/count.json?url=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('twitter'), $headers );
208
- $RollingCurlX->addRequest( "https://plusone.google.com/_/+1/fastbutton?url=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('google'), $headers );
209
- $RollingCurlX->addRequest( "https://plusone.google.com/_/+1/fastbutton?url=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('google'), $headers );
210
- $RollingCurlX->addRequest( "http://api.pinterest.com/v1/urls/count.json?url=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('pinterest'), $headers );
211
- $RollingCurlX->addRequest( "http://api.pinterest.com/v1/urls/count.json?url=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('pinterest'), $headers );
212
  } else {
213
  $RollingCurlX->addRequest( "http://public.newsharecounts.com/count.json?url=" . $this->url, $post_data, array($this, 'getCount'), array('twitter'), $headers );
214
- $RollingCurlX->addRequest( "https://plusone.google.com/_/+1/fastbutton?url=" . $this->url, $post_data, array($this, 'getCount'), array('google'), $headers );
215
- $RollingCurlX->addRequest( "http://api.pinterest.com/v1/urls/count.json?url=" . $this->url, $post_data, array($this, 'getCount'), array('pinterest'), $headers );
216
  }
217
 
218
- $RollingCurlX->addRequest( "https://www.linkedin.com/countserv/count/share?format=json&url=" . $this->url, $post_data, array($this, 'getCount'), array('linkedin'), $headers );
219
  $RollingCurlX->addRequest( "http://www.stumbleupon.com/services/1.01/badge.getinfo?url=" . $this->url, $post_data, array($this, 'getCount'), array('stumbleupon'), $headers );
220
  $RollingCurlX->addRequest( "https://api.bufferapp.com/1/links/shares.json?url=" . $this->url, $post_data, array($this, 'getCount'), array('buffer'), $headers );
221
  $RollingCurlX->addRequest( "https://vk.com/share.php?act=count&index=1&url=" . $this->url, $post_data, array($this, 'getCount'), array('vk'), $headers );
@@ -267,7 +268,6 @@ class mashengine {
267
  }
268
  break;
269
  case "google":
270
- //preg_match( '/window\.__SSR = {c: ([\d]+)TEST/', $data, $matches );
271
  preg_match( "#window\.__SSR = {c: ([\d]+)#", $data, $matches );
272
  if( isset( $matches[0] ) )
273
  $count = str_replace( 'window.__SSR = {c: ', '', $matches[0] );
@@ -312,9 +312,7 @@ class mashengine {
312
  }
313
 
314
  $count = ( int ) $count;
315
- /* $this->data->shares->total += $count;
316
- $this->data->shares->$service[0] = $count;
317
- * */
318
  $this->data->error = $error;
319
  $this->data->total += $count;
320
  $this->data->{$service[0]} = $count;
@@ -322,10 +320,10 @@ class mashengine {
322
  MASHSB()->logger->info( 'MashEngine - URL: ' . $url . ' ' . $service[0] . ': ' . $count );
323
  mashdebug()->info( 'MashEngine - URL: ' . $url . ' ' . $service[0] . ': ' . $count );
324
  //echo 'MashEngine - URL: ' . $url . ' ' . $service[0] . ': ' . $count . '<br>';
325
- $this->debug_notices[] = 'MashEngine - URL: ' . $url . ' ' . $service[0] . ': ' . $count . '<br>';
326
  $mashsb_debug[] = 'MashEngine - URL: ' . $url . ' ' . $service[0] . ': ' . $count;
327
 
328
- add_action( 'wp_footer', array($this, 'outputDebug'), 100 );
329
  }
330
  return;
331
  }
@@ -335,17 +333,19 @@ class mashengine {
335
 
336
  if( current_user_can( 'install_plugins' ) && isset( $mashsb_options['debug_mode'] ) ) {
337
  echo '<div class="mash-debug" style="display:block;z-index:250000;font-size:11px;text-align:center;">';
 
 
338
  var_dump( $this->debug_notices );
339
  echo '</div>';
340
  }
341
  }
342
 
343
  public function setRateLimitTransient() {
344
- set_transient( 'mashsb_rate_limit', 'true', 5 * 60 );
345
 
346
  MASHSB()->logger->info( 'Error: Facebook Rate Limit hit' );
347
- $this->debug_notices[] = 'Error: Requests to Facebook hit Rate Limit.';
348
- add_action( 'wp_footer', array($this, 'outputDebug'), 100 );
349
  }
350
 
351
  public function getRemainingRateLimitTime() {
10
  private $debug_notices;
11
 
12
  function __construct( $url, $timeout = 10 ) {
13
+ //$url = 'https://mashshare.net';
14
  // remove http and https
15
  $url_host_path = preg_replace( "(^https?://)", "", $url );
16
  // build new urls
68
  case $fb_mode === 'likes':
69
  //if( empty( $mashsb_options['fb_access_token_new'] ) ) {
70
  if( isset( $mashsb_options['cumulate_http_https'] ) ) {
71
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?fields=og_object{likes.summary(true).limit(0)},share&id=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
72
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?fields=og_object{likes.summary(true).limit(0)},share&id=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
73
  } else {
74
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?fields=og_object{likes.summary(true).limit(0)},share&id=" . $this->url, $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
75
  }
76
  //}
77
  // else {
86
  case $fb_mode === 'total':
87
  //if( empty( $mashsb_options['fb_access_token_new'] ) ) {
88
  if( isset( $mashsb_options['cumulate_http_https'] ) ) {
89
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?fields=og_object{likes.summary(true).limit(0)},share&id=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('facebook_total'), $headers );
90
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?fields=og_object{likes.summary(true).limit(0)},share&id=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('facebook_total'), $headers );
91
  } else {
92
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?fields=og_object{likes.summary(true).limit(0)},share&id=" . $this->url, $post_data, array($this, 'getCount'), array('facebook_total'), $headers );
93
  }
94
  // } else {
95
  // if( isset( $mashsb_options['cumulate_http_https'] ) ) {
103
  default:
104
  //if( empty( $mashsb_options['fb_access_token_new'] ) ) {
105
  if( isset( $mashsb_options['cumulate_http_https'] ) ) {
106
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?fields=og_object{likes.summary(true).limit(0)},share&id=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('facebook_shares'), $headers );
107
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?fields=og_object{likes.summary(true).limit(0)},share&id=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('facebook_shares'), $headers );
108
  } else {
109
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?fields=og_object{likes.summary(true).limit(0)},share&id=" . $this->url, $post_data, array($this, 'getCount'), array('facebook_shares'), $headers );
110
  }
111
  // } else {
112
  // if( isset( $mashsb_options['cumulate_http_https'] ) ) {
206
  if( isset( $mashsb_options['cumulate_http_https'] ) ) {
207
  $RollingCurlX->addRequest( "http://public.newsharecounts.com/count.json?url=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('twitter'), $headers );
208
  $RollingCurlX->addRequest( "http://public.newsharecounts.com/count.json?url=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('twitter'), $headers );
209
+ //$RollingCurlX->addRequest( "https://plusone.google.com/_/+1/fastbutton?url=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('google'), $headers );
210
+ //$RollingCurlX->addRequest( "https://plusone.google.com/_/+1/fastbutton?url=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('google'), $headers );
211
+ $RollingCurlX->addRequest( "https://api.pinterest.com/v1/urls/count.json?url=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('pinterest'), $headers );
212
+ $RollingCurlX->addRequest( "https://api.pinterest.com/v1/urls/count.json?url=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('pinterest'), $headers );
213
  } else {
214
  $RollingCurlX->addRequest( "http://public.newsharecounts.com/count.json?url=" . $this->url, $post_data, array($this, 'getCount'), array('twitter'), $headers );
215
+ //$RollingCurlX->addRequest( "https://plusone.google.com/_/+1/fastbutton?url=" . $this->url, $post_data, array($this, 'getCount'), array('google'), $headers );
216
+ $RollingCurlX->addRequest( "https://api.pinterest.com/v1/urls/count.json?url=" . $this->url, $post_data, array($this, 'getCount'), array('pinterest'), $headers );
217
  }
218
 
219
+ //$RollingCurlX->addRequest( "https://www.linkedin.com/countserv/count/share?format=json&url=" . $this->url, $post_data, array($this, 'getCount'), array('linkedin'), $headers );
220
  $RollingCurlX->addRequest( "http://www.stumbleupon.com/services/1.01/badge.getinfo?url=" . $this->url, $post_data, array($this, 'getCount'), array('stumbleupon'), $headers );
221
  $RollingCurlX->addRequest( "https://api.bufferapp.com/1/links/shares.json?url=" . $this->url, $post_data, array($this, 'getCount'), array('buffer'), $headers );
222
  $RollingCurlX->addRequest( "https://vk.com/share.php?act=count&index=1&url=" . $this->url, $post_data, array($this, 'getCount'), array('vk'), $headers );
268
  }
269
  break;
270
  case "google":
 
271
  preg_match( "#window\.__SSR = {c: ([\d]+)#", $data, $matches );
272
  if( isset( $matches[0] ) )
273
  $count = str_replace( 'window.__SSR = {c: ', '', $matches[0] );
312
  }
313
 
314
  $count = ( int ) $count;
315
+
 
 
316
  $this->data->error = $error;
317
  $this->data->total += $count;
318
  $this->data->{$service[0]} = $count;
320
  MASHSB()->logger->info( 'MashEngine - URL: ' . $url . ' ' . $service[0] . ': ' . $count );
321
  mashdebug()->info( 'MashEngine - URL: ' . $url . ' ' . $service[0] . ': ' . $count );
322
  //echo 'MashEngine - URL: ' . $url . ' ' . $service[0] . ': ' . $count . '<br>';
323
+ $this->debug_notices[] = 'MashEngine - URL: ' . $url . ' ' . $service[0] . ': ' . $count;
324
  $mashsb_debug[] = 'MashEngine - URL: ' . $url . ' ' . $service[0] . ': ' . $count;
325
 
326
+ add_action( 'wp_footer', array($this, 'outputDebug'), 1000 );
327
  }
328
  return;
329
  }
333
 
334
  if( current_user_can( 'install_plugins' ) && isset( $mashsb_options['debug_mode'] ) ) {
335
  echo '<div class="mash-debug" style="display:block;z-index:250000;font-size:11px;text-align:center;">';
336
+ $this->debug_notices[] = (false === get_transient( 'timeout_mashsb_rate_limit' ) ? '' : 'FB rate limit active. Shares will be collected again in ' . $this->getRemainingRateLimitTime() . 'min.');
337
+ //$this->debug_notices[] = 'MashShare Cache will be refreshed in ' . $time. 'min';
338
  var_dump( $this->debug_notices );
339
  echo '</div>';
340
  }
341
  }
342
 
343
  public function setRateLimitTransient() {
344
+ set_transient( 'mashsb_rate_limit', 'true', 60 * 60 );
345
 
346
  MASHSB()->logger->info( 'Error: Facebook Rate Limit hit' );
347
+ $this->debug_notices[] = 'Error: Requests to Facebook hit Rate Limit. Delaying requests for 60min';
348
+ add_action( 'wp_footer', array($this, 'outputDebug'), 1000 );
349
  }
350
 
351
  public function getRemainingRateLimitTime() {
includes/scripts.php CHANGED
@@ -18,7 +18,6 @@ add_action( 'wp_enqueue_scripts', 'mashsb_load_scripts', 10 );
18
  add_action( 'wp_enqueue_scripts', 'mashsb_register_styles', 10 );
19
  add_action( 'wp_enqueue_scripts', 'mashsb_load_inline_styles', 10 );
20
  add_action( 'admin_enqueue_scripts', 'mashsb_load_plugins_admin_scripts', 10 );
21
- //add_action( 'amp_post_template_css', 'mashsb_amp_load_css', 10 );
22
 
23
  /**
24
  * Load Scripts
@@ -38,7 +37,9 @@ function mashsb_load_scripts( $hook ) {
38
  return;
39
  }
40
 
41
- $url = mashsb_get_url();
 
 
42
  $title = urlencode( html_entity_decode( the_title_attribute( 'echo=0' ), ENT_COMPAT, 'UTF-8' ) );
43
  $title = str_replace( '#', '%23', $title );
44
  $titleclean = esc_html( $title );
@@ -62,11 +63,15 @@ function mashsb_load_scripts( $hook ) {
62
  isset( $mashsb_options['load_scripts_footer'] ) ? $in_footer = true : $in_footer = false;
63
 
64
  wp_enqueue_script( 'mashsb', $js_dir . 'mashsb' . $suffix . '.js', array('jquery'), MASHSB_VERSION, $in_footer );
65
- //wp_enqueue_script( 'element-queries', $js_dir . 'ElementQueries' . '.js', array('jquery'), MASHSB_VERSION, $in_footer );
66
 
67
- !isset( $mashsb_options['disable_sharecount'] ) ? $shareresult = getSharedcount( $url ) : $shareresult = 0;
 
 
 
 
 
68
  wp_localize_script( 'mashsb', 'mashsb', array(
69
- 'shares' => $shareresult,
70
  'round_shares' => isset( $mashsb_options['mashsharer_round'] ),
71
  /* Do not animate shares on blog posts. The share count would be wrong there and performance bad */
72
  'animate_shares' => isset( $mashsb_options['animate_shares'] ) && is_singular() ? 1 : 0,
@@ -82,10 +87,16 @@ function mashsb_load_scripts( $hook ) {
82
  'singular' => is_singular() ? 1 : 0,
83
  'twitter_popup' => isset( $mashsb_options['twitter_popup'] ) ? 0 : 1,
84
  //'restapi' => $restapi
85
- 'refresh' => mashsb_is_cache_refresh() ? 1 : 0
86
- ) );
 
 
 
 
 
87
  }
88
 
 
89
  /**
90
  * Register CSS Styles
91
  *
@@ -273,112 +284,6 @@ function mashsb_load_inline_styles() {
273
  wp_add_inline_style( 'mashsb-styles', $mashsb_custom_css );
274
  }
275
 
276
- /**
277
- * Load AMP (Accelerated Mobile Pages) CSS
278
- *
279
- * @return string css
280
- */
281
- //function mashsb_amp_load_css() {
282
- // global $mashsb_options;
283
- //
284
- // $share_color = !empty( $mashsb_options['share_color'] ) ? '.mashsb-count {color:' . $mashsb_options['share_color'] . '}' : '';
285
- // $custom_css = isset( $mashsb_options['custom_css'] ) ? $mashsb_options['custom_css'] : '';
286
- // $amp_css = isset( $mashsb_options['amp_css'] ) ? $mashsb_options['amp_css'] : '';
287
- //
288
- // $css = "@font-face {
289
- // font-family: 'mashsb-font';
290
- // src: url('" . MASHSB_PLUGIN_URL . "/assets/css/fonts/mashsb-font.eot?29924580');
291
- // src: url('" . MASHSB_PLUGIN_URL . "/assets/css/fonts/mashsb-font.eot?29924580#iefix') format('embedded-opentype'),
292
- // url('" . MASHSB_PLUGIN_URL . "/assets/css/fonts/mashsb-font.woff2?29924580') format('woff2'),
293
- // url('" . MASHSB_PLUGIN_URL . "/assets/css/fonts/mashsb-font.woff?29924580') format('woff'),
294
- // url('" . MASHSB_PLUGIN_URL . "/assets/css/fonts/mashsb-font.ttf?29924580') format('truetype'),
295
- // url('" . MASHSB_PLUGIN_URL . "/assets/css/fonts/mashsb-font.svg?29924580#mashsb-font') format('svg');
296
- // font-weight: normal;
297
- // font-style: normal;
298
- //}";
299
- //
300
- // // Get default css file
301
- // $css .= file_get_contents( MASHSB_PLUGIN_DIR . '/assets/css/mashsb-amp.css' );
302
- //
303
- //
304
- // // add custom css
305
- // $css .= $custom_css;
306
- //
307
- // // add AMP custom css
308
- // $css .= $amp_css;
309
- //
310
- // // STYLES
311
- // $css .= $share_color;
312
- //
313
- // if( !empty( $mashsb_options['border_radius'] ) && $mashsb_options['border_radius'] != 'default' ) {
314
- // $css .= '
315
- // [class^="mashicon-"], .onoffswitch-label, .onoffswitch2-label {
316
- // border-radius: ' . $mashsb_options['border_radius'] . 'px;
317
- // }';
318
- // }
319
- // if( !empty( $mashsb_options['mash_style'] ) && $mashsb_options['mash_style'] == 'gradiant' ) {
320
- // $css .= '
321
- // .mashsb-buttons a {
322
- // background-image: -webkit-linear-gradient(bottom,rgba(0, 0, 0, 0.17) 0%,rgba(255, 255, 255, 0.17) 100%);
323
- // background-image: -moz-linear-gradient(bottom,rgba(0, 0, 0, 0.17) 0%,rgba(255, 255, 255, 0.17) 100%);
324
- // background-image: linear-gradient(bottom,rgba(0,0,0,.17) 0%,rgba(255,255,255,.17) 100%);}';
325
- // }
326
- // // Get css for small buttons
327
- // $css .= '[class^="mashicon-"] .text, [class*=" mashicon-"] .text{
328
- // text-indent: -9999px;
329
- // line-height: 0px;
330
- // display: block;
331
- // }
332
- // [class^="mashicon-"] .text:after, [class*=" mashicon-"] .text:after {
333
- // content: "";
334
- // text-indent: 0;
335
- // font-size:13px;
336
- // display: block;
337
- // }
338
- // [class^="mashicon-"], [class*=" mashicon-"] {
339
- // width:25%;
340
- // text-align: center;
341
- // }
342
- // [class^="mashicon-"] .icon:before, [class*=" mashicon-"] .icon:before {
343
- // float:none;
344
- // margin-right: 0;
345
- // }
346
- // .mashsb-buttons a{
347
- // margin-right: 3px;
348
- // margin-bottom:3px;
349
- // min-width: 0px;
350
- // width: 41px;
351
- // }
352
- //
353
- // .onoffswitch,
354
- // .onoffswitch-inner:before,
355
- // .onoffswitch-inner:after
356
- // .onoffswitch2,
357
- // .onoffswitch2-inner:before,
358
- // .onoffswitch2-inner:after {
359
- // margin-right: 0px;
360
- // width: 41px;
361
- // line-height: 41px;
362
- // }';
363
- // // hide plus and subscribe button
364
- // // on AMP we disable js
365
- // $css .= '.onoffswitch2, .onoffswitch{display:none}';
366
- //
367
- // // Hide subscribe button when it's not a link
368
- // $css .= isset( $mashsb_options['subscribe_behavior'] ) && $mashsb_options['subscribe_behavior'] === 'content' ? '.mashicon-subscribe{display:none;}' : '';
369
- //
370
- // // Make sure the share buttons are not moving under the share count when decreasing width
371
- // $css .= '.mashsb-buttons{display:table;}';
372
- //
373
- // // Float the second shares box
374
- // $css .= '.secondary-shares{float:left;}';
375
- //
376
- // // Hide the view count
377
- // $css .= '.mashpv{display:none;}';
378
- //
379
- // echo $css;
380
- //}
381
-
382
  /*
383
  * Check if debug mode is enabled
384
  *
@@ -405,3 +310,4 @@ function mashsb_is_active_responsive_addon() {
405
  }
406
  return false;
407
  }
 
18
  add_action( 'wp_enqueue_scripts', 'mashsb_register_styles', 10 );
19
  add_action( 'wp_enqueue_scripts', 'mashsb_load_inline_styles', 10 );
20
  add_action( 'admin_enqueue_scripts', 'mashsb_load_plugins_admin_scripts', 10 );
 
21
 
22
  /**
23
  * Load Scripts
37
  return;
38
  }
39
 
40
+ //$url = mashsb_get_url();
41
+ //$url = mashsb_get_main_url();
42
+ $url = get_permalink();
43
  $title = urlencode( html_entity_decode( the_title_attribute( 'echo=0' ), ENT_COMPAT, 'UTF-8' ) );
44
  $title = str_replace( '#', '%23', $title );
45
  $titleclean = esc_html( $title );
63
  isset( $mashsb_options['load_scripts_footer'] ) ? $in_footer = true : $in_footer = false;
64
 
65
  wp_enqueue_script( 'mashsb', $js_dir . 'mashsb' . $suffix . '.js', array('jquery'), MASHSB_VERSION, $in_footer );
 
66
 
67
+ $status = apply_filters('mashsbStatus', false);
68
+
69
+ //!isset( $mashsb_options['disable_sharecount'] ) ? $shareresult = getSharedcount( $url ) : $shareresult = 0;
70
+
71
+ $refresh = mashsb_is_cache_refresh() ? 1 : 0;
72
+
73
  wp_localize_script( 'mashsb', 'mashsb', array(
74
+ 'shares' => isset($post->ID) ? mashsb_get_total_shares_post_meta($post->ID) : false,
75
  'round_shares' => isset( $mashsb_options['mashsharer_round'] ),
76
  /* Do not animate shares on blog posts. The share count would be wrong there and performance bad */
77
  'animate_shares' => isset( $mashsb_options['animate_shares'] ) && is_singular() ? 1 : 0,
87
  'singular' => is_singular() ? 1 : 0,
88
  'twitter_popup' => isset( $mashsb_options['twitter_popup'] ) ? 0 : 1,
89
  //'restapi' => $restapi
90
+ 'refresh' => $refresh,
91
+ 'nonce' => wp_create_nonce( "mashsb-nonce" ),
92
+ 'postid' => isset($post->ID) && is_singular() ? $post->ID : false,
93
+ 'servertime' => time(),
94
+ 'ajaxurl' => admin_url('admin-ajax.php')
95
+ ) );
96
+
97
  }
98
 
99
+
100
  /**
101
  * Register CSS Styles
102
  *
284
  wp_add_inline_style( 'mashsb-styles', $mashsb_custom_css );
285
  }
286
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
  /*
288
  * Check if debug mode is enabled
289
  *
310
  }
311
  return false;
312
  }
313
+
includes/sharecount-functions.php CHANGED
@@ -14,6 +14,155 @@ if( !defined( 'ABSPATH' ) ) {
14
  exit;
15
  }
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  /**
19
  * Check if the facebook rate limit has been exceeded
@@ -29,7 +178,7 @@ function mashsb_rate_limit_exceeded(){
29
 
30
 
31
  /**
32
- * Make sure that requests do not exceed 1req / 25second
33
  * @return boolean
34
  */
35
  function mashsb_is_req_limited() {
@@ -38,7 +187,7 @@ function mashsb_rate_limit_exceeded(){
38
  $data_timeout = get_option('_transient_timeout_mashsb_limit_req');
39
 
40
  if (false === $data_timeout || empty($data_timeout) || $data_timeout < time() ){
41
- set_transient('mashsb_limit_req', '1', 25);
42
  $mashsb_debug[] = 'Temp Rate Limit not exceeded';
43
  return false;
44
  }
@@ -56,6 +205,10 @@ function mashsb_rate_limit_exceeded(){
56
  function mashsb_is_cache_refresh() {
57
  global $post, $mashsb_options;
58
 
 
 
 
 
59
 
60
  // Debug mode or cache activated
61
  if( MASHSB_DEBUG || isset( $mashsb_options['disable_cache'] ) ) {
@@ -78,53 +231,91 @@ function mashsb_is_cache_refresh() {
78
  *
79
  Exit here to save cpu time
80
  */
81
-
82
- if( is_404() || is_search() || is_admin() || !mashsb_is_enabled_permalinks() ) {
83
- return false;
84
  }
85
-
86
- // New cache on singular pages
87
- //
88
- // Refreshing cache on blog posts like categories will lead
89
- // to high load and multiple API requests so we only check
90
- // the main url on these other pages
91
- if( is_singular() ) {
92
- // last updated timestamp
93
- $last_updated = get_post_meta( $post->ID, 'mashsb_timestamp', true );
94
- if( !empty( $last_updated ) ) {
95
- MASHSB()->logger->info( 'mashsb_is_cache_refresh - is_singular() url: ' . get_permalink($post->ID) . ' : last updated:' . date( 'Y-m-d H:i:s', $last_updated ) );
96
- }
97
- } else if( mashsb_get_main_url() ) {
98
-
99
- // Get transient timeout and calculate last update time
100
- $url = mashsb_get_main_url();
101
- $transient = '_transient_timeout_mashcount_' . md5( mashsb_get_main_url() );
102
- $last_updated = get_option( $transient ) - mashsb_get_expiration();
103
- if( !empty( $last_updated ) ) {
104
- MASHSB()->logger->info( 'mashsb_is_cache_refresh() mashsb_get_main_url() url: ' . $url . ' last updated:' . date( 'Y-m-d H:i:s', $last_updated ) );
105
- }
106
- } else {
107
- // No valid URL so do not refresh cache
108
- MASHSB()->logger->info( 'mashsb_is_cache_refresh: No valid URL - do not refresh cache' );
109
- return false;
110
  }
 
 
111
 
112
- // No timestamp so let's create cache for the first time
113
- if( empty( $last_updated ) ) {
114
- MASHSB()->logger->info( 'mashsb_is_cache_refresh: No Timestamp. Refresh Cache' );
 
 
 
 
 
 
 
 
115
  return true;
116
  }
117
-
118
  // The caching expiration
119
  $expiration = mashsb_get_expiration();
120
  $next_update = $last_updated + $expiration;
121
- MASHSB()->logger->info( 'mashsb_is_cache_refresh. Next update ' . date( 'Y-m-d H:i:s', $next_update ) . ' current time: ' . date( 'Y-m-d H:i:s', time() ) );
122
-
123
- // Refresh Cache when last update plus expiration is older than current time
124
  if( ($last_updated + $expiration) <= time() ) {
125
- MASHSB()->logger->info( 'mashsb_is_cache_refresh: Refresh Cache!' );
126
  return true;
127
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  }
129
 
130
  /**
@@ -195,6 +386,8 @@ function mashsb_get_expiration() {
195
  global $mashsb_options;
196
  $expiration = (isset( $mashsb_options['caching_method'] ) && $mashsb_options['caching_method'] == 'async_cache') ? mashsb_get_expiration_method_async() : mashsb_get_expiration_method_loading();
197
 
 
 
198
  // Set expiration time to zero if debug mode is enabled or cache deactivated
199
  if( MASHSB_DEBUG || isset( $mashsb_options['disable_cache'] ) ) {
200
  $expiration = 0;
@@ -203,53 +396,6 @@ function mashsb_get_expiration() {
203
  return ( int ) $expiration;
204
  }
205
 
206
- /**
207
- * Check if we can use the REST API
208
- *
209
- * @deprecated not used
210
- * @return boolean true
211
- */
212
- //function mashsb_allow_rest_api() {
213
- // if( version_compare( get_bloginfo( 'version' ), '4.4.0', '>=' ) ) {
214
- // return true;
215
- // }
216
- //}
217
-
218
- /**
219
- * Check via REST API if cache should be updated
220
- *
221
- * @since 3.0.0
222
- * @deprecated not used
223
- * @return string numerical
224
- */
225
- //function mashsb_restapi_refresh_cache( $request ) {
226
- // if( mashsb_is_cache_refresh() ) {
227
- // return '1';
228
- // } else {
229
- // return '0';
230
- // }
231
- //}
232
-
233
- /**
234
- * Register the API route
235
- * Used in WP 4.4 and later The WP REST API got a better performance than native ajax endpoints
236
- * Endpoint: /wp-json/mashshare/v1/verifycache/
237
- *
238
- * @since 3.0.0
239
- * @deprecated not used
240
- * */
241
- //if( mashsb_allow_rest_api() ) {
242
- // add_action( 'rest_api_init', 'mashsb_rest_routes' );
243
- //}
244
- //
245
- //function mashsb_rest_routes() {
246
- // register_rest_route( 'mashshare/v1', '/verifycache/', array(
247
- // 'methods' => \WP_REST_Server::READABLE,
248
- // 'callback' => 'mashsb_restapi_refresh_cache'
249
- // )
250
- // );
251
- //}
252
-
253
  /**
254
  * Check if permalinks are enabled
255
  *
@@ -274,6 +420,8 @@ function mashsb_get_main_url() {
274
  $url = home_url( add_query_arg( array(), $wp->request ) );
275
  if( !empty( $url ) ) {
276
  return mashsb_sanitize_url( $url );
 
 
277
  }
278
  }
279
 
14
  exit;
15
  }
16
 
17
+ /**
18
+ * Save fb share count asnycronically via ajax
19
+ */
20
+ function mashsb_set_fb_sharecount() {
21
+
22
+ $postId = isset( $_POST['postid'] ) ? $_POST['postid'] : false;
23
+
24
+ // Ajax result
25
+ $result = isset( $_POST['shares'] ) ? $_POST['shares'] : false;
26
+ $comment_count = isset( $result['comment_count'] ) ? $result['comment_count'] : 0;
27
+ $share_count = isset( $result['share_count'] ) ? $result['share_count'] : 0;
28
+ //$url = isset( $result['share_url'] ) ? $result['share_url'] : '';
29
+
30
+ if( !$postId || empty($postId) ){
31
+ wp_die('no post id');
32
+ //wp_die(mashsb_set_fb_shares_transient( $url, $comment_count, $share_count) );
33
+ }
34
+
35
+ // Cache results
36
+ $cacheJsonShares = mashsb_get_jsonshares_post_meta( $postId );
37
+ $cacheTotalShares = mashsb_get_total_shares_post_meta( $postId );
38
+
39
+ // New shares
40
+ $cacheJsonShares['facebook_total'] = $share_count + $comment_count;
41
+ $cacheJsonShares['facebook_likes'] = $share_count;
42
+ $cacheJsonShares['facebook_comments'] = $comment_count;
43
+
44
+ // Update shares but only if new shares are larger than cached values
45
+ // Performance reasons AND to ensure that shares does not get lost if page permalink is changed
46
+ update_post_meta( $postId, 'mashsb_jsonshares', json_encode($cacheJsonShares) );
47
+
48
+ $newTotalShares = mashsb_get_total_shares($postId);
49
+ if ($newTotalShares > $cacheTotalShares){
50
+ update_post_meta( $postId, 'mashsb_shares', $newTotalShares );
51
+ }
52
+ wp_die( json_encode( $cacheJsonShares ) );
53
+ }
54
+
55
+ add_action( 'wp_ajax_mashsb_set_fb_shares', 'mashsb_set_fb_sharecount' );
56
+ add_action( 'wp_ajax_nopriv_mashsb_set_fb_shares', 'mashsb_set_fb_sharecount' );
57
+
58
+ /**
59
+ *
60
+ * @param string $url
61
+ * @param int $comment_count
62
+ * @param int $share_count
63
+ * @return int
64
+ */
65
+ //function mashsb_set_fb_shares_transient( $url, $comment_count = 0, $share_count = 0) {
66
+ // if (empty($url)){
67
+ // return 0;
68
+ // }
69
+ //
70
+ // $mode = isset( $mashsb_options['facebook_count_mode'] ) ? $mashsb_options['facebook_count_mode'] : 'total';
71
+ //
72
+ // // Expiration
73
+ // $expiration = mashsb_get_expiration();
74
+ //
75
+ // // Remove variables, parameters and trailingslash
76
+ // $url_clean = mashsb_sanitize_url( $url );
77
+ //
78
+ // // Get existing share count
79
+ // $current_shares = mashsbGetShareCountFromTransient( $url_clean );
80
+ //
81
+ //
82
+ // // It's request limited
83
+ // if( mashsb_is_req_limited() ) {
84
+ // return mashsbGetShareCountFromTransient( $url_clean );
85
+ // }
86
+ //
87
+ // // Regenerate the data and save the transient
88
+ //
89
+ // // Get the share counts
90
+ // if( $mode === 'total' ) {
91
+ // $shares = $current_shares + $comment_count + $share_count;
92
+ // }
93
+ // if( $mode === 'shares' ) {
94
+ // $shares = $current_shares + $share_count;
95
+ // }
96
+ // // Update shares only if resulted shares are more than stored shares
97
+ // if ($shares > $current_shares){
98
+ // // Set the transient and return shares
99
+ // set_transient( 'mashcount_' . md5( $url_clean ), $shares, $expiration );
100
+ // MASHSB()->logger->info( 'mashsb_set_fb_shares_transient set_transient - shares:' . $shares . ' url: ' . $url_clean );
101
+ // }
102
+ // return $shares + getFakecount();
103
+ //
104
+ //}
105
+
106
+ /**
107
+ * Get post meta mashsb_jsonshares
108
+ * @param bool $postId
109
+ * @return array
110
+ */
111
+ function mashsb_get_jsonshares_post_meta( $postId = false ) {
112
+ $result = array();
113
+
114
+ if( $postId === false )
115
+ return $result;
116
+
117
+ $result = json_decode(get_post_meta( $postId, 'mashsb_jsonshares', true ), true);
118
+
119
+ return $result;
120
+ }
121
+
122
+ /**
123
+ * Get total shares
124
+ * @param int $postId
125
+ * @return int
126
+ */
127
+ function mashsb_get_total_shares($postId){
128
+ $mode = isset( $mashsb_options['facebook_count_mode'] ) ? $mashsb_options['facebook_count_mode'] : 'total';
129
+
130
+ $result = json_decode(get_post_meta( $postId, 'mashsb_jsonshares', true ), true);
131
+
132
+ $fbtotal = isset($result['facebook_total']) ? $result['facebook_total'] : 0;
133
+ $fbshares = isset($result['facebook_likes']) ? $result['facebook_likes'] : 0;
134
+ $fbcomments = isset($result['facebook_comments']) ? $result['facebook_comments'] : 0;
135
+ $twitter = isset($result['twitter']) ? $result['twitter'] : 0;
136
+ $google = isset($result['google']) ? $result['google'] : 0;
137
+ $pinterest = isset($result['pinterest']) ? $result['pinterest'] : 0;
138
+ $linkedin = isset($result['linkedin']) ? $result['linkedin'] : 0;
139
+ $stumbleupon = isset($result['stumbleupon']) ? $result['stumbleupon'] : 0;
140
+
141
+
142
+ if( $mode === 'total' ) {
143
+ $shares = $fbtotal + $twitter + $google + $pinterest + $linkedin + $stumbleupon;
144
+ }
145
+ if( $mode === 'shares' ) {
146
+ $shares = $fbshares + $twitter + $google + $pinterest + $linkedin + $stumbleupon;
147
+ }
148
+
149
+ return (int)$shares;
150
+
151
+ }
152
+
153
+ /**
154
+ * Get post meta mashsb_shares
155
+ * @param bool $postId
156
+ * @return mixed string|boolean
157
+ */
158
+ function mashsb_get_total_shares_post_meta($postId = false){
159
+ if ($postId === false)
160
+ return false;
161
+
162
+ $result = get_post_meta( $postId, 'mashsb_shares', true );
163
+
164
+ return $result;
165
+ }
166
 
167
  /**
168
  * Check if the facebook rate limit has been exceeded
178
 
179
 
180
  /**
181
+ * Make sure that requests do not exceed 1req / 60second
182
  * @return boolean
183
  */
184
  function mashsb_is_req_limited() {
187
  $data_timeout = get_option('_transient_timeout_mashsb_limit_req');
188
 
189
  if (false === $data_timeout || empty($data_timeout) || $data_timeout < time() ){
190
+ set_transient('mashsb_limit_req', '1', 5);
191
  $mashsb_debug[] = 'Temp Rate Limit not exceeded';
192
  return false;
193
  }
205
  function mashsb_is_cache_refresh() {
206
  global $post, $mashsb_options;
207
 
208
+ // Force Cache Reload
209
+ if( isset( $_GET['mashsb-refresh'] ) ) {
210
+ return true;
211
+ }
212
 
213
  // Debug mode or cache activated
214
  if( MASHSB_DEBUG || isset( $mashsb_options['disable_cache'] ) ) {
231
  *
232
  Exit here to save cpu time
233
  */
234
+
235
+ if( is_admin() || is_404() || is_search() || !mashsb_is_enabled_permalinks() ) {
236
+ return false;
237
  }
238
+
239
+ /*
240
+ * Refreshing cache on multiple blog posts like categories will lead
241
+ * to high load and multiple API requests so we only check
242
+ * the main url
243
+ */
244
+ if( !is_singular() || !isset($post->ID) ) {
245
+ return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  }
247
+ $last_updated = 0;
248
+ $last_updated = get_post_meta( $post->ID, 'mashsb_timestamp', true );
249
 
250
+ // else {
251
+ // $url = mashsb_get_main_url();
252
+ // if (empty($url))
253
+ // return false;
254
+ // $transient = '_transient_timeout_mashcount_' . md5( $url );
255
+ // $last_updated = get_option( $transient ) - mashsb_get_expiration();
256
+ // }
257
+
258
+ // No timestamp! So let's create cache for the first time
259
+ if( empty( $last_updated ) || $last_updated < 0 ) {
260
+ // Write timestamp (Use this on top of this condition. If this is not on top following return statements will be skipped and ignored - possible bug?)
261
  return true;
262
  }
263
+
264
  // The caching expiration
265
  $expiration = mashsb_get_expiration();
266
  $next_update = $last_updated + $expiration;
267
+
268
+ // Refresh Cache when last update plus expiration time is older than current time
 
269
  if( ($last_updated + $expiration) <= time() ) {
270
+ // Write timestamp (Use this on top of this condition. If this is not on top following return statements will be skipped and ignored - possible bug?)
271
  return true;
272
  }
273
+
274
+ return false;
275
+
276
+
277
+ // New cache on singular pages
278
+ //
279
+ // Refreshing cache on blog posts like categories will lead
280
+ // to high load and multiple API requests so we only check
281
+ // the main url on these other pages
282
+ // if( is_singular() && isset($post->ID) ) {
283
+ // // last updated timestamp
284
+ // $last_updated = get_post_meta( $post->ID, 'mashsb_timestamp', true );
285
+ // if( !empty( $last_updated ) ) {
286
+ // MASHSB()->logger->info( 'mashsb_is_cache_refresh - is_singular() url: ' . get_permalink($post->ID) . ' : last updated:' . date( 'Y-m-d H:i:s', $last_updated ) );
287
+ // }
288
+ // } else if( mashsb_get_main_url() ) {
289
+ //
290
+ // // Get transient timeout and calculate last update time
291
+ // $url = mashsb_get_main_url();
292
+ // $transient = '_transient_timeout_mashcount_' . md5( $url );
293
+ // $last_updated = get_option( $transient ) - mashsb_get_expiration();
294
+ // if( !empty( $last_updated ) ) {
295
+ // MASHSB()->logger->info( 'mashsb_is_cache_refresh() mashsb_get_main_url() url: ' . $url . ' last updated:' . date( 'Y-m-d H:i:s', $last_updated ) );
296
+ // }
297
+ // } else {
298
+ // // No valid URL so do not refresh cache
299
+ // MASHSB()->logger->info( 'mashsb_is_cache_refresh: No valid URL - do not refresh cache' );
300
+ // return false;
301
+ // }
302
+ //
303
+ // // No timestamp so let's create cache for the first time
304
+ // if( empty( $last_updated ) ) {
305
+ // MASHSB()->logger->info( 'mashsb_is_cache_refresh: No Timestamp. Refresh Cache' );
306
+ // return true;
307
+ // }
308
+ //
309
+ // // The caching expiration
310
+ // $expiration = mashsb_get_expiration();
311
+ // $next_update = $last_updated + $expiration;
312
+ // MASHSB()->logger->info( 'mashsb_is_cache_refresh. Next update ' . date( 'Y-m-d H:i:s', $next_update ) . ' current time: ' . date( 'Y-m-d H:i:s', time() ) );
313
+ //
314
+ // // Refresh Cache when last update plus expiration time is older than current time
315
+ // if( ($last_updated + $expiration) <= time() ) {
316
+ // MASHSB()->logger->info( 'mashsb_is_cache_refresh: Refresh Cache!' );
317
+ // return true;
318
+ // }
319
  }
320
 
321
  /**
386
  global $mashsb_options;
387
  $expiration = (isset( $mashsb_options['caching_method'] ) && $mashsb_options['caching_method'] == 'async_cache') ? mashsb_get_expiration_method_async() : mashsb_get_expiration_method_loading();
388
 
389
+ //$expiration = 10;
390
+
391
  // Set expiration time to zero if debug mode is enabled or cache deactivated
392
  if( MASHSB_DEBUG || isset( $mashsb_options['disable_cache'] ) ) {
393
  $expiration = 0;
396
  return ( int ) $expiration;
397
  }
398
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
399
  /**
400
  * Check if permalinks are enabled
401
  *
420
  $url = home_url( add_query_arg( array(), $wp->request ) );
421
  if( !empty( $url ) ) {
422
  return mashsb_sanitize_url( $url );
423
+ } else {
424
+ return '';
425
  }
426
  }
427
 
includes/template-functions.php CHANGED
@@ -89,6 +89,23 @@ function mashsbGetShareMethod( $mashsbSharesObj ) {
89
  function mashsbGetNonPostShares( $url ) {
90
  global $mashsb_debug;
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
 
93
  // Expiration
94
  $expiration = mashsb_get_expiration();
@@ -101,13 +118,7 @@ function mashsbGetNonPostShares( $url ) {
101
 
102
  // Its request limited
103
  if ( mashsb_is_req_limited() ){
104
- $shares = get_transient( 'mashcount_' . md5( $url_clean ) );
105
- if( isset( $shares ) && is_numeric( $shares ) ) {
106
- MASHSB()->logger->info( 'mashsbGetNonPostShares() get shares from get_transient. URL: ' . $url_clean . ' SHARES: ' . $shares );
107
- return $shares + getFakecount();
108
- } else {
109
- return 0 + getFakecount(); // we need a result
110
- }
111
  }
112
 
113
  // Regenerate the data and save the transient
@@ -121,17 +132,22 @@ function mashsbGetNonPostShares( $url ) {
121
  MASHSB()->logger->info( 'mashsbGetNonPostShares set_transient - shares:' . $mashsbShareCounts->total . ' url: ' . $url_clean );
122
  return $mashsbShareCounts->total + getFakecount();
123
  } else {
124
- // Get shares from transient cache
125
-
126
- $shares = get_transient( 'mashcount_' . md5( $url_clean ) );
127
-
 
 
 
 
 
 
128
  if( isset( $shares ) && is_numeric( $shares ) ) {
129
- MASHSB()->logger->info( 'mashsbGetNonPostShares() get shares from get_transient. URL: ' . $url_clean . ' SHARES: ' . $shares );
130
  return $shares + getFakecount();
131
  } else {
132
  return 0 + getFakecount(); // we need a result
133
  }
134
- }
135
  }
136
 
137
 
@@ -145,17 +161,6 @@ function mashsbGetNonPostShares( $url ) {
145
  function getSharedcount( $url ) {
146
  global $mashsb_options, $post, $mashsb_sharecount, $mashsb_debug; // todo test a global share count var if it reduces the amount of requests
147
 
148
- $mashsb_debug[] = 'Trying to get share count!';
149
-
150
- // Return global share count variable to prevent multiple execution
151
- if (is_array($mashsb_sharecount) && array_key_exists($url, $mashsb_sharecount) && !empty($mashsb_sharecount[$url]) && !mashsb_is_cache_refresh() ){
152
- return $mashsb_sharecount[$url] + getFakecount();
153
- }
154
-
155
-
156
- // Remove mashsb-refresh query parameter
157
- $url = mashsb_sanitize_url($url);
158
-
159
  /*
160
  * Deactivate share count on:
161
  * - 404 pages
@@ -163,14 +168,28 @@ function getSharedcount( $url ) {
163
  * - empty url
164
  * - disabled permalinks
165
  * - disabled share count setting
 
166
  * - deprecated: admin pages (we need to remove this for themes which are using a bad infinite scroll implementation where is_admin() is always true)
167
  */
168
 
 
169
 
170
  if( is_404() || is_search() || empty($url) || !mashsb_is_enabled_permalinks() || isset($mashsb_options['disable_sharecount']) ) {
171
- $mashsb_debug[] = 'MashShare: Trying to get share count deactivated';
172
  return apply_filters( 'filter_get_sharedcount', 0 );
173
  }
 
 
 
 
 
 
 
 
 
 
 
 
174
 
175
  /*
176
  * Return share count on non singular pages when url is defined
@@ -192,7 +211,7 @@ function getSharedcount( $url ) {
192
 
193
  // Its request limited
194
  if ( mashsb_is_req_limited() ){
195
- $mashsb_debug[] = 'Rate limit reached. Return Share from custom meta option';
196
  return get_post_meta( $post->ID, 'mashsb_shares', true ) + getFakecount();
197
  }
198
 
@@ -512,9 +531,9 @@ function mashsb_getNetworks( $is_shortcode = false, $services = 0 ) {
512
 
513
  // Lets use the data attribute to prevent that pininit.js is overwriting our pinterest button - PR: https://secure.helpscout.net/conversation/257066283/954/?folderId=924740
514
  if ('pinterest' === $enablednetworks[$key]['id'] && !mashsb_is_amp_page() ) {
515
- $output .= '<a ' . $display . ' class="mashicon-' . $enablednetworks[$key]['id'] . $class_size . $class_margin . $class_center . $class_style . '" href="#" data-mashsb-url="'. arrNetworks( $enablednetworks[$key]['id'], $is_shortcode ) . '" target="_blank" rel="nofollow"><span class="icon"></span><span class="text">' . $name . '</span></a>';
516
  } else {
517
- $output .= '<a ' . $display . ' class="mashicon-' . $enablednetworks[$key]['id'] . $class_size . $class_margin . $class_center . $class_style . '" href="' . arrNetworks( $enablednetworks[$key]['id'], $is_shortcode ) . '" target="_blank" rel="nofollow"><span class="icon"></span><span class="text">' . $name . '</span></a>';
518
  }
519
  $output .= $onoffswitch;
520
  $output .= $startsecondaryshares;
@@ -646,9 +665,9 @@ function mashsb_getNetworksShortcode( $is_shortcode = false, $services = 0, $net
646
 
647
  // Lets use the data attribute to prevent that pininit.js is overwriting our pinterest button - PR: https://secure.helpscout.net/conversation/257066283/954/?folderId=924740
648
  if ('pinterest' === $enablednetworks[$key]['id'] && !mashsb_is_amp_page() ) {
649
- $output .= '<a ' . $display . ' class="mashicon-' . $enablednetworks[$key]['id'] . $class_size . $class_margin . $class_center . $class_style . $class_icons . '" href="#" data-mashsb-url="'. arrNetworks( $enablednetworks[$key]['id'], $is_shortcode ) . '" target="_blank" rel="nofollow"><span class="icon"></span><span class="text">' . $name . '</span></a>';
650
  } else {
651
- $output .= '<a ' . $display . ' class="mashicon-' . $enablednetworks[$key]['id'] . $class_size . $class_margin . $class_center . $class_style . $class_icons . '" href="' . arrNetworks( $enablednetworks[$key]['id'], $is_shortcode ) . '" target="_blank" rel="nofollow"><span class="icon"></span><span class="text">' . $name . '</span></a>';
652
  }
653
  $output .= $onoffswitch;
654
  $output .= $startsecondaryshares;
@@ -662,6 +681,7 @@ function mashsb_getNetworksShortcode( $is_shortcode = false, $services = 0, $net
662
  return apply_filters( 'return_networks', $output );
663
  }
664
 
 
665
  /*
666
  * Render template
667
  * Returns share buttons and share count
@@ -672,7 +692,7 @@ function mashsb_getNetworksShortcode( $is_shortcode = false, $services = 0, $net
672
 
673
  function mashshareShow() {
674
  global $mashsb_options;
675
-
676
  $class_stretched = isset($mashsb_options['responsive_buttons']) ? 'mashsb-stretched' : '';
677
 
678
  $return = '<aside class="mashsb-container mashsb-main ' . $class_stretched . '">'
@@ -898,7 +918,7 @@ function mashsb_get_post_meta_position() {
898
  */
899
 
900
  function mashshare_filter_content( $content ) {
901
- global $mashsb_options, $post, $wp_current_filter, $wp;
902
 
903
  // Default position
904
  $position = !empty( $mashsb_options['mashsharer_position'] ) ? $mashsb_options['mashsharer_position'] : '';
@@ -1003,7 +1023,7 @@ function mashsb_get_image( $postID ) {
1003
 
1004
  if( has_post_thumbnail( $post->ID ) ) {
1005
  $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
1006
- return $image[0];
1007
  }
1008
  }
1009
 
@@ -1037,6 +1057,7 @@ function mashsb_get_excerpt_by_id( $post_id ) {
1037
  }
1038
 
1039
  $the_excerpt = $the_post->post_content; //Gets post_content to be used as a basis for the excerpt
 
1040
  $excerpt_length = 35; //Sets excerpt length by word count
1041
  $the_excerpt = strip_tags( strip_shortcodes( $the_excerpt ) ); //Strips tags and images
1042
  $words = explode( ' ', $the_excerpt, $excerpt_length + 1 );
89
  function mashsbGetNonPostShares( $url ) {
90
  global $mashsb_debug;
91
 
92
+ /*
93
+ * Deactivate share count on:
94
+ * - 404 pages
95
+ * - search page
96
+ * - empty url
97
+ * - disabled permalinks
98
+ * - disabled share count setting
99
+ * - rate limit exceeded
100
+ * - deprecated: admin pages (we need to remove this for themes which are using a bad infinite scroll implementation where is_admin() is always true)
101
+ */
102
+
103
+
104
+ if( is_404() || is_search() || empty($url) || !mashsb_is_enabled_permalinks() || isset($mashsb_options['disable_sharecount']) || mashsb_rate_limit_exceeded() ) {
105
+ $mashsb_debug[] = 'MashShare: Share count (temporary) disabled';
106
+ return apply_filters( 'filter_get_sharedcount', 0 );
107
+ }
108
+
109
 
110
  // Expiration
111
  $expiration = mashsb_get_expiration();
118
 
119
  // Its request limited
120
  if ( mashsb_is_req_limited() ){
121
+ mashsbGetShareCountFromTransient($url_clean);
 
 
 
 
 
 
122
  }
123
 
124
  // Regenerate the data and save the transient
132
  MASHSB()->logger->info( 'mashsbGetNonPostShares set_transient - shares:' . $mashsbShareCounts->total . ' url: ' . $url_clean );
133
  return $mashsbShareCounts->total + getFakecount();
134
  } else {
135
+ mashsbGetShareCountFromTransient($url_clean);
136
+ }
137
+ }
138
+ /**
139
+ * get share count from transient
140
+ * @param type string
141
+ * @return int
142
+ */
143
+ function mashsbGetShareCountFromTransient($url){
144
+ $shares = get_transient( 'mashcount_' . md5( $url ) );
145
  if( isset( $shares ) && is_numeric( $shares ) ) {
146
+ MASHSB()->logger->info( 'mashsbGetNonPostShares() get shares from get_transient. URL: ' . $url . ' SHARES: ' . $shares );
147
  return $shares + getFakecount();
148
  } else {
149
  return 0 + getFakecount(); // we need a result
150
  }
 
151
  }
152
 
153
 
161
  function getSharedcount( $url ) {
162
  global $mashsb_options, $post, $mashsb_sharecount, $mashsb_debug; // todo test a global share count var if it reduces the amount of requests
163
 
 
 
 
 
 
 
 
 
 
 
 
164
  /*
165
  * Deactivate share count on:
166
  * - 404 pages
168
  * - empty url
169
  * - disabled permalinks
170
  * - disabled share count setting
171
+ * - rate limit exceeded
172
  * - deprecated: admin pages (we need to remove this for themes which are using a bad infinite scroll implementation where is_admin() is always true)
173
  */
174
 
175
+ //|| mashsb_rate_limit_exceeded()
176
 
177
  if( is_404() || is_search() || empty($url) || !mashsb_is_enabled_permalinks() || isset($mashsb_options['disable_sharecount']) ) {
178
+ $mashsb_debug[] = 'MashShare: Share count (temporary) disabled';
179
  return apply_filters( 'filter_get_sharedcount', 0 );
180
  }
181
+
182
+ $mashsb_debug[] = 'Trying to get share count!';
183
+
184
+ // Return global share count variable to prevent multiple execution
185
+ if (is_array($mashsb_sharecount) && array_key_exists($url, $mashsb_sharecount) && !empty($mashsb_sharecount[$url]) && !mashsb_is_cache_refresh() ){
186
+ return $mashsb_sharecount[$url] + getFakecount();
187
+ }
188
+
189
+
190
+ // Remove mashsb-refresh query parameter
191
+ $url = mashsb_sanitize_url($url);
192
+
193
 
194
  /*
195
  * Return share count on non singular pages when url is defined
211
 
212
  // Its request limited
213
  if ( mashsb_is_req_limited() ){
214
+ $mashsb_debug[] = 'Rate limit reached: Return Share from custom meta field.';
215
  return get_post_meta( $post->ID, 'mashsb_shares', true ) + getFakecount();
216
  }
217
 
531
 
532
  // Lets use the data attribute to prevent that pininit.js is overwriting our pinterest button - PR: https://secure.helpscout.net/conversation/257066283/954/?folderId=924740
533
  if ('pinterest' === $enablednetworks[$key]['id'] && !mashsb_is_amp_page() ) {
534
+ $output .= '<a ' . $display . ' class="mashicon-' . $enablednetworks[$key]['id'] . $class_size . $class_margin . $class_center . $class_style . '" href="#" data-mashsb-url="'. arrNetworks( $enablednetworks[$key]['id'], $is_shortcode ) . '" target="_blank" rel="noopener nofollow"><span class="icon"></span><span class="text">' . $name . '</span></a>';
535
  } else {
536
+ $output .= '<a ' . $display . ' class="mashicon-' . $enablednetworks[$key]['id'] . $class_size . $class_margin . $class_center . $class_style . '" href="' . arrNetworks( $enablednetworks[$key]['id'], $is_shortcode ) . '" target="_blank" rel="noopener nofollow"><span class="icon"></span><span class="text">' . $name . '</span></a>';
537
  }
538
  $output .= $onoffswitch;
539
  $output .= $startsecondaryshares;
665
 
666
  // Lets use the data attribute to prevent that pininit.js is overwriting our pinterest button - PR: https://secure.helpscout.net/conversation/257066283/954/?folderId=924740
667
  if ('pinterest' === $enablednetworks[$key]['id'] && !mashsb_is_amp_page() ) {
668
+ $output .= '<a ' . $display . ' class="mashicon-' . $enablednetworks[$key]['id'] . $class_size . $class_margin . $class_center . $class_style . $class_icons . '" href="#" data-mashsb-url="'. arrNetworks( $enablednetworks[$key]['id'], $is_shortcode ) . '" target="_blank" rel="noopener nofollow"><span class="icon"></span><span class="text">' . $name . '</span></a>';
669
  } else {
670
+ $output .= '<a ' . $display . ' class="mashicon-' . $enablednetworks[$key]['id'] . $class_size . $class_margin . $class_center . $class_style . $class_icons . '" href="' . arrNetworks( $enablednetworks[$key]['id'], $is_shortcode ) . '" target="_blank" rel="noopener nofollow"><span class="icon"></span><span class="text">' . $name . '</span></a>';
671
  }
672
  $output .= $onoffswitch;
673
  $output .= $startsecondaryshares;
681
  return apply_filters( 'return_networks', $output );
682
  }
683
 
684
+
685
  /*
686
  * Render template
687
  * Returns share buttons and share count
692
 
693
  function mashshareShow() {
694
  global $mashsb_options;
695
+
696
  $class_stretched = isset($mashsb_options['responsive_buttons']) ? 'mashsb-stretched' : '';
697
 
698
  $return = '<aside class="mashsb-container mashsb-main ' . $class_stretched . '">'
918
  */
919
 
920
  function mashshare_filter_content( $content ) {
921
+ global $mashsb_options, $wp_current_filter;
922
 
923
  // Default position
924
  $position = !empty( $mashsb_options['mashsharer_position'] ) ? $mashsb_options['mashsharer_position'] : '';
1023
 
1024
  if( has_post_thumbnail( $post->ID ) ) {
1025
  $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
1026
+ return isset($image[0]) ? $image[0] : '';
1027
  }
1028
  }
1029
 
1057
  }
1058
 
1059
  $the_excerpt = $the_post->post_content; //Gets post_content to be used as a basis for the excerpt
1060
+ // Strip all shortcodes
1061
  $excerpt_length = 35; //Sets excerpt length by word count
1062
  $the_excerpt = strip_tags( strip_shortcodes( $the_excerpt ) ); //Strips tags and images
1063
  $words = explode( ' ', $the_excerpt, $excerpt_length + 1 );
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.4.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.4.8' );
41
  }
42
 
43
  // Debug mode
@@ -199,7 +199,7 @@ if( !class_exists( 'mashshare' ) ) :
199
  require_once MASHSB_PLUGIN_DIR . 'includes/shorturls.php';
200
  require_once MASHSB_PLUGIN_DIR . 'includes/libraries/class-google-shorturl.php';
201
  require_once MASHSB_PLUGIN_DIR . 'includes/libraries/class-bitly-shorturl.php';
202
- require_once MASHSB_PLUGIN_DIR . 'includes/admin/tracking.php'; // Ensure cron is loading even on frontpage
203
  require_once MASHSB_PLUGIN_DIR . 'includes/debug/debug.php';
204
  require_once MASHSB_PLUGIN_DIR . 'includes/amp.php';
205
  require_once MASHSB_PLUGIN_DIR . 'includes/cron.php';
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.5.0
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.5.0' );
41
  }
42
 
43
  // Debug mode
199
  require_once MASHSB_PLUGIN_DIR . 'includes/shorturls.php';
200
  require_once MASHSB_PLUGIN_DIR . 'includes/libraries/class-google-shorturl.php';
201
  require_once MASHSB_PLUGIN_DIR . 'includes/libraries/class-bitly-shorturl.php';
202
+ //require_once MASHSB_PLUGIN_DIR . 'includes/admin/tracking.php'; // Ensure cron is loading even on frontpage
203
  require_once MASHSB_PLUGIN_DIR . 'includes/debug/debug.php';
204
  require_once MASHSB_PLUGIN_DIR . 'includes/amp.php';
205
  require_once MASHSB_PLUGIN_DIR . 'includes/cron.php';
readme.txt CHANGED
@@ -1,310 +1,321 @@
1
- === Social Media Share Buttons | MashShare ===
2
-
3
- Author URL: https://www.mashshare.net
4
- Plugin URL: https://www.mashshare.net
5
- Contributors: ReneHermi, WP-Staging, ilgityildirim
6
- Donate link: https://www.mashshare.net
7
- 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.9
12
- Stable tag: 3.4.8
13
-
14
- Social Media Share Buttons for Twitter, Facebook and other social networks. Highly customizable Social Media ecosystem
15
-
16
- == Description ==
17
-
18
- #### MashShare - The Social Media Ecosystem (Twitter counts supported)
19
- A free Social Media Plugin, professional and highly customizable<br />
20
- ecosystem for social media sharing and optimizing of your valuable content.<br />
21
-
22
- <strong>Stop slowing down your website and prevent ranking loose.</strong>
23
- Other social buttons are often using external scripts which are increasing loading times.
24
- MashShare is using NO external script dependencies. All code is loaded directly from your website and <strong>MashShare ensures yours and your visitors privacy!</strong> <br />
25
-
26
- * <strong>New: </strong> Most Shared Posts Widget
27
- * <strong>New: </strong> Async share count aggregation
28
- * <strong>New: </strong> Dashboard for total share count on posts screen
29
- * <strong>New: </strong> Short URL integration
30
- * <strong>New: </strong> Support for Accelerated Mobile Pages (AMP) when using the [official WordPress AMP plugin](https://wordpress.org/plugins/amp/)
31
-
32
- <strong>Installation</strong>
33
- [youtube https://www.youtube.com/watch?v=vRSE-pQJTBQ]
34
-
35
- It gives you per default a large total share counter beside three large
36
- prominent Share Buttons for your Twitter tweets, Facebook share and the option<br />
37
- to place a prominent subscribe button for your news feed and mailing list.
38
- This services are free per default including great support.
39
- There is no need to create an account! <br />
40
-
41
- We also offer free Add-Ons for specifing social sharing image, title, description and twitter hashtags and think this is satisfying for most website owners who need a free and effective working social sharing solution.<br />
42
-
43
- If you need services like Whatsapp, Pinterest, Mail,<br />
44
- Print, Linkedin, Odnoklassniki etc., you get them on the Add-On Marketplace.<br />
45
-
46
- MashShare can also be used in conjunction with other third-party share buttons vendor!
47
-
48
- Free and paid Add-Ons available for:
49
-
50
- - More Social Share Buttons<br />
51
- - YouTube Video Share Popup<br />
52
- - Share Button Responsive<br />
53
- - Sticky Share bar<br />
54
- - Social Sharing Optimization<br />
55
- - Google Analytics<br />
56
- - and more...<br />
57
-
58
- [Demo](https://www.mashshare.net?utm_source=wp-plugin-repo&utm_medium=link&utm_campaign=after-features-info-link) | [More Add-Ons >>](https://www.mashshare.net/downloads?utm_source=wp-plugin-repo&utm_medium=link&utm_campaign=get-addons)
59
-
60
-
61
- <h4> Social Media Share Buttons</h4>
62
-
63
- This Social Media share buttons plugin in active development and will be updated on a regular basis - Please do not rate negative before we tried to solve your issue.
64
-
65
- = Main Features =
66
-
67
- * High Performance Social Media Icons - easy to use - Share Buttons for the most common networks
68
- * High Resolution lossless vector font share button icons
69
- * Show the Total Social Media Share count at a glance
70
- * Object and transient caches to provide incredibly fast execution speed of Social Media Icons
71
- * Shortcodes
72
- * Extensible with many [Add-Ons](https://www.mashshare.net/downloads) (Google Analytics, More Social Networks, Responsive, YouTube Video Share and more...)
73
- * Developer friendly with several filters and actions.
74
- * Highly customizable
75
- * Smart (virtual) share count function. Add virtual shares to new articles. Use psychological aspects to increase real shares.
76
-
77
- = Recent Changes and New Features: =
78
-
79
- * Social Media Icons with Improved performance
80
- * Option to disable Social Media share count completely (no sql queries will be generated any longer)
81
- * Shortcode option to disable share counts
82
- * Checking if curl is working on the server
83
- * Option to disable share count cache for testing purposes
84
- * Use of sharp and crisp clear font Social Media Icons instead Social Media Icons images
85
- * Button 'extra content' for content slider subcribe forms or any other content New: Use a link for the Subscribe button instead the toggle drop down
86
- * Complete rewrite of CSS for easier modifications
87
- * Improved MashShare Social Media extension system
88
- * Improved backend, new MashShare Social Media Add-On page
89
- * Multi language capable, *.po files
90
- * Change color of share counts via setting
91
- * Count up animation for share buttons counts (Does not work for shortcodes and on blog pages)
92
- * HTML5 Tag < aside > wrapped around to tell search engines that the share buttons are not part of the content
93
- * Plus button moves to end of share buttons when activated and does not stay longer in place.
94
- * Drag and drop sort order of share buttons services.
95
- * Enable desired Social Media share buttons Icons with one click
96
- * Choose which Social Media network should be visible all the time This ones will be large sized by default. Other Social Media networks are behind the plus sign
97
- * Three different effective share button styles - Less is more here
98
- * Choose border radius of the Social Media buttons
99
- * Keep settings when share buttons are uninstalled - optional
100
- * Custom CSS field for individual styling of the social media share buttons
101
-
102
- <strong> Social Media Add-Ons available for </strong>
103
-
104
- * Google / G+
105
- * Whatsapp (Whatsapp button is shown only on mobile devices)
106
- * Pinterest
107
- * Digg
108
- * Linkedin
109
- * Reddit
110
- * Stumbleupon
111
- * Vk / VKontakte
112
- * Print
113
- * Delicious
114
- * Buffer
115
- * Weibo
116
- * Pocket
117
- * Xing
118
- * Tumblr
119
- * Mail
120
- * ManageWP
121
- * Meneame
122
- * Odnoklassniki
123
- * Frype / Draugiem
124
- * Skype
125
- * Flipboard
126
- * Hackernews
127
-
128
- = High Performance =
129
-
130
- MashShare Social Media ecosystem is *coded well and developed for high performance*. It´s making full use of available persistant and non persistant caching techniques.
131
- MashShare loads only the Javascript and php object classes it needs at the moment of execution, making it small and fast and easy extensible by third party developer.
132
-
133
- <h4>How fast is MashShare?</h4>
134
-
135
- We published benchmarks of using MashShare compared with other plugins here:
136
- https://www.mashshare.net/mashshare-proven-fast-benchmark/
137
-
138
- **Shortcodes**
139
-
140
- * Use `[mashshare]` anywhere in pages or post's text to show the buttons and total share count wherever you like.
141
- Share Buttons will be shown exactly on the place where you copy the shortcode in your content.
142
-
143
- There are more parameters available:
144
-
145
- * Embed Share Buttons in pages or posts: `[mashshare] `
146
- * Buttons without sharecount: `[mashshare shares="false"]`
147
- * Sharecount only: `[mashshare buttons="false"]`
148
- * Share buttons alignment: `[mashshare shares="false" buttons="true" align="left|right"]`
149
- * Shortcode in template files via php: `echo do_shortcode('[mashshare]');`
150
- * Custom url: `[mashshare url="http://www.google.de"]`
151
- * Custom share text: `[mashshare text="This is my custom share text"]`
152
-
153
- * For manual insertion of the Share Buttons in your template files use the following php code on place you like to see the share buttons:`echo do_shortcode('[mashshare]');`
154
- Configure the Share buttons sharing function in the settings page of the plugin.
155
- * Change the color of MashShare count with setting option.
156
-
157
- **Full SEO third party plugin support**
158
- MashShare integrates with [All in One SEO Pack](http://wordpress.org/plugins/all-in-one-seo-pack/) and [WordPress SEO by Yoast](http://wordpress.org/plugins/wordpress-seo/).
159
- Any description and title which is defined in Yoast open graph settings will be used by MashShare Open Graph Settings
160
-
161
- ** GitHub **
162
- Follow the development and improve MashShare.
163
- You find us on GitHub at: https://github.com/mashshare/MashShare
164
-
165
- ** Languages **
166
-
167
- MashShare has been translated into many languages:
168
-
169
- 1. English
170
- 2. German
171
- 3. Spanish
172
- 4. Turkish
173
- 5. Italy
174
- 6. Portuguese (Brazil)
175
-
176
- Please help to translate the share button plugin into more languages:
177
- https://translate.wordpress.org/projects/wp-plugins/mashsharer
178
-
179
- = How does it work? =
180
-
181
- MashShare makes use of public available API endpoints which are delivered by social networks. It periodically checks for the total count
182
- of all your Facebook and Twitter shares and cumulates them. It than shows the total number beside the Share and Social Media Icons.
183
- No need to embed dozens of external slow loading scripts into your website.
184
-
185
-
186
- = How to install and setup? =
187
- Install it via the admin dashboard and to 'Plugins', click 'Add New' and search the plugins for 'MashShare'. Install the plugin with 'Install Now'.
188
- After installation goto the settings page Settings->MashShare and make your changes there.
189
-
190
-
191
- == Frequently Asked Questions ==
192
-
193
- > Find here the Frequently Asked Questions. Also look into our docs which is often more up to date:
194
- http://docs.mashshare.net/
195
-
196
- <h4>There are no social share buttons visible after updating or installing MashShare</h4>
197
- This happens sometimes when you are using the MashShare Network Add-On which is disabled during update process or when your are updating from a very early MashShare version 1.x.
198
- Solution: Disable MashShare Social Media Network Add-On and MashShare Core plugin. Enable first MashShare THAN the Social Media Network Add-On and all Social Media Share buttons become visible again. (Activating order is important here)
199
-
200
- <h4>Why is the Social Media total count not shown immediately after sharing?</h4>
201
- It takes some time for the script to detect the sharing. So wait a few minutes than you see the total calculated clicks. Keep also in mind the caching time you defined in the admin panel.
202
- So when you set the plugin to 5minutes caching time. You have to wait at least for 5minutes until the click count is shown.
203
-
204
- <h4>Do I need a MashShare account?</h4>
205
- There is no account needed. All code resides on your website and there is no account or any monthly fee necessary to use MashShare.
206
-
207
- <h4>Does this plugin sends any personal user data to you or to Facebook, Twitter etc.?</h4>
208
-
209
- No, there is no personal data send to Facebook, Twitter, Google and other services. There is also no data which goes to MashShare that includes any IP or other data without your explicit grant.
210
- The big advantage of using Mashare Share buttons is the independance in comparision to other plugins which creates steady connections to Facebook and Co.
211
- So there is no IP based data send to the social networks or to sharedcount.
212
-
213
- <h4>Do I have to do manual changes in Javascript or HTML Code?</h4>
214
- There is no need for you to make any manual changes. The plugin does everything for you. But if you are an experienced web-developer you are free to use the php function mashsharer(); in your templates.
215
-
216
- <h4>Is there a shortcode for pages and posts?</h4>
217
- Use the shortcode [mashshare] to embed the Share Buttons in pages or posts.
218
-
219
- <h4>Why is Facebook sharing only the URL and not the title and description of my page?</h4>
220
- You need to enable the open graph settings or install a plugin like yoast which injects open graph tags in your site
221
- Read here more about this: http://docs.mashshare.net/article/10-facebook-is-showing-wrong-image-or-share-text
222
-
223
- == Official Site ==
224
- * https://www.mashshare.net
225
-
226
- == Installation ==
227
- 1. Download the share button plugin "MashShare" , unzip and place it in your wp-content/plugins/ folder. You can alternatively upload and install it via the WordPress plugin backend.
228
- 2. Activate the plugin through the 'Plugins' menu in WordPress.
229
- 3. Select Plugins->MashShare
230
-
231
- == Screenshots ==
232
-
233
- 1. Subscribe form with Social Media Facebook button and mail subscribe
234
- 2. Default share buttons with separate available responsive Add-On
235
- 3. Sortable Total Share Dashboard
236
- 4. Default Sharebuttons with separate available responsive Add-On
237
- 5. Responsive Design + Social-Networks (separate Add-Ons)
238
- 6. Default Share buttons + Subscribe Button opened (included)
239
- 7. Social Media Settings on post edit screen
240
- 8. Sticky Sharebar Add-On on desktop device
241
- 9. Round circle style (included)
242
- 11. Default share buttons (included)
243
- 12. Custom Social Sharing descriptions with free MashShare Open Graph Add-On
244
- 13. Extend MashShare with great Add-Ons
245
-
246
-
247
- == Changelog ==
248
-
249
- = 3.4.9 =
250
- * New: Add new short code parameter [mashshare icons=1] allows to show icon buttons only
251
- * Fix: Remove access token notice
252
- * Tweak: Lower request break to 5min if facebook api req/hours limits are reached
253
-
254
- = 3.4.8 =
255
- * New: Extend shortcode and allow selection of certain networks and button size [mashshare networks="facebook,twitter,linkedin" services="3" size="small"]
256
- * Tweak: Remove Facebook Access Token. Will be replaced by queue processing soon to prevent exceeding facebook api limits
257
- * Tweak: Clean up debug mode
258
- * Tweak: Clean up Welcome page
259
- * Tweak: Clean up sidebar
260
- * Fix: Tweet button
261
-
262
- = 3.4.7 =
263
- * Fix: 100% PHP7 compatibility! No more warnings with php7 compatibility checker
264
-
265
- = 3.4.6 =
266
- * New: Make use of Twitter character limit of 280 characters.
267
- * Tweak: Compatible up to WordPress 4.9
268
-
269
- = 3.4.5 =
270
- * New: Create custom values for open graph meta tag og:type, e.g video, product
271
- * Fix: undefined var title
272
- * Fix: Pinterest popup not opening when network add-on is not installed
273
- * Fix: Remove deprecated code and make mashsb.js smaller
274
- * Fix: Facebook access token validation function not working
275
-
276
- = 3.4.4 =
277
- * Fix: Check fb access token not working properly
278
-
279
- = 3.4.3 =
280
- * Fix: Facebook and twitter buttons missing on multisite activations when bimber theme is used
281
- * Fix: Whatsapp button not shown on sticky sharebar add-on when network add-on is not installed
282
- * Tweak: Return a more clear error notice when access token is not valid.
283
-
284
- = 3.4.2 =
285
- * Tweak: Better admin descriptions
286
- * New: Tested up to WP 4.8
287
-
288
- = 3.4.1 =
289
- * New: Support for PHPUnit 6
290
- * Fix: Move invisible sub menus from dashboard to MashShare menu section to prevent confusion if a plugin like Menu Editor Pro is active which makes even invisible menu entries visible
291
-
292
- = 3.4.1 =
293
- * Cleaning up readme.txt. MashShare plugin has been disabled on wordpress.org for using too many keywords and a few other issues with its readme.txt
294
-
295
- = 3.4.0 =
296
- * New: Google Analytics add-on allows to append utm_source tracking params for traffic tracking with google Analytics
297
- * Fix: Pinterest and google plus share counts are not cummulated together with http/https option
298
- * Fix: Remove admin notice if Facebook access token is empty
299
- * Fix: Remove console.log test notice
300
- * Fix: Check if multi_curl_exec is allowed
301
- * Fix: Share count not incrementing if transient mashsb_limit_req expiration is not set. (Caused by Possible WP Bug or custom theme transient filter)
302
- * Tweak: Use https endpoint for facebook sharing url
303
-
304
- See release notes and complete changelog at:
305
- https://www.mashshare.net/changelog/
306
-
307
- == Upgrade Notice ==
308
-
309
- = 3.4.8 =
310
- 3.4.8 * New shortcode options. Preparations for new MashShare count queue processing. Compatible up to WordPress 4.9.2
 
 
 
 
 
 
 
 
 
 
 
1
+ === Social Media Share Buttons | MashShare ===
2
+
3
+ Author URL: https://www.mashshare.net
4
+ Plugin URL: https://www.mashshare.net
5
+ Contributors: ReneHermi, WP-Staging, ilgityildirim
6
+ Donate link: https://www.mashshare.net
7
+ 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, dsgvo
10
+ Requires at least: 3.6+
11
+ Tested up to: 4.9
12
+ Stable tag: 3.5.0
13
+
14
+ Social Media Share Buttons for Twitter, Facebook and other social networks. Highly customizable Social Media ecosystem
15
+
16
+ == Description ==
17
+
18
+ #### MashShare - The Social Media Ecosystem (Twitter counts supported)
19
+ A free Social Media Plugin, professional and highly customizable<br />
20
+ ecosystem for social media sharing and optimizing of your valuable content.<br />
21
+
22
+ <strong>Important for EU users: MashShare is DSGVO compliant!<br />
23
+ No IP data or any other personal data is send to third parties or collected at all.</strong><br>
24
+
25
+ <strong>Stop slowing down your website and prevent ranking loose.</strong>
26
+ Other social buttons are often using external scripts which are increasing loading times.
27
+ MashShare is using NO external script dependencies. All code is loaded directly from your website and <strong>MashShare ensures yours and your visitors privacy!</strong> <br />
28
+
29
+ * <strong>New: </strong> Most Shared Posts Widget
30
+ * <strong>New: </strong> Async share count aggregation
31
+ * <strong>New: </strong> Dashboard for total share count on posts screen
32
+ * <strong>New: </strong> Short URL integration
33
+ * <strong>New: </strong> Support for Accelerated Mobile Pages (AMP) when using the [official WordPress AMP plugin](https://wordpress.org/plugins/amp/)
34
+
35
+ <strong>Installation</strong>
36
+ [youtube https://www.youtube.com/watch?v=vRSE-pQJTBQ]
37
+
38
+ It gives you per default a large total share counter beside three large
39
+ prominent Share Buttons for your Twitter tweets, Facebook share and the option<br />
40
+ to place a prominent subscribe button for your news feed and mailing list.
41
+ This services are free per default including great support.
42
+ There is no need to create an account! <br />
43
+
44
+ We also offer free Add-Ons for specifing social sharing image, title, description and twitter hashtags and think this is satisfying for most website owners who need a free and effective working social sharing solution.<br />
45
+
46
+ If you need services like Whatsapp, Pinterest, Mail,<br />
47
+ Print, Linkedin, Odnoklassniki etc., you get them on the Add-On Marketplace.<br />
48
+
49
+ MashShare can also be used in conjunction with other third-party share buttons vendor!
50
+
51
+ Free and paid Add-Ons available for:
52
+
53
+ - More Social Share Buttons<br />
54
+ - YouTube Video Share Popup<br />
55
+ - Share Button Responsive<br />
56
+ - Sticky Share bar<br />
57
+ - Social Sharing Optimization<br />
58
+ - Google Analytics<br />
59
+ - and more...<br />
60
+
61
+ [Demo](https://www.mashshare.net?utm_source=wp-plugin-repo&utm_medium=link&utm_campaign=after-features-info-link) | [More Add-Ons >>](https://www.mashshare.net/downloads?utm_source=wp-plugin-repo&utm_medium=link&utm_campaign=get-addons)
62
+
63
+
64
+ <h4> Social Media Share Buttons</h4>
65
+
66
+ This Social Media share buttons plugin in active development and will be updated on a regular basis - Please do not rate negative before we tried to solve your issue.
67
+
68
+ = Main Features =
69
+
70
+ * High Performance Social Media Icons - easy to use - Share Buttons for the most common networks
71
+ * High Resolution lossless vector font share button icons
72
+ * Show the Total Social Media Share count at a glance
73
+ * Object and transient caches to provide incredibly fast execution speed of Social Media Icons
74
+ * Shortcodes
75
+ * Extensible with many [Add-Ons](https://www.mashshare.net/downloads) (Google Analytics, More Social Networks, Responsive, YouTube Video Share and more...)
76
+ * Developer friendly with several filters and actions.
77
+ * Highly customizable
78
+ * Smart (virtual) share count function. Add virtual shares to new articles. Use psychological aspects to increase real shares.
79
+
80
+ = Recent Changes and New Features: =
81
+
82
+ * Social Media Icons with Improved performance
83
+ * Option to disable Social Media share count completely (no sql queries will be generated any longer)
84
+ * Shortcode option to disable share counts
85
+ * Checking if curl is working on the server
86
+ * Option to disable share count cache for testing purposes
87
+ * Use of sharp and crisp clear font Social Media Icons instead Social Media Icons images
88
+ * Button 'extra content' for content slider subcribe forms or any other content New: Use a link for the Subscribe button instead the toggle drop down
89
+ * Complete rewrite of CSS for easier modifications
90
+ * Improved MashShare Social Media extension system
91
+ * Improved backend, new MashShare Social Media Add-On page
92
+ * Multi language capable, *.po files
93
+ * Change color of share counts via setting
94
+ * Count up animation for share buttons counts (Does not work for shortcodes and on blog pages)
95
+ * HTML5 Tag < aside > wrapped around to tell search engines that the share buttons are not part of the content
96
+ * Plus button moves to end of share buttons when activated and does not stay longer in place.
97
+ * Drag and drop sort order of share buttons services.
98
+ * Enable desired Social Media share buttons Icons with one click
99
+ * Choose which Social Media network should be visible all the time This ones will be large sized by default. Other Social Media networks are behind the plus sign
100
+ * Three different effective share button styles - Less is more here
101
+ * Choose border radius of the Social Media buttons
102
+ * Keep settings when share buttons are uninstalled - optional
103
+ * Custom CSS field for individual styling of the social media share buttons
104
+
105
+ <strong> Social Media Add-Ons available for </strong>
106
+
107
+ * Google / G+
108
+ * Whatsapp (Whatsapp button is shown only on mobile devices)
109
+ * Pinterest
110
+ * Digg
111
+ * Linkedin
112
+ * Reddit
113
+ * Stumbleupon
114
+ * Vk / VKontakte
115
+ * Print
116
+ * Delicious
117
+ * Buffer
118
+ * Weibo
119
+ * Pocket
120
+ * Xing
121
+ * Tumblr
122
+ * Mail
123
+ * ManageWP
124
+ * Meneame
125
+ * Odnoklassniki
126
+ * Frype / Draugiem
127
+ * Skype
128
+ * Flipboard
129
+ * Hackernews
130
+
131
+ = High Performance =
132
+
133
+ MashShare Social Media ecosystem is *coded well and developed for high performance*. It´s making full use of available persistant and non persistant caching techniques.
134
+ MashShare loads only the Javascript and php object classes it needs at the moment of execution, making it small and fast and easy extensible by third party developer.
135
+
136
+ <h4>How fast is MashShare?</h4>
137
+
138
+ We published benchmarks of using MashShare compared with other plugins here:
139
+ https://www.mashshare.net/mashshare-proven-fast-benchmark/
140
+
141
+ **Shortcodes**
142
+
143
+ * Use `[mashshare]` anywhere in pages or post's text to show the buttons and total share count wherever you like.
144
+ Share Buttons will be shown exactly on the place where you copy the shortcode in your content.
145
+
146
+ There are more parameters available:
147
+
148
+ * Embed Share Buttons in pages or posts: `[mashshare] `
149
+ * Buttons without sharecount: `[mashshare shares="false"]`
150
+ * Sharecount only: `[mashshare buttons="false"]`
151
+ * Share buttons alignment: `[mashshare shares="false" buttons="true" align="left|right"]`
152
+ * Shortcode in template files via php: `echo do_shortcode('[mashshare]');`
153
+ * Custom url: `[mashshare url="http://www.google.de"]`
154
+ * Custom share text: `[mashshare text="This is my custom share text"]`
155
+
156
+ * For manual insertion of the Share Buttons in your template files use the following php code on place you like to see the share buttons:`echo do_shortcode('[mashshare]');`
157
+ Configure the Share buttons sharing function in the settings page of the plugin.
158
+ * Change the color of MashShare count with setting option.
159
+
160
+ **Full SEO third party plugin support**
161
+ MashShare integrates with [All in One SEO Pack](http://wordpress.org/plugins/all-in-one-seo-pack/) and [WordPress SEO by Yoast](http://wordpress.org/plugins/wordpress-seo/).
162
+ Any description and title which is defined in Yoast open graph settings will be used by MashShare Open Graph Settings
163
+
164
+ ** GitHub **
165
+ Follow the development and improve MashShare.
166
+ You find us on GitHub at: https://github.com/mashshare/MashShare
167
+
168
+ ** Languages **
169
+
170
+ MashShare has been translated into many languages:
171
+
172
+ 1. English
173
+ 2. German
174
+ 3. Spanish
175
+ 4. Turkish
176
+ 5. Italy
177
+ 6. Portuguese (Brazil)
178
+
179
+ Please help to translate the share button plugin into more languages:
180
+ https://translate.wordpress.org/projects/wp-plugins/mashsharer
181
+
182
+ = How does it work? =
183
+
184
+ MashShare makes use of public available API endpoints which are delivered by social networks. It periodically checks for the total count
185
+ of all your Facebook and Twitter shares and cumulates them. It than shows the total number beside the Share and Social Media Icons.
186
+ No need to embed dozens of external slow loading scripts into your website.
187
+
188
+
189
+ = How to install and setup? =
190
+ Install it via the admin dashboard and to 'Plugins', click 'Add New' and search the plugins for 'MashShare'. Install the plugin with 'Install Now'.
191
+ After installation goto the settings page Settings->MashShare and make your changes there.
192
+
193
+
194
+ == Frequently Asked Questions ==
195
+
196
+ > Find here the Frequently Asked Questions. Also look into our docs which is often more up to date:
197
+ http://docs.mashshare.net/
198
+
199
+ <h4>There are no social share buttons visible after updating or installing MashShare</h4>
200
+ This happens sometimes when you are using the MashShare Network Add-On which is disabled during update process or when your are updating from a very early MashShare version 1.x.
201
+ Solution: Disable MashShare Social Media Network Add-On and MashShare Core plugin. Enable first MashShare THAN the Social Media Network Add-On and all Social Media Share buttons become visible again. (Activating order is important here)
202
+
203
+ <h4>Why is the Social Media total count not shown immediately after sharing?</h4>
204
+ It takes some time for the script to detect the sharing. So wait a few minutes than you see the total calculated clicks. Keep also in mind the caching time you defined in the admin panel.
205
+ So when you set the plugin to 5minutes caching time. You have to wait at least for 5minutes until the click count is shown.
206
+
207
+ <h4>Do I need a MashShare account?</h4>
208
+ There is no account needed. All code resides on your website and there is no account or any monthly fee necessary to use MashShare.
209
+
210
+ <h4>Does this plugin sends any personal user data to you or to Facebook, Twitter etc.?</h4>
211
+
212
+ No, there is no personal data send to Facebook, Twitter, Google and other services. There is also no data which goes to MashShare that includes any IP or other data without your explicit grant.
213
+ The big advantage of using Mashare Share buttons is the independance in comparision to other plugins which creates steady connections to Facebook and Co.
214
+ So there is no IP based data send to the social networks or to sharedcount.
215
+
216
+ <h4>Do I have to do manual changes in Javascript or HTML Code?</h4>
217
+ There is no need for you to make any manual changes. The plugin does everything for you. But if you are an experienced web-developer you are free to use the php function mashsharer(); in your templates.
218
+
219
+ <h4>Is there a shortcode for pages and posts?</h4>
220
+ Use the shortcode [mashshare] to embed the Share Buttons in pages or posts.
221
+
222
+ <h4>Why is Facebook sharing only the URL and not the title and description of my page?</h4>
223
+ You need to enable the open graph settings or install a plugin like yoast which injects open graph tags in your site
224
+ Read here more about this: http://docs.mashshare.net/article/10-facebook-is-showing-wrong-image-or-share-text
225
+
226
+ == Official Site ==
227
+ * https://www.mashshare.net
228
+
229
+ == Installation ==
230
+ 1. Download the share button plugin "MashShare" , unzip and place it in your wp-content/plugins/ folder. You can alternatively upload and install it via the WordPress plugin backend.
231
+ 2. Activate the plugin through the 'Plugins' menu in WordPress.
232
+ 3. Select Plugins->MashShare
233
+
234
+ == Screenshots ==
235
+
236
+ 1. Subscribe form with Social Media Facebook button and mail subscribe
237
+ 2. Default share buttons with separate available responsive Add-On
238
+ 3. Sortable Total Share Dashboard
239
+ 4. Default Sharebuttons with separate available responsive Add-On
240
+ 5. Responsive Design + Social-Networks (separate Add-Ons)
241
+ 6. Default Share buttons + Subscribe Button opened (included)
242
+ 7. Social Media Settings on post edit screen
243
+ 8. Sticky Sharebar Add-On on desktop device
244
+ 9. Round circle style (included)
245
+ 11. Default share buttons (included)
246
+ 12. Custom Social Sharing descriptions with free MashShare Open Graph Add-On
247
+ 13. Extend MashShare with great Add-Ons
248
+
249
+
250
+ == Changelog ==
251
+
252
+ = 3.5.0 =
253
+ * New: Tested up to WordPress 4.9.5
254
+ * New: Improved share count aggregation
255
+ * New: Add rel="noopener" to all network buttons
256
+ * Tweak: Remove opt-in notice
257
+ * Tweak: Remove rate limit notice
258
+ * Fix: Calls to networks api are still made when sharecount is disabled
259
+
260
+ = 3.4.9 =
261
+ * New: Add new short code parameter [mashshare icons=1] allows to show icon buttons only
262
+ * Fix: Remove access token notice
263
+ * Tweak: Lower request break to 5min if facebook api req/hours limits are reached
264
+
265
+ = 3.4.8 =
266
+ * New: Extend shortcode and allow selection of certain networks and button size [mashshare networks="facebook,twitter,linkedin" services="3" size="small"]
267
+ * Tweak: Remove Facebook Access Token. Will be replaced by queue processing soon to prevent exceeding facebook api limits
268
+ * Tweak: Clean up debug mode
269
+ * Tweak: Clean up Welcome page
270
+ * Tweak: Clean up sidebar
271
+ * Fix: Tweet button
272
+
273
+ = 3.4.7 =
274
+ * Fix: 100% PHP7 compatibility! No more warnings with php7 compatibility checker
275
+
276
+ = 3.4.6 =
277
+ * New: Make use of Twitter character limit of 280 characters.
278
+ * Tweak: Compatible up to WordPress 4.9
279
+
280
+ = 3.4.5 =
281
+ * New: Create custom values for open graph meta tag og:type, e.g video, product
282
+ * Fix: undefined var title
283
+ * Fix: Pinterest popup not opening when network add-on is not installed
284
+ * Fix: Remove deprecated code and make mashsb.js smaller
285
+ * Fix: Facebook access token validation function not working
286
+
287
+ = 3.4.4 =
288
+ * Fix: Check fb access token not working properly
289
+
290
+ = 3.4.3 =
291
+ * Fix: Facebook and twitter buttons missing on multisite activations when bimber theme is used
292
+ * Fix: Whatsapp button not shown on sticky sharebar add-on when network add-on is not installed
293
+ * Tweak: Return a more clear error notice when access token is not valid.
294
+
295
+ = 3.4.2 =
296
+ * Tweak: Better admin descriptions
297
+ * New: Tested up to WP 4.8
298
+
299
+ = 3.4.1 =
300
+ * New: Support for PHPUnit 6
301
+ * Fix: Move invisible sub menus from dashboard to MashShare menu section to prevent confusion if a plugin like Menu Editor Pro is active which makes even invisible menu entries visible
302
+
303
+ = 3.4.1 =
304
+ * Cleaning up readme.txt. MashShare plugin has been disabled on wordpress.org for using too many keywords and a few other issues with its readme.txt
305
+
306
+ = 3.4.0 =
307
+ * New: Google Analytics add-on allows to append utm_source tracking params for traffic tracking with google Analytics
308
+ * Fix: Pinterest and google plus share counts are not cummulated together with http/https option
309
+ * Fix: Remove admin notice if Facebook access token is empty
310
+ * Fix: Remove console.log test notice
311
+ * Fix: Check if multi_curl_exec is allowed
312
+ * Fix: Share count not incrementing if transient mashsb_limit_req expiration is not set. (Caused by Possible WP Bug or custom theme transient filter)
313
+ * Tweak: Use https endpoint for facebook sharing url
314
+
315
+ See release notes and complete changelog at:
316
+ https://www.mashshare.net/changelog/
317
+
318
+ == Upgrade Notice ==
319
+
320
+ = 3.4.8 =
321
+ 3.4.8 * New shortcode options. Preparations for new MashShare count queue processing. Compatible up to WordPress 4.9.2
templates/sidebar.php CHANGED
@@ -14,9 +14,9 @@ $user = wp_get_current_user();
14
 
15
  <div id="mashsb-sidebar">
16
 
17
- <a class="mashsb-banner" target="_blank" href="https://www.mashshare.net/pricing/?utm_source=insideplugin&utm_medium=userwebsite&utm_content=sidebar&utm_campaign=freeplugin"><img src="<?php echo MASHSB_PLUGIN_URL . 'assets/images/upgrade_to_pro.png'; ?>" width="300" height="250" alt="<?php _e( 'Increase your Shares and Social Traffic', 'mashsb' ); ?>" /></a>
18
 
19
- <form method="post" action="<?php echo $post; ?>" target="_blank" class="subscribe block" style="display:none;">
20
  <h2><?php _e( 'Get More Traffic', 'mashsb' ); ?></h2>
21
 
22
  <?php $user = wp_get_current_user(); ?>
@@ -67,6 +67,6 @@ $user = wp_get_current_user();
67
 
68
  <p class="author">&mdash; Jean-Paul Horn</p>
69
 
70
- <p class="via"><a target="_blank" href="https://twitter.com/JeanPaulH/status/726084101145550850">via Twitter</a></p>
71
  </div>
72
  </div>
14
 
15
  <div id="mashsb-sidebar">
16
 
17
+ <a class="mashsb-banner" target="_blank" rel="noopener" href="https://www.mashshare.net/pricing/?utm_source=insideplugin&utm_medium=userwebsite&utm_content=sidebar&utm_campaign=freeplugin"><img src="<?php echo MASHSB_PLUGIN_URL . 'assets/images/upgrade_to_pro.png'; ?>" width="300" height="250" alt="<?php _e( 'Increase your Shares and Social Traffic', 'mashsb' ); ?>" /></a>
18
 
19
+ <form method="post" action="<?php echo $post; ?>" target="_blank" rel="noopener" class="subscribe block" style="display:none;">
20
  <h2><?php _e( 'Get More Traffic', 'mashsb' ); ?></h2>
21
 
22
  <?php $user = wp_get_current_user(); ?>
67
 
68
  <p class="author">&mdash; Jean-Paul Horn</p>
69
 
70
+ <p class="via"><a target="_blank" rel="noopener" href="https://twitter.com/JeanPaulH/status/726084101145550850">via Twitter</a></p>
71
  </div>
72
  </div>
templates/sidebar_mail.php CHANGED
@@ -14,7 +14,7 @@ $user = wp_get_current_user();
14
 
15
  <div id="mashsb-sidebar">
16
 
17
- <a class="mashsb-banner" target="_blank" href="https://www.mashshare.net/pricing/?utm_source=insideplugin&utm_medium=userwebsite&utm_content=sidebar&utm_campaign=freeplugin"><img src="<?php echo MASHSB_PLUGIN_URL . 'assets/images/upgrade_to_pro.png'; ?>" width="300" height="250" alt="<?php _e( 'Increase your Shares and Social Traffic', 'mashsb' ); ?>" /></a>
18
 
19
  <form method="post" action="<?php echo $post; ?>" target="_blank" class="subscribe block">
20
  <h2><?php _e( 'Get 20% Off!', 'mashsb' ); ?></h2>
14
 
15
  <div id="mashsb-sidebar">
16
 
17
+ <a class="mashsb-banner" target="_blank" rel="noopener" href="https://www.mashshare.net/pricing/?utm_source=insideplugin&utm_medium=userwebsite&utm_content=sidebar&utm_campaign=freeplugin"><img src="<?php echo MASHSB_PLUGIN_URL . 'assets/images/upgrade_to_pro.png'; ?>" width="300" height="250" alt="<?php _e( 'Increase your Shares and Social Traffic', 'mashsb' ); ?>" /></a>
18
 
19
  <form method="post" action="<?php echo $post; ?>" target="_blank" class="subscribe block">
20
  <h2><?php _e( 'Get 20% Off!', 'mashsb' ); ?></h2>