WP ULike - Version 4.5.3

Version Description

  • Fixed: Reported JS counter issues.
Download this release

Release Info

Developer alimir
Plugin Icon 128x128 WP ULike
Version 4.5.3
Comparing to
See all releases

Code changes from version 4.5.2 to 4.5.3

admin/assets/js/plugins.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! WP ULike - v4.5.1
2
  * https://wpulike.com
3
  * TechnoWich 2021;
4
  */
1
+ /*! WP ULike - v4.5.3
2
  * https://wpulike.com
3
  * TechnoWich 2021;
4
  */
assets/js/wp-ulike.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! WP ULike - v4.5.1
2
  * https://wpulike.com
3
  * TechnoWich 2021;
4
  */
@@ -555,7 +555,6 @@
555
  append: '',
556
  appendTimeout: 2000,
557
  displayLikers: false,
558
- counterValue: '',
559
  likersTemplate: 'default',
560
  disablePophover: true,
561
  isTotal: false,
@@ -568,7 +567,6 @@
568
  },
569
  attributesMap = {
570
  "ulike-id": "ID",
571
- "ulike-counter-value": "counterValue",
572
  "ulike-nonce": "nonce",
573
  "ulike-type": "type",
574
  "ulike-append": "append",
@@ -603,23 +601,20 @@
603
  // General element
604
  this.generalElement = this.$element.find(this.settings.generalSelector);
605
 
606
- // Append dom counter element
607
- if (this.settings.counterValue !== '') {
608
- this.buttonElement.each(function (index, element) {
609
- if (typeof $(element).data('ulike-counter-value') !== 'undefined' && !$(element).next(this.settings.counterSelector).length) {
610
- $(element).after($("<span/>")
611
- .addClass(
612
- this.settings.counterSelector.split('.').join("")
613
- ).html($(element).data('ulike-counter-value')));
614
- }
615
- }.bind(this));
616
- }
617
-
618
  // Create counter element
619
  this.counterElement = this.generalElement.find(
620
  this.settings.counterSelector
621
  );
622
 
 
 
 
 
 
 
 
 
 
623
  // Get likers box container element
624
  this.likersElement = this.$element.find(this.settings.likersSelector);
625
 
@@ -812,21 +807,22 @@
812
  },
813
 
