Social Media Share Buttons | MashShare - Version 3.3.0

Version Description

  • New: Integrate Facebook Social Media Rate Limiter to prevent hitting facebook api request limits and rate limit errors resulting in zero facebook share counts
Download this release

Release Info

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

Code changes from version 3.2.9 to 3.3.0

assets/js/mashsb-admin.js CHANGED
@@ -32,46 +32,47 @@ jQuery(document).ready(function ($) {
32
  });
33
 
34
 
35
- // $('#mashsb_settings\\[fb_access_token\\]').on("change paste keyup",function(){
36
- //
37
- // var two_month = 60 * 60 * 24 * 60 * 1000; // timestamp in miliseconds
38
- // var expiration_timestamp = (new Date().getTime()) + two_month; // time in miliseconds
39
- //
40
- // var unixtimestamp = (new Date().getTime() + (60 * 60 * 24 * 60 * 1000)) / 1000; // timestamp in seconds
41
- //
42
- // var human_date = new Date(expiration_timestamp);
43
- //
44
- // if ($('#mashsb_settings\\[fb_access_token\\]').val()){
45
- // check_access_token();
46
- // document.getElementById('mashsb_expire_token_status').innerHTML = 'Token needs renewal on ' + human_date + '<br>MashShare will notify you shortly before the access token expires.';
47
- // }else {
48
- // document.getElementById('mashsb_expire_token_status').innerHTML = '';
49
- // }
50
- // });
 
51
 
52
 
53
- // function check_access_token()
54
- // {
55
- // $.ajax("https://graph.facebook.com/v2.7/?id=http://www.google.de&access_token=" + $('#mashsb_settings\\[fb_access_token\\]').val())
56
- // .done(function (e) {
57
- // $('#mashsb_token_notice').html('');
58
- // console.log(e);
59
- // })
60
- // .fail(function (e) {
61
- // $('#mashsb_token_notice').html('<span style="color:red;"> <strong>Error:</strong> Access Token Invalid!</span>');
62
- // console.log(e);
63
- // })
64
- // }
65
 
66
- // $('#mashsb_fb_auth').click(function (e) {
67
- // e.preventDefault();
68
- // winWidth = 520;
69
- // winHeight = 350;
70
- // var winTop = (screen.height / 2) - (winHeight / 2);
71
- // var winLeft = (screen.width / 2) - (winWidth / 2);
72
- // var url = $(this).attr('href');
73
- // mashsb_fb_auth = window.open(url, 'mashsb_fb_auth', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight + ',resizable=yes');
74
- // });
75
 
76
  // // Share Color Picker
77
  // $('.share_color').colpick({
32
  });
33
 
34
 
35
+ $('#mashsb_settings\\[fb_access_token\\]').on("change paste keyup",function(){
36
+
37
+ var two_month = 60 * 60 * 24 * 60 * 1000; // timestamp in miliseconds
38
+ var expiration_timestamp = (new Date().getTime()) + two_month; // time in miliseconds
39
+
40
+ var unixtimestamp = (new Date().getTime() + (60 * 60 * 24 * 60 * 1000)) / 1000; // timestamp in seconds
41
+
42
+ var human_date = new Date(expiration_timestamp);
43
+
44
+ if ($('#mashsb_settings\\[fb_access_token\\]').val()){
45
+ check_access_token();
46
+ document.getElementById('mashsb_expire_token_status').innerHTML = 'Token needs renewal on ' + human_date + '<br>MashShare will notify you shortly before the access token expires.';
47
+ $('#mashsb_settings\\[expire_fb_access_token\\]').val(unixtimestamp.toFixed(0));
48
+ }else {
49
+ document.getElementById('mashsb_expire_token_status').innerHTML = '';
50
+ }
51
+ });
52
 
53
 
54
+ function check_access_token()
55
+ {
56
+ $.ajax("https://graph.facebook.com/v2.7/?id=http://www.google.de&access_token=" + $('#mashsb_settings\\[fb_access_token\\]').val())
57
+ .done(function (e) {
58
+ $('#mashsb_token_notice').html('');
59
+ console.log(e);
60
+ })
61
+ .fail(function (e) {
62
+ $('#mashsb_token_notice').html('<span style="color:red;"> <strong>Error:</strong> Access Token Invalid!</span>');
63
+ console.log(e);
64
+ })
65
+ }
66
 
67
+ $('#mashsb_fb_auth').click(function (e) {
68
+ e.preventDefault();
69
+ winWidth = 520;
70
+ winHeight = 350;
71
+ var winTop = (screen.height / 2) - (winHeight / 2);
72
+ var winLeft = (screen.width / 2) - (winWidth / 2);
73
+ var url = $(this).attr('href');
74
+ mashsb_fb_auth = window.open(url, 'mashsb_fb_auth', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight + ',resizable=yes');
75
+ });
76
 
77
  // // Share Color Picker
78
  // $('.share_color').colpick({
