Version Description
- Added: New modern "pile + modal" template for likers box. [PRO]
- Added: Auto display option for standard attachments. [PRO]
- Added: New option to filter buddypress user notifications.
- Fixed: An issue with top posts query.
Download this release
Release Info
Developer | alimir |
Plugin | WP ULike |
Version | 4.4.8 |
Comparing to | |
See all releases |
Code changes from version 4.4.7 to 4.4.8
- admin/assets/js/plugins.js +1 -1
- admin/classes/class-wp-ulike-admin-panel.php +15 -0
- assets/js/wp-ulike.js +5 -2
- assets/js/wp-ulike.min.js +2 -2
- includes/classes/class-wp-ulike-cta-listener.php +4 -1
- includes/classes/class-wp-ulike-setting-repo.php +12 -0
- includes/classes/class-wp-ulike-voters-listener.php +4 -1
- includes/functions/general.php +31 -17
- includes/functions/queries.php +10 -9
- includes/hooks/general.php +3 -1
- includes/hooks/shortcodes.php +5 -2
- includes/hooks/third-party.php +3 -3
- readme.txt +8 -2
- wp-ulike.php +3 -3
admin/assets/js/plugins.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WP ULike - v4.4.
|
2 |
* https://wpulike.com
|
3 |
* TechnoWich 2021;
|
4 |
*/
|
1 |
+
/*! WP ULike - v4.4.8
|
2 |
* https://wpulike.com
|
3 |
* TechnoWich 2021;
|
4 |
*/
|
admin/classes/class-wp-ulike-admin-panel.php
CHANGED
@@ -289,6 +289,21 @@ if ( ! class_exists( 'wp_ulike_admin_panel' ) ) {
|
|
289 |
'title' => __('Enable User Notification', WP_ULIKE_SLUG),
|
290 |
'desc' => __('Sends out notifications when you get a like from someone', WP_ULIKE_SLUG),
|
291 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
$buddypress_options = array( array(
|
293 |
'type' => 'content',
|
294 |
'content' => sprintf( '<strong>%s</strong> %s', __( 'BuddyPress', WP_ULIKE_SLUG ), __( 'plugin is not installed or activated', WP_ULIKE_SLUG ) ),
|
289 |
'title' => __('Enable User Notification', WP_ULIKE_SLUG),
|
290 |
'desc' => __('Sends out notifications when you get a like from someone', WP_ULIKE_SLUG),
|
291 |
);
|
292 |
+
$get_content_fields['buddypress']['filter_user_notification_types'] = array(
|
293 |
+
'id' => 'filter_user_notification_types',
|
294 |
+
'type' => 'select',
|
295 |
+
'title' => __( 'Disable Notification Types',WP_ULIKE_SLUG ),
|
296 |
+
'desc' => __('With this option, you can disable user notification on content types.', WP_ULIKE_SLUG),
|
297 |
+
'chosen' => true,
|
298 |
+
'multiple' => true,
|
299 |
+
'options' => array(
|
300 |
+
'post' => __('Posts', WP_ULIKE_SLUG),
|
301 |
+
'comment' => __('Comments', WP_ULIKE_SLUG),
|
302 |
+
'activity' => __('Activities', WP_ULIKE_SLUG),
|
303 |
+
'topic' => __('Topics', WP_ULIKE_SLUG)
|
304 |
+
),
|
305 |
+
'dependency'=> array( 'enable_add_notification', '==', 'true' ),
|
306 |
+
);
|
307 |
$buddypress_options = array( array(
|
308 |
'type' => 'content',
|
309 |
'content' => sprintf( '<strong>%s</strong> %s', __( 'BuddyPress', WP_ULIKE_SLUG ), __( 'plugin is not installed or activated', WP_ULIKE_SLUG ) ),
|
assets/js/wp-ulike.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WP ULike - v4.4.
|
2 |
* https://wpulike.com
|
3 |
* TechnoWich 2021;
|
4 |
*/
|
@@ -819,7 +819,7 @@
|
|
819 |
/**
|
820 |
* init & update likers box
|
821 |
*/
|
822 |
-
_updateLikers: function () {
|
823 |
// Make a request to generate or refresh the likers box
|
824 |
if (this.settings.displayLikers) {
|
825 |
// return on these conditions
|
@@ -849,6 +849,9 @@
|
|
849 |
}
|
850 |
}.bind(this)
|
851 |
);
|
|
|
|
|
|
|
852 |
}
|
853 |
},
|
854 |
|
1 |
+
/*! WP ULike - v4.4.8
|
2 |
* https://wpulike.com
|
3 |
* TechnoWich 2021;
|
4 |
*/
|
819 |
/**
|
820 |
* init & update likers box
|
821 |
*/
|
822 |
+
_updateLikers: function (event) {
|
823 |
// Make a request to generate or refresh the likers box
|
824 |
if (this.settings.displayLikers) {
|
825 |
// return on these conditions
|
849 |
}
|
850 |
}.bind(this)
|
851 |
);
|
852 |
+
|
853 |
+
event.stopImmediatePropagation();
|
854 |
+
return false;
|
855 |
}
|
856 |
},
|
857 |
|
assets/js/wp-ulike.min.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
/*! WP ULike - v4.4.
|
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(),d=n.tooltip.outerWidth(),p=n.tooltip.outerHeight(),u=document.querySelector("body").offsetWidth,h=document.querySelector("body").offsetHeight,g=o.is(":visible")?o.outerHeight():0,m=o.is(":visible")?o.outerWidth():0,c={};if(c.below=h-(p+a+l.top)>5,c.above=l.top-p>5,c.vertical_half=l.top+r/2-p/2>5,c.right=u-(d+r+l.left)>5,c.right_half=u-l.left-r/2-d/2>5,c.right_full=u-l.left-d>5,c.left=l.left-d>5,c.left_half=l.left+r/2-d/2>5,c.left_full=l.left-d>5,n.positionDebug({"Clicked Element":{Left:l.left,Top:l.top}}),n.positionDebug({"Element Dimensions":{Height:a,Width:r},"Tooltip Dimensions":{Height:p,Width:d},"Window Dimensions":{Height:h,Width:u},"Arrow Dimensions":{Height:g,Width:m}}),n.positionDebug(c),("auto"===t||"bottom"===t)&&c.below&&c.left_half&&c.right_half)n.positionDebug("Displaying below, centered"),e="top",i=l.left-d/2+r/2,s=l.top+a+g/2;else if(("auto"===t||"top"===t)&&c.above&&c.left_half&&c.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-d/2+t.width()/2}else i=l.left-d/2+r/2;s=l.top-p-g/2}else("auto"===t||"left"===t)&&c.left&&c.vertical_half?(n.positionDebug("Displaying left, centered"),e="right",i=l.left-d-m/2,s=l.top+a/2-p/2):("auto"===t||"right"===t)&&c.right&&c.vertical_half?(n.positionDebug("Displaying right, centered"),e="left",i=l.left+r+m/2,s=l.top+a/2-p/2):("auto"===t||"bottom"===t)&&c.below&&c.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)&&c.below&&c.left_full?(n.positionDebug("Displaying below, to the left"),e="top ulf-arrow-hug-right",i=l.left+r-d,s=l.top+a+g/2):("auto"===t||"top"===t)&&c.above&&c.right_full?(n.positionDebug("Displaying above, to the right"),e="bottom ulf-arrow-hug-left",i=l.left,s=l.top-p-g/2):("auto"===t||"top"===t)&&c.above&&c.left_full&&(n.positionDebug("Displaying above, to the left"),e="bottom ulf-arrow-hug-right",i=l.left+r-d,s=l.top-p-g/2);return[e,r,d,p,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.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),this.generalElement=this.$element.find(this.settings.generalSelector),this.counterElement=this.generalElement.find(this.settings.counterSelector),this.likersElement=this.$element.find(this.settings.likersSelector),l){var n=this.buttonElement.data(s);void 0!==n&&(this.settings[l[s]]=n)}this.init()}t.extend(a.prototype,{init:function(){this.buttonElement.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(){if(this.settings.displayLikers){if("popover"==this.settings.likersTemplate&&this.$element.data("ulike-tooltip"))return;if("default"==this.settings.likersTemplate&&this.likersElement.length)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))}},_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()),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(this).bind("DOMNodeInserted",(function(e){t(".wpulike").WordpressUlike()}))})),t(".wpulike").WordpressUlike()}(jQuery);
|
1 |
+
/*! WP ULike - v4.4.8
|
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,m=o.is(":visible")?o.outerWidth():0,c={};if(c.below=h-(d+a+l.top)>5,c.above=l.top-d>5,c.vertical_half=l.top+r/2-d/2>5,c.right=u-(p+r+l.left)>5,c.right_half=u-l.left-r/2-p/2>5,c.right_full=u-l.left-p>5,c.left=l.left-p>5,c.left_half=l.left+r/2-p/2>5,c.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:m}}),n.positionDebug(c),("auto"===t||"bottom"===t)&&c.below&&c.left_half&&c.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)&&c.above&&c.left_half&&c.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)&&c.left&&c.vertical_half?(n.positionDebug("Displaying left, centered"),e="right",i=l.left-p-m/2,s=l.top+a/2-d/2):("auto"===t||"right"===t)&&c.right&&c.vertical_half?(n.positionDebug("Displaying right, centered"),e="left",i=l.left+r+m/2,s=l.top+a/2-d/2):("auto"===t||"bottom"===t)&&c.below&&c.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)&&c.below&&c.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)&&c.above&&c.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)&&c.above&&c.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.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),this.generalElement=this.$element.find(this.settings.generalSelector),this.counterElement=this.generalElement.find(this.settings.counterSelector),this.likersElement=this.$element.find(this.settings.likersSelector),l){var n=this.buttonElement.data(s);void 0!==n&&(this.settings[l[s]]=n)}this.init()}t.extend(a.prototype,{init:function(){this.buttonElement.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()),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(this).bind("DOMNodeInserted",(function(e){t(".wpulike").WordpressUlike()}))})),t(".wpulike").WordpressUlike()}(jQuery);
|
includes/classes/class-wp-ulike-cta-listener.php
CHANGED
@@ -120,7 +120,10 @@ final class wp_ulike_cta_listener extends wp_ulike_ajax_listener_base {
|
|
120 |
$this->settings_type->getTableName(),
|
121 |
$this->settings_type->getColumnName(),
|
122 |
$this->data['id'],
|
123 |
-
$this->settings_type->getSettingKey()
|
|
|
|
|
|
|
124 |
);
|
125 |
$this->response['likers'] = ! empty( $template ) ? array(
|
126 |
'template' => $this->data['likersTemplate'] != 'popover' ? $template : sprintf(
|
120 |
$this->settings_type->getTableName(),
|
121 |
$this->settings_type->getColumnName(),
|
122 |
$this->data['id'],
|
123 |
+
$this->settings_type->getSettingKey(),
|
124 |
+
array(
|
125 |
+
'style' => $this->data['likersTemplate']
|
126 |
+
)
|
127 |
);
|
128 |
$this->response['likers'] = ! empty( $template ) ? array(
|
129 |
'template' => $this->data['likersTemplate'] != 'popover' ? $template : sprintf(
|
includes/classes/class-wp-ulike-setting-repo.php
CHANGED
@@ -131,6 +131,18 @@ class wp_ulike_setting_repo {
|
|
131 |
return $enable_toast && ! in_array( $typeName, $filter_toast );
|
132 |
}
|
133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
/**
|
135 |
* Get require login template
|
136 |
*
|
131 |
return $enable_toast && ! in_array( $typeName, $filter_toast );
|
132 |
}
|
133 |
|
134 |
+
/**
|
135 |
+
* Check toast display condition
|
136 |
+
*
|
137 |
+
* @return boolean
|
138 |
+
*/
|
139 |
+
public static function hasNotification( $typeName ){
|
140 |
+
$enable_notice = self::getOption( self::getSettingKey( $typeName ) . '|enable_add_notification', false );
|
141 |
+
$filter_notice = self::getOption( self::getSettingKey( $typeName ) . '|filter_user_notification_types', array() );
|
142 |
+
return $enable_notice && ! in_array( $typeName, $filter_notice );
|
143 |
+
}
|
144 |
+
|
145 |
+
|
146 |
/**
|
147 |
* Get require login template
|
148 |
*
|
includes/classes/class-wp-ulike-voters-listener.php
CHANGED
@@ -49,7 +49,10 @@ final class wp_ulike_voters_listener extends wp_ulike_ajax_listener_base {
|
|
49 |
$this->settings_type->getTableName(),
|
50 |
$this->settings_type->getColumnName(),
|
51 |
$this->data['id'],
|
52 |
-
$this->settings_type->getSettingKey()
|
|
|
|
|
|
|
53 |
);
|
54 |
|
55 |
$this->afterGetListAction();
|
49 |
$this->settings_type->getTableName(),
|
50 |
$this->settings_type->getColumnName(),
|
51 |
$this->data['id'],
|
52 |
+
$this->settings_type->getSettingKey(),
|
53 |
+
array(
|
54 |
+
'style' => $this->data['likersTemplate']
|
55 |
+
)
|
56 |
);
|
57 |
|
58 |
$this->afterGetListAction();
|
includes/functions/general.php
CHANGED
@@ -76,42 +76,47 @@ if( ! function_exists( 'wp_ulike_get_table_info' ) ){
|
|
76 |
* @return void
|
77 |
*/
|
78 |
function wp_ulike_get_table_info( $type = 'post' ){
|
|
|
79 |
$output = array();
|
80 |
|
81 |
switch ( $type ) {
|
82 |
case 'comment':
|
83 |
$output = array(
|
84 |
-
'table'
|
85 |
-
'column'
|
86 |
-
'related_table'
|
87 |
-
'
|
|
|
88 |
);
|
89 |
break;
|
90 |
|
91 |
case 'activity':
|
92 |
$output = array(
|
93 |
-
'table'
|
94 |
-
'column'
|
95 |
-
'related_table'
|
96 |
-
'
|
|
|
97 |
);
|
98 |
break;
|
99 |
|
100 |
case 'topic':
|
101 |
$output = array(
|
102 |
-
'table'
|
103 |
-
'column'
|
104 |
-
'related_table'
|
105 |
-
'
|
|
|
106 |
);
|
107 |
break;
|
108 |
|
109 |
default:
|
110 |
$output = array(
|
111 |
-
'table'
|
112 |
-
'column'
|
113 |
-
'related_table'
|
114 |
-
'
|
|
|
115 |
);
|
116 |
break;
|
117 |
}
|
@@ -336,16 +341,25 @@ if( ! function_exists( 'wp_ulike_get_likers_template' ) ){
|
|
336 |
$defaults = array(
|
337 |
"counter" => ! empty( $options['likers_count'] ) ? $options['likers_count'] : 10,
|
338 |
"template" => ! empty( $options['likers_template'] ) ? $options['likers_template'] : null,
|
|
|
339 |
"avatar_size" => ! empty( $options['likers_gravatar_size'] ) ? $options['likers_gravatar_size'] : 64
|
340 |
);
|
341 |
$parsed_args = wp_parse_args( $args, $defaults );
|
342 |
|
343 |
// Get likers list
|
344 |
-
$get_users = wp_ulike_get_likers_list_per_post( $table_name, $column_name, $item_ID,
|
345 |
// Bulk user list
|
346 |
$users_list = '';
|
347 |
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
if( ! empty( $get_users ) ) {
|
|
|
|
|
349 |
|
350 |
// Get likers html template
|
351 |
$get_template = ! empty( $parsed_args['template'] ) ? $parsed_args['template'] : '<div class="wp-ulike-likers-list">%START_WHILE%<span class="wp-ulike-liker"><a href="#" title="%USER_NAME%">%USER_AVATAR%</a></span>%END_WHILE%</div>' ;
|
76 |
* @return void
|
77 |
*/
|
78 |
function wp_ulike_get_table_info( $type = 'post' ){
|
79 |
+
global $wpdb;
|
80 |
$output = array();
|
81 |
|
82 |
switch ( $type ) {
|
83 |
case 'comment':
|
84 |
$output = array(
|
85 |
+
'table' => 'ulike_comments',
|
86 |
+
'column' => 'comment_id',
|
87 |
+
'related_table' => 'comments',
|
88 |
+
'related_table_prefix' => $wpdb->comments,
|
89 |
+
'related_column' => 'comment_ID'
|
90 |
);
|
91 |
break;
|
92 |
|
93 |
case 'activity':
|
94 |
$output = array(
|
95 |
+
'table' => 'ulike_activities',
|
96 |
+
'column' => 'activity_id',
|
97 |
+
'related_table' => 'bp_activity',
|
98 |
+
'related_table_prefix' => is_multisite() ? $wpdb->base_prefix . 'bp_activity' : $wpdb->prefix . 'bp_activity',
|
99 |
+
'related_column' => 'id'
|
100 |
);
|
101 |
break;
|
102 |
|
103 |
case 'topic':
|
104 |
$output = array(
|
105 |
+
'table' => 'ulike_forums',
|
106 |
+
'column' => 'topic_id',
|
107 |
+
'related_table' => 'posts',
|
108 |
+
'related_table_prefix' => $wpdb->posts,
|
109 |
+
'related_column' => 'ID'
|
110 |
);
|
111 |
break;
|
112 |
|
113 |
default:
|
114 |
$output = array(
|
115 |
+
'table' => 'ulike',
|
116 |
+
'column' => 'post_id',
|
117 |
+
'related_table' => 'posts',
|
118 |
+
'related_table_prefix' => $wpdb->posts,
|
119 |
+
'related_column' => 'ID'
|
120 |
);
|
121 |
break;
|
122 |
}
|
341 |
$defaults = array(
|
342 |
"counter" => ! empty( $options['likers_count'] ) ? $options['likers_count'] : 10,
|
343 |
"template" => ! empty( $options['likers_template'] ) ? $options['likers_template'] : null,
|
344 |
+
"style" => ! empty( $options['likers_style'] ) ? $options['likers_style'] : 'popover',
|
345 |
"avatar_size" => ! empty( $options['likers_gravatar_size'] ) ? $options['likers_gravatar_size'] : 64
|
346 |
);
|
347 |
$parsed_args = wp_parse_args( $args, $defaults );
|
348 |
|
349 |
// Get likers list
|
350 |
+
$get_users = wp_ulike_get_likers_list_per_post( $table_name, $column_name, $item_ID, NULL );
|
351 |
// Bulk user list
|
352 |
$users_list = '';
|
353 |
|
354 |
+
// Create custom template
|
355 |
+
$custom_template = apply_filters( 'wp_ulike_get_likers_template', false, $get_users, $item_ID, $parsed_args, $table_name, $column_name, $options );
|
356 |
+
if( $custom_template !== false ){
|
357 |
+
return $custom_template;
|
358 |
+
}
|
359 |
+
|
360 |
if( ! empty( $get_users ) ) {
|
361 |
+
// Limit array content
|
362 |
+
$get_users = array_slice( $get_users, 0, $parsed_args['counter'] );
|
363 |
|
364 |
// Get likers html template
|
365 |
$get_template = ! empty( $parsed_args['template'] ) ? $parsed_args['template'] : '<div class="wp-ulike-likers-list">%START_WHILE%<span class="wp-ulike-liker"><a href="#" title="%USER_NAME%">%USER_AVATAR%</a></span>%END_WHILE%</div>' ;
|
includes/functions/queries.php
CHANGED
@@ -106,7 +106,7 @@ if( ! function_exists( 'wp_ulike_get_popular_items_info' ) ){
|
|
106 |
ORDER BY %7$s
|
107 |
%8$s %9$s',
|
108 |
$wpdb->prefix . 'ulike_meta',
|
109 |
-
$
|
110 |
$info_args['related_column'],
|
111 |
$related_condition,
|
112 |
$parsed_args['type'],
|
@@ -129,16 +129,17 @@ if( ! function_exists( 'wp_ulike_get_popular_items_info' ) ){
|
|
129 |
SELECT COUNT(t.%1$s) AS counter,
|
130 |
t.%1$s AS item_ID
|
131 |
FROM %2$s t
|
132 |
-
INNER JOIN %3$s r ON t.%1$s = r.%4$s
|
133 |
-
WHERE %
|
134 |
-
%
|
135 |
GROUP BY item_ID
|
136 |
-
ORDER BY %
|
137 |
-
%
|
138 |
$info_args['column'],
|
139 |
$wpdb->prefix . $info_args['table'],
|
140 |
-
$
|
141 |
$info_args['related_column'],
|
|
|
142 |
$status_type,
|
143 |
$user_condition,
|
144 |
$period_limit,
|
@@ -261,7 +262,7 @@ if( ! function_exists( 'wp_ulike_get_popular_items_total_number' ) ){
|
|
261 |
INNER JOIN %2$s r ON t.item_id = r.%3$s %4$s
|
262 |
WHERE t.meta_value > 0 AND t.meta_group = "%5$s" %6$s',
|
263 |
$wpdb->prefix . 'ulike_meta',
|
264 |
-
$
|
265 |
$info_args['related_column'],
|
266 |
$related_condition,
|
267 |
$parsed_args['type'],
|
@@ -286,7 +287,7 @@ if( ! function_exists( 'wp_ulike_get_popular_items_total_number' ) ){
|
|
286 |
%8$s',
|
287 |
$info_args['column'],
|
288 |
$wpdb->prefix . $info_args['table'],
|
289 |
-
$
|
290 |
$info_args['related_column'],
|
291 |
$related_condition,
|
292 |
$status_type,
|
106 |
ORDER BY %7$s
|
107 |
%8$s %9$s',
|
108 |
$wpdb->prefix . 'ulike_meta',
|
109 |
+
$info_args['related_table_prefix'],
|
110 |
$info_args['related_column'],
|
111 |
$related_condition,
|
112 |
$parsed_args['type'],
|
129 |
SELECT COUNT(t.%1$s) AS counter,
|
130 |
t.%1$s AS item_ID
|
131 |
FROM %2$s t
|
132 |
+
INNER JOIN %3$s r ON t.%1$s = r.%4$s %5$s
|
133 |
+
WHERE %6$s %7$s
|
134 |
+
%8$s
|
135 |
GROUP BY item_ID
|
136 |
+
ORDER BY %9$s
|
137 |
+
%10$s %11$s',
|
138 |
$info_args['column'],
|
139 |
$wpdb->prefix . $info_args['table'],
|
140 |
+
$info_args['related_table_prefix'],
|
141 |
$info_args['related_column'],
|
142 |
+
$related_condition,
|
143 |
$status_type,
|
144 |
$user_condition,
|
145 |
$period_limit,
|
262 |
INNER JOIN %2$s r ON t.item_id = r.%3$s %4$s
|
263 |
WHERE t.meta_value > 0 AND t.meta_group = "%5$s" %6$s',
|
264 |
$wpdb->prefix . 'ulike_meta',
|
265 |
+
$info_args['related_table_prefix'],
|
266 |
$info_args['related_column'],
|
267 |
$related_condition,
|
268 |
$parsed_args['type'],
|
287 |
%8$s',
|
288 |
$info_args['column'],
|
289 |
$wpdb->prefix . $info_args['table'],
|
290 |
+
$info_args['related_table_prefix'],
|
291 |
$info_args['related_column'],
|
292 |
$related_condition,
|
293 |
$status_type,
|
includes/hooks/general.php
CHANGED
@@ -175,7 +175,9 @@ if( ! function_exists( 'wp_ulike_display_inline_likers_template' ) ){
|
|
175 |
if( $args['disable_pophover'] || $args['likers_style'] == 'default' ){
|
176 |
echo sprintf(
|
177 |
'<div class="wp_ulike_likers_wrapper wp_%s_likers_%s">%s</div>',
|
178 |
-
$args['type'], $args['ID'], wp_ulike_get_likers_template( $table, $column, $args['ID'], $setting
|
|
|
|
|
179 |
);
|
180 |
}
|
181 |
|
175 |
if( $args['disable_pophover'] || $args['likers_style'] == 'default' ){
|
176 |
echo sprintf(
|
177 |
'<div class="wp_ulike_likers_wrapper wp_%s_likers_%s">%s</div>',
|
178 |
+
$args['type'], $args['ID'], wp_ulike_get_likers_template( $table, $column, $args['ID'], $setting, array(
|
179 |
+
'style' => 'default'
|
180 |
+
) )
|
181 |
);
|
182 |
}
|
183 |
|
includes/hooks/shortcodes.php
CHANGED
@@ -118,6 +118,7 @@ if( ! function_exists( 'wp_ulike_likers_box_shortcode' ) ){
|
|
118 |
"type" => 'post',
|
119 |
"counter" => 10,
|
120 |
"template" => '',
|
|
|
121 |
"avatar_size" => 64
|
122 |
), $atts );
|
123 |
|
@@ -150,8 +151,10 @@ if( ! function_exists( 'wp_ulike_likers_box_shortcode' ) ){
|
|
150 |
$args['template'] = html_entity_decode( $args['template'] );
|
151 |
}
|
152 |
|
153 |
-
|
154 |
-
wp_ulike_get_likers_template( $get_settings['table'], $get_settings['column'], $args['id'], $get_settings['setting'], $args ) )
|
|
|
|
|
155 |
}
|
156 |
add_shortcode( 'wp_ulike_likers_box', 'wp_ulike_likers_box_shortcode' );
|
157 |
}
|
118 |
"type" => 'post',
|
119 |
"counter" => 10,
|
120 |
"template" => '',
|
121 |
+
"style" => '',
|
122 |
"avatar_size" => 64
|
123 |
), $atts );
|
124 |
|
151 |
$args['template'] = html_entity_decode( $args['template'] );
|
152 |
}
|
153 |
|
154 |
+
$output = sprintf( '<div class="wp_ulike_manual_likers_wrapper wp_%s_likers_%d">%s</div>', $args['type'], $args['id'],
|
155 |
+
wp_ulike_get_likers_template( $get_settings['table'], $get_settings['column'], $args['id'], $get_settings['setting'], $args ) );
|
156 |
+
|
157 |
+
return apply_filters( 'wp_ulike_likers_box_shortcode', $output, $args['id'], $args['type'] );
|
158 |
}
|
159 |
add_shortcode( 'wp_ulike_likers_box', 'wp_ulike_likers_box_shortcode' );
|
160 |
}
|
includes/hooks/third-party.php
CHANGED
@@ -215,7 +215,7 @@ if( ! function_exists( 'wp_ulike_add_bp_notifications' ) ){
|
|
215 |
function wp_ulike_add_bp_notifications( $cp_ID, $type, $user_ID, $status, $has_log, $slug ){
|
216 |
|
217 |
// Return if user not logged in or an older data log exist
|
218 |
-
if( ! is_user_logged_in() || $has_log > 0 || !
|
219 |
return;
|
220 |
}
|
221 |
|
@@ -289,8 +289,8 @@ if( ! function_exists( 'wp_ulike_add_bp_notifications' ) ){
|
|
289 |
|
290 |
}
|
291 |
|
292 |
-
//Sends out notifications when you get a like from someone
|
293 |
-
if (
|
294 |
// No notifications from Anonymous
|
295 |
if ( ! $user_ID || false === get_userdata( $user_ID ) ) {
|
296 |
return false;
|
215 |
function wp_ulike_add_bp_notifications( $cp_ID, $type, $user_ID, $status, $has_log, $slug ){
|
216 |
|
217 |
// Return if user not logged in or an older data log exist
|
218 |
+
if( ! is_user_logged_in() || $has_log > 0 || ! defined( 'BP_VERSION' ) ){
|
219 |
return;
|
220 |
}
|
221 |
|
289 |
|
290 |
}
|
291 |
|
292 |
+
// Sends out notifications when you get a like from someone
|
293 |
+
if ( wp_ulike_setting_repo::hasNotification( $slug ) ) {
|
294 |
// No notifications from Anonymous
|
295 |
if ( ! $user_ID || false === get_userdata( $user_ID ) ) {
|
296 |
return false;
|
readme.txt
CHANGED
@@ -5,8 +5,8 @@ Author: TechnoWich
|
|
5 |
Tags: like, marketing, elementor, user profile, statistics, favorite, rating, button, dislike, gamification, bookmark, member
|
6 |
Requires PHP: 5.6
|
7 |
Requires at least: 5.0
|
8 |
-
Tested up to: 5.7
|
9 |
-
Stable tag: 4.4.
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
@@ -140,6 +140,12 @@ Yes, WP ULike is compatible with Apache, Nginx, Microsoft IIS et LiteSpeed web s
|
|
140 |
|
141 |
== Changelog ==
|
142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
= 4.4.7 =
|
144 |
* Improved: Some old functionalities.
|
145 |
* Improved: Compatibility with WordPress 5.7 applied.
|
5 |
Tags: like, marketing, elementor, user profile, statistics, favorite, rating, button, dislike, gamification, bookmark, member
|
6 |
Requires PHP: 5.6
|
7 |
Requires at least: 5.0
|
8 |
+
Tested up to: 5.7.1
|
9 |
+
Stable tag: 4.4.8
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
140 |
|
141 |
== Changelog ==
|
142 |
|
143 |
+
= 4.4.8 =
|
144 |
+
* Added: New modern "pile + modal" template for likers box. [PRO]
|
145 |
+
* Added: Auto display option for standard attachments. [PRO]
|
146 |
+
* Added: New option to filter buddypress user notifications.
|
147 |
+
* Fixed: An issue with top posts query.
|
148 |
+
|
149 |
= 4.4.7 =
|
150 |
* Improved: Some old functionalities.
|
151 |
* Improved: Compatibility with WordPress 5.7 applied.
|
wp-ulike.php
CHANGED
@@ -10,14 +10,14 @@
|
|
10 |
* Plugin Name: WP ULike
|
11 |
* Plugin URI: https://wpulike.com/?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash
|
12 |
* Description: WP ULike plugin allows to integrate a beautiful Ajax Like Button into your wordPress website to allow your visitors to like and unlike pages, posts, comments AND buddypress activities. Its very simple to use and supports many options.
|
13 |
-
* Version: 4.4.
|
14 |
* Author: TechnoWich
|
15 |
* Author URI: https://technowich.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
|
16 |
* Text Domain: wp-ulike
|
17 |
* License: GPL2
|
18 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
19 |
* Domain Path: /languages/
|
20 |
-
* Tested up to: 5.7
|
21 |
|
22 |
/------------------------------------------\
|
23 |
_ __ _ _____ _ _ _ _
|
@@ -41,7 +41,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
41 |
|
42 |
// Do not change these values
|
43 |
define( 'WP_ULIKE_PLUGIN_URI' , 'https://wpulike.com/' );
|
44 |
-
define( 'WP_ULIKE_VERSION' , '4.4.
|
45 |
define( 'WP_ULIKE_DB_VERSION' , '2.1' );
|
46 |
define( 'WP_ULIKE_SLUG' , 'wp-ulike' );
|
47 |
define( 'WP_ULIKE_NAME' , __( 'WP ULike', WP_ULIKE_SLUG ));
|
10 |
* Plugin Name: WP ULike
|
11 |
* Plugin URI: https://wpulike.com/?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash
|
12 |
* Description: WP ULike plugin allows to integrate a beautiful Ajax Like Button into your wordPress website to allow your visitors to like and unlike pages, posts, comments AND buddypress activities. Its very simple to use and supports many options.
|
13 |
+
* Version: 4.4.8
|
14 |
* Author: TechnoWich
|
15 |
* Author URI: https://technowich.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
|
16 |
* Text Domain: wp-ulike
|
17 |
* License: GPL2
|
18 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
19 |
* Domain Path: /languages/
|
20 |
+
* Tested up to: 5.7.1
|
21 |
|
22 |
/------------------------------------------\
|
23 |
_ __ _ _____ _ _ _ _
|
41 |
|
42 |
// Do not change these values
|
43 |
define( 'WP_ULIKE_PLUGIN_URI' , 'https://wpulike.com/' );
|
44 |
+
define( 'WP_ULIKE_VERSION' , '4.4.8' );
|
45 |
define( 'WP_ULIKE_DB_VERSION' , '2.1' );
|
46 |
define( 'WP_ULIKE_SLUG' , 'wp-ulike' );
|
47 |
define( 'WP_ULIKE_NAME' , __( 'WP ULike', WP_ULIKE_SLUG ));
|