814
  __updateCounter: function (counterValue) {
 
815
  if (typeof counterValue !== "object") {
816
- this.counterElement.html(counterValue);
817
  } else {
818
  if (this.settings.isTotal && typeof counterValue.sub !== "undefined") {
819
- this.counterElement.html(counterValue.sub);
820
  } else {
821
  if (this.settings.factor === 'down') {
822
- this.counterElement.html(counterValue.down);
823
  if (this.siblingElement.length) {
824
- this.siblingElement.find(this.settings.counterSelector).html(counterValue.up);
825
  }
826
  } else {
827
- this.counterElement.html(counterValue.up);
828
  if (this.siblingElement.length) {
829
- this.siblingElement.find(this.settings.counterSelector).html(counterValue.down);
830
  }
831
  }
832
  }
1
+ /*! WP ULike - v4.5.3
2
  * https://wpulike.com
3
  * TechnoWich 2021;
4
  */
555
  append: '',
556
  appendTimeout: 2000,
557
  displayLikers: false,
 
558
  likersTemplate: 'default',
559
  disablePophover: true,
560
  isTotal: false,
567
  },
568
  attributesMap = {
569
  "ulike-id": "ID",
 
570
  "ulike-nonce": "nonce",
571
  "ulike-type": "type",
572
  "ulike-append": "append",
601
  // General element
602
  this.generalElement = this.$element.find(this.settings.generalSelector);
603
 
 
 
 
 
 
 
 
 
 
 
 
 
604
  // Create counter element
605
  this.counterElement = this.generalElement.find(
606
  this.settings.counterSelector
607
  );
608
 
609
+ // Append dom counter element
610
+ if (this.counterElement.length) {
611
+ this.counterElement.each(function (index, element) {
612
+ if (typeof $(element).data('ulike-counter-value') !== 'undefined') {
613
+ $(element).html($(element).data('ulike-counter-value'));
614
+ }
615
+ }.bind(this));
616
+ }
617
+
618
  // Get likers box container element
619
  this.likersElement = this.$element.find(this.settings.likersSelector);
620
 
807
  },
808
 
809
  __updateCounter: function (counterValue) {
810
+ // Update counter element
811
  if (typeof counterValue !== "object") {
812
+ this.counterElement.attr('data-ulike-counter-value', counterValue).html(counterValue);
813
  } else {
814
  if (this.settings.isTotal && typeof counterValue.sub !== "undefined") {
815
+ this.counterElement.attr('data-ulike-counter-value', counterValue.sub).html(counterValue.sub);
816
  } else {
817
  if (this.settings.factor === 'down') {
818
+ this.counterElement.attr('data-ulike-counter-value', counterValue.down).html(counterValue.down);
819
  if (this.siblingElement.length) {
820
+ this.siblingElement.find(this.settings.counterSelector).attr('data-ulike-counter-value', counterValue.up).html(counterValue.up);
821
  }
822
  } else {
823
+ this.counterElement.attr('data-ulike-counter-value', counterValue.up).html(counterValue.up);
824
  if (this.siblingElement.length) {
825
+ this.siblingElement.find(this.settings.counterSelector).attr('data-ulike-counter-value', counterValue.down).html(counterValue.down);
826
  }
827
  }
828
  }
assets/js/wp-ulike.min.js CHANGED
@@ -1,5 +1,5 @@
1
- /*! WP ULike - v4.5.1
2
  * https://wpulike.com
3
  * TechnoWich 2021;
4
  */
5
- !function(t){t.fn.WordpressUlikeTooltip=function(e){if(this.length>1)return this.each((function(){t(this).WordpressUlikeTooltip(e)})),this;if(void 0===this||1!==this.length)return!1;const i=t(this);e=t.extend({},t.WordpressUlikeTooltip.defaults,e,i.data());let s=i.attr("title");void 0!==s&&s.length&&(e.title=s),e.class+=" ulf-"+e.theme+"-theme",e.class+=" ulf-"+e.size,e.trigger=e.trigger.toLowerCase().trim();let n={dom:this,dom_wrapped:i,position_debug:e.position_debug,trigger:e.trigger,id:e.id,title:e.title,content:e.title,child_class:e.child,theme:e.theme,class:e.class,position:e.position,close_on_outside_click:e.close_on_outside_click,singleton:e.singleton,dataAttr:"ulike-tooltip",createTooltipHTML:function(){return`<div class='ulf-tooltip ${n.class}' role='tooltip'><div class='ulf-arrow'></div><div class='ulf-content'>${n.content}</div></div>`},destroy:function(){const e=n.dom_wrapped.data(n.dataAttr);null!=e&&(e.dom_wrapped.off("touchstart mouseenter",e.show),e.dom_wrapped.off("click",e.preventDefaultHandler),t(window).off("resize",e.onResize),e.isVisible()&&e.hide(),e.dom_wrapped.data(e.dataAttr,null))},initialize:function(){return n.dom_wrapped.on("touchstart mouseenter",n.show),n.dom_wrapped.on("click",n.preventDefaultHandler),t.WordpressUlikeTooltip.body_click_initialized||(t(document).on("touchstart mousedown",n.onClickOutside),t.WordpressUlikeTooltip.bodyClickInitialized=!0),n.dom_wrapped.data(n.dataAttr,n),t(document).on("WordpressUlikeLikersMarkupUpdated",(function(t,e,i,s){if("popover"==i)if(s.length)n.show();else{let t=e.data(n.dataAttr);null!=t&&t.destroy()}})),n.dom},preventDefaultHandler:function(t){return t.preventDefault(),!1},show:function(e){if(n.isVisible())return!1;n.singleton&&n.hideAllVisible();const i=t("body");(void 0===e||e)&&"function"==typeof n.title&&(n.content=n.title(n.dom_wrapped,n)),i.append(n.createTooltipHTML()),n.tooltip=t(".ulf-tooltip:last"),n.positionTooltip(),t(window).on("resize",n.onResize);const s="ulp-dom-"+n.id;n.tooltip.attr("id",s),n.dom.attr("aria-describedby",s),t.WordpressUlikeTooltip.visible.push(n),(void 0===e||e)&&n.dom.trigger("ulf-show",[n.tooltip,n.hide]),t("body").on("DOMSubtreeModified",n.positionTooltip)},isVisible:function(){return t.inArray(n,t.WordpressUlikeTooltip.visible)>-1},hideAllVisible:function(){return t.each(t.WordpressUlikeTooltip.visible,(function(t,e){e.dom_wrapped.hasClass("ulf-focused")||e.hide()})),this},hide:function(e){t("body").off("DOMSubtreeModified",n.positionTooltip),t(window).off("resize",n.onResize),n.dom.attr("aria-describedby",null),n.tooltip&&n.tooltip.length&&n.tooltip.remove(),(void 0===e||e)&&n.dom.trigger("ulf-hide"),"click"!==n.trigger&&n.dom_wrapped.off("touchstart mousedown",n.hide);var i=t.inArray(n,t.WordpressUlikeTooltip.visible);return t.WordpressUlikeTooltip.visible.splice(i,1),n.dom},onResize:function(){n.hide(!1),n.show(!1)},onClickOutside:function(e){const i=t(e.target);i.hasClass("ulf-tooltip")||i.parents(".ulf-tooltip:first").length||t.each(t.WordpressUlikeTooltip.visible,(function(t,e){void 0!==e&&e.close_on_outside_click&&(i!==e.dom_wrapped||"focus"!==e.trigger&&"hoverfocus"!==e.trigger)&&e.hide()}))},positionTooltip:function(){n.positionDebug("-- Start positioning --"),n.dom_wrapped.length&&n.dom_wrapped.is(":visible")||(n.positionDebug("Elem no longer exists. Removing tooltip"),n.hide(!0));let t=n.tooltip.find(".ulf-arrow"),[e,i,s,o,l,a]=n.calculateSafePosition(n.position);return void 0===l&&"auto"!==n.position&&(n.positionDebug("Couldn't fit preferred position"),[e,i,s,o,l,a]=n.calculateSafePosition("auto")),void 0===l?(n.positionDebug("Doesn't appear to fit. Displaying centered"),n.tooltip.addClass("ulf-centered").css({top:"50%",left:"50%","margin-left":-s/2,"margin-top":-o/2}),t&&t.length&&t.remove(),void n.positionDebug("-- Done positioning --")):(n.positionDebug({"Setting Position":{Left:l,Top:a}}),n.tooltip.css("left",l),n.tooltip.css("top",a),i<60&&(n.positionDebug("Element is less than "+i+"px. Setting arrow to hug the side tighter"),e+=" ulf-arrow-super-hug"),t.addClass("ulf-arrow-"+e),n.positionDebug("-- Done positioning --"),n)},calculateSafePosition:function(t){let e,i,s,o=n.tooltip.find(".ulf-arrow"),l=n.dom_wrapped.offset(),a=n.dom_wrapped.outerHeight(),r=n.dom_wrapped.outerWidth(),p=n.tooltip.outerWidth(),d=n.tooltip.outerHeight(),u=document.querySelector("body").offsetWidth,h=document.querySelector("body").offsetHeight,g=o.is(":visible")?o.outerHeight():0,c=o.is(":visible")?o.outerWidth():0,m={};if(m.below=h-(d+a+l.top)>5,m.above=l.top-d>5,m.vertical_half=l.top+r/2-d/2>5,m.right=u-(p+r+l.left)>5,m.right_half=u-l.left-r/2-p/2>5,m.right_full=u-l.left-p>5,m.left=l.left-p>5,m.left_half=l.left+r/2-p/2>5,m.left_full=l.left-p>5,n.positionDebug({"Clicked Element":{Left:l.left,Top:l.top}}),n.positionDebug({"Element Dimensions":{Height:a,Width:r},"Tooltip Dimensions":{Height:d,Width:p},"Window Dimensions":{Height:h,Width:u},"Arrow Dimensions":{Height:g,Width:c}}),n.positionDebug(m),("auto"===t||"bottom"===t)&&m.below&&m.left_half&&m.right_half)n.positionDebug("Displaying below, centered"),e="top",i=l.left-p/2+r/2,s=l.top+a+g/2;else if(("auto"===t||"top"===t)&&m.above&&m.left_half&&m.right_half){if(n.positionDebug("Displaying above, centered"),e="bottom",n.child_class){let t=n.dom_wrapped.find(n.child_class).first();i=t.offset().left-p/2+t.width()/2}else i=l.left-p/2+r/2;s=l.top-d-g/2}else("auto"===t||"left"===t)&&m.left&&m.vertical_half?(n.positionDebug("Displaying left, centered"),e="right",i=l.left-p-c/2,s=l.top+a/2-d/2):("auto"===t||"right"===t)&&m.right&&m.vertical_half?(n.positionDebug("Displaying right, centered"),e="left",i=l.left+r+c/2,s=l.top+a/2-d/2):("auto"===t||"bottom"===t)&&m.below&&m.right_full?(n.positionDebug("Displaying below, to the right"),e="top ulf-arrow-hug-left",i=l.left,s=l.top+a+g/2):("auto"===t||"bottom"===t)&&m.below&&m.left_full?(n.positionDebug("Displaying below, to the left"),e="top ulf-arrow-hug-right",i=l.left+r-p,s=l.top+a+g/2):("auto"===t||"top"===t)&&m.above&&m.right_full?(n.positionDebug("Displaying above, to the right"),e="bottom ulf-arrow-hug-left",i=l.left,s=l.top-d-g/2):("auto"===t||"top"===t)&&m.above&&m.left_full&&(n.positionDebug("Displaying above, to the left"),e="bottom ulf-arrow-hug-right",i=l.left+r-p,s=l.top-d-g/2);return[e,r,p,d,i,s]},positionDebug:function(t){return!!n.position_debug&&("object"==typeof t?console.table(t):console.log("Position: "+t))}};return n.destroy(),n.initialize()},t.WordpressUlikeTooltip={},t.WordpressUlikeTooltip.visible=[],t.WordpressUlikeTooltip.body_click_initialized=!1,t.WordpressUlikeTooltip.defaults={id:Date.now(),title:"",trigger:"hoverfocus",position:"auto",class:"",theme:"black",size:"small",singleton:!0,close_on_outside_click:!0}}(jQuery),function(t,e,i,s){"use strict";var n={messageType:"success",messageText:"Hello World!",timeout:8e3,messageElement:"wpulike-message",notifContainer:"wpulike-notification"};function o(e,i){this.element=e,this.$element=t(e),this.settings=t.extend({},n,i),this._defaults=n,this._name="WordpressUlikeNotifications",this.init()}t.extend(o.prototype,{init:function(){this._message(),this._container(),this._append(),this._remove()},_message:function(){this.$messageElement=t("<div/>").addClass(this.settings.messageElement+" wpulike-"+this.settings.messageType).text(this.settings.messageText)},_container:function(){t("."+this.settings.notifContainer).length||this.$element.append(t("<div/>").addClass(this.settings.notifContainer)),this.$notifContainer=this.$element.find("."+this.settings.notifContainer)},_append:function(){this.$notifContainer.append(this.$messageElement).trigger("WordpressUlikeNotificationAppend")},_remove:function(){var e=this;this.$messageElement.on("click",(function(){t(this).fadeOut(300,(function(){t(this).remove(),t("."+e.settings.messageElement).length||e.$notifContainer.remove()})).trigger("WordpressUlikeRemoveNotification")})),e.settings.timeout&&setTimeout((function(){e.$messageElement.fadeOut(300,(function(){t(this).remove(),t("."+e.settings.messageElement).length||e.$notifContainer.remove()})).trigger("WordpressUlikeRemoveNotification")}),e.settings.timeout)}}),t.fn.WordpressUlikeNotifications=function(t){return this.each((function(){new o(this,t)}))}}(jQuery,window,document),function(t,e,i,s){"use strict";t(e);var n=t(i),o={ID:0,nonce:0,type:"",append:"",appendTimeout:2e3,displayLikers:!1,counterValue:"",likersTemplate:"default",disablePophover:!0,isTotal:!1,factor:"",template:"",counterSelector:".count-box",generalSelector:".wp_ulike_general_class",buttonSelector:".wp_ulike_btn",likersSelector:".wp_ulike_likers_wrapper"},l={"ulike-id":"ID","ulike-counter-value":"counterValue","ulike-nonce":"nonce","ulike-type":"type","ulike-append":"append","ulike-is-total":"isTotal","ulike-display-likers":"displayLikers","ulike-likers-style":"likersTemplate","ulike-disable-pophover":"disablePophover","ulike-append-timeout":"appendTimeout","ulike-factor":"factor","ulike-template":"template"};function a(e,i){for(var s in this.element=e,this.$element=t(e),this.settings=t.extend({},o,i),this._defaults=o,this._name="WordpressUlike",this.buttonElement=this.$element.find(this.settings.buttonSelector),l){var n=this.buttonElement.data(s);void 0!==n&&(this.settings[l[s]]=n)}this.generalElement=this.$element.find(this.settings.generalSelector),""!==this.settings.counterValue&&this.buttonElement.each(function(e,i){void 0===t(i).data("ulike-counter-value")||t(i).next(this.settings.counterSelector).length||t(i).after(t("<span/>").addClass(this.settings.counterSelector.split(".").join("")).html(t(i).data("ulike-counter-value")))}.bind(this)),this.counterElement=this.generalElement.find(this.settings.counterSelector),this.likersElement=this.$element.find(this.settings.likersSelector),this.init()}t.extend(a.prototype,{init:function(){this.buttonElement.on("click",this._initLike.bind(this)),this.generalElement.one("mouseenter",this._updateLikers.bind(this))},_ajax:function(e,i){t.ajax({url:wp_ulike_params.ajax_url,type:"POST",dataType:"json",data:e}).done(i)},_initLike:function(t){t.stopPropagation(),this._maybeUpdateElements(t),this._updateSameButtons(),this._updateSameLikers(),this.buttonElement.prop("disabled",!0),n.trigger("WordpressUlikeLoading",this.element),this.generalElement.addClass("wp_ulike_is_loading"),this._ajax({action:"wp_ulike_process",id:this.settings.ID,nonce:this.settings.nonce,factor:this.settings.factor,type:this.settings.type,template:this.settings.template,displayLikers:this.settings.displayLikers,likersTemplate:this.settings.likersTemplate},function(t){this.generalElement.removeClass("wp_ulike_is_loading"),t.success?(this._updateMarkup(t),this._appendChild()):t.data.hasToast&&this._sendNotification("error",t.data.message),this.buttonElement.prop("disabled",!1),n.trigger("WordpressUlikeUpdated",this.element)}.bind(this))},_maybeUpdateElements:function(e){this.buttonElement=t(e.currentTarget),this.generalElement=this.buttonElement.closest(this.settings.generalSelector),this.counterElement=this.generalElement.find(this.settings.counterSelector),this.settings.factor=this.buttonElement.data("ulike-factor")},_appendChild:function(){if(""!==this.settings.append){var e=t(this.settings.append);this.buttonElement.append(e),this.settings.appendTimeout&&setTimeout((function(){e.detach()}),this.settings.appendTimeout)}},_updateMarkup:function(t){this._setSbilingElement(),this._setSbilingButtons(),this._updateGeneralClassNames(t.data.status),null!==t.data.data&&(t.data.status<5&&(this.__updateCounter(t.data.data),this.settings.displayLikers&&void 0!==t.data.likers&&this._updateLikersMarkup(t.data.likers)),this._updateButton(t.data.btnText,t.data.status)),t.data.hasToast&&this._sendNotification(t.data.messageType,t.data.message)},_updateGeneralClassNames:function(t){var e="wp_ulike_is_not_liked",i="wp_ulike_is_liked",s="wp_ulike_is_unliked",n="wp_ulike_click_is_disabled";switch(this.siblingElement.length&&this.siblingElement.removeClass(this._arrayToString([i,s])),t){case 1:this.generalElement.addClass(i).removeClass(e),this.generalElement.children().first().addClass(n);break;case 2:this.generalElement.addClass(s).removeClass(i);break;case 3:this.generalElement.addClass(i).removeClass(s);break;default:this.generalElement.addClass(n),this.siblingElement.length&&this.siblingElement.addClass(n)}},_arrayToString:function(t){return t.join(" ")},_setSbilingElement:function(){this.siblingElement=this.generalElement.siblings()},_setSbilingButtons:function(){this.siblingButton=this.buttonElement.siblings(this.settings.buttonSelector)},__updateCounter:function(t){"object"!=typeof t?this.counterElement.html(t):this.settings.isTotal&&void 0!==t.sub?this.counterElement.html(t.sub):"down"===this.settings.factor?(this.counterElement.html(t.down),this.siblingElement.length&&this.siblingElement.find(this.settings.counterSelector).html(t.up)):(this.counterElement.html(t.up),this.siblingElement.length&&this.siblingElement.find(this.settings.counterSelector).html(t.down)),n.trigger("WordpressUlikeCounterUpdated",[this.buttonElement])},_updateLikers:function(t){if(this.settings.displayLikers){if("popover"==this.settings.likersTemplate&&this.$element.data("ulike-tooltip"))return;if("default"==this.settings.likersTemplate&&this.likersElement.length)return;return this.generalElement.addClass("wp_ulike_is_getting_likers_list"),this._ajax({action:"wp_ulike_get_likers",id:this.settings.ID,nonce:this.settings.nonce,type:this.settings.type,displayLikers:this.settings.displayLikers,likersTemplate:this.settings.likersTemplate},function(t){this.generalElement.removeClass("wp_ulike_is_getting_likers_list"),t.success&&this._updateLikersMarkup(t.data)}.bind(this)),t.stopImmediatePropagation(),!1}},_updateLikersMarkup:function(e){"popover"==this.settings.likersTemplate?(this.likersElement=this.$element,e.template&&this.likersElement.WordpressUlikeTooltip({id:this.settings.type.toLowerCase()+"-"+this.settings.ID,title:e.template,position:"top",child:this.settings.generalSelector,theme:"white",size:"tiny",trigger:"hover"})):(this.likersElement.length||(this.likersElement=t(e.template).appendTo(this.$element)),e.template?this.likersElement.show().html(e.template):this.likersElement.hide().empty()),n.trigger("WordpressUlikeLikersMarkupUpdated",[this.likersElement,this.settings.likersTemplate,e.template])},_updateSameButtons:function(){var t=void 0!==this.settings.factor?"_"+this.settings.factor:"";this.sameButtons=n.find(".wp_"+this.settings.type.toLowerCase()+t+"_btn_"+this.settings.ID),this.sameButtons.length>1&&(this.buttonElement=this.sameButtons,this.generalElement=this.buttonElement.closest(this.settings.generalSelector),this.counterElement=this.generalElement.find(this.settings.counterSelector))},_updateSameLikers:function(){this.sameLikers=n.find(".wp_"+this.settings.type.toLowerCase()+"_likers_"+this.settings.ID),this.sameLikers.length>1&&(this.likersElement=this.sameLikers)},_getLikersElement:function(){return this.likersElement},_updateButton:function(t,e){this.buttonElement.hasClass("wp_ulike_put_image")?(this.buttonElement.toggleClass("image-unlike wp_ulike_btn_is_active"),this.siblingElement.length&&this.siblingElement.find(this.settings.buttonSelector).removeClass("image-unlike wp_ulike_btn_is_active"),this.siblingButton.length&&this.siblingButton.removeClass("image-unlike wp_ulike_btn_is_active")):this.buttonElement.hasClass("wp_ulike_put_text")&&null!==t&&("object"!=typeof t?this.buttonElement.find("span").html(t):"down"===this.settings.factor?(this.buttonElement.find("span").html(t.down),this.siblingElement.length&&this.siblingElement.find(this.settings.buttonSelector).find("span").html(t.up)):(this.buttonElement.find("span").html(t.up),this.siblingElement.length&&this.siblingElement.find(this.settings.buttonSelector).find("span").html(t.down)))},_sendNotification:function(e,s){t(i.body).WordpressUlikeNotifications({messageType:e,messageText:s})}}),t.fn.WordpressUlike=function(e){return this.each((function(){t.data(this,"plugin_WordpressUlike")||t.data(this,"plugin_WordpressUlike",new a(this,e))}))}}(jQuery,window,document),function(t){t((function(){t(".wpulike").WordpressUlike()})),t(".wpulike").WordpressUlike(),t(document).ajaxComplete((function(){t(".wpulike").WordpressUlike()})),t("#buddypress").on("bp_ajax_request",'[data-bp-list="activity"]',(function(){t(".wpulike").WordpressUlike()}))}(jQuery);
1
+ /*! WP ULike - v4.5.3
2
  * https://wpulike.com
3
  * TechnoWich 2021;
4
  */
5
+ !function(t){t.fn.WordpressUlikeTooltip=function(e){if(this.length>1)return this.each((function(){t(this).WordpressUlikeTooltip(e)})),this;if(void 0===this||1!==this.length)return!1;const i=t(this);e=t.extend({},t.WordpressUlikeTooltip.defaults,e,i.data());let s=i.attr("title");void 0!==s&&s.length&&(e.title=s),e.class+=" ulf-"+e.theme+"-theme",e.class+=" ulf-"+e.size,e.trigger=e.trigger.toLowerCase().trim();let n={dom:this,dom_wrapped:i,position_debug:e.position_debug,trigger:e.trigger,id:e.id,title:e.title,content:e.title,child_class:e.child,theme:e.theme,class:e.class,position:e.position,close_on_outside_click:e.close_on_outside_click,singleton:e.singleton,dataAttr:"ulike-tooltip",createTooltipHTML:function(){return`<div class='ulf-tooltip ${n.class}' role='tooltip'><div class='ulf-arrow'></div><div class='ulf-content'>${n.content}</div></div>`},destroy:function(){const e=n.dom_wrapped.data(n.dataAttr);null!=e&&(e.dom_wrapped.off("touchstart mouseenter",e.show),e.dom_wrapped.off("click",e.preventDefaultHandler),t(window).off("resize",e.onResize),e.isVisible()&&e.hide(),e.dom_wrapped.data(e.dataAttr,null))},initialize:function(){return n.dom_wrapped.on("touchstart mouseenter",n.show),n.dom_wrapped.on("click",n.preventDefaultHandler),t.WordpressUlikeTooltip.body_click_initialized||(t(document).on("touchstart mousedown",n.onClickOutside),t.WordpressUlikeTooltip.bodyClickInitialized=!0),n.dom_wrapped.data(n.dataAttr,n),t(document).on("WordpressUlikeLikersMarkupUpdated",(function(t,e,i,s){if("popover"==i)if(s.length)n.show();else{let t=e.data(n.dataAttr);null!=t&&t.destroy()}})),n.dom},preventDefaultHandler:function(t){return t.preventDefault(),!1},show:function(e){if(n.isVisible())return!1;n.singleton&&n.hideAllVisible();const i=t("body");(void 0===e||e)&&"function"==typeof n.title&&(n.content=n.title(n.dom_wrapped,n)),i.append(n.createTooltipHTML()),n.tooltip=t(".ulf-tooltip:last"),n.positionTooltip(),t(window).on("resize",n.onResize);const s="ulp-dom-"+n.id;n.tooltip.attr("id",s),n.dom.attr("aria-describedby",s),t.WordpressUlikeTooltip.visible.push(n),(void 0===e||e)&&n.dom.trigger("ulf-show",[n.tooltip,n.hide]),t("body").on("DOMSubtreeModified",n.positionTooltip)},isVisible:function(){return t.inArray(n,t.WordpressUlikeTooltip.visible)>-1},hideAllVisible:function(){return t.each(t.WordpressUlikeTooltip.visible,(function(t,e){e.dom_wrapped.hasClass("ulf-focused")||e.hide()})),this},hide:function(e){t("body").off("DOMSubtreeModified",n.positionTooltip),t(window).off("resize",n.onResize),n.dom.attr("aria-describedby",null),n.tooltip&&n.tooltip.length&&n.tooltip.remove(),(void 0===e||e)&&n.dom.trigger("ulf-hide"),"click"!==n.trigger&&n.dom_wrapped.off("touchstart mousedown",n.hide);var i=t.inArray(n,t.WordpressUlikeTooltip.visible);return t.WordpressUlikeTooltip.visible.splice(i,1),n.dom},onResize:function(){n.hide(!1),n.show(!1)},onClickOutside:function(e){const i=t(e.target);i.hasClass("ulf-tooltip")||i.parents(".ulf-tooltip:first").length||t.each(t.WordpressUlikeTooltip.visible,(function(t,e){void 0!==e&&e.close_on_outside_click&&(i!==e.dom_wrapped||"focus"!==e.trigger&&"hoverfocus"!==e.trigger)&&e.hide()}))},positionTooltip:function(){n.positionDebug("-- Start positioning --"),n.dom_wrapped.length&&n.dom_wrapped.is(":visible")||(n.positionDebug("Elem no longer exists. Removing tooltip"),n.hide(!0));let t=n.tooltip.find(".ulf-arrow"),[e,i,s,o,l,a]=n.calculateSafePosition(n.position);return void 0===l&&"auto"!==n.position&&(n.positionDebug("Couldn't fit preferred position"),[e,i,s,o,l,a]=n.calculateSafePosition("auto")),void 0===l?(n.positionDebug("Doesn't appear to fit. Displaying centered"),n.tooltip.addClass("ulf-centered").css({top:"50%",left:"50%","margin-left":-s/2,"margin-top":-o/2}),t&&t.length&&t.remove(),void n.positionDebug("-- Done positioning --")):(n.positionDebug({"Setting Position":{Left:l,Top:a}}),n.tooltip.css("left",l),n.tooltip.css("top",a),i<60&&(n.positionDebug("Element is less than "+i+"px. Setting arrow to hug the side tighter"),e+=" ulf-arrow-super-hug"),t.addClass("ulf-arrow-"+e),n.positionDebug("-- Done positioning --"),n)},calculateSafePosition:function(t){let e,i,s,o=n.tooltip.find(".ulf-arrow"),l=n.dom_wrapped.offset(),a=n.dom_wrapped.outerHeight(),r=n.dom_wrapped.outerWidth(),u=n.tooltip.outerWidth(),d=n.tooltip.outerHeight(),p=document.querySelector("body").offsetWidth,h=document.querySelector("body").offsetHeight,g=o.is(":visible")?o.outerHeight():0,c=o.is(":visible")?o.outerWidth():0,m={};if(m.below=h-(d+a+l.top)>5,m.above=l.top-d>5,m.vertical_half=l.top+r/2-d/2>5,m.right=p-(u+r+l.left)>5,m.right_half=p-l.left-r/2-u/2>5,m.right_full=p-l.left-u>5,m.left=l.left-u>5,m.left_half=l.left+r/2-u/2>5,m.left_full=l.left-u>5,n.positionDebug({"Clicked Element":{Left:l.left,Top:l.top}}),n.positionDebug({"Element Dimensions":{Height:a,Width:r},"Tooltip Dimensions":{Height:d,Width:u},"Window Dimensions":{Height:h,Width:p},"Arrow Dimensions":{Height:g,Width:c}}),n.positionDebug(m),("auto"===t||"bottom"===t)&&m.below&&m.left_half&&m.right_half)n.positionDebug("Displaying below, centered"),e="top",i=l.left-u/2+r/2,s=l.top+a+g/2;else if(("auto"===t||"top"===t)&&m.above&&m.left_half&&m.right_half){if(n.positionDebug("Displaying above, centered"),e="bottom",n.child_class){let t=n.dom_wrapped.find(n.child_class).first();i=t.offset().left-u/2+t.width()/2}else i=l.left-u/2+r/2;s=l.top-d-g/2}else("auto"===t||"left"===t)&&m.left&&m.vertical_half?(n.positionDebug("Displaying left, centered"),e="right",i=l.left-u-c/2,s=l.top+a/2-d/2):("auto"===t||"right"===t)&&m.right&&m.vertical_half?(n.positionDebug("Displaying right, centered"),e="left",i=l.left+r+c/2,s=l.top+a/2-d/2):("auto"===t||"bottom"===t)&&m.below&&m.right_full?(n.positionDebug("Displaying below, to the right"),e="top ulf-arrow-hug-left",i=l.left,s=l.top+a+g/2):("auto"===t||"bottom"===t)&&m.below&&m.left_full?(n.positionDebug("Displaying below, to the left"),e="top ulf-arrow-hug-right",i=l.left+r-u,s=l.top+a+g/2):("auto"===t||"top"===t)&&m.above&&m.right_full?(n.positionDebug("Displaying above, to the right"),e="bottom ulf-arrow-hug-left",i=l.left,s=l.top-d-g/2):("auto"===t||"top"===t)&&m.above&&m.left_full&&(n.positionDebug("Displaying above, to the left"),e="bottom ulf-arrow-hug-right",i=l.left+r-u,s=l.top-d-g/2);return[e,r,u,d,i,s]},positionDebug:function(t){return!!n.position_debug&&("object"==typeof t?console.table(t):console.log("Position: "+t))}};return n.destroy(),n.initialize()},t.WordpressUlikeTooltip={},t.WordpressUlikeTooltip.visible=[],t.WordpressUlikeTooltip.body_click_initialized=!1,t.WordpressUlikeTooltip.defaults={id:Date.now(),title:"",trigger:"hoverfocus",position:"auto",class:"",theme:"black",size:"small",singleton:!0,close_on_outside_click:!0}}(jQuery),function(t,e,i,s){"use strict";var n={messageType:"success",messageText:"Hello World!",timeout:8e3,messageElement:"wpulike-message",notifContainer:"wpulike-notification"};function o(e,i){this.element=e,this.$element=t(e),this.settings=t.extend({},n,i),this._defaults=n,this._name="WordpressUlikeNotifications",this.init()}t.extend(o.prototype,{init:function(){this._message(),this._container(),this._append(),this._remove()},_message:function(){this.$messageElement=t("<div/>").addClass(this.settings.messageElement+" wpulike-"+this.settings.messageType).text(this.settings.messageText)},_container:function(){t("."+this.settings.notifContainer).length||this.$element.append(t("<div/>").addClass(this.settings.notifContainer)),this.$notifContainer=this.$element.find("."+this.settings.notifContainer)},_append:function(){this.$notifContainer.append(this.$messageElement).trigger("WordpressUlikeNotificationAppend")},_remove:function(){var e=this;this.$messageElement.on("click",(function(){t(this).fadeOut(300,(function(){t(this).remove(),t("."+e.settings.messageElement).length||e.$notifContainer.remove()})).trigger("WordpressUlikeRemoveNotification")})),e.settings.timeout&&setTimeout((function(){e.$messageElement.fadeOut(300,(function(){t(this).remove(),t("."+e.settings.messageElement).length||e.$notifContainer.remove()})).trigger("WordpressUlikeRemoveNotification")}),e.settings.timeout)}}),t.fn.WordpressUlikeNotifications=function(t){return this.each((function(){new o(this,t)}))}}(jQuery,window,document),function(t,e,i,s){"use strict";t(e);var n=t(i),o={ID:0,nonce:0,type:"",append:"",appendTimeout:2e3,displayLikers:!1,likersTemplate:"default",disablePophover:!0,isTotal:!1,factor:"",template:"",counterSelector:".count-box",generalSelector:".wp_ulike_general_class",buttonSelector:".wp_ulike_btn",likersSelector:".wp_ulike_likers_wrapper"},l={"ulike-id":"ID","ulike-nonce":"nonce","ulike-type":"type","ulike-append":"append","ulike-is-total":"isTotal","ulike-display-likers":"displayLikers","ulike-likers-style":"likersTemplate","ulike-disable-pophover":"disablePophover","ulike-append-timeout":"appendTimeout","ulike-factor":"factor","ulike-template":"template"};function a(e,i){for(var s in this.element=e,this.$element=t(e),this.settings=t.extend({},o,i),this._defaults=o,this._name="WordpressUlike",this.buttonElement=this.$element.find(this.settings.buttonSelector),l){var n=this.buttonElement.data(s);void 0!==n&&(this.settings[l[s]]=n)}this.generalElement=this.$element.find(this.settings.generalSelector),this.counterElement=this.generalElement.find(this.settings.counterSelector),this.counterElement.length&&this.counterElement.each(function(e,i){void 0!==t(i).data("ulike-counter-value")&&t(i).html(t(i).data("ulike-counter-value"))}.bind(this)),this.likersElement=this.$element.find(this.settings.likersSelector),this.init()}t.extend(a.prototype,{init:function(){this.buttonElement.on("click",this._initLike.bind(this)),this.generalElement.one("mouseenter",this._updateLikers.bind(this))},_ajax:function(e,i){t.ajax({url:wp_ulike_params.ajax_url,type:"POST",dataType:"json",data:e}).done(i)},_initLike:function(t){t.stopPropagation(),this._maybeUpdateElements(t),this._updateSameButtons(),this._updateSameLikers(),this.buttonElement.prop("disabled",!0),n.trigger("WordpressUlikeLoading",this.element),this.generalElement.addClass("wp_ulike_is_loading"),this._ajax({action:"wp_ulike_process",id:this.settings.ID,nonce:this.settings.nonce,factor:this.settings.factor,type:this.settings.type,template:this.settings.template,displayLikers:this.settings.displayLikers,likersTemplate:this.settings.likersTemplate},function(t){this.generalElement.removeClass("wp_ulike_is_loading"),t.success?(this._updateMarkup(t),this._appendChild()):t.data.hasToast&&this._sendNotification("error",t.data.message),this.buttonElement.prop("disabled",!1),n.trigger("WordpressUlikeUpdated",this.element)}.bind(this))},_maybeUpdateElements:function(e){this.buttonElement=t(e.currentTarget),this.generalElement=this.buttonElement.closest(this.settings.generalSelector),this.counterElement=this.generalElement.find(this.settings.counterSelector),this.settings.factor=this.buttonElement.data("ulike-factor")},_appendChild:function(){if(""!==this.settings.append){var e=t(this.settings.append);this.buttonElement.append(e),this.settings.appendTimeout&&setTimeout((function(){e.detach()}),this.settings.appendTimeout)}},_updateMarkup:function(t){this._setSbilingElement(),this._setSbilingButtons(),this._updateGeneralClassNames(t.data.status),null!==t.data.data&&(t.data.status<5&&(this.__updateCounter(t.data.data),this.settings.displayLikers&&void 0!==t.data.likers&&this._updateLikersMarkup(t.data.likers)),this._updateButton(t.data.btnText,t.data.status)),t.data.hasToast&&this._sendNotification(t.data.messageType,t.data.message)},_updateGeneralClassNames:function(t){var e="wp_ulike_is_not_liked",i="wp_ulike_is_liked",s="wp_ulike_is_unliked",n="wp_ulike_click_is_disabled";switch(this.siblingElement.length&&this.siblingElement.removeClass(this._arrayToString([i,s])),t){case 1:this.generalElement.addClass(i).removeClass(e),this.generalElement.children().first().addClass(n);break;case 2:this.generalElement.addClass(s).removeClass(i);break;case 3:this.generalElement.addClass(i).removeClass(s);break;default:this.generalElement.addClass(n),this.siblingElement.length&&this.siblingElement.addClass(n)}},_arrayToString:function(t){return t.join(" ")},_setSbilingElement:function(){this.siblingElement=this.generalElement.siblings()},_setSbilingButtons:function(){this.siblingButton=this.buttonElement.siblings(this.settings.buttonSelector)},__updateCounter:function(t){"object"!=typeof t?this.counterElement.attr("data-ulike-counter-value",t).html(t):this.settings.isTotal&&void 0!==t.sub?this.counterElement.attr("data-ulike-counter-value",t.sub).html(t.sub):"down"===this.settings.factor?(this.counterElement.attr("data-ulike-counter-value",t.down).html(t.down),this.siblingElement.length&&this.siblingElement.find(this.settings.counterSelector).attr("data-ulike-counter-value",t.up).html(t.up)):(this.counterElement.attr("data-ulike-counter-value",t.up).html(t.up),this.siblingElement.length&&this.siblingElement.find(this.settings.counterSelector).attr("data-ulike-counter-value",t.down).html(t.down)),n.trigger("WordpressUlikeCounterUpdated",[this.buttonElement])},_updateLikers:function(t){if(this.settings.displayLikers){if("popover"==this.settings.likersTemplate&&this.$element.data("ulike-tooltip"))return;if("default"==this.settings.likersTemplate&&this.likersElement.length)return;return this.generalElement.addClass("wp_ulike_is_getting_likers_list"),this._ajax({action:"wp_ulike_get_likers",id:this.settings.ID,nonce:this.settings.nonce,type:this.settings.type,displayLikers:this.settings.displayLikers,likersTemplate:this.settings.likersTemplate},function(t){this.generalElement.removeClass("wp_ulike_is_getting_likers_list"),t.success&&this._updateLikersMarkup(t.data)}.bind(this)),t.stopImmediatePropagation(),!1}},_updateLikersMarkup:function(e){"popover"==this.settings.likersTemplate?(this.likersElement=this.$element,e.template&&this.likersElement.WordpressUlikeTooltip({id:this.settings.type.toLowerCase()+"-"+this.settings.ID,title:e.template,position:"top",child:this.settings.generalSelector,theme:"white",size:"tiny",trigger:"hover"})):(this.likersElement.length||(this.likersElement=t(e.template).appendTo(this.$element)),e.template?this.likersElement.show().html(e.template):this.likersElement.hide().empty()),n.trigger("WordpressUlikeLikersMarkupUpdated",[this.likersElement,this.settings.likersTemplate,e.template])},_updateSameButtons:function(){var t=void 0!==this.settings.factor?"_"+this.settings.factor:"";this.sameButtons=n.find(".wp_"+this.settings.type.toLowerCase()+t+"_btn_"+this.settings.ID),this.sameButtons.length>1&&(this.buttonElement=this.sameButtons,this.generalElement=this.buttonElement.closest(this.settings.generalSelector),this.counterElement=this.generalElement.find(this.settings.counterSelector))},_updateSameLikers:function(){this.sameLikers=n.find(".wp_"+this.settings.type.toLowerCase()+"_likers_"+this.settings.ID),this.sameLikers.length>1&&(this.likersElement=this.sameLikers)},_getLikersElement:function(){return this.likersElement},_updateButton:function(t,e){this.buttonElement.hasClass("wp_ulike_put_image")?(this.buttonElement.toggleClass("image-unlike wp_ulike_btn_is_active"),this.siblingElement.length&&this.siblingElement.find(this.settings.buttonSelector).removeClass("image-unlike wp_ulike_btn_is_active"),this.siblingButton.length&&this.siblingButton.removeClass("image-unlike wp_ulike_btn_is_active")):this.buttonElement.hasClass("wp_ulike_put_text")&&null!==t&&("object"!=typeof t?this.buttonElement.find("span").html(t):"down"===this.settings.factor?(this.buttonElement.find("span").html(t.down),this.siblingElement.length&&this.siblingElement.find(this.settings.buttonSelector).find("span").html(t.up)):(this.buttonElement.find("span").html(t.up),this.siblingElement.length&&this.siblingElement.find(this.settings.buttonSelector).find("span").html(t.down)))},_sendNotification:function(e,s){t(i.body).WordpressUlikeNotifications({messageType:e,messageText:s})}}),t.fn.WordpressUlike=function(e){return this.each((function(){t.data(this,"plugin_WordpressUlike")||t.data(this,"plugin_WordpressUlike",new a(this,e))}))}}(jQuery,window,document),function(t){t((function(){t(".wpulike").WordpressUlike()})),t(".wpulike").WordpressUlike(),t(document).ajaxComplete((function(){t(".wpulike").WordpressUlike()})),t("#buddypress").on("bp_ajax_request",'[data-bp-list="activity"]',(function(){t(".wpulike").WordpressUlike()}))}(jQuery);
includes/functions/templates.php CHANGED
@@ -77,7 +77,6 @@ if( ! function_exists( 'wp_ulike_set_default_template' ) ){
77
  data-ulike-template="<?php echo $style; ?>"
78
  data-ulike-display-likers="<?php echo $display_likers; ?>"
79
  data-ulike-likers-style="<?php echo $likers_style; ?>"
80
- data-ulike-counter-value="<?php echo esc_attr( $formatted_total_likes ); ?>"
81
  class="<?php echo $button_class; ?>">
82
  <?php
83
  echo $up_vote_inner_text;
@@ -87,7 +86,10 @@ if( ! function_exists( 'wp_ulike_set_default_template' ) ){
87
  }
88
  ?>
89
  </button>
90
- <?php do_action( 'wp_ulike_after_up_vote_button', $wp_ulike_template ); ?>
 
 
 
91
  </div>
92
  <?php
93
  do_action( 'wp_ulike_inside_template', $wp_ulike_template );
@@ -124,7 +126,6 @@ if( ! function_exists( 'wp_ulike_set_simple_heart_template' ) ){
124
  data-ulike-template="<?php echo $style; ?>"
125
  data-ulike-display-likers="<?php echo $display_likers; ?>"
126
  data-ulike-likers-style="<?php echo $likers_style; ?>"
127
- data-ulike-counter-value="<?php echo esc_attr( $formatted_total_likes ); ?>"
128
  class="<?php echo $button_class; ?>">
129
  <?php
130
  echo $up_vote_inner_text;
@@ -134,7 +135,10 @@ if( ! function_exists( 'wp_ulike_set_simple_heart_template' ) ){
134
  }
135
  ?>
136
  </button>
137
- <?php do_action( 'wp_ulike_after_up_vote_button', $wp_ulike_template ); ?>
 
 
 
138
  </div>
139
  <?php
140
  do_action( 'wp_ulike_inside_template', $wp_ulike_template );
@@ -171,14 +175,16 @@ if( ! function_exists( 'wp_ulike_set_robeen_template' ) ){
171
  data-ulike-template="<?php echo $style; ?>"
172
  data-ulike-display-likers="<?php echo $display_likers; ?>"
173
  data-ulike-likers-style="<?php echo $likers_style; ?>"
174
- data-ulike-counter-value="<?php echo esc_attr( $formatted_total_likes ); ?>"
175
  class="<?php echo $button_class; ?>">
176
  <?php
177
  echo $up_vote_inner_text;
178
  do_action( 'wp_ulike_inside_like_button', $wp_ulike_template );
179
  ?>
180
  </button>
181
- <?php do_action( 'wp_ulike_after_up_vote_button', $wp_ulike_template ); ?>
 
 
 
182
  </div>
183
  <?php
184
  do_action( 'wp_ulike_inside_template', $wp_ulike_template );
@@ -217,7 +223,6 @@ if( ! function_exists( 'wp_ulike_set_animated_heart_template' ) ){
217
  data-ulike-display-likers="<?php echo $display_likers; ?>"
218
  data-ulike-likers-style="<?php echo $likers_style; ?>"
219
  data-ulike-append="<?php echo esc_attr( '<svg class="wpulike-svg-heart wpulike-svg-heart-pop one" viewBox="0 0 32 29.6"><path d="M23.6,0c-3.4,0-6.3,2.7-7.6,5.6C14.7,2.7,11.8,0,8.4,0C3.8,0,0,3.8,0,8.4c0,9.4,9.5,11.9,16,21.2c6.1-9.3,16-12.1,16-21.2C32,3.8,28.2,0,23.6,0z"/></svg><svg class="wpulike-svg-heart wpulike-svg-heart-pop two" viewBox="0 0 32 29.6"><path d="M23.6,0c-3.4,0-6.3,2.7-7.6,5.6C14.7,2.7,11.8,0,8.4,0C3.8,0,0,3.8,0,8.4c0,9.4,9.5,11.9,16,21.2c6.1-9.3,16-12.1,16-21.2C32,3.8,28.2,0,23.6,0z"/></svg><svg class="wpulike-svg-heart wpulike-svg-heart-pop three" viewBox="0 0 32 29.6"><path d="M23.6,0c-3.4,0-6.3,2.7-7.6,5.6C14.7,2.7,11.8,0,8.4,0C3.8,0,0,3.8,0,8.4c0,9.4,9.5,11.9,16,21.2c6.1-9.3,16-12.1,16-21.2C32,3.8,28.2,0,23.6,0z"/></svg><svg class="wpulike-svg-heart wpulike-svg-heart-pop four" viewBox="0 0 32 29.6"><path d="M23.6,0c-3.4,0-6.3,2.7-7.6,5.6C14.7,2.7,11.8,0,8.4,0C3.8,0,0,3.8,0,8.4c0,9.4,9.5,11.9,16,21.2c6.1-9.3,16-12.1,16-21.2C32,3.8,28.2,0,23.6,0z"/></svg><svg class="wpulike-svg-heart wpulike-svg-heart-pop five" viewBox="0 0 32 29.6"><path d="M23.6,0c-3.4,0-6.3,2.7-7.6,5.6C14.7,2.7,11.8,0,8.4,0C3.8,0,0,3.8,0,8.4c0,9.4,9.5,11.9,16,21.2c6.1-9.3,16-12.1,16-21.2C32,3.8,28.2,0,23.6,0z"/></svg><svg class="wpulike-svg-heart wpulike-svg-heart-pop six" viewBox="0 0 32 29.6"><path d="M23.6,0c-3.4,0-6.3,2.7-7.6,5.6C14.7,2.7,11.8,0,8.4,0C3.8,0,0,3.8,0,8.4c0,9.4,9.5,11.9,16,21.2c6.1-9.3,16-12.1,16-21.2C32,3.8,28.2,0,23.6,0z"/></svg><svg class="wpulike-svg-heart wpulike-svg-heart-pop seven" viewBox="0 0 32 29.6"><path d="M23.6,0c-3.4,0-6.3,2.7-7.6,5.6C14.7,2.7,11.8,0,8.4,0C3.8,0,0,3.8,0,8.4c0,9.4,9.5,11.9,16,21.2c6.1-9.3,16-12.1,16-21.2C32,3.8,28.2,0,23.6,0z"/></svg><svg class="wpulike-svg-heart wpulike-svg-heart-pop eight" viewBox="0 0 32 29.6"><path d="M23.6,0c-3.4,0-6.3,2.7-7.6,5.6C14.7,2.7,11.8,0,8.4,0C3.8,0,0,3.8,0,8.4c0,9.4,9.5,11.9,16,21.2c6.1-9.3,16-12.1,16-21.2C32,3.8,28.2,0,23.6,0z"/></svg><svg class="wpulike-svg-heart wpulike-svg-heart-pop nine" viewBox="0 0 32 29.6"><path d="M23.6,0c-3.4,0-6.3,2.7-7.6,5.6C14.7,2.7,11.8,0,8.4,0C3.8,0,0,3.8,0,8.4c0,9.4,9.5,11.9,16,21.2c6.1-9.3,16-12.1,16-21.2C32,3.8,28.2,0,23.6,0z"/></svg>' ); ?>"
220
- data-ulike-counter-value="<?php echo esc_attr( $formatted_total_likes ); ?>"
221
  class="<?php echo $button_class; ?>">
222
  <?php
223
  echo $up_vote_inner_text;
@@ -228,7 +233,10 @@ if( ! function_exists( 'wp_ulike_set_animated_heart_template' ) ){
228
  d="m471.382812 44.578125c-26.503906-28.746094-62.871093-44.578125-102.410156-44.578125-29.554687 0-56.621094 9.34375-80.449218 27.769531-12.023438 9.300781-22.917969 20.679688-32.523438 33.960938-9.601562-13.277344-20.5-24.660157-32.527344-33.960938-23.824218-18.425781-50.890625-27.769531-80.445312-27.769531-39.539063 0-75.910156 15.832031-102.414063 44.578125-26.1875 28.410156-40.613281 67.222656-40.613281 109.292969 0 43.300781 16.136719 82.9375 50.78125 124.742187 30.992188 37.394531 75.535156 75.355469 127.117188 119.3125 17.613281 15.011719 37.578124 32.027344 58.308593 50.152344 5.476563 4.796875 12.503907 7.4375 19.792969 7.4375 7.285156 0 14.316406-2.640625 19.785156-7.429687 20.730469-18.128907 40.707032-35.152344 58.328125-50.171876 51.574219-43.949218 96.117188-81.90625 127.109375-119.304687 34.644532-41.800781 50.777344-81.4375 50.777344-124.742187 0-42.066407-14.425781-80.878907-40.617188-109.289063zm0 0" />
229
  </svg>
230
  </button>
231
- <?php do_action( 'wp_ulike_after_up_vote_button', $wp_ulike_template ); ?>
 
 
 
232
  </div>
233
  <?php
234
  do_action( 'wp_ulike_inside_template', $wp_ulike_template );
77
  data-ulike-template="<?php echo $style; ?>"
78
  data-ulike-display-likers="<?php echo $display_likers; ?>"
79
  data-ulike-likers-style="<?php echo $likers_style; ?>"
 
80
  class="<?php echo $button_class; ?>">
81
  <?php
82
  echo $up_vote_inner_text;
86
  }
87
  ?>
88
  </button>
89
+ <?php
90
+ echo $display_counters ? sprintf( '<span class="count-box wp_ulike_counter_up" data-ulike-counter-value="%s"></span>', esc_attr( $formatted_total_likes ) ) : '';
91
+ do_action( 'wp_ulike_after_up_vote_button', $wp_ulike_template );
92
+ ?>
93
  </div>
94
  <?php
95
  do_action( 'wp_ulike_inside_template', $wp_ulike_template );
126
  data-ulike-template="<?php echo $style; ?>"
127
  data-ulike-display-likers="<?php echo $display_likers; ?>"
128
  data-ulike-likers-style="<?php echo $likers_style; ?>"
 
129
  class="<?php echo $button_class; ?>">
130
  <?php
131
  echo $up_vote_inner_text;
135
  }
136
  ?>
137
  </button>
138
+ <?php
139
+ echo $display_counters ? sprintf( '<span class="count-box wp_ulike_counter_up" data-ulike-counter-value="%s"></span>', esc_attr( $formatted_total_likes ) ) : '';
140
+ do_action( 'wp_ulike_after_up_vote_button', $wp_ulike_template );
141
+ ?>
142
  </div>
143
  <?php
144
  do_action( 'wp_ulike_inside_template', $wp_ulike_template );
175
  data-ulike-template="<?php echo $style; ?>"
176
  data-ulike-display-likers="<?php echo $display_likers; ?>"
177
  data-ulike-likers-style="<?php echo $likers_style; ?>"
 
178
  class="<?php echo $button_class; ?>">
179
  <?php
180
  echo $up_vote_inner_text;
181
  do_action( 'wp_ulike_inside_like_button', $wp_ulike_template );
182
  ?>
183
  </button>
184
+ <?php
185
+ echo $display_counters ? sprintf( '<span class="count-box wp_ulike_counter_up" data-ulike-counter-value="%s"></span>', esc_attr( $formatted_total_likes ) ) : '';
186
+ do_action( 'wp_ulike_after_up_vote_button', $wp_ulike_template );
187
+ ?>
188
  </div>
189
  <?php
190
  do_action( 'wp_ulike_inside_template', $wp_ulike_template );
223
  data-ulike-display-likers="<?php echo $display_likers; ?>"
224
  data-ulike-likers-style="<?php echo $likers_style; ?>"
225
  data-ulike-append="<?php echo esc_attr( '<svg class="wpulike-svg-heart wpulike-svg-heart-pop one" viewBox="0 0 32 29.6"><path d="M23.6,0c-3.4,0-6.3,2.7-7.6,5.6C14.7,2.7,11.8,0,8.4,0C3.8,0,0,3.8,0,8.4c0,9.4,9.5,11.9,16,21.2c6.1-9.3,16-12.1,16-21.2C32,3.8,28.2,0,23.6,0z"/></svg><svg class="wpulike-svg-heart wpulike-svg-heart-pop two" viewBox="0 0 32 29.6"><path d="M23.6,0c-3.4,0-6.3,2.7-7.6,5.6C14.7,2.7,11.8,0,8.4,0C3.8,0,0,3.8,0,8.4c0,9.4,9.5,11.9,16,21.2c6.1-9.3,16-12.1,16-21.2C32,3.8,28.2,0,23.6,0z"/></svg><svg class="wpulike-svg-heart wpulike-svg-heart-pop three" viewBox="0 0 32 29.6"><path d="M23.6,0c-3.4,0-6.3,2.7-7.6,5.6C14.7,2.7,11.8,0,8.4,0C3.8,0,0,3.8,0,8.4c0,9.4,9.5,11.9,16,21.2c6.1-9.3,16-12.1,16-21.2C32,3.8,28.2,0,23.6,0z"/></svg><svg class="wpulike-svg-heart wpulike-svg-heart-pop four" viewBox="0 0 32 29.6"><path d="M23.6,0c-3.4,0-6.3,2.7-7.6,5.6C14.7,2.7,11.8,0,8.4,0C3.8,0,0,3.8,0,8.4c0,9.4,9.5,11.9,16,21.2c6.1-9.3,16-12.1,16-21.2C32,3.8,28.2,0,23.6,0z"/></svg><svg class="wpulike-svg-heart wpulike-svg-heart-pop five" viewBox="0 0 32 29.6"><path d="M23.6,0c-3.4,0-6.3,2.7-7.6,5.6C14.7,2.7,11.8,0,8.4,0C3.8,0,0,3.8,0,8.4c0,9.4,9.5,11.9,16,21.2c6.1-9.3,16-12.1,16-21.2C32,3.8,28.2,0,23.6,0z"/></svg><svg class="wpulike-svg-heart wpulike-svg-heart-pop six" viewBox="0 0 32 29.6"><path d="M23.6,0c-3.4,0-6.3,2.7-7.6,5.6C14.7,2.7,11.8,0,8.4,0C3.8,0,0,3.8,0,8.4c0,9.4,9.5,11.9,16,21.2c6.1-9.3,16-12.1,16-21.2C32,3.8,28.2,0,23.6,0z"/></svg><svg class="wpulike-svg-heart wpulike-svg-heart-pop seven" viewBox="0 0 32 29.6"><path d="M23.6,0c-3.4,0-6.3,2.7-7.6,5.6C14.7,2.7,11.8,0,8.4,0C3.8,0,0,3.8,0,8.4c0,9.4,9.5,11.9,16,21.2c6.1-9.3,16-12.1,16-21.2C32,3.8,28.2,0,23.6,0z"/></svg><svg class="wpulike-svg-heart wpulike-svg-heart-pop eight" viewBox="0 0 32 29.6"><path d="M23.6,0c-3.4,0-6.3,2.7-7.6,5.6C14.7,2.7,11.8,0,8.4,0C3.8,0,0,3.8,0,8.4c0,9.4,9.5,11.9,16,21.2c6.1-9.3,16-12.1,16-21.2C32,3.8,28.2,0,23.6,0z"/></svg><svg class="wpulike-svg-heart wpulike-svg-heart-pop nine" viewBox="0 0 32 29.6"><path d="M23.6,0c-3.4,0-6.3,2.7-7.6,5.6C14.7,2.7,11.8,0,8.4,0C3.8,0,0,3.8,0,8.4c0,9.4,9.5,11.9,16,21.2c6.1-9.3,16-12.1,16-21.2C32,3.8,28.2,0,23.6,0z"/></svg>' ); ?>"
 
226
  class="<?php echo $button_class; ?>">
227
  <?php
228
  echo $up_vote_inner_text;
233
  d="m471.382812 44.578125c-26.503906-28.746094-62.871093-44.578125-102.410156-44.578125-29.554687 0-56.621094 9.34375-80.449218 27.769531-12.023438 9.300781-22.917969 20.679688-32.523438 33.960938-9.601562-13.277344-20.5-24.660157-32.527344-33.960938-23.824218-18.425781-50.890625-27.769531-80.445312-27.769531-39.539063 0-75.910156 15.832031-102.414063 44.578125-26.1875 28.410156-40.613281 67.222656-40.613281 109.292969 0 43.300781 16.136719 82.9375 50.78125 124.742187 30.992188 37.394531 75.535156 75.355469 127.117188 119.3125 17.613281 15.011719 37.578124 32.027344 58.308593 50.152344 5.476563 4.796875 12.503907 7.4375 19.792969 7.4375 7.285156 0 14.316406-2.640625 19.785156-7.429687 20.730469-18.128907 40.707032-35.152344 58.328125-50.171876 51.574219-43.949218 96.117188-81.90625 127.109375-119.304687 34.644532-41.800781 50.777344-81.4375 50.777344-124.742187 0-42.066407-14.425781-80.878907-40.617188-109.289063zm0 0" />
234
  </svg>
235
  </button>
236
+ <?php
237
+ echo $display_counters ? sprintf( '<span class="count-box wp_ulike_counter_up" data-ulike-counter-value="%s"></span>', esc_attr( $formatted_total_likes ) ) : '';
238
+ do_action( 'wp_ulike_after_up_vote_button', $wp_ulike_template );
239
+ ?>
240
  </div>
241
  <?php
242
  do_action( 'wp_ulike_inside_template', $wp_ulike_template );
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: like, marketing, elementor, user profile, statistics, favorite, rating, bu
6
  Requires PHP: 5.6
7
  Requires at least: 5.0
8
  Tested up to: 5.7.2
9
- Stable tag: 4.5.2
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -140,6 +140,9 @@ Yes, WP ULike is compatible with Apache, Nginx, Microsoft IIS et LiteSpeed web s
140
 
141
  == Changelog ==
142
 
 
 
 
143
  = 4.5.2 =
144
  * Fixed: JS conflict issue with buddypress activity stream.
145
 
@@ -816,6 +819,9 @@ Yes, WP ULike is compatible with Apache, Nginx, Microsoft IIS et LiteSpeed web s
816
 
817
  == Upgrade Notice ==
818
 
 
 
 
819
  = 4.5.1 =
820
  * Important: If page cache is enabled on your site, clear the cache immediately after updating.
821
 
6
  Requires PHP: 5.6
7
  Requires at least: 5.0
8
  Tested up to: 5.7.2
9
+ Stable tag: 4.5.3
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
140
 
141
  == Changelog ==
142
 
143
+ = 4.5.3 =
144
+ * Fixed: Reported JS counter issues.
145
+
146
  = 4.5.2 =
147
  * Fixed: JS conflict issue with buddypress activity stream.
148
 
819
 
820
  == Upgrade Notice ==
821
 
822
+ = 4.5.3 =
823
+ * Important: If page cache is enabled on your site, clear the cache immediately after updating.
824
+
825
  = 4.5.1 =
826
  * Important: If page cache is enabled on your site, clear the cache immediately after updating.
827
 
wp-ulike.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WP ULike
4
  * Plugin URI: https://wpulike.com/?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash
5
  * Description: Receiving feedback is crucial as a content creator, but unfortunately, the pieces of content you can collect it on are limited by default. However, with the help of the WP ULike plugin, it is possible to cast voting to any type of content you may have on your website. With outstanding and eye-catching widgets, you can have Like and Dislike Button on all of your content would it be a post, comment, BuddyPress activity, bbPress topics, WooCommerce products, you name it. Now you can feel your users Love for each part of your work.
6
- * Version: 4.5.2
7
  * Author: TechnoWich
8
  * Author URI: https://technowich.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
9
  * Text Domain: wp-ulike
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
27
 
28
  // Do not change these values
29
  define( 'WP_ULIKE_PLUGIN_URI' , 'https://wpulike.com/' );
30
- define( 'WP_ULIKE_VERSION' , '4.5.2' );
31
  define( 'WP_ULIKE_DB_VERSION' , '2.1' );
32
  define( 'WP_ULIKE_SLUG' , 'wp-ulike' );
33
  define( 'WP_ULIKE_NAME' , __( 'WP ULike', WP_ULIKE_SLUG ));
3
  * Plugin Name: WP ULike
4
  * Plugin URI: https://wpulike.com/?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash
5
  * Description: Receiving feedback is crucial as a content creator, but unfortunately, the pieces of content you can collect it on are limited by default. However, with the help of the WP ULike plugin, it is possible to cast voting to any type of content you may have on your website. With outstanding and eye-catching widgets, you can have Like and Dislike Button on all of your content would it be a post, comment, BuddyPress activity, bbPress topics, WooCommerce products, you name it. Now you can feel your users Love for each part of your work.
6
+ * Version: 4.5.3
7
  * Author: TechnoWich
8
  * Author URI: https://technowich.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
9
  * Text Domain: wp-ulike
27
 
28
  // Do not change these values
29
  define( 'WP_ULIKE_PLUGIN_URI' , 'https://wpulike.com/' );
30
+ define( 'WP_ULIKE_VERSION' , '4.5.3' );
31
  define( 'WP_ULIKE_DB_VERSION' , '2.1' );
32
  define( 'WP_ULIKE_SLUG' , 'wp-ulike' );
33
  define( 'WP_ULIKE_NAME' , __( 'WP ULike', WP_ULIKE_SLUG ));