assets/js/mashsb-admin.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(a){function b(a,b,c){if(c){var d=new Date;d.setTime(d.getTime()+24*c*60*60*1e3);var e="; expires="+d.toGMTString()}else var e="";document.cookie=a+"="+b+e+"; path=/"}function c(a){for(var b=a+"=",c=document.cookie.split(";"),d=0;d<c.length;d++){for(var e=c[d];" "==e.charAt(0);)e=e.substring(1,e.length);if(0==e.indexOf(b))return e.substring(b.length,e.length)}return null}function d(){var a=jQuery(".mashsb-tabs.active").find("a").attr("href");b("mashsb_active_tab",a)}function e(){var a=c("mashsb_active_tab");return null==a&&(a="#mashsb_settingsgeneral_header"),a}function f(){var a,b;return a=jQuery(".mashsb.nav-tab-wrapper a.nav-tab-active:nth-child(2)"),b=jQuery(".mashsb.nav-tab-wrapper a.nav-tab-active:nth-child(3)"),a.length>0||b.length>0?void 0:e()+"-nav"}a(".mashsb-color-box").each(function(){a(this).colpick({layout:"hex",submit:0,colorScheme:"light",onChange:function(b,c,d,e,f){a(e).css("border-color","#"+c),f||a(e).val(c)}}).keyup(function(){a(this).colpickSetColor(this.value)}),a(this).colpick({layout:"hex",submit:0,colorScheme:"light",onChange:function(b,c,d,e,f){a(e).css("border-color","#"+c),f||a(e).val(c)}}).keyup(function(){a(this).colpickSetColor(this.value)})}),a("#mashsb_settings\\[responsive_buttons\\]").attr("checked")?a("#mashsb_settings\\[button_width\\]").closest(".row").css("display","none"):a("#mashsb_settings\\[button_width\\]").closest(".row").fadeIn(300).css("display","table-row"),a("#mashsb_settings\\[responsive_buttons\\]").click(function(){a(this).attr("checked")?a("#mashsb_settings\\[button_width\\]").closest(".row").css("display","none"):a("#mashsb_settings\\[button_width\\]").closest(".row").fadeIn(300).css("display","table-row")}),a(".mashsb-chosen-select").chosen({width:"400px"}),a("#mashsb_settings\\[caching_method\\]").change(function(){"refresh_loading"===a("#mashsb_settings\\[caching_method\\]").val()?a("#mashsb_settings\\[mashsharer_cache\\]").closest(".row").fadeIn(300).css("display","table-row"):a("#mashsb_settings\\[mashsharer_cache\\]").closest(".row").css("display","none")}),"refresh_loading"===a("#mashsb_settings\\[caching_method\\]").val()?a("#mashsb_settings\\[mashsharer_cache\\]").closest(".row").fadeIn(300).css("display","table-row"):a("#mashsb_settings\\[mashsharer_cache\\]").closest(".row").css("display","none"),a(".mashsb-tabs").length&&a("#mashsb_container").easytabs({animate:!0,updateHash:!0,defaultTab:f()}),a("#mashsb_container").bind("easytabs:after",function(){0==jQuery(".mashsb.nav-tab-wrapper a.nav-tab-active:nth-child(2)").length&&d()}),a(".mashtab").length&&a(".tabcontent_container").easytabs({animate:!0}),a("#mashsb_network_list").sortable({items:".mashsb_list_item",opacity:.6,cursor:"move",axis:"y",update:function(){var b=a(this).sortable("serialize")+"&action=mashsb_update_order";a.post(ajaxurl,b,function(){})}}),a(".mashsb-helper").click(function(b){b.preventDefault();var c=a(this),d=a(this).next();a(".mashsb-message").not(d).hide();var e=c.position();d.css(d.hasClass("bottom")?{left:e.left-d.width()/2+"px",top:e.top+c.height()+9+"px"}:{left:e.left+c.width()+9+"px",top:e.top+c.height()/2-18+"px"}),d.toggle(),b.stopPropagation()}),a("body").click(function(){a(".mashsb-message").hide()}),a(".mashsb-message").click(function(a){a.stopPropagation()})}),function(a,b,c){function d(a){return a=a||location.href,"#"+a.replace(/^[^#]*#?(.*)$/,"$1")}var e,f="hashchange",g=document,h=a.event.special,i=g.documentMode,j="on"+f in b&&(i===c||i>7);a.fn[f]=function(a){return a?this.bind(f,a):this.trigger(f)},a.fn[f].delay=50,h[f]=a.extend(h[f],{setup:function(){return j?!1:void a(e.start)},teardown:function(){return j?!1:void a(e.stop)}}),e=function(){function e(){var c=d(),g=n(k);c!==k?(m(k=c,g),a(b).trigger(f)):g!==k&&(location.href=location.href.replace(/#.*/,"")+g),h=setTimeout(e,a.fn[f].delay)}var h,i={},k=d(),l=function(a){return a},m=l,n=l;return i.start=function(){h||e()},i.stop=function(){h&&clearTimeout(h),h=c},a.browser.msie&&!j&&function(){var b,c;i.start=function(){b||(c=a.fn[f].src,c=c&&c+d(),b=a('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){c||m(d()),e()}).attr("src",c||"javascript:0").insertAfter("body")[0].contentWindow,g.onpropertychange=function(){try{"title"===event.propertyName&&(b.document.title=g.title)}catch(a){}})},i.stop=l,n=function(){return d(b.location.href)},m=function(c,d){var e=b.document,h=a.fn[f].domain;c!==d&&(e.title=g.title,e.open(),h&&e.write('<script>document.domain="'+h+'"</script>'),e.close(),b.location.hash=c)}}(),i}()}(jQuery,this),function(a){a.easytabs=function(b,c){var d,e,f,g,h,i,j=this,k=a(b),l={animate:!0,panelActiveClass:"active",tabActiveClass:"active",defaultTab:"li:first-child",animationSpeed:"normal",tabs:"> ul > li",updateHash:!0,cycle:!1,collapsible:!1,collapsedClass:"collapsed",collapsedByDefault:!0,uiTabs:!1,transitionIn:"fadeIn",transitionOut:"fadeOut",transitionInEasing:"swing",transitionOutEasing:"swing",transitionCollapse:"slideUp",transitionUncollapse:"slideDown",transitionCollapseEasing:"swing",transitionUncollapseEasing:"swing",containerClass:"",tabsClass:"",tabClass:"",panelClass:"",cache:!0,event:"click",panelContext:k},m={fast:200,normal:400,slow:600};j.init=function(){j.settings=i=a.extend({},l,c),i.bind_str=i.event+".easytabs",i.uiTabs&&(i.tabActiveClass="ui-tabs-selected",i.containerClass="ui-tabs ui-widget ui-widget-content ui-corner-all",i.tabsClass="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all",i.tabClass="ui-state-default ui-corner-top",i.panelClass="ui-tabs-panel ui-widget-content ui-corner-bottom"),i.collapsible&&void 0!==c.defaultTab&&void 0===c.collpasedByDefault&&(i.collapsedByDefault=!1),"string"==typeof i.animationSpeed&&(i.animationSpeed=m[i.animationSpeed]),a("a.anchor").remove().prependTo("body"),k.data("easytabs",{}),j.setTransitions(),j.getTabs(),o(),p(),r(),v(),w(),k.attr("data-easytabs",!0)},j.setTransitions=function(){f=i.animate?{show:i.transitionIn,hide:i.transitionOut,speed:i.animationSpeed,collapse:i.transitionCollapse,uncollapse:i.transitionUncollapse,halfSpeed:i.animationSpeed/2}:{show:"show",hide:"hide",speed:0,collapse:"hide",uncollapse:"show",halfSpeed:0}},j.getTabs=function(){var b;j.tabs=k.find(i.tabs),j.panels=a(),j.tabs.each(function(){var c=a(this),d=c.children("a"),e=c.children("a").data("target");c.data("easytabs",{}),void 0!==e&&null!==e?c.data("easytabs").ajax=d.attr("href"):e=d.attr("href"),e=e.match(/#([^\?]+)/)[1],b=i.panelContext.find("#"+e),b.length?(b.data("easytabs",{position:b.css("position"),visibility:b.css("visibility")}),b.not(i.panelActiveClass).hide(),j.panels=j.panels.add(b),c.data("easytabs").panel=b):(j.tabs=j.tabs.not(c),"console"in window&&console.warn("Warning: tab without matching panel for selector '#"+e+"' removed from set"))})},j.selectTab=function(a,b){var c=window.location,d=(c.hash.match(/^[^\?]*/)[0],a.parent().data("easytabs").panel),e=a.parent().data("easytabs").ajax;i.collapsible&&!h&&(a.hasClass(i.tabActiveClass)||a.hasClass(i.collapsedClass))?j.toggleTabCollapse(a,d,e,b):a.hasClass(i.tabActiveClass)&&d.hasClass(i.panelActiveClass)?i.cache||s(a,d,e,b):s(a,d,e,b)},j.toggleTabCollapse=function(a,b,c,d){j.panels.stop(!0,!0),n(k,"easytabs:before",[a,b,i])&&(j.tabs.filter("."+i.tabActiveClass).removeClass(i.tabActiveClass).children().removeClass(i.tabActiveClass),a.hasClass(i.collapsedClass)?(!c||i.cache&&a.parent().data("easytabs").cached||(k.trigger("easytabs:ajax:beforeSend",[a,b]),b.load(c,function(c,d,e){a.parent().data("easytabs").cached=!0,k.trigger("easytabs:ajax:complete",[a,b,c,d,e])})),a.parent().removeClass(i.collapsedClass).addClass(i.tabActiveClass).children().removeClass(i.collapsedClass).addClass(i.tabActiveClass),b.addClass(i.panelActiveClass)[f.uncollapse](f.speed,i.transitionUncollapseEasing,function(){k.trigger("easytabs:midTransition",[a,b,i]),"function"==typeof d&&d()})):(a.addClass(i.collapsedClass).parent().addClass(i.collapsedClass),b.removeClass(i.panelActiveClass)[f.collapse](f.speed,i.transitionCollapseEasing,function(){k.trigger("easytabs:midTransition",[a,b,i]),"function"==typeof d&&d()})))},j.matchTab=function(a){return j.tabs.find("[href='"+a+"'],[data-target='"+a+"']").first()},j.matchInPanel=function(a){return a&&j.validId(a)?j.panels.filter(":has("+a+")").first():[]},j.validId=function(a){return a.substr(1).match(/^[A-Za-z][A-Za-z0-9\-_:\.]*$/)},j.selectTabFromHashChange=function(){var a,b=window.location.hash.match(/^[^\?]*/)[0],c=j.matchTab(b);i.updateHash&&(c.length?(h=!0,j.selectTab(c)):(a=j.matchInPanel(b),a.length?(b="#"+a.attr("id"),c=j.matchTab(b),h=!0,j.selectTab(c)):d.hasClass(i.tabActiveClass)||i.cycle||(""===b||j.matchTab(g).length||k.closest(b).length)&&(h=!0,j.selectTab(e))))},j.cycleTabs=function(b){i.cycle&&(b%=j.tabs.length,$tab=a(j.tabs[b]).children("a").first(),h=!0,j.selectTab($tab,function(){setTimeout(function(){j.cycleTabs(b+1)},i.cycle)}))},j.publicMethods={select:function(b){var c;0===(c=j.tabs.filter(b)).length?0===(c=j.tabs.find("a[href='"+b+"']")).length&&0===(c=j.tabs.find("a"+b)).length&&0===(c=j.tabs.find("[data-target='"+b+"']")).length&&0===(c=j.tabs.find("a[href$='"+b+"']")).length&&a.error("Tab '"+b+"' does not exist in tab set"):c=c.children("a").first(),j.selectTab(c)}};var n=function(b,c,d){var e=a.Event(c);return b.trigger(e,d),e.result!==!1},o=function(){k.addClass(i.containerClass),j.tabs.parent().addClass(i.tabsClass),j.tabs.addClass(i.tabClass),j.panels.addClass(i.panelClass)},p=function(){var b,c=window.location.hash.match(/^[^\?]*/)[0],f=j.matchTab(c).parent();1===f.length?(d=f,i.cycle=!1):(b=j.matchInPanel(c),b.length?(c="#"+b.attr("id"),d=j.matchTab(c).parent()):(d=j.tabs.parent().find(i.defaultTab),0===d.length&&a.error("The specified default tab ('"+i.defaultTab+"') could not be found in the tab set ('"+i.tabs+"') out of "+j.tabs.length+" tabs."))),e=d.children("a").first(),q(f)},q=function(b){var c,f;i.collapsible&&0===b.length&&i.collapsedByDefault?d.addClass(i.collapsedClass).children().addClass(i.collapsedClass):(c=a(d.data("easytabs").panel),f=d.data("easytabs").ajax,!f||i.cache&&d.data("easytabs").cached||(k.trigger("easytabs:ajax:beforeSend",[e,c]),c.load(f,function(a,b,f){d.data("easytabs").cached=!0,k.trigger("easytabs:ajax:complete",[e,c,a,b,f])})),d.data("easytabs").panel.show().addClass(i.panelActiveClass),d.addClass(i.tabActiveClass).children().addClass(i.tabActiveClass)),k.trigger("easytabs:initialised",[e,c])},r=function(){j.tabs.children("a").bind(i.bind_str,function(b){i.cycle=!1,h=!1,j.selectTab(a(this)),b.preventDefault?b.preventDefault():b.returnValue=!1})},s=function(a,b,c,d){if(j.panels.stop(!0,!0),n(k,"easytabs:before",[a,b,i])){var e,l,m,o,p=j.panels.filter(":visible"),q=b.parent(),r=window.location.hash.match(/^[^\?]*/)[0];i.animate&&(e=t(b),l=p.length?u(p):0,m=e-l),g=r,o=function(){k.trigger("easytabs:midTransition",[a,b,i]),i.animate&&"fadeIn"==i.transitionIn&&0>m&&q.animate({height:q.height()+m},f.halfSpeed).css({"min-height":""}),i.updateHash&&!h?window.history.pushState?window.history.pushState(null,null,"#"+b.attr("id")):window.location.hash="#"+b.attr("id"):h=!1,b[f.show](f.speed,i.transitionInEasing,function(){q.css({height:"","min-height":""}),k.trigger("easytabs:after",[a,b,i]),"function"==typeof d&&d()})},!c||i.cache&&a.parent().data("easytabs").cached||(k.trigger("easytabs:ajax:beforeSend",[a,b]),b.load(c,function(c,d,e){a.parent().data("easytabs").cached=!0,k.trigger("easytabs:ajax:complete",[a,b,c,d,e])})),i.animate&&"fadeOut"==i.transitionOut&&(m>0?q.animate({height:q.height()+m},f.halfSpeed):q.css({"min-height":q.height()})),j.tabs.filter("."+i.tabActiveClass).removeClass(i.tabActiveClass).children().removeClass(i.tabActiveClass),j.tabs.filter("."+i.collapsedClass).removeClass(i.collapsedClass).children().removeClass(i.collapsedClass),a.parent().addClass(i.tabActiveClass).children().addClass(i.tabActiveClass),j.panels.filter("."+i.panelActiveClass).removeClass(i.panelActiveClass),b.addClass(i.panelActiveClass),p.length?p[f.hide](f.speed,i.transitionOutEasing,o):b[f.uncollapse](f.speed,i.transitionUncollapseEasing,o)}},t=function(b){if(b.data("easytabs")&&b.data("easytabs").lastHeight)return b.data("easytabs").lastHeight;var c,d,e=b.css("display");try{c=a("<div></div>",{position:"absolute",visibility:"hidden",overflow:"hidden"})}catch(f){c=a("<div></div>",{visibility:"hidden",overflow:"hidden"})}return d=b.wrap(c).css({position:"relative",visibility:"hidden",display:"block"}).outerHeight(),b.unwrap(),b.css({position:b.data("easytabs").position,visibility:b.data("easytabs").visibility,display:e}),b.data("easytabs").lastHeight=d,d},u=function(a){var b=a.outerHeight();return a.data("easytabs")?a.data("easytabs").lastHeight=b:a.data("easytabs",{lastHeight:b}),b},v=function(){"function"==typeof a(window).hashchange?a(window).hashchange(function(){j.selectTabFromHashChange()}):a.address&&"function"==typeof a.address.change&&a.address.change(function(){j.selectTabFromHashChange()})},w=function(){var a;i.cycle&&(a=j.tabs.index(d),setTimeout(function(){j.cycleTabs(a+1)},i.cycle))};j.init()},a.fn.easytabs=function(b){var c=arguments;return this.each(function(){var d=a(this),e=d.data("easytabs");return void 0===e&&(e=new a.easytabs(this,b),d.data("easytabs",e)),e.publicMethods[b]?e.publicMethods[b](Array.prototype.slice.call(c,1)):void 0})}}(jQuery),function(a){var b=function(){var b='<div class="colpick"><div class="colpick_color"><div class="colpick_color_overlay1"><div class="colpick_color_overlay2"><div class="colpick_selector_outer"><div class="colpick_selector_inner"></div></div></div></div></div><div class="colpick_hue"><div class="colpick_hue_arrs"><div class="colpick_hue_larr"></div><div class="colpick_hue_rarr"></div></div></div><div class="colpick_new_color"></div><div class="colpick_current_color"></div><div class="colpick_hex_field"><div class="colpick_field_letter">#</div><input type="text" maxlength="6" size="6" /></div><div class="colpick_rgb_r colpick_field"><div class="colpick_field_letter">R</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_rgb_g colpick_field"><div class="colpick_field_letter">G</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_rgb_b colpick_field"><div class="colpick_field_letter">B</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_hsb_h colpick_field"><div class="colpick_field_letter">H</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_hsb_s colpick_field"><div class="colpick_field_letter">S</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_hsb_b colpick_field"><div class="colpick_field_letter">B</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_submit"></div></div>',c={showEvent:"click",onShow:function(){},onBeforeShow:function(){},onHide:function(){},onChange:function(){},onSubmit:function(){},colorScheme:"light",color:"3289c7",livePreview:!0,flat:!1,layout:"full",submit:1,submitText:"OK",height:156},g=function(b,c){var d=f(b);a(c).data("colpick").fields.eq(1).val(d.r).end().eq(2).val(d.g).end().eq(3).val(d.b).end()},i=function(b,c){a(c).data("colpick").fields.eq(4).val(Math.round(b.h)).end().eq(5).val(Math.round(b.s)).end().eq(6).val(Math.round(b.b)).end()},j=function(b,c){a(c).data("colpick").fields.eq(0).val(h(b))},k=function(b,c){a(c).data("colpick").selector.css("backgroundColor","#"+h({h:b.h,s:100,b:100})),a(c).data("colpick").selectorIndic.css({left:parseInt(a(c).data("colpick").height*b.s/100,10),top:parseInt(a(c).data("colpick").height*(100-b.b)/100,10)})},l=function(b,c){a(c).data("colpick").hue.css("top",parseInt(a(c).data("colpick").height-a(c).data("colpick").height*b.h/360,10))},m=function(b,c){a(c).data("colpick").currentColor.css("backgroundColor","#"+h(b))},n=function(b,c){a(c).data("colpick").newColor.css("backgroundColor","#"+h(b))},o=function(){var b,c=a(this).parent().parent();this.parentNode.className.indexOf("_hex")>0?(c.data("colpick").color=b=d(G(this.value)),g(b,c.get(0)),i(b,c.get(0))):this.parentNode.className.indexOf("_hsb")>0?(c.data("colpick").color=b=E({h:parseInt(c.data("colpick").fields.eq(4).val(),10),s:parseInt(c.data("colpick").fields.eq(5).val(),10),b:parseInt(c.data("colpick").fields.eq(6).val(),10)}),g(b,c.get(0)),j(b,c.get(0))):(c.data("colpick").color=b=e(F({r:parseInt(c.data("colpick").fields.eq(1).val(),10),g:parseInt(c.data("colpick").fields.eq(2).val(),10),b:parseInt(c.data("colpick").fields.eq(3).val(),10)})),j(b,c.get(0)),i(b,c.get(0))),k(b,c.get(0)),l(b,c.get(0)),n(b,c.get(0)),c.data("colpick").onChange.apply(c.parent(),[b,h(b),f(b),c.data("colpick").el,0])},p=function(){a(this).parent().removeClass("colpick_focus")},q=function(){a(this).parent().parent().data("colpick").fields.parent().removeClass("colpick_focus"),a(this).parent().addClass("colpick_focus")},r=function(b){b.preventDefault?b.preventDefault():b.returnValue=!1;var c=a(this).parent().find("input").focus(),d={el:a(this).parent().addClass("colpick_slider"),max:this.parentNode.className.indexOf("_hsb_h")>0?360:this.parentNode.className.indexOf("_hsb")>0?100:255,y:b.pageY,field:c,val:parseInt(c.val(),10),preview:a(this).parent().parent().data("colpick").livePreview};a(document).mouseup(d,t),a(document).mousemove(d,s)},s=function(a){return a.data.field.val(Math.max(0,Math.min(a.data.max,parseInt(a.data.val-a.pageY+a.data.y,10)))),a.data.preview&&o.apply(a.data.field.get(0),[!0]),!1},t=function(b){return o.apply(b.data.field.get(0),[!0]),b.data.el.removeClass("colpick_slider").find("input").focus(),a(document).off("mouseup",t),a(document).off("mousemove",s),!1},u=function(b){b.preventDefault?b.preventDefault():b.returnValue=!1;var c={cal:a(this).parent(),y:a(this).offset().top};a(document).on("mouseup touchend",c,w),a(document).on("mousemove touchmove",c,v);var d="touchstart"==b.type?b.originalEvent.changedTouches[0].pageY:b.pageY;return o.apply(c.cal.data("colpick").fields.eq(4).val(parseInt(360*(c.cal.data("colpick").height-(d-c.y))/c.cal.data("colpick").height,10)).get(0),[c.cal.data("colpick").livePreview]),!1},v=function(a){var b="touchmove"==a.type?a.originalEvent.changedTouches[0].pageY:a.pageY;return o.apply(a.data.cal.data("colpick").fields.eq(4).val(parseInt(360*(a.data.cal.data("colpick").height-Math.max(0,Math.min(a.data.cal.data("colpick").height,b-a.data.y)))/a.data.cal.data("colpick").height,10)).get(0),[a.data.preview]),!1},w=function(b){return g(b.data.cal.data("colpick").color,b.data.cal.get(0)),j(b.data.cal.data("colpick").color,b.data.cal.get(0)),a(document).off("mouseup touchend",w),a(document).off("mousemove touchmove",v),!1},x=function(b){b.preventDefault?b.preventDefault():b.returnValue=!1;var c={cal:a(this).parent(),pos:a(this).offset()};c.preview=c.cal.data("colpick").livePreview,a(document).on("mouseup touchend",c,z),a(document).on("mousemove touchmove",c,y);var d;return"touchstart"==b.type?(pageX=b.originalEvent.changedTouches[0].pageX,d=b.originalEvent.changedTouches[0].pageY):(pageX=b.pageX,d=b.pageY),o.apply(c.cal.data("colpick").fields.eq(6).val(parseInt(100*(c.cal.data("colpick").height-(d-c.pos.top))/c.cal.data("colpick").height,10)).end().eq(5).val(parseInt(100*(pageX-c.pos.left)/c.cal.data("colpick").height,10)).get(0),[c.preview]),!1},y=function(a){var b;return"touchmove"==a.type?(pageX=a.originalEvent.changedTouches[0].pageX,b=a.originalEvent.changedTouches[0].pageY):(pageX=a.pageX,b=a.pageY),o.apply(a.data.cal.data("colpick").fields.eq(6).val(parseInt(100*(a.data.cal.data("colpick").height-Math.max(0,Math.min(a.data.cal.data("colpick").height,b-a.data.pos.top)))/a.data.cal.data("colpick").height,10)).end().eq(5).val(parseInt(100*Math.max(0,Math.min(a.data.cal.data("colpick").height,pageX-a.data.pos.left))/a.data.cal.data("colpick").height,10)).get(0),[a.data.preview]),!1},z=function(b){return g(b.data.cal.data("colpick").color,b.data.cal.get(0)),j(b.data.cal.data("colpick").color,b.data.cal.get(0)),a(document).off("mouseup touchend",z),a(document).off("mousemove touchmove",y),!1},A=function(){var b=a(this).parent(),c=b.data("colpick").color;b.data("colpick").origColor=c,m(c,b.get(0)),b.data("colpick").onSubmit(c,h(c),f(c),b.data("colpick").el)},B=function(b){b.stopPropagation();var c=a("#"+a(this).data("colpickId"));c.data("colpick").onBeforeShow.apply(this,[c.get(0)]);var d=a(this).offset(),e=d.top+this.offsetHeight,f=d.left,g=D(),h=c.width();f+h>g.l+g.w&&(f-=h),c.css({left:f+"px",top:e+"px"}),0!=c.data("colpick").onShow.apply(this,[c.get(0)])&&c.show(),a("html").mousedown({cal:c},C),c.mousedown(function(a){a.stopPropagation()})},C=function(b){0!=b.data.cal.data("colpick").onHide.apply(this,[b.data.cal.get(0)])&&b.data.cal.hide(),a("html").off("mousedown",C)},D=function(){var a="CSS1Compat"==document.compatMode;return{l:window.pageXOffset||(a?document.documentElement.scrollLeft:document.body.scrollLeft),w:window.innerWidth||(a?document.documentElement.clientWidth:document.body.clientWidth)}},E=function(a){return{h:Math.min(360,Math.max(0,a.h)),s:Math.min(100,Math.max(0,a.s)),b:Math.min(100,Math.max(0,a.b))}},F=function(a){return{r:Math.min(255,Math.max(0,a.r)),g:Math.min(255,Math.max(0,a.g)),b:Math.min(255,Math.max(0,a.b))}},G=function(a){var b=6-a.length;if(b>0){for(var c=[],d=0;b>d;d++)c.push("0");c.push(a),a=c.join("")}return a},H=function(){var b=a(this).parent(),c=b.data("colpick").origColor;b.data("colpick").color=c,g(c,b.get(0)),j(c,b.get(0)),i(c,b.get(0)),k(c,b.get(0)),l(c,b.get(0)),n(c,b.get(0))};return{init:function(f){if(f=a.extend({},c,f||{}),"string"==typeof f.color)f.color=d(f.color);else if(void 0!=f.color.r&&void 0!=f.color.g&&void 0!=f.color.b)f.color=e(f.color);else{if(void 0==f.color.h||void 0==f.color.s||void 0==f.color.b)return this;f.color=E(f.color)}return this.each(function(){if(!a(this).data("colpickId")){var c=a.extend({},f);c.origColor=f.color;var d="collorpicker_"+parseInt(1e3*Math.random());a(this).data("colpickId",d);var e=a(b).attr("id",d);e.addClass("colpick_"+c.layout+(c.submit?"":" colpick_"+c.layout+"_ns")),"light"!=c.colorScheme&&e.addClass("colpick_"+c.colorScheme),e.find("div.colpick_submit").html(c.submitText).click(A),c.fields=e.find("input").change(o).blur(p).focus(q),e.find("div.colpick_field_arrs").mousedown(r).end().find("div.colpick_current_color").click(H),c.selector=e.find("div.colpick_color").on("mousedown touchstart",x),c.selectorIndic=c.selector.find("div.colpick_selector_outer"),c.el=this,c.hue=e.find("div.colpick_hue_arrs"),huebar=c.hue.parent();var h=navigator.userAgent.toLowerCase(),s="Microsoft Internet Explorer"===navigator.appName,t=s?parseFloat(h.match(/msie ([0-9]{1,}[\.0-9]{0,})/)[1]):0,v=s&&10>t,w=["#ff0000","#ff0080","#ff00ff","#8000ff","#0000ff","#0080ff","#00ffff","#00ff80","#00ff00","#80ff00","#ffff00","#ff8000","#ff0000"];if(v){var y,z;for(y=0;11>=y;y++)z=a("<div></div>").attr("style","height:8.333333%; filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr="+w[y]+", endColorstr="+w[y+1]+'); -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='+w[y]+", endColorstr="+w[y+1]+')";'),huebar.append(z)}else stopList=w.join(","),huebar.attr("style","background:-webkit-linear-gradient(top,"+stopList+"); background: -o-linear-gradient(top,"+stopList+"); background: -ms-linear-gradient(top,"+stopList+"); background:-moz-linear-gradient(top,"+stopList+"); -webkit-linear-gradient(top,"+stopList+"); background:linear-gradient(to bottom,"+stopList+"); ");e.find("div.colpick_hue").on("mousedown touchstart",u),c.newColor=e.find("div.colpick_new_color"),c.currentColor=e.find("div.colpick_current_color"),e.data("colpick",c),g(c.color,e.get(0)),i(c.color,e.get(0)),j(c.color,e.get(0)),l(c.color,e.get(0)),k(c.color,e.get(0)),m(c.color,e.get(0)),n(c.color,e.get(0)),c.flat?(e.appendTo(this).show(),e.css({position:"relative",display:"block"})):(e.appendTo(document.body),a(this).on(c.showEvent,B),e.css({position:"absolute"}))}})},showPicker:function(){return this.each(function(){a(this).data("colpickId")&&B.apply(this)})},hidePicker:function(){return this.each(function(){a(this).data("colpickId")&&a("#"+a(this).data("colpickId")).hide()})},setColor:function(b,c){if(c="undefined"==typeof c?1:c,"string"==typeof b)b=d(b);else if(void 0!=b.r&&void 0!=b.g&&void 0!=b.b)b=e(b);else{if(void 0==b.h||void 0==b.s||void 0==b.b)return this;b=E(b)}return this.each(function(){if(a(this).data("colpickId")){var d=a("#"+a(this).data("colpickId"));d.data("colpick").color=b,d.data("colpick").origColor=b,g(b,d.get(0)),i(b,d.get(0)),j(b,d.get(0)),l(b,d.get(0)),k(b,d.get(0)),n(b,d.get(0)),d.data("colpick").onChange.apply(d.parent(),[b,h(b),f(b),d.data("colpick").el,1]),c&&m(b,d.get(0))}})}}}(),c=function(a){var a=parseInt(a.indexOf("#")>-1?a.substring(1):a,16);return{r:a>>16,g:(65280&a)>>8,b:255&a}},d=function(a){return e(c(a))},e=function(a){var b={h:0,s:0,b:0},c=Math.min(a.r,a.g,a.b),d=Math.max(a.r,a.g,a.b),e=d-c;return b.b=d,b.s=0!=d?255*e/d:0,b.h=0!=b.s?a.r==d?(a.g-a.b)/e:a.g==d?2+(a.b-a.r)/e:4+(a.r-a.g)/e:-1,b.h*=60,b.h<0&&(b.h+=360),b.s*=100/255,b.b*=100/255,b},f=function(a){var b={},c=a.h,d=255*a.s/100,e=255*a.b/100;if(0==d)b.r=b.g=b.b=e;else{var f=e,g=(255-d)*e/255,h=(f-g)*(c%60)/60;360==c&&(c=0),60>c?(b.r=f,b.b=g,b.g=g+h):120>c?(b.g=f,b.b=g,b.r=f-h):180>c?(b.g=f,b.r=g,b.b=g+h):240>c?(b.b=f,b.r=g,b.g=f-h):300>c?(b.b=f,b.g=g,b.r=g+h):360>c?(b.r=f,b.g=g,b.b=f-h):(b.r=0,b.g=0,b.b=0)}return{r:Math.round(b.r),g:Math.round(b.g),b:Math.round(b.b)}},g=function(b){var c=[b.r.toString(16),b.g.toString(16),b.b.toString(16)];return a.each(c,function(a,b){1==b.length&&(c[a]="0"+b)}),c.join("")},h=function(a){return g(f(a))};a.fn.extend({colpick:b.init,colpickHide:b.hidePicker,colpickShow:b.showPicker,colpickSetColor:b.setColor}),a.extend({colpick:{rgbToHex:g,rgbToHsb:e,hsbToHex:h,hsbToRgb:f,hexToHsb:d,hexToRgb:c}})}(jQuery),window.twttr=function(a,b,c){var d,e=a.getElementsByTagName(b)[0],f=window.twttr||{};return a.getElementById(c)?f:(d=a.createElement(b),d.id=c,d.src="https://platform.twitter.com/widgets.js",e.parentNode.insertBefore(d,e),f._e=[],f.ready=function(a){f._e.push(a)},f)}(document,"script","twitter-wjs");
1
+ jQuery(document).ready(function(a){function b(){a.ajax("https://graph.facebook.com/v2.7/?id=http://www.google.de&access_token="+a("#mashsb_settings\\[fb_access_token\\]").val()).done(function(b){a("#mashsb_token_notice").html(""),console.log(b)}).fail(function(b){a("#mashsb_token_notice").html('<span style="color:red;"> <strong>Error:</strong> Access Token Invalid!</span>'),console.log(b)})}function c(a,b,c){if(c){var d=new Date;d.setTime(d.getTime()+24*c*60*60*1e3);var e="; expires="+d.toGMTString()}else var e="";document.cookie=a+"="+b+e+"; path=/"}function d(a){for(var b=a+"=",c=document.cookie.split(";"),d=0;d<c.length;d++){for(var e=c[d];" "==e.charAt(0);)e=e.substring(1,e.length);if(0==e.indexOf(b))return e.substring(b.length,e.length)}return null}function e(){var a=jQuery(".mashsb-tabs.active").find("a").attr("href");c("mashsb_active_tab",a)}function f(){var a=d("mashsb_active_tab");return null==a&&(a="#mashsb_settingsgeneral_header"),a}function g(){var a,b;return a=jQuery(".mashsb.nav-tab-wrapper a.nav-tab-active:nth-child(2)"),b=jQuery(".mashsb.nav-tab-wrapper a.nav-tab-active:nth-child(3)"),a.length>0||b.length>0?void 0:f()+"-nav"}a(".mashsb-color-box").each(function(){a(this).colpick({layout:"hex",submit:0,colorScheme:"light",onChange:function(b,c,d,e,f){a(e).css("border-color","#"+c),f||a(e).val(c)}}).keyup(function(){a(this).colpickSetColor(this.value)}),a(this).colpick({layout:"hex",submit:0,colorScheme:"light",onChange:function(b,c,d,e,f){a(e).css("border-color","#"+c),f||a(e).val(c)}}).keyup(function(){a(this).colpickSetColor(this.value)})}),a("#mashsb_settings\\[fb_access_token\\]").on("change paste keyup",function(){var c=5184e6,d=(new Date).getTime()+c,e=((new Date).getTime()+5184e6)/1e3,f=new Date(d);a("#mashsb_settings\\[fb_access_token\\]").val()?(b(),document.getElementById("mashsb_expire_token_status").innerHTML="Token needs renewal on "+f+"<br>MashShare will notify you shortly before the access token expires.",a("#mashsb_settings\\[expire_fb_access_token\\]").val(e.toFixed(0))):document.getElementById("mashsb_expire_token_status").innerHTML=""}),a("#mashsb_fb_auth").click(function(b){b.preventDefault(),winWidth=520,winHeight=350;var c=screen.height/2-winHeight/2,d=screen.width/2-winWidth/2,e=a(this).attr("href");mashsb_fb_auth=window.open(e,"mashsb_fb_auth","top="+c+",left="+d+",toolbar=0,status=0,width="+winWidth+",height="+winHeight+",resizable=yes")}),a("#mashsb_settings\\[responsive_buttons\\]").attr("checked")?a("#mashsb_settings\\[button_width\\]").closest(".row").css("display","none"):a("#mashsb_settings\\[button_width\\]").closest(".row").fadeIn(300).css("display","table-row"),a("#mashsb_settings\\[responsive_buttons\\]").click(function(){a(this).attr("checked")?a("#mashsb_settings\\[button_width\\]").closest(".row").css("display","none"):a("#mashsb_settings\\[button_width\\]").closest(".row").fadeIn(300).css("display","table-row")}),a(".mashsb-chosen-select").chosen({width:"400px"}),a("#mashsb_settings\\[caching_method\\]").change(function(){"refresh_loading"===a("#mashsb_settings\\[caching_method\\]").val()?a("#mashsb_settings\\[mashsharer_cache\\]").closest(".row").fadeIn(300).css("display","table-row"):a("#mashsb_settings\\[mashsharer_cache\\]").closest(".row").css("display","none")}),"refresh_loading"===a("#mashsb_settings\\[caching_method\\]").val()?a("#mashsb_settings\\[mashsharer_cache\\]").closest(".row").fadeIn(300).css("display","table-row"):a("#mashsb_settings\\[mashsharer_cache\\]").closest(".row").css("display","none"),a(".mashsb-tabs").length&&a("#mashsb_container").easytabs({animate:!0,updateHash:!0,defaultTab:g()}),a("#mashsb_container").bind("easytabs:after",function(){0==jQuery(".mashsb.nav-tab-wrapper a.nav-tab-active:nth-child(2)").length&&e()}),a(".mashtab").length&&a(".tabcontent_container").easytabs({animate:!0}),a("#mashsb_network_list").sortable({items:".mashsb_list_item",opacity:.6,cursor:"move",axis:"y",update:function(){var b=a(this).sortable("serialize")+"&action=mashsb_update_order";a.post(ajaxurl,b,function(){})}}),a(".mashsb-helper").click(function(b){b.preventDefault();var c=a(this),d=a(this).next();a(".mashsb-message").not(d).hide();var e=c.position();d.css(d.hasClass("bottom")?{left:e.left-d.width()/2+"px",top:e.top+c.height()+9+"px"}:{left:e.left+c.width()+9+"px",top:e.top+c.height()/2-18+"px"}),d.toggle(),b.stopPropagation()}),a("body").click(function(){a(".mashsb-message").hide()}),a(".mashsb-message").click(function(a){a.stopPropagation()})}),function(a,b,c){function d(a){return a=a||location.href,"#"+a.replace(/^[^#]*#?(.*)$/,"$1")}var e,f="hashchange",g=document,h=a.event.special,i=g.documentMode,j="on"+f in b&&(i===c||i>7);a.fn[f]=function(a){return a?this.bind(f,a):this.trigger(f)},a.fn[f].delay=50,h[f]=a.extend(h[f],{setup:function(){return j?!1:void a(e.start)},teardown:function(){return j?!1:void a(e.stop)}}),e=function(){function e(){var c=d(),g=n(k);c!==k?(m(k=c,g),a(b).trigger(f)):g!==k&&(location.href=location.href.replace(/#.*/,"")+g),h=setTimeout(e,a.fn[f].delay)}var h,i={},k=d(),l=function(a){return a},m=l,n=l;return i.start=function(){h||e()},i.stop=function(){h&&clearTimeout(h),h=c},a.browser.msie&&!j&&function(){var b,c;i.start=function(){b||(c=a.fn[f].src,c=c&&c+d(),b=a('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){c||m(d()),e()}).attr("src",c||"javascript:0").insertAfter("body")[0].contentWindow,g.onpropertychange=function(){try{"title"===event.propertyName&&(b.document.title=g.title)}catch(a){}})},i.stop=l,n=function(){return d(b.location.href)},m=function(c,d){var e=b.document,h=a.fn[f].domain;c!==d&&(e.title=g.title,e.open(),h&&e.write('<script>document.domain="'+h+'"</script>'),e.close(),b.location.hash=c)}}(),i}()}(jQuery,this),function(a){a.easytabs=function(b,c){var d,e,f,g,h,i,j=this,k=a(b),l={animate:!0,panelActiveClass:"active",tabActiveClass:"active",defaultTab:"li:first-child",animationSpeed:"normal",tabs:"> ul > li",updateHash:!0,cycle:!1,collapsible:!1,collapsedClass:"collapsed",collapsedByDefault:!0,uiTabs:!1,transitionIn:"fadeIn",transitionOut:"fadeOut",transitionInEasing:"swing",transitionOutEasing:"swing",transitionCollapse:"slideUp",transitionUncollapse:"slideDown",transitionCollapseEasing:"swing",transitionUncollapseEasing:"swing",containerClass:"",tabsClass:"",tabClass:"",panelClass:"",cache:!0,event:"click",panelContext:k},m={fast:200,normal:400,slow:600};j.init=function(){j.settings=i=a.extend({},l,c),i.bind_str=i.event+".easytabs",i.uiTabs&&(i.tabActiveClass="ui-tabs-selected",i.containerClass="ui-tabs ui-widget ui-widget-content ui-corner-all",i.tabsClass="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all",i.tabClass="ui-state-default ui-corner-top",i.panelClass="ui-tabs-panel ui-widget-content ui-corner-bottom"),i.collapsible&&void 0!==c.defaultTab&&void 0===c.collpasedByDefault&&(i.collapsedByDefault=!1),"string"==typeof i.animationSpeed&&(i.animationSpeed=m[i.animationSpeed]),a("a.anchor").remove().prependTo("body"),k.data("easytabs",{}),j.setTransitions(),j.getTabs(),o(),p(),r(),v(),w(),k.attr("data-easytabs",!0)},j.setTransitions=function(){f=i.animate?{show:i.transitionIn,hide:i.transitionOut,speed:i.animationSpeed,collapse:i.transitionCollapse,uncollapse:i.transitionUncollapse,halfSpeed:i.animationSpeed/2}:{show:"show",hide:"hide",speed:0,collapse:"hide",uncollapse:"show",halfSpeed:0}},j.getTabs=function(){var b;j.tabs=k.find(i.tabs),j.panels=a(),j.tabs.each(function(){var c=a(this),d=c.children("a"),e=c.children("a").data("target");c.data("easytabs",{}),void 0!==e&&null!==e?c.data("easytabs").ajax=d.attr("href"):e=d.attr("href"),e=e.match(/#([^\?]+)/)[1],b=i.panelContext.find("#"+e),b.length?(b.data("easytabs",{position:b.css("position"),visibility:b.css("visibility")}),b.not(i.panelActiveClass).hide(),j.panels=j.panels.add(b),c.data("easytabs").panel=b):(j.tabs=j.tabs.not(c),"console"in window&&console.warn("Warning: tab without matching panel for selector '#"+e+"' removed from set"))})},j.selectTab=function(a,b){var c=window.location,d=(c.hash.match(/^[^\?]*/)[0],a.parent().data("easytabs").panel),e=a.parent().data("easytabs").ajax;i.collapsible&&!h&&(a.hasClass(i.tabActiveClass)||a.hasClass(i.collapsedClass))?j.toggleTabCollapse(a,d,e,b):a.hasClass(i.tabActiveClass)&&d.hasClass(i.panelActiveClass)?i.cache||s(a,d,e,b):s(a,d,e,b)},j.toggleTabCollapse=function(a,b,c,d){j.panels.stop(!0,!0),n(k,"easytabs:before",[a,b,i])&&(j.tabs.filter("."+i.tabActiveClass).removeClass(i.tabActiveClass).children().removeClass(i.tabActiveClass),a.hasClass(i.collapsedClass)?(!c||i.cache&&a.parent().data("easytabs").cached||(k.trigger("easytabs:ajax:beforeSend",[a,b]),b.load(c,function(c,d,e){a.parent().data("easytabs").cached=!0,k.trigger("easytabs:ajax:complete",[a,b,c,d,e])})),a.parent().removeClass(i.collapsedClass).addClass(i.tabActiveClass).children().removeClass(i.collapsedClass).addClass(i.tabActiveClass),b.addClass(i.panelActiveClass)[f.uncollapse](f.speed,i.transitionUncollapseEasing,function(){k.trigger("easytabs:midTransition",[a,b,i]),"function"==typeof d&&d()})):(a.addClass(i.collapsedClass).parent().addClass(i.collapsedClass),b.removeClass(i.panelActiveClass)[f.collapse](f.speed,i.transitionCollapseEasing,function(){k.trigger("easytabs:midTransition",[a,b,i]),"function"==typeof d&&d()})))},j.matchTab=function(a){return j.tabs.find("[href='"+a+"'],[data-target='"+a+"']").first()},j.matchInPanel=function(a){return a&&j.validId(a)?j.panels.filter(":has("+a+")").first():[]},j.validId=function(a){return a.substr(1).match(/^[A-Za-z][A-Za-z0-9\-_:\.]*$/)},j.selectTabFromHashChange=function(){var a,b=window.location.hash.match(/^[^\?]*/)[0],c=j.matchTab(b);i.updateHash&&(c.length?(h=!0,j.selectTab(c)):(a=j.matchInPanel(b),a.length?(b="#"+a.attr("id"),c=j.matchTab(b),h=!0,j.selectTab(c)):d.hasClass(i.tabActiveClass)||i.cycle||(""===b||j.matchTab(g).length||k.closest(b).length)&&(h=!0,j.selectTab(e))))},j.cycleTabs=function(b){i.cycle&&(b%=j.tabs.length,$tab=a(j.tabs[b]).children("a").first(),h=!0,j.selectTab($tab,function(){setTimeout(function(){j.cycleTabs(b+1)},i.cycle)}))},j.publicMethods={select:function(b){var c;0===(c=j.tabs.filter(b)).length?0===(c=j.tabs.find("a[href='"+b+"']")).length&&0===(c=j.tabs.find("a"+b)).length&&0===(c=j.tabs.find("[data-target='"+b+"']")).length&&0===(c=j.tabs.find("a[href$='"+b+"']")).length&&a.error("Tab '"+b+"' does not exist in tab set"):c=c.children("a").first(),j.selectTab(c)}};var n=function(b,c,d){var e=a.Event(c);return b.trigger(e,d),e.result!==!1},o=function(){k.addClass(i.containerClass),j.tabs.parent().addClass(i.tabsClass),j.tabs.addClass(i.tabClass),j.panels.addClass(i.panelClass)},p=function(){var b,c=window.location.hash.match(/^[^\?]*/)[0],f=j.matchTab(c).parent();1===f.length?(d=f,i.cycle=!1):(b=j.matchInPanel(c),b.length?(c="#"+b.attr("id"),d=j.matchTab(c).parent()):(d=j.tabs.parent().find(i.defaultTab),0===d.length&&a.error("The specified default tab ('"+i.defaultTab+"') could not be found in the tab set ('"+i.tabs+"') out of "+j.tabs.length+" tabs."))),e=d.children("a").first(),q(f)},q=function(b){var c,f;i.collapsible&&0===b.length&&i.collapsedByDefault?d.addClass(i.collapsedClass).children().addClass(i.collapsedClass):(c=a(d.data("easytabs").panel),f=d.data("easytabs").ajax,!f||i.cache&&d.data("easytabs").cached||(k.trigger("easytabs:ajax:beforeSend",[e,c]),c.load(f,function(a,b,f){d.data("easytabs").cached=!0,k.trigger("easytabs:ajax:complete",[e,c,a,b,f])})),d.data("easytabs").panel.show().addClass(i.panelActiveClass),d.addClass(i.tabActiveClass).children().addClass(i.tabActiveClass)),k.trigger("easytabs:initialised",[e,c])},r=function(){j.tabs.children("a").bind(i.bind_str,function(b){i.cycle=!1,h=!1,j.selectTab(a(this)),b.preventDefault?b.preventDefault():b.returnValue=!1})},s=function(a,b,c,d){if(j.panels.stop(!0,!0),n(k,"easytabs:before",[a,b,i])){var e,l,m,o,p=j.panels.filter(":visible"),q=b.parent(),r=window.location.hash.match(/^[^\?]*/)[0];i.animate&&(e=t(b),l=p.length?u(p):0,m=e-l),g=r,o=function(){k.trigger("easytabs:midTransition",[a,b,i]),i.animate&&"fadeIn"==i.transitionIn&&0>m&&q.animate({height:q.height()+m},f.halfSpeed).css({"min-height":""}),i.updateHash&&!h?window.history.pushState?window.history.pushState(null,null,"#"+b.attr("id")):window.location.hash="#"+b.attr("id"):h=!1,b[f.show](f.speed,i.transitionInEasing,function(){q.css({height:"","min-height":""}),k.trigger("easytabs:after",[a,b,i]),"function"==typeof d&&d()})},!c||i.cache&&a.parent().data("easytabs").cached||(k.trigger("easytabs:ajax:beforeSend",[a,b]),b.load(c,function(c,d,e){a.parent().data("easytabs").cached=!0,k.trigger("easytabs:ajax:complete",[a,b,c,d,e])})),i.animate&&"fadeOut"==i.transitionOut&&(m>0?q.animate({height:q.height()+m},f.halfSpeed):q.css({"min-height":q.height()})),j.tabs.filter("."+i.tabActiveClass).removeClass(i.tabActiveClass).children().removeClass(i.tabActiveClass),j.tabs.filter("."+i.collapsedClass).removeClass(i.collapsedClass).children().removeClass(i.collapsedClass),a.parent().addClass(i.tabActiveClass).children().addClass(i.tabActiveClass),j.panels.filter("."+i.panelActiveClass).removeClass(i.panelActiveClass),b.addClass(i.panelActiveClass),p.length?p[f.hide](f.speed,i.transitionOutEasing,o):b[f.uncollapse](f.speed,i.transitionUncollapseEasing,o)}},t=function(b){if(b.data("easytabs")&&b.data("easytabs").lastHeight)return b.data("easytabs").lastHeight;var c,d,e=b.css("display");try{c=a("<div></div>",{position:"absolute",visibility:"hidden",overflow:"hidden"})}catch(f){c=a("<div></div>",{visibility:"hidden",overflow:"hidden"})}return d=b.wrap(c).css({position:"relative",visibility:"hidden",display:"block"}).outerHeight(),b.unwrap(),b.css({position:b.data("easytabs").position,visibility:b.data("easytabs").visibility,display:e}),b.data("easytabs").lastHeight=d,d},u=function(a){var b=a.outerHeight();return a.data("easytabs")?a.data("easytabs").lastHeight=b:a.data("easytabs",{lastHeight:b}),b},v=function(){"function"==typeof a(window).hashchange?a(window).hashchange(function(){j.selectTabFromHashChange()}):a.address&&"function"==typeof a.address.change&&a.address.change(function(){j.selectTabFromHashChange()})},w=function(){var a;i.cycle&&(a=j.tabs.index(d),setTimeout(function(){j.cycleTabs(a+1)},i.cycle))};j.init()},a.fn.easytabs=function(b){var c=arguments;return this.each(function(){var d=a(this),e=d.data("easytabs");return void 0===e&&(e=new a.easytabs(this,b),d.data("easytabs",e)),e.publicMethods[b]?e.publicMethods[b](Array.prototype.slice.call(c,1)):void 0})}}(jQuery),function(a){var b=function(){var b='<div class="colpick"><div class="colpick_color"><div class="colpick_color_overlay1"><div class="colpick_color_overlay2"><div class="colpick_selector_outer"><div class="colpick_selector_inner"></div></div></div></div></div><div class="colpick_hue"><div class="colpick_hue_arrs"><div class="colpick_hue_larr"></div><div class="colpick_hue_rarr"></div></div></div><div class="colpick_new_color"></div><div class="colpick_current_color"></div><div class="colpick_hex_field"><div class="colpick_field_letter">#</div><input type="text" maxlength="6" size="6" /></div><div class="colpick_rgb_r colpick_field"><div class="colpick_field_letter">R</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_rgb_g colpick_field"><div class="colpick_field_letter">G</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_rgb_b colpick_field"><div class="colpick_field_letter">B</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_hsb_h colpick_field"><div class="colpick_field_letter">H</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_hsb_s colpick_field"><div class="colpick_field_letter">S</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_hsb_b colpick_field"><div class="colpick_field_letter">B</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_submit"></div></div>',c={showEvent:"click",onShow:function(){},onBeforeShow:function(){},onHide:function(){},onChange:function(){},onSubmit:function(){},colorScheme:"light",color:"3289c7",livePreview:!0,flat:!1,layout:"full",submit:1,submitText:"OK",height:156},g=function(b,c){var d=f(b);a(c).data("colpick").fields.eq(1).val(d.r).end().eq(2).val(d.g).end().eq(3).val(d.b).end()},i=function(b,c){a(c).data("colpick").fields.eq(4).val(Math.round(b.h)).end().eq(5).val(Math.round(b.s)).end().eq(6).val(Math.round(b.b)).end()},j=function(b,c){a(c).data("colpick").fields.eq(0).val(h(b))},k=function(b,c){a(c).data("colpick").selector.css("backgroundColor","#"+h({h:b.h,s:100,b:100})),a(c).data("colpick").selectorIndic.css({left:parseInt(a(c).data("colpick").height*b.s/100,10),top:parseInt(a(c).data("colpick").height*(100-b.b)/100,10)})},l=function(b,c){a(c).data("colpick").hue.css("top",parseInt(a(c).data("colpick").height-a(c).data("colpick").height*b.h/360,10))},m=function(b,c){a(c).data("colpick").currentColor.css("backgroundColor","#"+h(b))},n=function(b,c){a(c).data("colpick").newColor.css("backgroundColor","#"+h(b))},o=function(){var b,c=a(this).parent().parent();this.parentNode.className.indexOf("_hex")>0?(c.data("colpick").color=b=d(G(this.value)),g(b,c.get(0)),i(b,c.get(0))):this.parentNode.className.indexOf("_hsb")>0?(c.data("colpick").color=b=E({h:parseInt(c.data("colpick").fields.eq(4).val(),10),s:parseInt(c.data("colpick").fields.eq(5).val(),10),b:parseInt(c.data("colpick").fields.eq(6).val(),10)}),g(b,c.get(0)),j(b,c.get(0))):(c.data("colpick").color=b=e(F({r:parseInt(c.data("colpick").fields.eq(1).val(),10),g:parseInt(c.data("colpick").fields.eq(2).val(),10),b:parseInt(c.data("colpick").fields.eq(3).val(),10)})),j(b,c.get(0)),i(b,c.get(0))),k(b,c.get(0)),l(b,c.get(0)),n(b,c.get(0)),c.data("colpick").onChange.apply(c.parent(),[b,h(b),f(b),c.data("colpick").el,0])},p=function(){a(this).parent().removeClass("colpick_focus")},q=function(){a(this).parent().parent().data("colpick").fields.parent().removeClass("colpick_focus"),a(this).parent().addClass("colpick_focus")},r=function(b){b.preventDefault?b.preventDefault():b.returnValue=!1;var c=a(this).parent().find("input").focus(),d={el:a(this).parent().addClass("colpick_slider"),max:this.parentNode.className.indexOf("_hsb_h")>0?360:this.parentNode.className.indexOf("_hsb")>0?100:255,y:b.pageY,field:c,val:parseInt(c.val(),10),preview:a(this).parent().parent().data("colpick").livePreview};a(document).mouseup(d,t),a(document).mousemove(d,s)},s=function(a){return a.data.field.val(Math.max(0,Math.min(a.data.max,parseInt(a.data.val-a.pageY+a.data.y,10)))),a.data.preview&&o.apply(a.data.field.get(0),[!0]),!1},t=function(b){return o.apply(b.data.field.get(0),[!0]),b.data.el.removeClass("colpick_slider").find("input").focus(),a(document).off("mouseup",t),a(document).off("mousemove",s),!1},u=function(b){b.preventDefault?b.preventDefault():b.returnValue=!1;var c={cal:a(this).parent(),y:a(this).offset().top};a(document).on("mouseup touchend",c,w),a(document).on("mousemove touchmove",c,v);var d="touchstart"==b.type?b.originalEvent.changedTouches[0].pageY:b.pageY;return o.apply(c.cal.data("colpick").fields.eq(4).val(parseInt(360*(c.cal.data("colpick").height-(d-c.y))/c.cal.data("colpick").height,10)).get(0),[c.cal.data("colpick").livePreview]),!1},v=function(a){var b="touchmove"==a.type?a.originalEvent.changedTouches[0].pageY:a.pageY;return o.apply(a.data.cal.data("colpick").fields.eq(4).val(parseInt(360*(a.data.cal.data("colpick").height-Math.max(0,Math.min(a.data.cal.data("colpick").height,b-a.data.y)))/a.data.cal.data("colpick").height,10)).get(0),[a.data.preview]),!1},w=function(b){return g(b.data.cal.data("colpick").color,b.data.cal.get(0)),j(b.data.cal.data("colpick").color,b.data.cal.get(0)),a(document).off("mouseup touchend",w),a(document).off("mousemove touchmove",v),!1},x=function(b){b.preventDefault?b.preventDefault():b.returnValue=!1;var c={cal:a(this).parent(),pos:a(this).offset()};c.preview=c.cal.data("colpick").livePreview,a(document).on("mouseup touchend",c,z),a(document).on("mousemove touchmove",c,y);var d;return"touchstart"==b.type?(pageX=b.originalEvent.changedTouches[0].pageX,d=b.originalEvent.changedTouches[0].pageY):(pageX=b.pageX,d=b.pageY),o.apply(c.cal.data("colpick").fields.eq(6).val(parseInt(100*(c.cal.data("colpick").height-(d-c.pos.top))/c.cal.data("colpick").height,10)).end().eq(5).val(parseInt(100*(pageX-c.pos.left)/c.cal.data("colpick").height,10)).get(0),[c.preview]),!1},y=function(a){var b;return"touchmove"==a.type?(pageX=a.originalEvent.changedTouches[0].pageX,b=a.originalEvent.changedTouches[0].pageY):(pageX=a.pageX,b=a.pageY),o.apply(a.data.cal.data("colpick").fields.eq(6).val(parseInt(100*(a.data.cal.data("colpick").height-Math.max(0,Math.min(a.data.cal.data("colpick").height,b-a.data.pos.top)))/a.data.cal.data("colpick").height,10)).end().eq(5).val(parseInt(100*Math.max(0,Math.min(a.data.cal.data("colpick").height,pageX-a.data.pos.left))/a.data.cal.data("colpick").height,10)).get(0),[a.data.preview]),!1},z=function(b){return g(b.data.cal.data("colpick").color,b.data.cal.get(0)),j(b.data.cal.data("colpick").color,b.data.cal.get(0)),a(document).off("mouseup touchend",z),a(document).off("mousemove touchmove",y),!1},A=function(){var b=a(this).parent(),c=b.data("colpick").color;b.data("colpick").origColor=c,m(c,b.get(0)),b.data("colpick").onSubmit(c,h(c),f(c),b.data("colpick").el)},B=function(b){b.stopPropagation();var c=a("#"+a(this).data("colpickId"));c.data("colpick").onBeforeShow.apply(this,[c.get(0)]);var d=a(this).offset(),e=d.top+this.offsetHeight,f=d.left,g=D(),h=c.width();f+h>g.l+g.w&&(f-=h),c.css({left:f+"px",top:e+"px"}),0!=c.data("colpick").onShow.apply(this,[c.get(0)])&&c.show(),a("html").mousedown({cal:c},C),c.mousedown(function(a){a.stopPropagation()})},C=function(b){0!=b.data.cal.data("colpick").onHide.apply(this,[b.data.cal.get(0)])&&b.data.cal.hide(),a("html").off("mousedown",C)},D=function(){var a="CSS1Compat"==document.compatMode;return{l:window.pageXOffset||(a?document.documentElement.scrollLeft:document.body.scrollLeft),w:window.innerWidth||(a?document.documentElement.clientWidth:document.body.clientWidth)}},E=function(a){return{h:Math.min(360,Math.max(0,a.h)),s:Math.min(100,Math.max(0,a.s)),b:Math.min(100,Math.max(0,a.b))}},F=function(a){return{r:Math.min(255,Math.max(0,a.r)),g:Math.min(255,Math.max(0,a.g)),b:Math.min(255,Math.max(0,a.b))}},G=function(a){var b=6-a.length;if(b>0){for(var c=[],d=0;b>d;d++)c.push("0");c.push(a),a=c.join("")}return a},H=function(){var b=a(this).parent(),c=b.data("colpick").origColor;b.data("colpick").color=c,g(c,b.get(0)),j(c,b.get(0)),i(c,b.get(0)),k(c,b.get(0)),l(c,b.get(0)),n(c,b.get(0))};return{init:function(f){if(f=a.extend({},c,f||{}),"string"==typeof f.color)f.color=d(f.color);else if(void 0!=f.color.r&&void 0!=f.color.g&&void 0!=f.color.b)f.color=e(f.color);else{if(void 0==f.color.h||void 0==f.color.s||void 0==f.color.b)return this;f.color=E(f.color)}return this.each(function(){if(!a(this).data("colpickId")){var c=a.extend({},f);c.origColor=f.color;var d="collorpicker_"+parseInt(1e3*Math.random());a(this).data("colpickId",d);var e=a(b).attr("id",d);e.addClass("colpick_"+c.layout+(c.submit?"":" colpick_"+c.layout+"_ns")),"light"!=c.colorScheme&&e.addClass("colpick_"+c.colorScheme),e.find("div.colpick_submit").html(c.submitText).click(A),c.fields=e.find("input").change(o).blur(p).focus(q),e.find("div.colpick_field_arrs").mousedown(r).end().find("div.colpick_current_color").click(H),c.selector=e.find("div.colpick_color").on("mousedown touchstart",x),c.selectorIndic=c.selector.find("div.colpick_selector_outer"),c.el=this,c.hue=e.find("div.colpick_hue_arrs"),huebar=c.hue.parent();var h=navigator.userAgent.toLowerCase(),s="Microsoft Internet Explorer"===navigator.appName,t=s?parseFloat(h.match(/msie ([0-9]{1,}[\.0-9]{0,})/)[1]):0,v=s&&10>t,w=["#ff0000","#ff0080","#ff00ff","#8000ff","#0000ff","#0080ff","#00ffff","#00ff80","#00ff00","#80ff00","#ffff00","#ff8000","#ff0000"];if(v){var y,z;for(y=0;11>=y;y++)z=a("<div></div>").attr("style","height:8.333333%; filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr="+w[y]+", endColorstr="+w[y+1]+'); -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='+w[y]+", endColorstr="+w[y+1]+')";'),huebar.append(z)}else stopList=w.join(","),huebar.attr("style","background:-webkit-linear-gradient(top,"+stopList+"); background: -o-linear-gradient(top,"+stopList+"); background: -ms-linear-gradient(top,"+stopList+"); background:-moz-linear-gradient(top,"+stopList+"); -webkit-linear-gradient(top,"+stopList+"); background:linear-gradient(to bottom,"+stopList+"); ");e.find("div.colpick_hue").on("mousedown touchstart",u),c.newColor=e.find("div.colpick_new_color"),c.currentColor=e.find("div.colpick_current_color"),e.data("colpick",c),g(c.color,e.get(0)),i(c.color,e.get(0)),j(c.color,e.get(0)),l(c.color,e.get(0)),k(c.color,e.get(0)),m(c.color,e.get(0)),n(c.color,e.get(0)),c.flat?(e.appendTo(this).show(),e.css({position:"relative",display:"block"})):(e.appendTo(document.body),a(this).on(c.showEvent,B),e.css({position:"absolute"}))}})},showPicker:function(){return this.each(function(){a(this).data("colpickId")&&B.apply(this)})},hidePicker:function(){return this.each(function(){a(this).data("colpickId")&&a("#"+a(this).data("colpickId")).hide()})},setColor:function(b,c){if(c="undefined"==typeof c?1:c,"string"==typeof b)b=d(b);else if(void 0!=b.r&&void 0!=b.g&&void 0!=b.b)b=e(b);else{if(void 0==b.h||void 0==b.s||void 0==b.b)return this;b=E(b)}return this.each(function(){if(a(this).data("colpickId")){var d=a("#"+a(this).data("colpickId"));d.data("colpick").color=b,d.data("colpick").origColor=b,g(b,d.get(0)),i(b,d.get(0)),j(b,d.get(0)),l(b,d.get(0)),k(b,d.get(0)),n(b,d.get(0)),d.data("colpick").onChange.apply(d.parent(),[b,h(b),f(b),d.data("colpick").el,1]),c&&m(b,d.get(0))}})}}}(),c=function(a){var a=parseInt(a.indexOf("#")>-1?a.substring(1):a,16);return{r:a>>16,g:(65280&a)>>8,b:255&a}},d=function(a){return e(c(a))},e=function(a){var b={h:0,s:0,b:0},c=Math.min(a.r,a.g,a.b),d=Math.max(a.r,a.g,a.b),e=d-c;return b.b=d,b.s=0!=d?255*e/d:0,b.h=0!=b.s?a.r==d?(a.g-a.b)/e:a.g==d?2+(a.b-a.r)/e:4+(a.r-a.g)/e:-1,b.h*=60,b.h<0&&(b.h+=360),b.s*=100/255,b.b*=100/255,b},f=function(a){var b={},c=a.h,d=255*a.s/100,e=255*a.b/100;if(0==d)b.r=b.g=b.b=e;else{var f=e,g=(255-d)*e/255,h=(f-g)*(c%60)/60;360==c&&(c=0),60>c?(b.r=f,b.b=g,b.g=g+h):120>c?(b.g=f,b.b=g,b.r=f-h):180>c?(b.g=f,b.r=g,b.b=g+h):240>c?(b.b=f,b.r=g,b.g=f-h):300>c?(b.b=f,b.g=g,b.r=g+h):360>c?(b.r=f,b.g=g,b.b=f-h):(b.r=0,b.g=0,b.b=0)}return{r:Math.round(b.r),g:Math.round(b.g),b:Math.round(b.b)}},g=function(b){var c=[b.r.toString(16),b.g.toString(16),b.b.toString(16)];return a.each(c,function(a,b){1==b.length&&(c[a]="0"+b)}),c.join("")},h=function(a){return g(f(a))};a.fn.extend({colpick:b.init,colpickHide:b.hidePicker,colpickShow:b.showPicker,colpickSetColor:b.setColor}),a.extend({colpick:{rgbToHex:g,rgbToHsb:e,hsbToHex:h,hsbToRgb:f,hexToHsb:d,hexToRgb:c}})}(jQuery),window.twttr=function(a,b,c){var d,e=a.getElementsByTagName(b)[0],f=window.twttr||{};return a.getElementById(c)?f:(d=a.createElement(b),d.id=c,d.src="https://platform.twitter.com/widgets.js",e.parentNode.insertBefore(d,e),f._e=[],f.ready=function(a){f._e.push(a)},f)}(document,"script","twitter-wjs");
includes/admin/admin-notices.php CHANGED
@@ -53,6 +53,12 @@ function mashsb_admin_messages() {
53
  echo '<p>' . sprintf(__('Your website exceeded the Facebook rate limit. Share count requests to Facebook will be delayed for 60min and the Facebook 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 request shares in ' . mashsbGetRemainingRateLimitTime() , 'mashsb'), admin_url() . 'admin.php?page=mashsb-settings') . '</p>';
54
  echo '</div>';
55
  }
 
 
 
 
 
 
56
 
57
  // Cache warning
58
  if( mashsb_is_deactivated_cache() ) {
@@ -392,10 +398,10 @@ add_action( 'in_plugin_update_message-mashsharer/mashshare.php', 'mashsb_in_plug
392
  * @return type
393
  */
394
  function mashsbGetRemainingRateLimitTime() {
395
- $trans_time = get_transient( 'timeout_mash_rate_limit' );
396
 
397
  if( false !== $trans_time ) {
398
- $rest = time() - $trans_time;
399
 
400
  if ($rest < 60){
401
  return $rest . ' seconds.';
@@ -404,5 +410,5 @@ function mashsbGetRemainingRateLimitTime() {
404
  return $minutes;
405
  }
406
  }
407
- return time();
408
  }
53
  echo '<p>' . sprintf(__('Your website exceeded the Facebook rate limit. Share count requests to Facebook will be delayed for 60min and the Facebook 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 request shares in ' . mashsbGetRemainingRateLimitTime() , 'mashsb'), admin_url() . 'admin.php?page=mashsb-settings') . '</p>';
54
  echo '</div>';
55
  }
56
+ // // Access Token expired
57
+ // if( mashsb_is_access_token_expired() ) {
58
+ // echo '<div class="error">';
59
+ // echo '<p>' . sprintf(__('Your Facebook Access Token has been expired. You need to <a href="%s">generate a new one</a> or your MashShare Facebook Shares will not be refreshed', 'mashsb'), admin_url() . 'admin.php?page=mashsb-settings') . '</p>';
60
+ // echo '</div>';
61
+ // }
62
 
63
  // Cache warning
64
  if( mashsb_is_deactivated_cache() ) {
398
  * @return type
399
  */
400
  function mashsbGetRemainingRateLimitTime() {
401
+ $trans_time = get_transient( 'timeout_mashsb_rate_limit' );
402
 
403
  if( false !== $trans_time ) {
404
+ $rest = abs(time() - $trans_time);
405
 
406
  if ($rest < 60){
407
  return $rest . ' seconds.';
410
  return $minutes;
411
  }
412
  }
413
+ return 0 . 'seconds';
414
  }
includes/admin/settings/register-settings.php CHANGED
@@ -262,13 +262,13 @@ function mashsb_get_registered_settings() {
262
  'type' => 'text',
263
  'size' => 'large'
264
  ),
265
- array(
266
- 'id' => 'fb_app_id',
267
- 'name' => __( 'Facebook App ID', 'mashsb' ),
268
- 'desc' => sprintf( __( 'Optional and not needed for basic share buttons. But required by some MashShare Add-Ons. <a href="%1s" target="_blank">Create a App ID now</a>.', 'mashsb' ), 'https://developers.facebook.com/docs/apps/register' ),
269
- 'type' => 'text',
270
- 'size' => 'medium'
271
- ),
272
  // array(
273
  // 'id' => 'fb_app_secret',
274
  // 'name' => __( 'Facebook App Secret', 'mashsb' ),
@@ -682,6 +682,12 @@ So the MashShare open graph data will be containing the same social meta data th
682
  'desc' => __( '<strong>Note: </strong> Check this box before you get in contact with our support team. This allows us to check publically hidden debug messages on your website. Do not forget to disable it thereafter! Enable this also to write daily sorted log files of requested share counts to folder <strong>/wp-content/plugins/mashsharer/logs</strong>. Please send us this files when you notice a wrong share count.' . mashsb_log_permissions(), 'mashsb' ),
683
  'type' => 'checkbox'
684
  ),
 
 
 
 
 
 
685
  )
686
  ),
687
  'licenses' => apply_filters( 'mashsb_settings_licenses', array(
@@ -1875,3 +1881,27 @@ function mashsb_fboauth_callback( $args ) {
1875
  echo $html;
1876
 
1877
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
  'type' => 'text',
263
  'size' => 'large'
264
  ),
265
+ // array(
266
+ // 'id' => 'fb_app_id',
267
+ // 'name' => __( 'Facebook App ID', 'mashsb' ),
268
+ // 'desc' => sprintf( __( 'Optional and not needed for basic share buttons. But required by some MashShare Add-Ons. <a href="%1s" target="_blank">Create a App ID now</a>.', 'mashsb' ), 'https://developers.facebook.com/docs/apps/register' ),
269
+ // 'type' => 'text',
270
+ // 'size' => 'medium'
271
+ // ),
272
  // array(
273
  // 'id' => 'fb_app_secret',
274
  // 'name' => __( 'Facebook App Secret', 'mashsb' ),
682
  'desc' => __( '<strong>Note: </strong> Check this box before you get in contact with our support team. This allows us to check publically hidden debug messages on your website. Do not forget to disable it thereafter! Enable this also to write daily sorted log files of requested share counts to folder <strong>/wp-content/plugins/mashsharer/logs</strong>. Please send us this files when you notice a wrong share count.' . mashsb_log_permissions(), 'mashsb' ),
683
  'type' => 'checkbox'
684
  ),
685
+ 'fb_debug' => array(
686
+ 'id' => 'fb_debug',
687
+ 'name' => __( '', 'mashsb' ),
688
+ 'desc' => '',
689
+ 'type' => 'ratelimit'
690
+ ),
691
  )
692
  ),
693
  'licenses' => apply_filters( 'mashsb_settings_licenses', array(
1881
  echo $html;
1882
 
1883
  }
1884
+
1885
+ function mashsb_ratelimit_callback(){
1886
+ global $mashsb_options;
1887
+
1888
+
1889
+ if (!mashsb_is_admin_page() || !isset($mashsb_options['debug_mode']) || !function_exists('curl_init')){
1890
+ return '';
1891
+ }
1892
+ $url = 'http://graph.facebook.com/?id=http://www.google.com';
1893
+ //$url = 'http://graph.facebook.com/';
1894
+
1895
+ $curl_handle=curl_init();
1896
+ curl_setopt($curl_handle,CURLOPT_URL,$url);
1897
+ curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
1898
+ curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
1899
+ $buffer = curl_exec($curl_handle);
1900
+ curl_close($curl_handle);
1901
+ if (empty($buffer)){
1902
+ print "Nothing returned from url.<p>";
1903
+ }
1904
+ else{
1905
+ print '<div style="max-width:200px;">'.$buffer . '</div>';
1906
+ }
1907
+ }
includes/debug/debug.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Output debug notices in footer
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
+ }
20
+ }
21
+ add_action('wp_footer', 'mashsbOutputDebug', 100);
22
+
23
+
24
+
includes/mashengine.php CHANGED
@@ -25,15 +25,10 @@ class mashengine {
25
  public function getALLCounts() {
26
  $this->data = new stdClass;
27
  $this->data->total = 0;
 
28
 
29
- if( false === mashsb_rate_limit_exceeded() ) {
30
- $data = $this->getSharesALL();
31
- return $data;
32
- }
33
- $this->debug_notices[] = 'MashShare: Facebook Rate Limit Exceeded. Try again in ' . $this->getRemainingRateLimitTime() . 'seconds' ;
34
- add_action( 'wp_footer', array($this, 'outputDebug'), 100 );
35
- // return 0;
36
- return $this->data;
37
  }
38
 
39
  /* Collect share count from facebook and twitter */
@@ -41,15 +36,10 @@ class mashengine {
41
  public function getFBTWCounts() {
42
  $this->data = new stdClass;
43
  $this->data->total = 0;
 
44
 
45
- if( false === mashsb_rate_limit_exceeded() ) {
46
- $data = $this->getSharesFBTW();
47
- return $data;
48
- }
49
- $this->debug_notices[] = 'MashShare: Facebook Rate Limit Exceeded<br>';
50
- add_action( 'wp_footer', array($this, 'outputDebug'), 100 );
51
- // return 0;
52
- return $this->data;
53
  }
54
 
55
  /* Build the multi_curl() crawler for facebook and twitter
@@ -60,7 +50,7 @@ class mashengine {
60
  public function getSharesFBTW() {
61
  global $mashsb_options;
62
 
63
- $fb_mode = isset( $mashsb_options['facebook_count_mode'] ) ? $mashsb_options['facebook_count_mode'] : 'shares';
64
 
65
  $post_data = null;
66
  $headers = null;
@@ -76,30 +66,54 @@ class mashengine {
76
  $RollingCurlX->setOptions( $options );
77
  switch ( $fb_mode ) {
78
  case $fb_mode === 'likes':
79
- if( isset( $mashsb_options['cumulate_http_https'] ) ) {
80
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
81
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
 
 
 
 
82
  } else {
83
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->url, $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
 
 
 
 
 
84
  }
85
-
86
  break;
87
  case $fb_mode === 'total':
88
- if( isset( $mashsb_options['cumulate_http_https'] ) ) {
89
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('facebook_total'), $headers );
90
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('facebook_total'), $headers );
 
 
 
 
91
  } else {
92
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->url, $post_data, array($this, 'getCount'), array('facebook_total'), $headers );
 
 
 
 
 
93
  }
94
-
95
  break;
96
  default:
97
-
98
- if( isset( $mashsb_options['cumulate_http_https'] ) ) {
99
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('facebook_shares'), $headers );
100
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('facebook_shares'), $headers );
 
 
 
101
  } else {
102
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->url, $post_data, array($this, 'getCount'), array('facebook_shares'), $headers );
 
 
 
 
 
103
  }
104
  }
105
  if( isset( $mashsb_options['cumulate_http_https'] ) ) {
@@ -125,7 +139,7 @@ class mashengine {
125
  public function getSharesALL() {
126
  global $mashsb_options;
127
 
128
- $fb_mode = isset( $mashsb_options['facebook_count_mode'] ) ? $mashsb_options['facebook_count_mode'] : 'shares';
129
  $post_data = null;
130
  $headers = null;
131
 
@@ -136,33 +150,57 @@ class mashengine {
136
 
137
  $RollingCurlX = new RollingCurlX( 10 ); // max 10 simultaneous downloads
138
  $RollingCurlX->setOptions( $options );
139
-
140
  switch ( $fb_mode ) {
141
  case $fb_mode === 'likes':
142
-
143
- if( isset( $mashsb_options['cumulate_http_https'] ) ) {
144
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
145
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
146
- } else {
 
 
147
  $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->url, $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
 
 
 
 
 
 
 
148
  }
149
-
150
  break;
151
  case $fb_mode === 'total':
152
- if( isset( $mashsb_options['cumulate_http_https'] ) ) {
153
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('facebook_total'), $headers );
154
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('facebook_total'), $headers );
 
 
 
 
155
  } else {
156
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->url, $post_data, array($this, 'getCount'), array('facebook_total'), $headers );
 
 
 
 
 
157
  }
158
-
159
  break;
160
  default:
161
- if( isset( $mashsb_options['cumulate_http_https'] ) ) {
162
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('facebook_shares'), $headers );
163
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('facebook_shares'), $headers );
 
 
 
 
164
  } else {
165
- $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->url, $post_data, array($this, 'getCount'), array('facebook_shares'), $headers );
 
 
 
 
 
166
  }
167
  }
168
  if( isset( $mashsb_options['cumulate_http_https'] ) ) {
@@ -193,9 +231,9 @@ class mashengine {
193
  */
194
 
195
  function getCount( $data, $url, $request_info, $service, $time ) {
196
- global $mashsb_options;
197
  $count = 0;
198
-
199
 
200
  if( $data ) {
201
  switch ( $service[0] ) {
@@ -203,8 +241,7 @@ class mashengine {
203
  case "facebook_likes":
204
  $data = json_decode( $data, true );
205
  $count = isset( $data['share']['share_count'] ) || array_key_exists( 'share_count', $data ) ? $data['share']['share_count'] : 0;
206
- if( isset( $data['error'] ) ) {
207
- // Probably rate limit exceed
208
  $this->setRateLimitTransient();
209
  }
210
  break;
@@ -223,6 +260,7 @@ class mashengine {
223
  $count = $share_count + $comment_count;
224
  if( isset( $data['error'] ) ) {
225
  // Probably rate limit exceed
 
226
  $this->setRateLimitTransient();
227
  }
228
  break;
@@ -275,6 +313,7 @@ class mashengine {
275
  /* $this->data->shares->total += $count;
276
  $this->data->shares->$service[0] = $count;
277
  * */
 
278
  $this->data->total += $count;
279
  $this->data->{$service[0]} = $count;
280
 
@@ -282,6 +321,7 @@ class mashengine {
282
  mashdebug()->info( 'MashEngine - URL: ' . $url . ' ' . $service[0] . ': ' . $count );
283
  //echo 'MashEngine - URL: ' . $url . ' ' . $service[0] . ': ' . $count . '<br>';
284
  $this->debug_notices[] = 'MashEngine - URL: ' . $url . ' ' . $service[0] . ': ' . $count . '<br>';
 
285
 
286
  add_action( 'wp_footer', array($this, 'outputDebug'), 100 );
287
  }
@@ -293,22 +333,23 @@ class mashengine {
293
 
294
  if( current_user_can( 'install_plugins' ) && isset( $mashsb_options['debug_mode'] ) ) {
295
  echo '<div class="mash-debug" style="display:block;z-index:250000;font-size:11px;text-align:center;">';
296
- var_dump($this->debug_notices);
297
  echo '</div>';
298
  }
299
  }
300
 
301
  public function setRateLimitTransient() {
302
- set_transient( 'mash_rate_limit', 'true', 60 * 60 );
303
 
304
  MASHSB()->logger->info( 'Error: Probably Facebook Rate Limit hit' );
305
- $this->debug_notices[] = 'Error: Requests to Facebook probably hit Rate Limit.' ;
 
306
  }
307
-
308
- public function getRemainingRateLimitTime(){
309
- $trans_time = get_transient('timeout_mash_rate_limit');
310
 
311
- if (false !== $trans_time){
 
 
 
312
  return time() - $trans_time;
313
  }
314
  return time();
25
  public function getALLCounts() {
26
  $this->data = new stdClass;
27
  $this->data->total = 0;
28
+ $this->data->error = '';
29
 
30
+ $data = $this->getSharesALL();
31
+ return $data;
 
 
 
 
 
 
32
  }
33
 
34
  /* Collect share count from facebook and twitter */
36
  public function getFBTWCounts() {
37
  $this->data = new stdClass;
38
  $this->data->total = 0;
39
+ $this->data->error = '';
40
 
41
+ $data = $this->getSharesFBTW();
42
+ return $data;
 
 
 
 
 
 
43
  }
44
 
45
  /* Build the multi_curl() crawler for facebook and twitter
50
  public function getSharesFBTW() {
51
  global $mashsb_options;
52
 
53
+ $fb_mode = isset( $mashsb_options['facebook_count_mode'] ) ? $mashsb_options['facebook_count_mode'] : 'total';
54
 
55
  $post_data = null;
56
  $headers = null;
66
  $RollingCurlX->setOptions( $options );
67
  switch ( $fb_mode ) {
68
  case $fb_mode === 'likes':
69
+ if( empty( $mashsb_options['fb_access_token'] ) ) {
70
+ if( isset( $mashsb_options['cumulate_http_https'] ) ) {
71
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
72
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
73
+ } else {
74
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->url, $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
75
+ }
76
  } else {
77
+ if( isset( $mashsb_options['cumulate_http_https'] ) ) {
78
+ $RollingCurlX->addRequest( "https://graph.facebook.com/v2.7/?id=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
79
+ $RollingCurlX->addRequest( "https://graph.facebook.com/v2.7/?id=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
80
+ } else {
81
+ $RollingCurlX->addRequest( "https://graph.facebook.com/v2.7/?id=" . $this->url . '&access_token=' . sanitize_text_field( $mashsb_options['fb_access_token'] ), $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
82
+ }
83
  }
 
84
  break;
85
  case $fb_mode === 'total':
86
+ if( empty( $mashsb_options['fb_access_token'] ) ) {
87
+ if( isset( $mashsb_options['cumulate_http_https'] ) ) {
88
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('facebook_total'), $headers );
89
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->http_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'] ) ) {
95
+ $RollingCurlX->addRequest( "https://graph.facebook.com/v2.7/?id=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('facebook_total'), $headers );
96
+ $RollingCurlX->addRequest( "https://graph.facebook.com/v2.7/?id=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('facebook_total'), $headers );
97
+ } else {
98
+ $RollingCurlX->addRequest( "https://graph.facebook.com/v2.7/?id=" . $this->url . '&access_token=' . sanitize_text_field( $mashsb_options['fb_access_token'] ), $post_data, array($this, 'getCount'), array('facebook_total'), $headers );
99
+ }
100
  }
 
101
  break;
102
  default:
103
+ if( empty( $mashsb_options['fb_access_token'] ) ) {
104
+ if( isset( $mashsb_options['cumulate_http_https'] ) ) {
105
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('facebook_shares'), $headers );
106
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->http_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'] ) ) {
112
+ $RollingCurlX->addRequest( "https://graph.facebook.com/v2.7/?id=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('facebook_shares'), $headers );
113
+ $RollingCurlX->addRequest( "https://graph.facebook.com/v2.7/?id=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('facebook_shares'), $headers );
114
+ } else {
115
+ $RollingCurlX->addRequest( "https://graph.facebook.com/v2.7/?id=" . $this->url . '&access_token=' . sanitize_text_field( $mashsb_options['fb_access_token'] ), $post_data, array($this, 'getCount'), array('facebook_shares'), $headers );
116
+ }
117
  }
118
  }
119
  if( isset( $mashsb_options['cumulate_http_https'] ) ) {
139
  public function getSharesALL() {
140
  global $mashsb_options;
141
 
142
+ $fb_mode = isset( $mashsb_options['facebook_count_mode'] ) ? $mashsb_options['facebook_count_mode'] : 'total';
143
  $post_data = null;
144
  $headers = null;
145
 
150
 
151
  $RollingCurlX = new RollingCurlX( 10 ); // max 10 simultaneous downloads
152
  $RollingCurlX->setOptions( $options );
 
153
  switch ( $fb_mode ) {
154
  case $fb_mode === 'likes':
155
+ if( empty( $mashsb_options['fb_access_token'] ) ) {
156
+ if( isset( $mashsb_options['cumulate_http_https'] ) ) {
157
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
158
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
159
+ } else {
160
+
161
+ }
162
  $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->url, $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
163
+ } else {
164
+ if( isset( $mashsb_options['cumulate_http_https'] ) ) {
165
+ $RollingCurlX->addRequest( "https://graph.facebook.com/v2.7/?id=" . $this->https_scheme_url . '&access_token=' . sanitize_text_field( $mashsb_options['fb_access_token'] ), $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
166
+ $RollingCurlX->addRequest( "https://graph.facebook.com/v2.7/?id=" . $this->http_scheme_url . '&access_token=' . sanitize_text_field( $mashsb_options['fb_access_token'] ), $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
167
+ } else {
168
+ $RollingCurlX->addRequest( "https://graph.facebook.com/v2.7/?id=" . $this->url . '&access_token=' . sanitize_text_field( $mashsb_options['fb_access_token'] ), $post_data, array($this, 'getCount'), array('facebook_likes'), $headers );
169
+ }
170
  }
 
171
  break;
172
  case $fb_mode === 'total':
173
+ if( empty( $mashsb_options['fb_access_token'] ) ) {
174
+ if( isset( $mashsb_options['cumulate_http_https'] ) ) {
175
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('facebook_total'), $headers );
176
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('facebook_total'), $headers );
177
+ } else {
178
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->url, $post_data, array($this, 'getCount'), array('facebook_total'), $headers );
179
+ }
180
  } else {
181
+ if( isset( $mashsb_options['cumulate_http_https'] ) ) {
182
+ $RollingCurlX->addRequest( "https://graph.facebook.com/v2.7/?id=" . $this->https_scheme_url . '&access_token=' . sanitize_text_field( $mashsb_options['fb_access_token'] ), $post_data, array($this, 'getCount'), array('facebook_total'), $headers );
183
+ $RollingCurlX->addRequest( "https://graph.facebook.com/v2.7/?id=" . $this->http_scheme_url . '&access_token=' . sanitize_text_field( $mashsb_options['fb_access_token'] ), $post_data, array($this, 'getCount'), array('facebook_total'), $headers );
184
+ } else {
185
+ $RollingCurlX->addRequest( "https://graph.facebook.com/v2.7/?id=" . $this->url . '&access_token=' . sanitize_text_field( $mashsb_options['fb_access_token'] ), $post_data, array($this, 'getCount'), array('facebook_total'), $headers );
186
+ }
187
  }
 
188
  break;
189
  default:
190
+ if( empty( $mashsb_options['fb_access_token'] ) ) {
191
+ if( isset( $mashsb_options['cumulate_http_https'] ) ) {
192
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->https_scheme_url, $post_data, array($this, 'getCount'), array('facebook_shares'), $headers );
193
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->http_scheme_url, $post_data, array($this, 'getCount'), array('facebook_shares'), $headers );
194
+ } else {
195
+ $RollingCurlX->addRequest( "http://graph.facebook.com/?id=" . $this->url, $post_data, array($this, 'getCount'), array('facebook_shares'), $headers );
196
+ }
197
  } else {
198
+ if( isset( $mashsb_options['cumulate_http_https'] ) ) {
199
+ $RollingCurlX->addRequest( "https://graph.facebook.com/v2.7/?id=" . $this->https_scheme_url . '&access_token=' . sanitize_text_field( $mashsb_options['fb_access_token'] ), $post_data, array($this, 'getCount'), array('facebook_shares'), $headers );
200
+ $RollingCurlX->addRequest( "https://graph.facebook.com/v2.7/?id=" . $this->http_scheme_url . '&access_token=' . sanitize_text_field( $mashsb_options['fb_access_token'] ), $post_data, array($this, 'getCount'), array('facebook_shares'), $headers );
201
+ } else {
202
+ $RollingCurlX->addRequest( "https://graph.facebook.com/v2.7/?id=" . $this->url . '&access_token=' . sanitize_text_field( $mashsb_options['fb_access_token'] ), $post_data, array($this, 'getCount'), array('facebook_shares'), $headers );
203
+ }
204
  }
205
  }
206
  if( isset( $mashsb_options['cumulate_http_https'] ) ) {
231
  */
232
 
233
  function getCount( $data, $url, $request_info, $service, $time ) {
234
+ global $mashsb_error;
235
  $count = 0;
236
+ $error = '';
237
 
238
  if( $data ) {
239
  switch ( $service[0] ) {
241
  case "facebook_likes":
242
  $data = json_decode( $data, true );
243
  $count = isset( $data['share']['share_count'] ) || array_key_exists( 'share_count', $data ) ? $data['share']['share_count'] : 0;
244
+ if( isset( $data['error'] ) ) { // Probably rate limit exceed
 
245
  $this->setRateLimitTransient();
246
  }
247
  break;
260
  $count = $share_count + $comment_count;
261
  if( isset( $data['error'] ) ) {
262
  // Probably rate limit exceed
263
+ $error = array('facebook_error' => $data['error']);
264
  $this->setRateLimitTransient();
265
  }
266
  break;
313
  /* $this->data->shares->total += $count;
314
  $this->data->shares->$service[0] = $count;
315
  * */
316
+ $this->data->error = $error;
317
  $this->data->total += $count;
318
  $this->data->{$service[0]} = $count;
319
 
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 . '<br>';
324
+ $mashsb_error[] = 'MashEngine - URL: ' . $url . ' ' . $service[0] . ': ' . $count;
325
 
326
  add_action( 'wp_footer', array($this, 'outputDebug'), 100 );
327
  }
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
+ var_dump( $this->debug_notices );
337
  echo '</div>';
338
  }
339
  }
340
 
341
  public function setRateLimitTransient() {
342
+ set_transient( 'mashsb_rate_limit', 'true', 60 * 60 );
343
 
344
  MASHSB()->logger->info( 'Error: Probably Facebook Rate Limit hit' );
345
+ $this->debug_notices[] = 'Error: Requests to Facebook probably hit Rate Limit.';
346
+ add_action( 'wp_footer', array($this, 'outputDebug'), 100 );
347
  }
 
 
 
348
 
349
+ public function getRemainingRateLimitTime() {
350
+ $trans_time = get_transient( 'timeout_mashsb_rate_limit' );
351
+
352
+ if( false !== $trans_time ) {
353
  return time() - $trans_time;
354
  }
355
  return time();
includes/sharecount-functions.php CHANGED
@@ -14,6 +14,53 @@ if( !defined( 'ABSPATH' ) ) {
14
  exit;
15
  }
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  /**
18
  * Check if cache time is expired and post must be refreshed
19
  *
@@ -213,15 +260,14 @@ function mashsb_get_expiration() {
213
  // );
214
  //}
215
 
216
-
217
  /**
218
  * Check if permalinks are enabled
219
  *
220
  * @return boolean true when enabled
221
  */
222
  function mashsb_is_enabled_permalinks() {
223
- $permalinks = get_option( 'permalink_structure' );
224
- if( !empty( $permalinks ) ) {
225
  return true;
226
  }
227
  return false;
14
  exit;
15
  }
16
 
17
+
18
+ /**
19
+ * Check if the facebook rate limit has been exceeded
20
+ * @return boolean
21
+ */
22
+ function mashsb_rate_limit_exceeded(){
23
+ return false; // rhe Deactivate this for testing
24
+ if (false === get_transient('mashsb_rate_limit')){
25
+ return false;
26
+ }
27
+ return true;
28
+ }
29
+ /**
30
+ * Check if the facebook access token has been expired
31
+ * @return boolean
32
+ */
33
+ function mashsb_is_access_token_expired(){
34
+ global $mashsb_options;
35
+
36
+ if (empty($mashsb_options['expire_fb_access_token'])){
37
+ return false;
38
+ }
39
+
40
+ if (time()>= $mashsb_options['expire_fb_access_token']){
41
+ return true;
42
+ }
43
+ return false;
44
+ }
45
+
46
+ /**
47
+ * Make sure that requests do not exceed 1req / 5second
48
+ * @return boolean
49
+ */
50
+ function mashsb_is_req_limited() {
51
+ global $mashsb_error;
52
+ $rate_limit = get_transient('mashsb_limit_req');
53
+
54
+ if (false === $rate_limit) {
55
+ set_transient('mashsb_limit_req', '1', 20);
56
+ return false;
57
+ }
58
+ $mashsb_error[] = 'MashShare: Facebook Temp Rate Limit Exceeded';
59
+ MASHSB()->logger->info('MashShare: Facebook Temp Rate Limit Exceeded');
60
+ return true;
61
+
62
+ }
63
+
64
  /**
65
  * Check if cache time is expired and post must be refreshed
66
  *
260
  // );
261
  //}
262
 
 
263
  /**
264
  * Check if permalinks are enabled
265
  *
266
  * @return boolean true when enabled
267
  */
268
  function mashsb_is_enabled_permalinks() {
269
+ $permalinks = get_option('permalink_structure');
270
+ if (!empty($permalinks)) {
271
  return true;
272
  }
273
  return false;
includes/template-functions.php CHANGED
@@ -86,7 +86,7 @@ function mashsbGetShareMethod( $mashsbSharesObj ) {
86
  * @returns integer $shares
87
  */
88
  function mashsbGetNonPostShares( $url ) {
89
- global $mashsb_options;
90
  // Expiration
91
  $expiration = mashsb_get_expiration();
92
 
@@ -95,6 +95,17 @@ function mashsbGetNonPostShares( $url ) {
95
 
96
  // Get any existing copy of our transient data and fill the cache
97
  if( mashsb_force_cache_refresh() ) {
 
 
 
 
 
 
 
 
 
 
 
98
 
99
  // Regenerate the data and save the transient
100
  // Get the share Object
@@ -120,16 +131,6 @@ function mashsbGetNonPostShares( $url ) {
120
  }
121
  }
122
 
123
- /**
124
- * Check if the facebook rate limit has been exceeded
125
- * @return boolean
126
- */
127
- function mashsb_rate_limit_exceeded(){
128
- if (false === get_transient('mash_rate_limit')){
129
- return false;
130
- }
131
- return true;
132
- }
133
 
134
  /*
135
  * Return the share count
@@ -139,8 +140,8 @@ function mashsb_rate_limit_exceeded(){
139
  */
140
 
141
  function getSharedcount( $url ) {
142
- global $mashsb_options, $post, $mashsb_sharecount; // todo test a global share count var if it reduces the amount of requests
143
-
144
  // Return global share count variable to prevent multiple execution
145
  if (is_array($mashsb_sharecount) && array_key_exists($url, $mashsb_sharecount) && !empty($mashsb_sharecount[$url]) && !mashsb_is_cache_refresh() ){
146
  return $mashsb_sharecount[$url] + getFakecount();
@@ -178,6 +179,11 @@ function getSharedcount( $url ) {
178
  * Refresh Cache
179
  */
180
  if( mashsb_force_cache_refresh() && is_singular() ) {
 
 
 
 
 
181
 
182
  // free some memory
183
  unset ( $mashsb_sharecount[$url] );
@@ -201,8 +207,7 @@ function getSharedcount( $url ) {
201
  * API share count is greater than real fresh requested share count ->
202
  */
203
 
204
-
205
-
206
  if( $mashsbShareCounts->total >= $mashsbStoredShareCount ) {
207
  update_post_meta( $post->ID, 'mashsb_shares', $mashsbShareCounts->total );
208
  update_post_meta( $post->ID, 'mashsb_jsonshares', json_encode( $mashsbShareCounts ) );
@@ -1176,4 +1181,4 @@ function mashsb_get_document_title() {
1176
 
1177
  $title = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
1178
  return $title;
1179
- }
86
  * @returns integer $shares
87
  */
88
  function mashsbGetNonPostShares( $url ) {
89
+ global $mashsb_error;
90
  // Expiration
91
  $expiration = mashsb_get_expiration();
92
 
95
 
96
  // Get any existing copy of our transient data and fill the cache
97
  if( mashsb_force_cache_refresh() ) {
98
+
99
+ // Its request limited
100
+ if ( mashsb_is_req_limited() ){
101
+ $shares = get_transient( 'mashcount_' . md5( $url_clean ) );
102
+ if( isset( $shares ) && is_numeric( $shares ) ) {
103
+ MASHSB()->logger->info( 'mashsbGetNonPostShares() get shares from get_transient. URL: ' . $url_clean . ' SHARES: ' . $shares );
104
+ return $shares + getFakecount();
105
+ } else {
106
+ return 0 + getFakecount(); // we need a result
107
+ }
108
+ }
109
 
110
  // Regenerate the data and save the transient
111
  // Get the share Object
131
  }
132
  }
133
 
 
 
 
 
 
 
 
 
 
 
134
 
135
  /*
136
  * Return the share count
140
  */
141
 
142
  function getSharedcount( $url ) {
143
+ global $post, $mashsb_sharecount, $mashsb_error; // todo test a global share count var if it reduces the amount of requests
144
+
145
  // Return global share count variable to prevent multiple execution
146
  if (is_array($mashsb_sharecount) && array_key_exists($url, $mashsb_sharecount) && !empty($mashsb_sharecount[$url]) && !mashsb_is_cache_refresh() ){
147
  return $mashsb_sharecount[$url] + getFakecount();
179
  * Refresh Cache
180
  */
181
  if( mashsb_force_cache_refresh() && is_singular() ) {
182
+
183
+ // Its request limited
184
+ if ( mashsb_is_req_limited() ){
185
+ return get_post_meta( $post->ID, 'mashsb_shares', true ) + getFakecount();
186
+ }
187
 
188
  // free some memory
189
  unset ( $mashsb_sharecount[$url] );
207
  * API share count is greater than real fresh requested share count ->
208
  */
209
 
210
+ //wp_die('error' . $mashsbShareCounts->error);
 
211
  if( $mashsbShareCounts->total >= $mashsbStoredShareCount ) {
212
  update_post_meta( $post->ID, 'mashsb_shares', $mashsbShareCounts->total );
213
  update_post_meta( $post->ID, 'mashsb_jsonshares', json_encode( $mashsbShareCounts ) );
1181
 
1182
  $title = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
1183
  return $title;
1184
+ }
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.2.9
10
  * Text Domain: mashsb
11
  * Domain Path: /languages
12
  * Credits: Thanks go to Pippin Williamson and the edd team. When we started with Mashshare we decided to use the EDD code base and
@@ -37,7 +37,7 @@ if( !defined( 'ABSPATH' ) )
37
 
38
  // Plugin version
39
  if( !defined( 'MASHSB_VERSION' ) ) {
40
- define( 'MASHSB_VERSION', '3.2.9' );
41
  }
42
 
43
  // Debug mode
@@ -199,6 +199,7 @@ if( !class_exists( 'mashshare' ) ) :
199
  require_once MASHSB_PLUGIN_DIR . 'includes/libraries/class-google-shorturl.php';
200
  require_once MASHSB_PLUGIN_DIR . 'includes/libraries/class-bitly-shorturl.php';
201
  require_once MASHSB_PLUGIN_DIR . 'includes/admin/tracking.php'; // Ensure cron is loading even on frontpage
 
202
 
203
  if( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
204
  require_once MASHSB_PLUGIN_DIR . 'includes/install.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.3.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.3.0' );
41
  }
42
 
43
  // Debug mode
199
  require_once MASHSB_PLUGIN_DIR . 'includes/libraries/class-google-shorturl.php';
200
  require_once MASHSB_PLUGIN_DIR . 'includes/libraries/class-bitly-shorturl.php';
201
  require_once MASHSB_PLUGIN_DIR . 'includes/admin/tracking.php'; // Ensure cron is loading even on frontpage
202
+ require_once MASHSB_PLUGIN_DIR . 'includes/debug/debug.php';
203
 
204
  if( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
205
  require_once MASHSB_PLUGIN_DIR . 'includes/install.php';
readme.txt CHANGED
@@ -9,7 +9,7 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Tags: Share buttons, Social Sharing, social media, Facebook, Twitter, Subscribe, Traffic posts, pages, widget, social share buttons, analytics, email
10
  Requires at least: 3.6+
11
  Tested up to: 4.7
12
- Stable tag: 3.2.9
13
 
14
  Social Media Share Buttons for Twitter, Facebook and other social networks. Highly customizable Social Media ecosystem
15
 
@@ -264,9 +264,6 @@ No, there is no personal data send to Facebook, Twitter, Google and other servic
264
  The big advantage of using this Mashare Share buttons is the independance in comparision to other plugins which creates steady connections to Facebook and Co.
265
  So there is no IP based data send to the social networks or to sharedcount.
266
 
267
- <h4>How is sharedcount able to get the total number of shares?</h4>
268
- Sharedcount is using public available API services of the social networks which deliver only the number of shares for a specific webpage. Sharedcount is not able to see who shared anything, only how often.
269
-
270
  <h4>Do i have to do manual changes in Javascript or HTML Code?</h4>
271
  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.
272
 
@@ -277,7 +274,7 @@ Use the shortcode [mashshare] to embed the Share Buttons in pages or posts.
277
  Most times this is a result of some php server limits. Check your logfiles to see which values must be increased.
278
  I can also assist you with such problems, but keep in mind that they are mostly not caused by this plugin.
279
 
280
- <h4>When i click on the share buttons, nothing happens and no popup window</h4>
281
  Mostly that is because you are using any third party and outdated theme which is not coded very well by the author and is not using the Wordpress API for embeding external plugin script.
282
  For MashSharer make sure your website source contains the script /mashsharer/assets/mashsharer.js
283
 
@@ -303,7 +300,7 @@ Read here more FAQ: [https://www.mashshare.net/faq/](https://www.mashshare.net/f
303
 
304
  == Screenshots ==
305
 
306
- 1. Subscribe form with Facebook button and mail subscribe
307
  2. Default share buttons with separate available responsive Add-On
308
  3. Sortable Total Share Dashboard
309
  4. Default Sharebuttons with separate available responsive Add-On
@@ -319,6 +316,10 @@ Read here more FAQ: [https://www.mashshare.net/faq/](https://www.mashshare.net/f
319
 
320
  == Changelog ==
321
 
 
 
 
 
322
  = 3.2.9 =
323
  * New: Better prevent excessive Rate Limit exceeding of the facebook api on high traffic sites which results in 0 facebook share counts
324
  * New: Create warning notices that appears when caching is disabled or cache is purged permanetely
9
  Tags: Share buttons, Social Sharing, social media, Facebook, Twitter, Subscribe, Traffic posts, pages, widget, social share buttons, analytics, email
10
  Requires at least: 3.6+
11
  Tested up to: 4.7
12
+ Stable tag: 3.3.0
13
 
14
  Social Media Share Buttons for Twitter, Facebook and other social networks. Highly customizable Social Media ecosystem
15
 
264
  The big advantage of using this Mashare Share buttons is the independance in comparision to other plugins which creates steady connections to Facebook and Co.
265
  So there is no IP based data send to the social networks or to sharedcount.
266
 
 
 
 
267
  <h4>Do i have to do manual changes in Javascript or HTML Code?</h4>
268
  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.
269
 
274
  Most times this is a result of some php server limits. Check your logfiles to see which values must be increased.
275
  I can also assist you with such problems, but keep in mind that they are mostly not caused by this plugin.
276
 
277
+ <h4>When i click on the Social Media share buttons, nothing happens and no popup window</h4>
278
  Mostly that is because you are using any third party and outdated theme which is not coded very well by the author and is not using the Wordpress API for embeding external plugin script.
279
  For MashSharer make sure your website source contains the script /mashsharer/assets/mashsharer.js
280
 
300
 
301
  == Screenshots ==
302
 
303
+ 1. Subscribe form with Social Media Facebook button and mail subscribe
304
  2. Default share buttons with separate available responsive Add-On
305
  3. Sortable Total Share Dashboard
306
  4. Default Sharebuttons with separate available responsive Add-On
316
 
317
  == Changelog ==
318
 
319
+ = 3.3.0 =
320
+ * New: Integrate Facebook Social Media Rate Limiter to prevent hitting facebook api request limits and rate limit errors resulting in zero facebook share counts
321
+
322
+
323
  = 3.2.9 =
324
  * New: Better prevent excessive Rate Limit exceeding of the facebook api on high traffic sites which results in 0 facebook share counts
325
  * New: Create warning notices that appears when caching is disabled or cache is purged permanetely
uninstall.php CHANGED
@@ -37,5 +37,9 @@ if( mashsb_get_option( 'uninstall_on_delete' ) ) {
37
  delete_post_meta_by_key( 'mashsb_shares' );
38
  delete_post_meta_by_key( 'mashsb_jsonshares' );
39
 
 
 
 
 
40
  wp_clear_scheduled_hook('mashsharer_transients_cron');
41
  }
37
  delete_post_meta_by_key( 'mashsb_shares' );
38
  delete_post_meta_by_key( 'mashsb_jsonshares' );
39
 
40
+ //delete transients
41
+ delete_transient('mashsb_rate_limit');
42
+ delete_transient('mashsb_limit_req');
43
+
44
  wp_clear_scheduled_hook('mashsharer_transients_cron');
45
  }