WP ULike - Version 1.7

Version Description

  • Added: Buddypress likes support.
  • Added: Post likes logs.
  • Added: Comment likes logs.
  • Added: Buddypress likes logs.
  • Added: pagination for the logs pages.
  • Added: FAQ document on wordpress.org
  • Added: get post likes function.
  • Modified: New setting menu.
  • Updated: language files.
Download this release

Release Info

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

Code changes from version 1.6 to 1.7

assets/img/wp-ulike-17/activity-likes.png ADDED
Binary file
assets/img/wp-ulike-17/likes-logs.png ADDED
Binary file
assets/img/wp-ulike-badge.png ADDED
Binary file
assets/img/wp-ulike-banner.png ADDED
Binary file
assets/js/ulike-activity-function.txt ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function likeThisActivity(activityID, n1, n2) {
2
+ if (activityID != '') {
3
+ jQuery('#wp-ulike-activity-' + activityID + ' .counter').html('<a class="loading"></a><span class="count-box">...</span>');
4
+ jQuery.ajax({
5
+ type:'POST',
6
+ url: ulike_obj.ajaxurl,
7
+ data:{
8
+ action:'ulikebuddypressprocess',
9
+ id: activityID
10
+ },
11
+ success: function(value) {
12
+ if(n1+n2 == 1){
13
+ jQuery('#wp-ulike-activity-' + activityID + ' .counter').html("<a onclick='likeThisActivity("+activityID+",1,1)' class='text'>" + ulike_obj.likeText + "</a><span class='count-box'>"+value+"</span>");
14
+ }
15
+ else if(n1+n2 == 2){
16
+ jQuery('#wp-ulike-activity-' + activityID + ' .counter').html("<a onclick='likeThisActivity("+activityID+",1,0)' class='text'>" + ulike_obj.disLikeText + "</a><span class='count-box'>"+value+"</span>");
17
+ }
18
+ else if(n1+n2 == 3){
19
+ jQuery('#wp-ulike-activity-' + activityID + ' .counter').html("<a class='text user-tooltip' title='Already Voted'>" + ulike_obj.likeText + "</a><span class='count-box'>"+value+"</span>");
20
+ }
21
+ }
22
+ });
23
+ }
24
+ }
assets/js/wp-ulike.js CHANGED
@@ -1 +1 @@
1
- function likeThis(e,l,s){""!=e&&(jQuery("#wp-ulike-"+e+" .counter").html('<a class="loading"></a><span class="count-box">...</span>'),jQuery.ajax({type:"POST",url:ulike_obj.ajaxurl,data:{action:"ulikeprocess",id:e},success:function(a){l+s==1?jQuery("#wp-ulike-"+e+" .counter").html("<a onclick='likeThis("+e+",1,1)' class='text'>"+ulike_obj.likeText+"</a><span class='count-box'>"+a+"</span>"):l+s==2?jQuery("#wp-ulike-"+e+" .counter").html("<a onclick='likeThis("+e+",1,0)' class='text'>"+ulike_obj.disLikeText+"</a><span class='count-box'>"+a+"</span>"):l+s==3&&jQuery("#wp-ulike-"+e+" .counter").html("<a class='text user-tooltip' title='Already Voted'>"+ulike_obj.likeText+"</a><span class='count-box'>"+a+"</span>")}}))}function likeThisComment(e,t,n){if(e!=""){jQuery("#wp-ulike-comment-"+e+" .counter").html('<a class="loading"></a><span class="count-box">...</span>');jQuery.ajax({type:"POST",url:ulike_obj.ajaxurl,data:{action:"ulikecommentprocess",id:e},success:function(r){if(t+n==1){jQuery("#wp-ulike-comment-"+e+" .counter").html("<a onclick='likeThisComment("+e+",1,1)' class='text'>"+ulike_obj.likeText+"</a><span class='count-box'>"+r+"</span>")}else if(t+n==2){jQuery("#wp-ulike-comment-"+e+" .counter").html("<a onclick='likeThisComment("+e+",1,0)' class='text'>"+ulike_obj.disLikeText+"</a><span class='count-box'>"+r+"</span>")}else if(t+n==3){jQuery("#wp-ulike-comment-"+e+" .counter").html("<a class='text user-tooltip' title='Already Voted'>"+ulike_obj.likeText+"</a><span class='count-box'>"+r+"</span>")}}})}}if(!function(t){"use strict";var e=function(t,e){this.init("tooltip",t,e)};e.prototype={constructor:e,init:function(e,i,n){var o,s,r,a,l;for(this.type=e,this.$element=t(i),this.options=this.getOptions(n),this.enabled=!0,r=this.options.trigger.split(" "),l=r.length;l--;)a=r[l],"click"==a?this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this)):"manual"!=a&&(o="hover"==a?"mouseenter":"focus",s="hover"==a?"mouseleave":"blur",this.$element.on(o+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(s+"."+this.type,this.options.selector,t.proxy(this.leave,this)));this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(e){return e=t.extend({},t.fn[this.type].defaults,this.$element.data(),e),e.delay&&"number"==typeof e.delay&&(e.delay={show:e.delay,hide:e.delay}),e},enter:function(e){var i,n=t.fn[this.type].defaults,o={};return this._options&&t.each(this._options,function(t,e){n[t]!=e&&(o[t]=e)},this),i=t(e.currentTarget)[this.type](o).data(this.type),i.options.delay&&i.options.delay.show?(clearTimeout(this.timeout),i.hoverState="in",void(this.timeout=setTimeout(function(){"in"==i.hoverState&&i.show()},i.options.delay.show))):i.show()},leave:function(e){var i=t(e.currentTarget)[this.type](this._options).data(this.type);return this.timeout&&clearTimeout(this.timeout),i.options.delay&&i.options.delay.hide?(i.hoverState="out",void(this.timeout=setTimeout(function(){"out"==i.hoverState&&i.hide()},i.options.delay.hide))):i.hide()},show:function(){var e,i,n,o,s,r,a=t.Event("show");if(this.hasContent()&&this.enabled){if(this.$element.trigger(a),a.isDefaultPrevented())return;switch(e=this.tip(),this.setContent(),this.options.animation&&e.addClass("fade"),s="function"==typeof this.options.placement?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement,e.detach().css({top:0,left:0,display:"block"}),this.options.container?e.appendTo(this.options.container):e.insertAfter(this.$element),i=this.getPosition(),n=e[0].offsetWidth,o=e[0].offsetHeight,s){case"bottom":r={top:i.top+i.height,left:i.left+i.width/2-n/2};break;case"top":r={top:i.top-o,left:i.left+i.width/2-n/2};break;case"left":r={top:i.top+i.height/2-o/2,left:i.left-n};break;case"right":r={top:i.top+i.height/2-o/2,left:i.left+i.width}}this.applyPlacement(r,s),this.$element.trigger("shown")}},applyPlacement:function(t,e){var i,n,o,s,r=this.tip(),a=r[0].offsetWidth,l=r[0].offsetHeight;r.offset(t).addClass(e).addClass("in"),i=r[0].offsetWidth,n=r[0].offsetHeight,"top"==e&&n!=l&&(t.top=t.top+l-n,s=!0),"bottom"==e||"top"==e?(o=0,t.left<0&&(o=-2*t.left,t.left=0,r.offset(t),i=r[0].offsetWidth,n=r[0].offsetHeight),this.replaceArrow(o-a+i,i,"left")):this.replaceArrow(n-l,n,"top"),s&&r.offset(t)},replaceArrow:function(t,e,i){this.arrow().css(i,t?50*(1-t/e)+"%":"")},setContent:function(){var t=this.tip(),e=this.getTitle();t.find(".tooltip-inner")[this.options.html?"html":"text"](e),t.removeClass("fade in top bottom left right")},hide:function(){function e(){var e=setTimeout(function(){i.off(t.support.transition.end).detach()},500);i.one(t.support.transition.end,function(){clearTimeout(e),i.detach()})}var i=this.tip(),n=t.Event("hide");return this.$element.trigger(n),n.isDefaultPrevented()?void 0:(i.removeClass("in"),t.support.transition&&this.$tip.hasClass("fade")?e():i.detach(),this.$element.trigger("hidden"),this)},fixTitle:function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},hasContent:function(){return this.getTitle()},getPosition:function(){var e=this.$element[0];return t.extend({},"function"==typeof e.getBoundingClientRect?e.getBoundingClientRect():{width:e.offsetWidth,height:e.offsetHeight},this.$element.offset())},getTitle:function(){var t,e=this.$element,i=this.options;return t=e.attr("data-original-title")||("function"==typeof i.title?i.title.call(e[0]):i.title)},tip:function(){return this.$tip=this.$tip||t(this.options.template)},arrow:function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(e){var i=e?t(e.currentTarget)[this.type](this._options).data(this.type):this;i.tip().hasClass("in")?i.hide():i.show()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}};var i=t.fn.tooltip;t.fn.tooltip=function(i){return this.each(function(){var n=t(this),o=n.data("tooltip"),s="object"==typeof i&&i;o||n.data("tooltip",o=new e(this,s)),"string"==typeof i&&o[i]()})},t.fn.tooltip.Constructor=e,t.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},t.fn.tooltip.noConflict=function(){return t.fn.tooltip=i,this}}(window.jQuery),"undefined"==typeof jQuery)throw new Error("WP Ulike's JavaScript requires jQuery");if(+function(t){"use strict";function e(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in e)if(void 0!==t.style[i])return{end:e[i]};return!1}t.fn.emulateTransitionEnd=function(e){var i=!1,n=this;t(this).one("bsTransitionEnd",function(){i=!0});var o=function(){i||t(n).trigger(t.support.transition.end)};return setTimeout(o,e),this},t(function(){t.support.transition=e(),t.support.transition&&(t.event.special.bsTransitionEnd={bindType:t.support.transition.end,delegateType:t.support.transition.end,handle:function(e){return t(e.target).is(this)?e.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),"undefined"==typeof jQuery)throw new Error("WP Ulike's JavaScript requires jQuery");+function(t){"use strict";function e(e){return this.each(function(){var i=t(this),o=i.data("bs.alert");o||i.data("bs.alert",o=new n(this)),"string"==typeof e&&o[e].call(i)})}var i='[data-dismiss="alert"]',n=function(e){t(e).on("click",i,this.close)};n.VERSION="3.2.0",n.prototype.close=function(e){function i(){s.detach().trigger("closed.bs.alert").remove()}var n=t(this),o=n.attr("data-target");o||(o=n.attr("href"),o=o&&o.replace(/.*(?=#[^\s]*$)/,""));var s=t(o);e&&e.preventDefault(),s.length||(s=n.hasClass("alert")?n:n.parent()),s.trigger(e=t.Event("close.bs.alert")),e.isDefaultPrevented()||(s.removeClass("in"),t.support.transition&&s.hasClass("fade")?s.one("bsTransitionEnd",i).emulateTransitionEnd(150):i())};var o=t.fn.alert;t.fn.alert=e,t.fn.alert.Constructor=n,t.fn.alert.noConflict=function(){return t.fn.alert=o,this},t(document).on("click.bs.alert.data-api",i,n.prototype.close)}(jQuery),jQuery(document).ready(function(t){t(".user-tooltip").tooltip()});
1
+ function likeThis(e,l,s){""!=e&&(jQuery("#wp-ulike-"+e+" .counter").html('<a class="loading"></a><span class="count-box">...</span>'),jQuery.ajax({type:"POST",url:ulike_obj.ajaxurl,data:{action:"ulikeprocess",id:e},success:function(a){l+s==1?jQuery("#wp-ulike-"+e+" .counter").html("<a onclick='likeThis("+e+",1,1)' class='text'>"+ulike_obj.likeText+"</a><span class='count-box'>"+a+"</span>"):l+s==2?jQuery("#wp-ulike-"+e+" .counter").html("<a onclick='likeThis("+e+",1,0)' class='text'>"+ulike_obj.disLikeText+"</a><span class='count-box'>"+a+"</span>"):l+s==3&&jQuery("#wp-ulike-"+e+" .counter").html("<a class='text user-tooltip' title='Already Voted'>"+ulike_obj.likeText+"</a><span class='count-box'>"+a+"</span>")}}))}function likeThisComment(e,t,n){if(e!=""){jQuery("#wp-ulike-comment-"+e+" .counter").html('<a class="loading"></a><span class="count-box">...</span>');jQuery.ajax({type:"POST",url:ulike_obj.ajaxurl,data:{action:"ulikecommentprocess",id:e},success:function(r){if(t+n==1){jQuery("#wp-ulike-comment-"+e+" .counter").html("<a onclick='likeThisComment("+e+",1,1)' class='text'>"+ulike_obj.likeText+"</a><span class='count-box'>"+r+"</span>")}else if(t+n==2){jQuery("#wp-ulike-comment-"+e+" .counter").html("<a onclick='likeThisComment("+e+",1,0)' class='text'>"+ulike_obj.disLikeText+"</a><span class='count-box'>"+r+"</span>")}else if(t+n==3){jQuery("#wp-ulike-comment-"+e+" .counter").html("<a class='text user-tooltip' title='Already Voted'>"+ulike_obj.likeText+"</a><span class='count-box'>"+r+"</span>")}}})}}function likeThisActivity(t,i,e){""!=t&&(jQuery("#wp-ulike-activity-"+t+" .counter").html('<a class="loading"></a><span class="count-box">...</span>'),jQuery.ajax({type:"POST",url:ulike_obj.ajaxurl,data:{action:"ulikebuddypressprocess",id:t},success:function(a){i+e==1?jQuery("#wp-ulike-activity-"+t+" .counter").html("<a onclick='likeThisActivity("+t+",1,1)' class='text'>"+ulike_obj.likeText+"</a><span class='count-box'>"+a+"</span>"):i+e==2?jQuery("#wp-ulike-activity-"+t+" .counter").html("<a onclick='likeThisActivity("+t+",1,0)' class='text'>"+ulike_obj.disLikeText+"</a><span class='count-box'>"+a+"</span>"):i+e==3&&jQuery("#wp-ulike-activity-"+t+" .counter").html("<a class='text user-tooltip' title='Already Voted'>"+ulike_obj.likeText+"</a><span class='count-box'>"+a+"</span>")}}))}if(!function(t){"use strict";var e=function(t,e){this.init("tooltip",t,e)};e.prototype={constructor:e,init:function(e,i,n){var o,s,r,a,l;for(this.type=e,this.$element=t(i),this.options=this.getOptions(n),this.enabled=!0,r=this.options.trigger.split(" "),l=r.length;l--;)a=r[l],"click"==a?this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this)):"manual"!=a&&(o="hover"==a?"mouseenter":"focus",s="hover"==a?"mouseleave":"blur",this.$element.on(o+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(s+"."+this.type,this.options.selector,t.proxy(this.leave,this)));this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(e){return e=t.extend({},t.fn[this.type].defaults,this.$element.data(),e),e.delay&&"number"==typeof e.delay&&(e.delay={show:e.delay,hide:e.delay}),e},enter:function(e){var i,n=t.fn[this.type].defaults,o={};return this._options&&t.each(this._options,function(t,e){n[t]!=e&&(o[t]=e)},this),i=t(e.currentTarget)[this.type](o).data(this.type),i.options.delay&&i.options.delay.show?(clearTimeout(this.timeout),i.hoverState="in",void(this.timeout=setTimeout(function(){"in"==i.hoverState&&i.show()},i.options.delay.show))):i.show()},leave:function(e){var i=t(e.currentTarget)[this.type](this._options).data(this.type);return this.timeout&&clearTimeout(this.timeout),i.options.delay&&i.options.delay.hide?(i.hoverState="out",void(this.timeout=setTimeout(function(){"out"==i.hoverState&&i.hide()},i.options.delay.hide))):i.hide()},show:function(){var e,i,n,o,s,r,a=t.Event("show");if(this.hasContent()&&this.enabled){if(this.$element.trigger(a),a.isDefaultPrevented())return;switch(e=this.tip(),this.setContent(),this.options.animation&&e.addClass("fade"),s="function"==typeof this.options.placement?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement,e.detach().css({top:0,left:0,display:"block"}),this.options.container?e.appendTo(this.options.container):e.insertAfter(this.$element),i=this.getPosition(),n=e[0].offsetWidth,o=e[0].offsetHeight,s){case"bottom":r={top:i.top+i.height,left:i.left+i.width/2-n/2};break;case"top":r={top:i.top-o,left:i.left+i.width/2-n/2};break;case"left":r={top:i.top+i.height/2-o/2,left:i.left-n};break;case"right":r={top:i.top+i.height/2-o/2,left:i.left+i.width}}this.applyPlacement(r,s),this.$element.trigger("shown")}},applyPlacement:function(t,e){var i,n,o,s,r=this.tip(),a=r[0].offsetWidth,l=r[0].offsetHeight;r.offset(t).addClass(e).addClass("in"),i=r[0].offsetWidth,n=r[0].offsetHeight,"top"==e&&n!=l&&(t.top=t.top+l-n,s=!0),"bottom"==e||"top"==e?(o=0,t.left<0&&(o=-2*t.left,t.left=0,r.offset(t),i=r[0].offsetWidth,n=r[0].offsetHeight),this.replaceArrow(o-a+i,i,"left")):this.replaceArrow(n-l,n,"top"),s&&r.offset(t)},replaceArrow:function(t,e,i){this.arrow().css(i,t?50*(1-t/e)+"%":"")},setContent:function(){var t=this.tip(),e=this.getTitle();t.find(".tooltip-inner")[this.options.html?"html":"text"](e),t.removeClass("fade in top bottom left right")},hide:function(){function e(){var e=setTimeout(function(){i.off(t.support.transition.end).detach()},500);i.one(t.support.transition.end,function(){clearTimeout(e),i.detach()})}var i=this.tip(),n=t.Event("hide");return this.$element.trigger(n),n.isDefaultPrevented()?void 0:(i.removeClass("in"),t.support.transition&&this.$tip.hasClass("fade")?e():i.detach(),this.$element.trigger("hidden"),this)},fixTitle:function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},hasContent:function(){return this.getTitle()},getPosition:function(){var e=this.$element[0];return t.extend({},"function"==typeof e.getBoundingClientRect?e.getBoundingClientRect():{width:e.offsetWidth,height:e.offsetHeight},this.$element.offset())},getTitle:function(){var t,e=this.$element,i=this.options;return t=e.attr("data-original-title")||("function"==typeof i.title?i.title.call(e[0]):i.title)},tip:function(){return this.$tip=this.$tip||t(this.options.template)},arrow:function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(e){var i=e?t(e.currentTarget)[this.type](this._options).data(this.type):this;i.tip().hasClass("in")?i.hide():i.show()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}};var i=t.fn.tooltip;t.fn.tooltip=function(i){return this.each(function(){var n=t(this),o=n.data("tooltip"),s="object"==typeof i&&i;o||n.data("tooltip",o=new e(this,s)),"string"==typeof i&&o[i]()})},t.fn.tooltip.Constructor=e,t.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},t.fn.tooltip.noConflict=function(){return t.fn.tooltip=i,this}}(window.jQuery),"undefined"==typeof jQuery)throw new Error("WP Ulike's JavaScript requires jQuery");if(+function(t){"use strict";function e(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in e)if(void 0!==t.style[i])return{end:e[i]};return!1}t.fn.emulateTransitionEnd=function(e){var i=!1,n=this;t(this).one("bsTransitionEnd",function(){i=!0});var o=function(){i||t(n).trigger(t.support.transition.end)};return setTimeout(o,e),this},t(function(){t.support.transition=e(),t.support.transition&&(t.event.special.bsTransitionEnd={bindType:t.support.transition.end,delegateType:t.support.transition.end,handle:function(e){return t(e.target).is(this)?e.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),"undefined"==typeof jQuery)throw new Error("WP Ulike's JavaScript requires jQuery");+function(t){"use strict";function e(e){return this.each(function(){var i=t(this),o=i.data("bs.alert");o||i.data("bs.alert",o=new n(this)),"string"==typeof e&&o[e].call(i)})}var i='[data-dismiss="alert"]',n=function(e){t(e).on("click",i,this.close)};n.VERSION="3.2.0",n.prototype.close=function(e){function i(){s.detach().trigger("closed.bs.alert").remove()}var n=t(this),o=n.attr("data-target");o||(o=n.attr("href"),o=o&&o.replace(/.*(?=#[^\s]*$)/,""));var s=t(o);e&&e.preventDefault(),s.length||(s=n.hasClass("alert")?n:n.parent()),s.trigger(e=t.Event("close.bs.alert")),e.isDefaultPrevented()||(s.removeClass("in"),t.support.transition&&s.hasClass("fade")?s.one("bsTransitionEnd",i).emulateTransitionEnd(150):i())};var o=t.fn.alert;t.fn.alert=e,t.fn.alert.Constructor=n,t.fn.alert.noConflict=function(){return t.fn.alert=o,this},t(document).on("click.bs.alert.data-api",i,n.prototype.close)}(jQuery),jQuery(document).ready(function(t){t(".user-tooltip").tooltip()});
class/pagination.class.php ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class pagination{
3
+ /*
4
+ Script Name: *Digg Style Paginator Class
5
+ Script URI: http://www.mis-algoritmos.com/2007/05/27/digg-style-pagination-class/
6
+ Description: Class in PHP that allows to use a pagination like a digg or sabrosus style.
7
+ Script Version: 0.4
8
+ Author: Victor De la Rocha
9
+ Author URI: http://www.mis-algoritmos.com
10
+ */
11
+ /*Default values*/
12
+ var $total_pages = -1;//items
13
+ var $limit = null;
14
+ var $target = "";
15
+ var $page = 1;
16
+ var $adjacents = 2;
17
+ var $showCounter = false;
18
+ var $className = "pagination";
19
+ var $parameterName = "page";
20
+ var $urlF = false;//urlFriendly
21
+
22
+ /*Buttons next and previous*/
23
+ var $nextT = "Next";
24
+ var $nextI = "&#187;"; //&#9658;
25
+ var $prevT = "Previous";
26
+ var $prevI = "&#171;"; //&#9668;
27
+
28
+ /*****/
29
+ var $calculate = false;
30
+
31
+ #Total items
32
+ function items($value){$this->total_pages = (int) $value;}
33
+
34
+ #how many items to show per page
35
+ function limit($value){$this->limit = (int) $value;}
36
+
37
+ #Page to sent the page value
38
+ function target($value){$this->target = $value;}
39
+
40
+ #Current page
41
+ function currentPage($value){$this->page = (int) $value;}
42
+
43
+ #How many adjacent pages should be shown on each side of the current page?
44
+ function adjacents($value){$this->adjacents = (int) $value;}
45
+
46
+ #show counter?
47
+ function showCounter($value=""){$this->showCounter=($value===true)?true:false;}
48
+
49
+ #to change the class name of the pagination div
50
+ function changeClass($value=""){$this->className=$value;}
51
+
52
+ function nextLabel($value){$this->nextT = $value;}
53
+ function nextIcon($value){$this->nextI = $value;}
54
+ function prevLabel($value){$this->prevT = $value;}
55
+ function prevIcon($value){$this->prevI = $value;}
56
+
57
+ #to change the class name of the pagination div
58
+ function parameterName($value=""){$this->parameterName=$value;}
59
+
60
+ #to change urlFriendly
61
+ function urlFriendly($value="%"){
62
+ if(eregi('^ *$',$value)){
63
+ $this->urlF=false;
64
+ return false;
65
+ }
66
+ $this->urlF=$value;
67
+ }
68
+
69
+ var $pagination;
70
+
71
+ function pagination(){}
72
+ function show(){
73
+ if(!$this->calculate)
74
+ if($this->calculate())
75
+ echo "<div class=\"$this->className\">$this->pagination</div>\n";
76
+ }
77
+ function getOutput(){
78
+ if(!$this->calculate)
79
+ if($this->calculate())
80
+ return "<div class=\"$this->className\">$this->pagination</div>\n";
81
+ }
82
+ function get_pagenum_link($id){
83
+ if(strpos($this->target,'?')===false)
84
+ if($this->urlF)
85
+ return str_replace($this->urlF,$id,$this->target);
86
+ else
87
+ return "$this->target?$this->parameterName=$id";
88
+ else
89
+ return "$this->target&$this->parameterName=$id";
90
+ }
91
+
92
+ function calculate(){
93
+ $this->pagination = "";
94
+ $this->calculate == true;
95
+ $error = false;
96
+ if($this->urlF and $this->urlF != '%' and strpos($this->target,$this->urlF)===false){
97
+ //Es necesario especificar el comodin para sustituir
98
+ echo "Especificaste un wildcard para sustituir, pero no existe en el target<br />";
99
+ $error = true;
100
+ }elseif($this->urlF and $this->urlF == '%' and strpos($this->target,$this->urlF)===false){
101
+ echo "Es necesario especificar en el target el comodin % para sustituir el n�mero de p�gina<br />";
102
+ $error = true;
103
+ }
104
+
105
+ if($this->total_pages < 0){
106
+ echo "It is necessary to specify the <strong>number of pages</strong> (\$class->items(1000))<br />";
107
+ $error = true;
108
+ }
109
+ if($this->limit == null){
110
+ echo "It is necessary to specify the <strong>limit of items</strong> to show per page (\$class->limit(10))<br />";
111
+ $error = true;
112
+ }
113
+ if($error)return false;
114
+
115
+ $n = trim($this->nextT.' '.$this->nextI);
116
+ $p = trim($this->prevI.' '.$this->prevT);
117
+
118
+ /* Setup vars for query. */
119
+ if($this->page)
120
+ $start = ($this->page - 1) * $this->limit; //first item to display on this page
121
+ else
122
+ $start = 0; //if no page var is given, set start to 0
123
+
124
+ /* Setup page vars for display. */
125
+ $prev = $this->page - 1; //previous page is page - 1
126
+ $next = $this->page + 1; //next page is page + 1
127
+ $lastpage = ceil($this->total_pages/$this->limit); //lastpage is = total pages / items per page, rounded up.
128
+ $lpm1 = $lastpage - 1; //last page minus 1
129
+
130
+ /*
131
+ Now we apply our rules and draw the pagination object.
132
+ We're actually saving the code to a variable in case we want to draw it more than once.
133
+ */
134
+
135
+ if($lastpage > 1){
136
+ if($this->page){
137
+ //anterior button
138
+ if($this->page > 1)
139
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($prev)."\" class=\"prev\">$p</a>";
140
+ else
141
+ $this->pagination .= "<span class=\"disabled\">$p</span>";
142
+ }
143
+ //pages
144
+ if ($lastpage < 7 + ($this->adjacents * 2)){//not enough pages to bother breaking it up
145
+ for ($counter = 1; $counter <= $lastpage; $counter++){
146
+ if ($counter == $this->page)
147
+ $this->pagination .= "<span class=\"current\">$counter</span>";
148
+ else
149
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\">$counter</a>";
150
+ }
151
+ }
152
+ elseif($lastpage > 5 + ($this->adjacents * 2)){//enough pages to hide some
153
+ //close to beginning; only hide later pages
154
+ if($this->page < 1 + ($this->adjacents * 2)){
155
+ for ($counter = 1; $counter < 4 + ($this->adjacents * 2); $counter++){
156
+ if ($counter == $this->page)
157
+ $this->pagination .= "<span class=\"current\">$counter</span>";
158
+ else
159
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\">$counter</a>";
160
+ }
161
+ $this->pagination .= "...";
162
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($lpm1)."\">$lpm1</a>";
163
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($lastpage)."\">$lastpage</a>";
164
+ }
165
+ //in middle; hide some front and some back
166
+ elseif($lastpage - ($this->adjacents * 2) > $this->page && $this->page > ($this->adjacents * 2)){
167
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link(1)."\">1</a>";
168
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link(2)."\">2</a>";
169
+ $this->pagination .= "...";
170
+ for ($counter = $this->page - $this->adjacents; $counter <= $this->page + $this->adjacents; $counter++)
171
+ if ($counter == $this->page)
172
+ $this->pagination .= "<span class=\"current\">$counter</span>";
173
+ else
174
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\">$counter</a>";
175
+ $this->pagination .= "...";
176
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($lpm1)."\">$lpm1</a>";
177
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($lastpage)."\">$lastpage</a>";
178
+ }
179
+ //close to end; only hide early pages
180
+ else{
181
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link(1)."\">1</a>";
182
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link(2)."\">2</a>";
183
+ $this->pagination .= "...";
184
+ for ($counter = $lastpage - (2 + ($this->adjacents * 2)); $counter <= $lastpage; $counter++)
185
+ if ($counter == $this->page)
186
+ $this->pagination .= "<span class=\"current\">$counter</span>";
187
+ else
188
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\">$counter</a>";
189
+ }
190
+ }
191
+ if($this->page){
192
+ //siguiente button
193
+ if ($this->page < $counter - 1)
194
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($next)."\" class=\"next\">$n</a>";
195
+ else
196
+ $this->pagination .= "<span class=\"disabled\">$n</span>";
197
+ if($this->showCounter)$this->pagination .= "<div class=\"pagination_data\">($this->total_pages Pages)</div>";
198
+ }
199
+ }
200
+
201
+ return true;
202
+ }
203
+ }
204
+ ?>
inc/about-page.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WP ULike about page
4
+ */
5
+
6
+ add_filter('get_avatar', 'remove_photo_class');
7
+ function remove_photo_class($avatar) {
8
+ return str_replace(' photo', ' gravatar', $avatar);
9
+ }
10
+
11
+ ?>
12
+
13
+ <style>
14
+ .ulike-badge{
15
+ background: url('<?php echo plugins_url('/assets', dirname(__FILE__)); ?>/img/wp-ulike-badge.png') no-repeat scroll center 24px / 150px 150px;
16
+ margin: 5px 0px 0px;
17
+ padding-top: 120px;
18
+ display: inline-block;
19
+ height:60px;
20
+ width: 150px;
21
+ }
22
+ <?php if(is_rtl()): ?>
23
+ .about-wrap .ulike-badge {
24
+ position: absolute;
25
+ top: 0px;
26
+ left: 0px;
27
+ }
28
+ <?php else: ?>
29
+ .about-wrap .ulike-badge {
30
+ position: absolute;
31
+ top: 0px;
32
+ right: 0px;
33
+ }
34
+ <?php endif; ?>
35
+ </style>
36
+
37
+ <div class="wrap about-wrap">
38
+
39
+ <h1><?php echo _e('Welcome to WP ULike','alimir') . ' ' . wp_ulike_get_version(); ?></h1>
40
+
41
+ <div class="about-text"><?php echo _e('Thanks for updating! This version is our leanest and most powerful version yet.', 'alimir'); ?></div>
42
+ <div class="ulike-badge"></div>
43
+
44
+ <h2 class="nav-tab-wrapper">
45
+ <a class="nav-tab nav-tab-active" href="#"><?php echo _e('What’s New','alimir'); ?></a>
46
+
47
+ </h2>
48
+
49
+ <div class="changelog">
50
+ <h2 class="about-headline-callout"><?php echo _e('About WP ULike', 'alimir'); ?></h2>
51
+ <img class="about-overview-img" src="<?php echo plugins_url('/assets', dirname(__FILE__)); ?>/img/wp-ulike-banner.png" alt="WP ULike" />
52
+ <p class="about-description"><?php _e('WP ULike enables you to add Ajax Like button into your WordPress site and allowing your visitors to like and dislike posts, pages, comments AND buddypress activities. It features: Clean Design, Ajax feature to update the data without reloading, Custom Like-Dislike Texts, Simple custom style with color picker settings, BuddyPress activity support, Widget to show Most Liked Posts And Most Liked Users avatars, Added automatically, RTL language support, Simple configuration panel and many more...', 'alimir'); ?></p>
53
+ </div>
54
+
55
+ <hr />
56
+
57
+ <div class="changelog">
58
+ <h2 class="about-headline-callout"><?php echo _e('New Administrative Tools','alimir'); ?></h2>
59
+
60
+ <div class="feature-section col two-col">
61
+ <div>
62
+ <h4>Buddypress likes support</h4>
63
+ <img style="width:90%" src="<?php echo plugins_url('/assets', dirname(__FILE__)); ?>/img/wp-ulike-17/activity-likes.png" alt="WP ULike" />
64
+ </div>
65
+
66
+ <div class="last-feature">
67
+ <h4>Likes Logs Support</h4>
68
+ <img style="width:90%" src="<?php echo plugins_url('/assets', dirname(__FILE__)); ?>/img/wp-ulike-17/likes-logs.png" alt="WP ULike" />
69
+ </div>
70
+ </div>
71
+
72
+ </div>
73
+
74
+ <hr />
75
+
76
+ <h2 class="about-headline-callout"><?php echo _e('Credits'); ?></h2><br />
77
+ <ul class="wp-people-group">
78
+ <li class="wp-person" id="wp-person-alimirzaei">
79
+ <a href="http://about.alimir.ir"><?php echo get_avatar( 'info@alimir.ir', 64 ); ?></a>
80
+ <a class="web" href="https://profiles.wordpress.org/alimir/">Ali Mirzaei</a>
81
+ <span class="title">Project Lead</span>
82
+ </li>
83
+ </ul>
84
+
85
+ <h4 class="wp-people-group"><?php _e('Translations','alimir'); ?></h4>
86
+ English, Persian, France, Chinese (Thanks Changmeng Hu), Chinese Tradition (Thanks Arefly)
87
+
88
+ <h4 class="wp-people-group"><?php _e('Like this plugin?','alimir'); ?></h4>
89
+ <p><?php _e('Show your support by Rating 5 Star in <a href="http://wordpress.org/plugins/wp-ulike"> Plugin Directory reviews</a>','alimir'); ?></p>
90
+
91
+ </div>
inc/wp-functions.php CHANGED
@@ -26,15 +26,6 @@
26
 
27
  $get_users = $wpdb->get_results("SELECT user_id FROM ".$wpdb->prefix."ulike WHERE post_id = '$post_ID'");
28
 
29
- /*
30
- $you_liked_this = $wpdb->get_var("SELECT user_id FROM ".$wpdb->prefix."ulike WHERE user_id = '$user_ID'");
31
- $get_user_likes_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."ulike WHERE user_id = '$get_user->user_id'");
32
- $count_user = count($get_users);
33
- if ($user_ID == $you_liked_this){
34
- $users_list .= "You , $count_user";
35
- }
36
- */
37
-
38
  foreach ( $get_users as $get_user )
39
  {
40
  if ($user_ID != $get_user->user_id):
@@ -66,6 +57,25 @@
66
 
67
  }
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  //get user status (like or dislike)
70
  function get_user_status($post_ID,$user_ID){
71
  global $wpdb;
@@ -86,6 +96,16 @@
86
  return "dislike";
87
  }
88
 
 
 
 
 
 
 
 
 
 
 
89
  //get user style settings
90
  function get_user_style(){
91
  $btn_style = '';
@@ -129,13 +149,24 @@
129
  ";
130
  }
131
 
 
 
 
 
 
 
 
 
 
 
 
132
  function wp_ulike_bp_activity_add($user_ID,$cp_ID,$type){
133
  if (function_exists('bp_is_active') && get_option('wp_ulike_bp_activity_add') == '1') {
134
  if($type=='comment'){
135
  bp_activity_add( array(
136
  'user_id' => $user_ID,
137
  'action' => '<strong>'.bp_core_get_userlink($user_ID).'</strong> '.__('liked','alimir').' <strong>'.get_comment_author($cp_ID).'</strong> '.__('comment','alimir').'. (So far, '.get_comment_author($cp_ID).' has <span class="badge">'. get_comment_meta($cp_ID, '_commentliked', true) .'</span> likes for this comment)',
138
- 'component' => 'wp_like',
139
  'type' => 'wp_like_group',
140
  'item_id' => $cp_ID
141
  ));
@@ -145,7 +176,7 @@
145
  bp_activity_add( array(
146
  'user_id' => $user_ID,
147
  'action' => '<strong>'.bp_core_get_userlink($user_ID).'</strong> '.__('liked','alimir').' <a href="'.get_permalink($cp_ID). '" title="'.$parent_title.'">'.$parent_title.'</a>. (So far, This post has <span class="badge">'.get_post_meta($cp_ID, '_liked', true).'</span> likes)',
148
- 'component' => 'wp_like',
149
  'type' => 'wp_like_group',
150
  'item_id' => $cp_ID
151
  ));
@@ -156,22 +187,47 @@
156
  }
157
  }
158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  //Convert numbers of Likes with string (kilobyte) format.
160
  function wp_ulike_format_number($num){
161
- if ($num >= 1000 && get_option('wp_ulike_format_number') == '1'){
162
- return round($num/1000, 2) . 'K+';
163
- }
164
  else
165
- return $num . '+';
 
 
166
  }
167
 
168
- //Shortcode function
 
 
 
 
 
 
169
  function wp_ulike_shortcode(){
170
  return wp_ulike('put');
171
  }
172
  add_shortcode( 'wp_ulike', 'wp_ulike_shortcode' );
173
 
174
- //add ULike button to the posts
175
  if (get_option('wp_ulike_onPage') == '1') {
176
  function wp_put_ulike($content) {
177
  if(!is_feed() && !is_page()) {
@@ -183,7 +239,7 @@
183
  add_filter('the_content', 'wp_put_ulike');
184
  }
185
 
186
- //add ULike button to the comments
187
  if (get_option('wp_ulike_onComments') == '1' && !is_admin()) {
188
  function wp_put_ulike_comments($content) {
189
  $content.= wp_ulike_comments('put');
@@ -191,4 +247,14 @@
191
  }
192
 
193
  add_filter('comment_text', 'wp_put_ulike_comments');
 
 
 
 
 
 
 
 
 
 
194
  }
26
 
27
  $get_users = $wpdb->get_results("SELECT user_id FROM ".$wpdb->prefix."ulike WHERE post_id = '$post_ID'");
28
 
 
 
 
 
 
 
 
 
 
29
  foreach ( $get_users as $get_user )
30
  {
31
  if ($user_ID != $get_user->user_id):
57
 
58
  }
59
 
60
+ //get user status (like or dislike)
61
+ function get_user_activities_data($activityID,$user_ID){
62
+ global $wpdb;
63
+ $users_list = '';
64
+
65
+ $get_users = $wpdb->get_results("SELECT user_id FROM ".$wpdb->prefix."ulike_activities WHERE activity_id = '$activityID'");
66
+
67
+ foreach ( $get_users as $get_user )
68
+ {
69
+ if ($user_ID != $get_user->user_id):
70
+ $user_info = get_userdata($get_user->user_id);
71
+ $users_list .= '<li><a class="user-tooltip" title="'.$user_info->display_name.'">'.get_avatar( $user_info->user_email, 32, '' , 'avatar').'</a></li>';
72
+ endif;
73
+ }
74
+
75
+ return $users_list;
76
+
77
+ }
78
+
79
  //get user status (like or dislike)
80
  function get_user_status($post_ID,$user_ID){
81
  global $wpdb;
96
  return "dislike";
97
  }
98
 
99
+ //get user activity status (like or dislike)
100
+ function get_user_activities_status($activityID,$user_ID){
101
+ global $wpdb;
102
+ $like_status = $wpdb->get_var("SELECT status FROM ".$wpdb->prefix."ulike_activities WHERE activity_id = '$activityID' AND user_id = '$user_ID'");
103
+ if ($like_status == "like")
104
+ return "like";
105
+ else
106
+ return "dislike";
107
+ }
108
+
109
  //get user style settings
110
  function get_user_style(){
111
  $btn_style = '';
149
  ";
150
  }
151
 
152
+ function wp_ulike_register_activity_actions() {
153
+ global $bp;
154
+ bp_activity_set_action(
155
+ $bp->activity->id,
156
+ 'wp_like_group',
157
+ __( 'WP ULike Activity', 'alimir' )
158
+ );
159
+ }
160
+
161
+ add_action( 'bp_register_activity_actions', 'wp_ulike_register_activity_actions' );
162
+
163
  function wp_ulike_bp_activity_add($user_ID,$cp_ID,$type){
164
  if (function_exists('bp_is_active') && get_option('wp_ulike_bp_activity_add') == '1') {
165
  if($type=='comment'){
166
  bp_activity_add( array(
167
  'user_id' => $user_ID,
168
  'action' => '<strong>'.bp_core_get_userlink($user_ID).'</strong> '.__('liked','alimir').' <strong>'.get_comment_author($cp_ID).'</strong> '.__('comment','alimir').'. (So far, '.get_comment_author($cp_ID).' has <span class="badge">'. get_comment_meta($cp_ID, '_commentliked', true) .'</span> likes for this comment)',
169
+ 'component' => 'activity',
170
  'type' => 'wp_like_group',
171
  'item_id' => $cp_ID
172
  ));
176
  bp_activity_add( array(
177
  'user_id' => $user_ID,
178
  'action' => '<strong>'.bp_core_get_userlink($user_ID).'</strong> '.__('liked','alimir').' <a href="'.get_permalink($cp_ID). '" title="'.$parent_title.'">'.$parent_title.'</a>. (So far, This post has <span class="badge">'.get_post_meta($cp_ID, '_liked', true).'</span> likes)',
179
+ 'component' => 'activity',
180
  'type' => 'wp_like_group',
181
  'item_id' => $cp_ID
182
  ));
187
  }
188
  }
189
 
190
+ //This function will be complete in the future
191
+ /*
192
+ function wp_ulike_bp_notification($user_ID,$activityID){
193
+ global $bp;
194
+ if ( bp_is_active( 'notifications' ) ) {
195
+ bp_notifications_add_notification( array(
196
+ 'user_id' => 1,
197
+ 'item_id' => $activityID,
198
+ 'secondary_item_id' => 3,
199
+ 'date_notified' => bp_core_current_time(),
200
+ 'is_new' => 1,
201
+ ) );
202
+ }
203
+ }
204
+ add_action( 'bp_activity_sent_mention_email', 'wp_ulike_bp_notification', 10, 5 );
205
+ */
206
+
207
  //Convert numbers of Likes with string (kilobyte) format.
208
  function wp_ulike_format_number($num){
209
+ $plus = '+';
210
+ if ($num >= 1000 && get_option('wp_ulike_format_number') == '1')
211
+ $value = round($num/1000, 2) . 'K' . $plus;
212
  else
213
+ $value = $num . $plus;
214
+ $value = apply_filters( 'wp_ulike_format_number', $value, $num, $plus);
215
+ return $value;
216
  }
217
 
218
+ //get the post likes number
219
+ function wp_ulike_get_post_likes($postID){
220
+ $val = get_post_meta($postID, '_liked', true);
221
+ return wp_ulike_format_number($val);
222
+ }
223
+
224
+ //Shortcode function for the post likes
225
  function wp_ulike_shortcode(){
226
  return wp_ulike('put');
227
  }
228
  add_shortcode( 'wp_ulike', 'wp_ulike_shortcode' );
229
 
230
+ //Insert ULike button to the posts
231
  if (get_option('wp_ulike_onPage') == '1') {
232
  function wp_put_ulike($content) {
233
  if(!is_feed() && !is_page()) {
239
  add_filter('the_content', 'wp_put_ulike');
240
  }
241
 
242
+ //Insert ULike button to the comments
243
  if (get_option('wp_ulike_onComments') == '1' && !is_admin()) {
244
  function wp_put_ulike_comments($content) {
245
  $content.= wp_ulike_comments('put');
247
  }
248
 
249
  add_filter('comment_text', 'wp_put_ulike_comments');
250
+ }
251
+
252
+ //Insert ULike button to the activities
253
+ if (get_option('wp_ulike_onActivities') == '1' && !is_admin()) {
254
+ function wp_put_ulike_buddypress($content) {
255
+ $content.= wp_ulike_buddypress('put');
256
+ return $content;
257
+ }
258
+
259
+ add_filter('bp_get_activity_action', 'wp_put_ulike_buddypress',10,2);
260
  }
inc/wp-logs.php ADDED
@@ -0,0 +1,338 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //include pagination class
3
+ include( plugin_dir_path(dirname(__FILE__)) . 'class/pagination.class.php');
4
+
5
+ function wp_ulike_post_likes_logs(){
6
+ global $wpdb;
7
+ $alternate = true;
8
+ $items = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."ulike");
9
+ if($items > 0) {
10
+ $p = new pagination;
11
+ $p->items($items);
12
+ $p->limit(20); // Limit entries per page
13
+ $p->target("admin.php?page=" . plugin_basename( dirname(__FILE__) ) . '/wp-options.php/post_logs');
14
+ $p->calculate(); // Calculates what to show
15
+ $p->parameterName('page_number');
16
+ $p->adjacents(1); //No. of page away from the current page
17
+
18
+ if(!isset($_GET['page_number'])) {
19
+ $p->page = 1;
20
+ } else {
21
+ $p->page = $_GET['page_number'];
22
+ }
23
+
24
+ //Query for limit page_number
25
+ $limit = "LIMIT " . ($p->page - 1) * $p->limit . ", " . $p->limit;
26
+
27
+ $get_ulike_logs = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."ulike ORDER BY id ASC ".$limit."");
28
+ $count_total_like = $wpdb->get_var("SELECT SUM(meta_value) FROM ".$wpdb->prefix."postmeta WHERE meta_key LIKE '_liked'" );
29
+ $count_total_post = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."postmeta WHERE meta_key LIKE '_liked'" );
30
+ ?>
31
+ <div class="wrap">
32
+ <h2><?php _e('WP ULike Logs', 'alimir'); ?></h2>
33
+ <h3><?php _e('Post Likes Logs', 'alimir'); ?></h3>
34
+ <div class="tablenav">
35
+ <div class='tablenav-pages'>
36
+ <?php echo $p->show(); // Echo out the list of paging. ?>
37
+ </div>
38
+ </div>
39
+ <table class="widefat">
40
+ <thead>
41
+ <tr>
42
+ <th width="2%"><?php _e('ID', 'alimir'); ?></th>
43
+ <th width="15%"><?php _e('Username', 'alimir'); ?></th>
44
+ <th width="10%"><?php _e('Status', 'alimir'); ?></th>
45
+ <th width="8%"><?php _e('Post ID', 'alimir'); ?></th>
46
+ <th width="35%"><?php _e('Post Title', 'alimir'); ?></th>
47
+ <th width="15%"><?php _e('Date / Time', 'alimir'); ?></th>
48
+ <th width="15%"><?php _e('IP', 'alimir'); ?></th>
49
+ </tr>
50
+ </thead>
51
+ <tbody>
52
+ <?php
53
+ foreach ( $get_ulike_logs as $get_ulike_log )
54
+ {
55
+ ?>
56
+ <tr <?php if ($alternate == true) echo 'class="alternate"';?>>
57
+ <td>
58
+ <?php echo $get_ulike_log->id; ?>
59
+ </td>
60
+ <td>
61
+ <?php
62
+ $user_info = get_userdata($get_ulike_log->user_id);
63
+ echo $user_info->display_name;
64
+ ?>
65
+ </td>
66
+ <td>
67
+ <?php echo $get_ulike_log->status; ?>
68
+ </td>
69
+ <td>
70
+ <?php echo $get_ulike_log->post_id; ?>
71
+ </td>
72
+ <td>
73
+ <?php echo get_the_title($get_ulike_log->post_id); ?>
74
+ </td>
75
+ <td>
76
+ <?php echo $get_ulike_log->date_time; ?>
77
+ </td>
78
+ <td>
79
+ <?php echo $get_ulike_log->ip; ?>
80
+ </td>
81
+ <?php
82
+ $alternate = !$alternate;
83
+ }
84
+ ?>
85
+ </tr>
86
+ </tbody>
87
+ </table>
88
+ <div class="tablenav">
89
+ <div class='tablenav-pages'>
90
+ <?php echo $p->show(); // Echo out the list of paging. ?>
91
+ </div>
92
+ </div>
93
+ </div>
94
+ <div class="wrap">
95
+ <h3><?php _e('Post Likes Logs Stats', 'alimir'); ?></h3>
96
+ <br style="clear" />
97
+ <table class="widefat">
98
+ <tr class="alternate">
99
+ <th><?php _e('Total Users Liked:', 'alimir'); ?></th>
100
+ <td><?php echo $items; ?></td>
101
+ </tr>
102
+ <tr>
103
+ <th><?php _e('Total Posts Liked:', 'alimir'); ?></th>
104
+ <td><?php echo $count_total_post; ?></td>
105
+ </tr>
106
+ <tr class="alternate">
107
+ <th><?php _e('Total Likes Sum:', 'alimir'); ?></th>
108
+ <td><?php echo $count_total_like; ?></td>
109
+ </tr>
110
+ </table>
111
+ </div>
112
+ <?php
113
+ } else {
114
+ echo "No Record Found";
115
+ }
116
+ }
117
+
118
+ function wp_ulike_comment_likes_logs(){
119
+ global $wpdb;
120
+ $alternate = true;
121
+ $items = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."ulike_comments");
122
+ if($items > 0) {
123
+ $p = new pagination;
124
+ $p->items($items);
125
+ $p->limit(20); // Limit entries per page
126
+ $p->target("admin.php?page=" . plugin_basename( dirname(__FILE__) ) . '/wp-options.php/comment_logs');
127
+ $p->calculate(); // Calculates what to show
128
+ $p->parameterName('page_number');
129
+ $p->adjacents(1); //No. of page away from the current page
130
+
131
+ if(!isset($_GET['page_number'])) {
132
+ $p->page = 1;
133
+ } else {
134
+ $p->page = $_GET['page_number'];
135
+ }
136
+
137
+ //Query for limit page_number
138
+ $limit = "LIMIT " . ($p->page - 1) * $p->limit . ", " . $p->limit;
139
+
140
+ $get_ulike_logs = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."ulike_comments ORDER BY id ASC ".$limit."");
141
+ $count_total_like = $wpdb->get_var("SELECT SUM(meta_value) FROM ".$wpdb->prefix."commentmeta WHERE meta_key LIKE '_commentliked'" );
142
+ $count_total_comments = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."commentmeta WHERE meta_key LIKE '_commentliked'" );
143
+ ?>
144
+ <div class="wrap">
145
+ <h2><?php _e('WP ULike Logs', 'alimir'); ?></h2>
146
+ <h3><?php _e('Comment Likes Logs', 'alimir'); ?></h3>
147
+ <div class="tablenav">
148
+ <div class='tablenav-pages'>
149
+ <?php echo $p->show(); // Echo out the list of paging. ?>
150
+ </div>
151
+ </div>
152
+ <table class="widefat">
153
+ <thead>
154
+ <tr>
155
+ <th width="2%"><?php _e('ID', 'alimir'); ?></th>
156
+ <th width="15%"><?php _e('Username', 'alimir'); ?></th>
157
+ <th width="10%"><?php _e('Status', 'alimir'); ?></th>
158
+ <th width="8%"><?php _e('Comment ID', 'alimir'); ?></th>
159
+ <th width="15%"><?php _e('Comment Author', 'alimir'); ?></th>
160
+ <th width="15%"><?php _e('Date / Time', 'alimir'); ?></th>
161
+ <th width="15%"><?php _e('IP', 'alimir'); ?></th>
162
+ </tr>
163
+ </thead>
164
+ <tbody>
165
+ <?php
166
+ foreach ( $get_ulike_logs as $get_ulike_log )
167
+ {
168
+ ?>
169
+ <tr <?php if ($alternate == true) echo 'class="alternate"';?>>
170
+ <td>
171
+ <?php echo $get_ulike_log->id; ?>
172
+ </td>
173
+ <td>
174
+ <?php
175
+ $user_info = get_userdata($get_ulike_log->user_id);
176
+ echo $user_info->display_name;
177
+ ?>
178
+ </td>
179
+ <td>
180
+ <?php echo $get_ulike_log->status; ?>
181
+ </td>
182
+ <td>
183
+ <?php echo $get_ulike_log->comment_id; ?>
184
+ </td>
185
+ <td>
186
+ <?php echo get_comment_author($get_ulike_log->comment_id) ?>
187
+ </td>
188
+ <td>
189
+ <?php echo $get_ulike_log->date_time; ?>
190
+ </td>
191
+ <td>
192
+ <?php echo $get_ulike_log->ip; ?>
193
+ </td>
194
+ <?php
195
+ $alternate = !$alternate;
196
+ }
197
+ ?>
198
+ </tr>
199
+ </tbody>
200
+ </table>
201
+ <div class="tablenav">
202
+ <div class='tablenav-pages'>
203
+ <?php echo $p->show(); // Echo out the list of paging. ?>
204
+ </div>
205
+ </div>
206
+ </div>
207
+ <div class="wrap">
208
+ <h3><?php _e('Comment Likes Logs Stats', 'alimir'); ?></h3>
209
+ <br style="clear" />
210
+ <table class="widefat">
211
+ <tr class="alternate">
212
+ <th><?php _e('Total Users Liked:', 'alimir'); ?></th>
213
+ <td><?php echo $items; ?></td>
214
+ </tr>
215
+ <tr>
216
+ <th><?php _e('Total Comments Liked:', 'alimir'); ?></th>
217
+ <td><?php echo $count_total_comments; ?></td>
218
+ </tr>
219
+ <tr class="alternate">
220
+ <th><?php _e('Total Likes Sum:', 'alimir'); ?></th>
221
+ <td><?php echo $count_total_like; ?></td>
222
+ </tr>
223
+ </table>
224
+ </div>
225
+ <?php
226
+ } else {
227
+ echo "No Record Found";
228
+ }
229
+ }
230
+
231
+ function wp_ulike_buddypress_likes_logs(){
232
+ global $wpdb;
233
+ $alternate = true;
234
+ $items = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."ulike_activities");
235
+ if($items > 0) {
236
+ $p = new pagination;
237
+ $p->items($items);
238
+ $p->limit(20); // Limit entries per page
239
+ $p->target("admin.php?page=" . plugin_basename( dirname(__FILE__) ) . '/wp-options.php/bp_logs');
240
+ $p->calculate(); // Calculates what to show
241
+ $p->parameterName('page_number');
242
+ $p->adjacents(1); //No. of page away from the current page
243
+
244
+ if(!isset($_GET['page_number'])) {
245
+ $p->page = 1;
246
+ } else {
247
+ $p->page = $_GET['page_number'];
248
+ }
249
+
250
+ //Query for limit page_number
251
+ $limit = "LIMIT " . ($p->page - 1) * $p->limit . ", " . $p->limit;
252
+
253
+ $get_ulike_logs = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."ulike_activities ORDER BY id ASC ".$limit."");
254
+ $count_total_like = $wpdb->get_var("SELECT SUM(meta_value) FROM ".$wpdb->prefix."bp_activity_meta WHERE meta_key LIKE '_activityliked'" );
255
+ $count_total_activity = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."bp_activity_meta WHERE meta_key LIKE '_activityliked'" );
256
+ ?>
257
+ <div class="wrap">
258
+ <h2><?php _e('WP ULike Logs', 'alimir'); ?></h2>
259
+ <h3><?php _e('Activity Likes Logs', 'alimir'); ?></h3>
260
+ <div class="tablenav">
261
+ <div class='tablenav-pages'>
262
+ <?php echo $p->show(); // Echo out the list of paging. ?>
263
+ </div>
264
+ </div>
265
+ <table class="widefat">
266
+ <thead>
267
+ <tr>
268
+ <th><?php _e('ID', 'alimir'); ?></th>
269
+ <th><?php _e('Username', 'alimir'); ?></th>
270
+ <th><?php _e('Status', 'alimir'); ?></th>
271
+ <th><?php _e('Activity ID', 'alimir'); ?></th>
272
+ <th><?php _e('Date / Time', 'alimir'); ?></th>
273
+ <th><?php _e('IP', 'alimir'); ?></th>
274
+ </tr>
275
+ </thead>
276
+ <tbody>
277
+ <?php
278
+ foreach ( $get_ulike_logs as $get_ulike_log )
279
+ {
280
+ ?>
281
+ <tr <?php if ($alternate == true) echo 'class="alternate"';?>>
282
+ <td>
283
+ <?php echo $get_ulike_log->id; ?>
284
+ </td>
285
+ <td>
286
+ <?php
287
+ $user_info = get_userdata($get_ulike_log->user_id);
288
+ echo $user_info->display_name;
289
+ ?>
290
+ </td>
291
+ <td>
292
+ <?php echo $get_ulike_log->status; ?>
293
+ </td>
294
+ <td>
295
+ <?php echo $get_ulike_log->activity_id; ?>
296
+ </td>
297
+ <td>
298
+ <?php echo $get_ulike_log->date_time; ?>
299
+ </td>
300
+ <td>
301
+ <?php echo $get_ulike_log->ip; ?>
302
+ </td>
303
+ <?php
304
+ $alternate = !$alternate;
305
+ }
306
+ ?>
307
+ </tr>
308
+ </tbody>
309
+ </table>
310
+ <div class="tablenav">
311
+ <div class='tablenav-pages'>
312
+ <?php echo $p->show(); // Echo out the list of paging. ?>
313
+ </div>
314
+ </div>
315
+ </div>
316
+ <div class="wrap">
317
+ <h3><?php _e('Activity Likes Logs Stats', 'alimir'); ?></h3>
318
+ <br style="clear" />
319
+ <table class="widefat">
320
+ <tr class="alternate">
321
+ <th><?php _e('Total Users Liked:', 'alimir'); ?></th>
322
+ <td><?php echo $items; ?></td>
323
+ </tr>
324
+ <tr>
325
+ <th><?php _e('Total Activities Liked:', 'alimir'); ?></th>
326
+ <td><?php echo $count_total_activity; ?></td>
327
+ </tr>
328
+ <tr class="alternate">
329
+ <th><?php _e('Total Likes Sum:', 'alimir'); ?></th>
330
+ <td><?php echo $count_total_like; ?></td>
331
+ </tr>
332
+ </table>
333
+ </div>
334
+ <?php
335
+ } else {
336
+ echo "No Record Found";
337
+ }
338
+ }
inc/wp-options.php CHANGED
@@ -1,14 +1,29 @@
1
  <?php
 
 
 
 
 
2
 
3
  function wp_ulike_adminMenu() {
4
- add_options_page(__( 'WP Ulike', 'alimir' ), __( 'WP Ulike', 'alimir' ), 'administrator', __FILE__, 'wp_ulike_settings_page', __FILE__);
 
 
 
 
5
  add_action('admin_init', 'wp_ulike_register_mysettings');
 
6
  }
7
  add_action('admin_menu', 'wp_ulike_adminMenu');
8
 
 
 
 
 
9
  function wp_ulike_register_mysettings() { // whitelist options
10
  register_setting( 'wp_ulike_options', 'wp_ulike_onPage' );
11
  register_setting( 'wp_ulike_options', 'wp_ulike_onComments' );
 
12
  register_setting( 'wp_ulike_options', 'wp_ulike_textOrImage' );
13
  register_setting( 'wp_ulike_options', 'wp_ulike_text' );
14
  register_setting( 'wp_ulike_options', 'wp_ulike_btn_text' );
@@ -31,163 +46,165 @@ function wp_ulike_settings_page() {
31
  ?>
32
  <div class="wrap">
33
 
34
- <h3><?php _e('Configuration','alimir'); ?></h3>
35
- <form method="post" action="options.php">
36
- <?php settings_fields('wp_ulike_options'); ?>
37
- <?php do_settings_sections( 'wp_ulike_options' ); ?>
38
- <table class="form-table">
39
- <tr>
40
- <th scope="row"><?php _e('Image or text?', 'alimir'); ?></th>
41
- <td>
42
- <label>
43
- <input name="wp_ulike_textOrImage" type="radio" value="image" <?php checked('image', get_option( 'wp_ulike_textOrImage' ) ); ?> /><img src="<?php echo plugins_url('assets/css/add.png', dirname(__FILE__)); ?>" alt="image">
44
- </label>
45
- <br />
46
- <label>
47
- <input name="wp_ulike_textOrImage" type="radio" value="text" <?php checked('text', get_option( 'wp_ulike_textOrImage' ) ); ?> />
48
- </label>
49
- <label>
50
- <input type="text" name="wp_ulike_text" id="wp_ulike_text" value="<?php echo get_option('wp_ulike_text'); ?>" />
51
- </label>
52
- </td>
53
- </tr>
54
- <tr>
55
- <th scope="row"><?php _e('Like Text', 'alimir'); ?></th>
56
- <td>
57
- <label for="wp_ulike_btn_text">
58
- <input type="text" name="wp_ulike_btn_text" id="wp_ulike_btn_text" value="<?php echo get_option('wp_ulike_btn_text'); ?>" />
59
- </label>
60
- </td>
61
- </tr>
62
- <tr>
63
- <th scope="row"><?php _e('Dislike Text?', 'alimir'); ?></th>
64
- <td>
65
- <label for="wp_ulike_dislike_text">
66
- <input type="text" name="wp_ulike_dislike_text" id="wp_ulike_dislike_text" value="<?php echo get_option('wp_ulike_dislike_text'); ?>" />
67
- </label>
68
- </td>
69
- </tr>
70
- <tr>
71
- <th scope="row"><?php _e('Automatic display', 'alimir'); ?></th>
72
- <td>
73
- <label for="wp_ulike_onPage">
74
- <input name="wp_ulike_onPage" id="wp_ulike_onPage" type="checkbox" value="1" <?php checked( '1', get_option( 'wp_ulike_onPage' ) ); ?> />
75
- <?php _e('<strong>On all posts</strong> (home, archives, search) at the bottom of the post', 'alimir'); ?>
76
- </label>
77
- <p class="description"><?php _e('If you disable this option, you have to put manually the code', 'alimir'); ?><code dir="ltr">&lt;?php if(function_exists('wp_ulike')) wp_ulike('get'); ?&gt;</code> <?php _e('wherever you want in your template.', 'alimir'); ?></p>
78
- </td>
79
- </tr>
80
- <tr>
81
- <th scope="row"><?php _e('Comment likes', 'alimir'); ?></th>
82
- <td>
83
- <label for="wp_ulike_onComments">
84
- <input name="wp_ulike_onComments" id="wp_ulike_onComments" type="checkbox" value="1" <?php checked( '1', get_option( 'wp_ulike_onComments' ) ); ?> />
85
- <?php _e('<strong>On all comments</strong> at the bottom of the comment', 'alimir'); ?>
86
- </label>
87
- <p class="description"><?php _e('If you disable this option, you have to put manually this code on comments text', 'alimir'); ?><code dir="ltr">&lt;?php if(function_exists('wp_ulike_comments')) wp_ulike_comments('get'); ?&gt;</code></p>
88
- </td>
89
- </tr>
90
- <tr>
91
- <th scope="row"><?php _e('Only registered Users', 'alimir'); ?></th>
92
- <td>
93
- <label for="wp_ulike_onlyRegistered">
94
- <input name="wp_ulike_onlyRegistered" id="wp_ulike_onlyRegistered" type="checkbox" value="1" <?php checked( '1', get_option( 'wp_ulike_onlyRegistered' ) ); ?> />
95
- <?php _e('Activate', 'alimir'); ?>
96
- </label>
97
- <p class="description"><?php _e('<strong>Only</strong> registered users have permission to like posts.', 'alimir'); ?></p>
98
- </td>
99
- </tr>
100
- <tr>
101
- <th scope="row"><?php _e('BuddyPress Activity', 'alimir'); ?></th>
102
- <td>
103
- <label for="wp_ulike_bp_activity_add">
104
- <input name="wp_ulike_bp_activity_add" id="wp_ulike_bp_activity_add" type="checkbox" value="1" <?php checked( '1', get_option( 'wp_ulike_bp_activity_add' ) ); ?> />
105
- <?php _e('Activate', 'alimir'); ?>
106
- </label>
107
- <p class="description"><?php _e('insert new likes in buddyPress activity page', 'alimir'); ?></p>
108
- </td>
109
- </tr>
110
- <tr>
111
- <th scope="row"><?php _e('Show Users Like Box', 'alimir'); ?></th>
112
- <td>
113
- <label for="wp_ulike_user_like_box">
114
- <input name="wp_ulike_user_like_box" id="wp_ulike_user_like_box" type="checkbox" value="1" <?php checked( '1', get_option( 'wp_ulike_user_like_box' ) ); ?> />
115
- <?php _e('Activate', 'alimir'); ?>
116
- </label>
117
- <p class="description"><?php _e('Active this option to show users avatar in like box.', 'alimir'); ?></p>
118
- </td>
119
- </tr>
120
- <tr>
121
- <th scope="row"><?php _e('Format Number', 'alimir'); ?></th>
122
- <td>
123
- <label for="wp_ulike_format_number">
124
- <input name="wp_ulike_format_number" id="wp_ulike_format_number" type="checkbox" value="1" <?php checked( '1', get_option( 'wp_ulike_format_number' ) ); ?> />
125
- <?php _e('Activate', 'alimir'); ?>
126
- </label>
127
- <p class="description"><?php _e('Convert numbers of Likes with string (kilobyte) format.', 'alimir'); ?><strong> (if -> likes>=1000)</strong></p>
128
- </td>
129
- </tr>
130
- <tr>
131
- <th scope="row"><?php _e('Custom Style', 'alimir'); ?></th>
132
- <td>
133
- <label for="wp_ulike_style">
134
- <input name="wp_ulike_style" id="wp_ulike_style" type="checkbox" value="1" <?php checked( '1', get_option( 'wp_ulike_style' ) ); ?> />
135
- <?php _e('Activate', 'alimir'); ?>
136
- </label>
137
- <p class="description"><?php _e('Active this option to see custom color settings.', 'alimir'); ?></p>
138
- </td>
139
- </tr>
140
- <tr class="checktoshow">
141
- <th scope="row"><?php _e('Button style', 'alimir'); ?></th>
142
- <td>
143
- <label for="wp_ulike_btn_bg">
144
- <input type="text" class="my-color-field" id="wp_ulike_btn_bg" name="wp_ulike_btn_bg" value="<?php echo get_option('wp_ulike_btn_bg'); ?>" />
145
- </label>
146
- <p class="description"><?php _e('Background', 'alimir'); ?></p><br />
147
- <label for="wp_ulike_btn_border">
148
- <input type="text" class="my-color-field" id="wp_ulike_btn_border" name="wp_ulike_btn_border" value="<?php echo get_option('wp_ulike_btn_border'); ?>" />
149
- </label>
150
- <p class="description"><?php _e('Border Color', 'alimir'); ?></p><br />
151
- <label for="wp_ulike_btn_color">
152
- <input type="text" class="my-color-field" id="wp_ulike_btn_color" name="wp_ulike_btn_color" value="<?php echo get_option('wp_ulike_btn_color'); ?>" />
153
- </label>
154
- <p class="description"><?php _e('Text Color', 'alimir'); ?></p>
155
- </td>
156
- </tr>
157
- <tr class="checktoshow">
158
- <th scope="row"><?php _e('Counter Style', 'alimir'); ?></th>
159
- <td>
160
- <label for="wp_ulike_counter_bg">
161
- <input type="text" class="my-color-field" id="wp_ulike_counter_bg" name="wp_ulike_counter_bg" value="<?php echo get_option('wp_ulike_counter_bg'); ?>" />
162
- </label>
163
- <p class="description"><?php _e('Background', 'alimir'); ?></p><br />
164
- <label for="wp_ulike_counter_border">
165
- <input type="text" class="my-color-field" id="wp_ulike_counter_border" name="wp_ulike_counter_border" value="<?php echo get_option('wp_ulike_counter_border'); ?>" />
166
- </label>
167
- <p class="description"><?php _e('Border Color', 'alimir'); ?></p><br />
168
- <label for="wp_ulike_counter_color">
169
- <input type="text" class="my-color-field" id="wp_ulike_counter_color" name="wp_ulike_counter_color" value="<?php echo get_option('wp_ulike_counter_color'); ?>" />
170
- </label>
171
- <p class="description"><?php _e('Text Color', 'alimir'); ?></p>
172
- </td>
173
- </tr>
174
- </table>
175
- <?php submit_button(); ?>
176
- </form>
177
-
178
-
179
- <div id="poststuff" class="ui-sortable meta-box-sortables">
180
- <div class="postbox">
181
- <h3><?php _e('Like this plugin?','alimir'); ?></h3>
182
- <div class="inside">
183
- <p>
184
- <?php _e('Show your support by Rating 5 Star in <a href="http://wordpress.org/plugins/wp-ulike"> Plugin Directory reviews</a>','alimir'); ?><br />
185
- <?php _e('Follow me on <a href="https://www.facebook.com/alimir.ir"> Facebook</a>','alimir'); ?><br />
186
- <?php _e('Plugin Author Blog: <a href="http://alimir.ir"> Wordpress & Programming World.</a>','alimir'); ?>
187
- </p>
188
- </div>
189
  </div>
190
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  </div>
192
  <?php
193
  }
1
  <?php
2
+ // Exit if accessed directly
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ //include logs menu files
6
+ include( plugin_dir_path(__FILE__) . 'wp-logs.php');
7
 
8
  function wp_ulike_adminMenu() {
9
+ add_menu_page(__( 'WP ULike', 'alimir' ), __( 'WP ULike', 'alimir' ), 'manage_options', __FILE__, 'wp_ulike_settings_page', 'dashicons-smiley');
10
+ add_submenu_page(__FILE__, __( 'Post Likes Logs', 'alimir' ), __( 'Post Likes Logs', 'alimir' ), 'manage_options', __FILE__ . '/post_logs', 'wp_ulike_post_likes_logs');
11
+ add_submenu_page(__FILE__, __( 'Comment Likes Logs', 'alimir' ), __( 'Comment Likes Logs', 'alimir' ), 'manage_options', __FILE__ . '/comment_logs', 'wp_ulike_comment_likes_logs');
12
+ add_submenu_page(__FILE__, __( 'Activity Likes Logs', 'alimir' ), __( 'Activity Likes Logs', 'alimir' ), 'manage_options', __FILE__ . '/bp_logs', 'wp_ulike_buddypress_likes_logs');
13
+ add_submenu_page(__FILE__, __( 'About WP ULike', 'alimir' ), __( 'About WP ULike', 'alimir' ), 'manage_options', __FILE__ . '/wp_ulike_about', 'wp_ulike_about_page');
14
  add_action('admin_init', 'wp_ulike_register_mysettings');
15
+
16
  }
17
  add_action('admin_menu', 'wp_ulike_adminMenu');
18
 
19
+ function wp_ulike_about_page() {
20
+ include( plugin_dir_path(__FILE__) . 'about-page.php');
21
+ }
22
+
23
  function wp_ulike_register_mysettings() { // whitelist options
24
  register_setting( 'wp_ulike_options', 'wp_ulike_onPage' );
25
  register_setting( 'wp_ulike_options', 'wp_ulike_onComments' );
26
+ register_setting( 'wp_ulike_options', 'wp_ulike_onActivities' );
27
  register_setting( 'wp_ulike_options', 'wp_ulike_textOrImage' );
28
  register_setting( 'wp_ulike_options', 'wp_ulike_text' );
29
  register_setting( 'wp_ulike_options', 'wp_ulike_btn_text' );
46
  ?>
47
  <div class="wrap">
48
 
49
+ <h3><?php _e('Configuration','alimir'); ?></h3>
50
+ <?php if( isset($_GET['settings-updated']) ) { ?>
51
+ <div id="message" class="updated">
52
+ <p><strong><?php _e('Settings saved.') ?></strong></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  </div>
54
+ <?php } ?>
55
+ <form method="post" action="options.php">
56
+ <?php settings_fields('wp_ulike_options'); ?>
57
+ <table class="form-table">
58
+ <tr>
59
+ <th scope="row"><?php _e('Image or text?', 'alimir'); ?></th>
60
+ <td>
61
+ <label>
62
+ <input name="wp_ulike_textOrImage" type="radio" value="image" <?php checked('image', get_option( 'wp_ulike_textOrImage' ) ); ?> /><img src="<?php echo plugins_url('assets/css/add.png', dirname(__FILE__)); ?>" alt="image">
63
+ </label>
64
+ <br />
65
+ <label>
66
+ <input name="wp_ulike_textOrImage" type="radio" value="text" <?php checked('text', get_option( 'wp_ulike_textOrImage' ) ); ?> />
67
+ </label>
68
+ <label>
69
+ <input type="text" name="wp_ulike_text" id="wp_ulike_text" value="<?php echo get_option('wp_ulike_text'); ?>" />
70
+ </label>
71
+ </td>
72
+ </tr>
73
+ <tr>
74
+ <th scope="row"><?php _e('Like Text', 'alimir'); ?></th>
75
+ <td>
76
+ <label for="wp_ulike_btn_text">
77
+ <input type="text" name="wp_ulike_btn_text" id="wp_ulike_btn_text" value="<?php echo get_option('wp_ulike_btn_text'); ?>" />
78
+ </label>
79
+ </td>
80
+ </tr>
81
+ <tr>
82
+ <th scope="row"><?php _e('Dislike Text?', 'alimir'); ?></th>
83
+ <td>
84
+ <label for="wp_ulike_dislike_text">
85
+ <input type="text" name="wp_ulike_dislike_text" id="wp_ulike_dislike_text" value="<?php echo get_option('wp_ulike_dislike_text'); ?>" />
86
+ </label>
87
+ </td>
88
+ </tr>
89
+ <tr>
90
+ <th scope="row"><?php _e('Automatic display', 'alimir'); ?></th>
91
+ <td>
92
+ <label for="wp_ulike_onPage">
93
+ <input name="wp_ulike_onPage" id="wp_ulike_onPage" type="checkbox" value="1" <?php checked( '1', get_option( 'wp_ulike_onPage' ) ); ?> />
94
+ <?php _e('<strong>On all posts</strong> (home, archives, search) at the bottom of the post', 'alimir'); ?>
95
+ </label>
96
+ <p class="description"><?php _e('If you disable this option, you have to put manually the code', 'alimir'); ?><code dir="ltr">&lt;?php if(function_exists('wp_ulike')) wp_ulike('get'); ?&gt;</code> <?php _e('wherever you want in your template.', 'alimir'); ?></p>
97
+ </td>
98
+ </tr>
99
+ <tr>
100
+ <th scope="row"><?php _e('Comment likes', 'alimir'); ?></th>
101
+ <td>
102
+ <label for="wp_ulike_onComments">
103
+ <input name="wp_ulike_onComments" id="wp_ulike_onComments" type="checkbox" value="1" <?php checked( '1', get_option( 'wp_ulike_onComments' ) ); ?> />
104
+ <?php _e('<strong>On all comments</strong> at the bottom of the comment', 'alimir'); ?>
105
+ </label>
106
+ <p class="description"><?php _e('If you disable this option, you have to put manually this code on comments text', 'alimir'); ?><code dir="ltr">&lt;?php if(function_exists('wp_ulike_comments')) wp_ulike_comments('get'); ?&gt;</code></p>
107
+ </td>
108
+ </tr>
109
+ <tr>
110
+ <th scope="row"><?php _e('Activity likes', 'alimir'); ?></th>
111
+ <td>
112
+ <label for="wp_ulike_onActivities">
113
+ <input name="wp_ulike_onActivities" id="wp_ulike_onActivities" type="checkbox" value="1" <?php checked( '1', get_option( 'wp_ulike_onActivities' ) ); ?> />
114
+ <?php _e('<strong>On all buddypress activities</strong> at the top of activity', 'alimir'); ?>
115
+ </label>
116
+ <p class="description"><?php _e('If you disable this option, you have to put manually this code on buddypres activities content', 'alimir'); ?><code dir="ltr">&lt;?php if(function_exists('wp_ulike_buddypress')) wp_ulike_buddypress('get'); ?&gt;</code></p>
117
+ </td>
118
+ </tr>
119
+ <tr>
120
+ <th scope="row"><?php _e('Only registered Users', 'alimir'); ?></th>
121
+ <td>
122
+ <label for="wp_ulike_onlyRegistered">
123
+ <input name="wp_ulike_onlyRegistered" id="wp_ulike_onlyRegistered" type="checkbox" value="1" <?php checked( '1', get_option( 'wp_ulike_onlyRegistered' ) ); ?> />
124
+ <?php _e('Activate', 'alimir'); ?>
125
+ </label>
126
+ <p class="description"><?php _e('<strong>Only</strong> registered users have permission to like posts.', 'alimir'); ?></p>
127
+ </td>
128
+ </tr>
129
+ <tr>
130
+ <th scope="row"><?php _e('BuddyPress Activity', 'alimir'); ?></th>
131
+ <td>
132
+ <label for="wp_ulike_bp_activity_add">
133
+ <input name="wp_ulike_bp_activity_add" id="wp_ulike_bp_activity_add" type="checkbox" value="1" <?php checked( '1', get_option( 'wp_ulike_bp_activity_add' ) ); ?> />
134
+ <?php _e('Activate', 'alimir'); ?>
135
+ </label>
136
+ <p class="description"><?php _e('insert new likes in buddyPress activity page', 'alimir'); ?></p>
137
+ </td>
138
+ </tr>
139
+ <tr>
140
+ <th scope="row"><?php _e('Show Users Like Box', 'alimir'); ?></th>
141
+ <td>
142
+ <label for="wp_ulike_user_like_box">
143
+ <input name="wp_ulike_user_like_box" id="wp_ulike_user_like_box" type="checkbox" value="1" <?php checked( '1', get_option( 'wp_ulike_user_like_box' ) ); ?> />
144
+ <?php _e('Activate', 'alimir'); ?>
145
+ </label>
146
+ <p class="description"><?php _e('Active this option to show users avatar in like box.', 'alimir'); ?></p>
147
+ </td>
148
+ </tr>
149
+ <tr>
150
+ <th scope="row"><?php _e('Format Number', 'alimir'); ?></th>
151
+ <td>
152
+ <label for="wp_ulike_format_number">
153
+ <input name="wp_ulike_format_number" id="wp_ulike_format_number" type="checkbox" value="1" <?php checked( '1', get_option( 'wp_ulike_format_number' ) ); ?> />
154
+ <?php _e('Activate', 'alimir'); ?>
155
+ </label>
156
+ <p class="description"><?php _e('Convert numbers of Likes with string (kilobyte) format.', 'alimir'); ?><strong> (if -> likes>=1000)</strong></p>
157
+ </td>
158
+ </tr>
159
+ <tr>
160
+ <th scope="row"><?php _e('Custom Style', 'alimir'); ?></th>
161
+ <td>
162
+ <label for="wp_ulike_style">
163
+ <input name="wp_ulike_style" id="wp_ulike_style" type="checkbox" value="1" <?php checked( '1', get_option( 'wp_ulike_style' ) ); ?> />
164
+ <?php _e('Activate', 'alimir'); ?>
165
+ </label>
166
+ <p class="description"><?php _e('Active this option to see custom color settings.', 'alimir'); ?></p>
167
+ </td>
168
+ </tr>
169
+ <tr class="checktoshow">
170
+ <th scope="row"><?php _e('Button style', 'alimir'); ?></th>
171
+ <td>
172
+ <label for="wp_ulike_btn_bg">
173
+ <input type="text" class="my-color-field" id="wp_ulike_btn_bg" name="wp_ulike_btn_bg" value="<?php echo get_option('wp_ulike_btn_bg'); ?>" />
174
+ </label>
175
+ <p class="description"><?php _e('Background', 'alimir'); ?></p><br />
176
+ <label for="wp_ulike_btn_border">
177
+ <input type="text" class="my-color-field" id="wp_ulike_btn_border" name="wp_ulike_btn_border" value="<?php echo get_option('wp_ulike_btn_border'); ?>" />
178
+ </label>
179
+ <p class="description"><?php _e('Border Color', 'alimir'); ?></p><br />
180
+ <label for="wp_ulike_btn_color">
181
+ <input type="text" class="my-color-field" id="wp_ulike_btn_color" name="wp_ulike_btn_color" value="<?php echo get_option('wp_ulike_btn_color'); ?>" />
182
+ </label>
183
+ <p class="description"><?php _e('Text Color', 'alimir'); ?></p>
184
+ </td>
185
+ </tr>
186
+ <tr class="checktoshow">
187
+ <th scope="row"><?php _e('Counter Style', 'alimir'); ?></th>
188
+ <td>
189
+ <label for="wp_ulike_counter_bg">
190
+ <input type="text" class="my-color-field" id="wp_ulike_counter_bg" name="wp_ulike_counter_bg" value="<?php echo get_option('wp_ulike_counter_bg'); ?>" />
191
+ </label>
192
+ <p class="description"><?php _e('Background', 'alimir'); ?></p><br />
193
+ <label for="wp_ulike_counter_border">
194
+ <input type="text" class="my-color-field" id="wp_ulike_counter_border" name="wp_ulike_counter_border" value="<?php echo get_option('wp_ulike_counter_border'); ?>" />
195
+ </label>
196
+ <p class="description"><?php _e('Border Color', 'alimir'); ?></p><br />
197
+ <label for="wp_ulike_counter_color">
198
+ <input type="text" class="my-color-field" id="wp_ulike_counter_color" name="wp_ulike_counter_color" value="<?php echo get_option('wp_ulike_counter_color'); ?>" />
199
+ </label>
200
+ <p class="description"><?php _e('Text Color', 'alimir'); ?></p>
201
+ </td>
202
+ </tr>
203
+ </table>
204
+ <?php do_settings_sections( 'wp_ulike_options' ); ?>
205
+ <?php submit_button(); ?>
206
+ </form>
207
+
208
  </div>
209
  <?php
210
  }
inc/wp-script.php CHANGED
@@ -13,6 +13,8 @@ function enqueueScripts() {
13
  add_action('wp_ajax_nopriv_ulikeprocess', 'wp_ulike_process');
14
  add_action('wp_ajax_ulikecommentprocess','wp_ulike_comments_process');
15
  add_action('wp_ajax_nopriv_ulikecommentprocess', 'wp_ulike_comments_process');
 
 
16
  }
17
 
18
  function enqueueStyle() {
13
  add_action('wp_ajax_nopriv_ulikeprocess', 'wp_ulike_process');
14
  add_action('wp_ajax_ulikecommentprocess','wp_ulike_comments_process');
15
  add_action('wp_ajax_nopriv_ulikecommentprocess', 'wp_ulike_comments_process');
16
+ add_action('wp_ajax_ulikebuddypressprocess','wp_ulike_buddypress_process');
17
+ add_action('wp_ajax_nopriv_ulikebuddypressprocess', 'wp_ulike_buddypress_process');
18
  }
19
 
20
  function enqueueStyle() {
inc/wp-ulike-buddypress.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //main activities function
3
+ function wp_ulike_buddypress($arg) {
4
+
5
+ global $wpdb,$user_ID;
6
+ $activityID = bp_get_activity_id();
7
+ $counter = '';
8
+ $get_like = bp_activity_get_meta($activityID, '_activityliked') != '' ? bp_activity_get_meta($activityID, '_activityliked') : '0';
9
+ $liked = wp_ulike_format_number($get_like);
10
+
11
+ if ( (get_option('wp_ulike_onlyRegistered') != '1') or (get_option('wp_ulike_onlyRegistered') == '1' && is_user_logged_in()) ){
12
+
13
+ if(is_user_logged_in()){
14
+ $user_status = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."ulike_activities WHERE activity_id = '$activityID' AND user_id = '$user_ID'");
15
+
16
+ if(!isset($_COOKIE['activity-liked-'.$activityID]) && $user_status == 0){
17
+ if (get_option('wp_ulike_textOrImage') == 'image') {
18
+ $counter = '<a onclick="likeThisActivity('.$activityID.', 1, 0);" class="image"></a><span class="count-box">'.$liked.'</span>';
19
+ }
20
+ else {
21
+ $counter = '<a onclick="likeThisActivity('.$activityID.', 1, 0);" class="text">'.get_option('wp_ulike_text').'</a><span class="count-box">'.$liked.'</span>';
22
+ }
23
+ }
24
+ else if($user_status != 0){
25
+ if(get_user_activities_status($activityID,$user_ID) == "like"){
26
+ $counter = '<a onclick="likeThisActivity('.$activityID.', 1, 1);" class="text">'.get_option('wp_ulike_btn_text').'</a><span class="count-box">'.$liked.'</span>';
27
+ }
28
+ else if(get_user_activities_status($activityID,$user_ID) == "dislike"){
29
+ $counter = '<a onclick="likeThisActivity('.$activityID.', 1, 0);" class="text">'.get_option('wp_ulike_dislike_text').'</a><span class="count-box">'.$liked.'</span>';
30
+ }
31
+ }
32
+
33
+ else if(isset($_COOKIE['activity-liked-'.$activityID]) && $user_status == 0){
34
+ $counter = '<a class="text user-tooltip" title="'.__('Already Voted','alimir').'">'.get_option('wp_ulike_btn_text').'</a><span class="count-box">'.$liked.'</span>';
35
+ }
36
+ }
37
+ else{
38
+ if(!isset($_COOKIE['activity-liked-'.$activityID])){
39
+
40
+ if (get_option('wp_ulike_textOrImage') == 'image') {
41
+ $counter = '<a onclick="likeThisActivity('.$activityID.', 1, 2);" class="image"></a><span class="count-box">'.$liked.'</span>';
42
+ }
43
+ else {
44
+ $counter = '<a onclick="likeThisActivity('.$activityID.', 1, 2);" class="text">'.get_option('wp_ulike_text').'</a><span class="count-box">'.$liked.'</span>';
45
+ }
46
+
47
+ }
48
+ else{
49
+
50
+ $counter = '<a class="text user-tooltip" title="'.__('Already Voted','alimir').'">'.get_option('wp_ulike_btn_text').'</a><span class="count-box">'.$liked.'</span>';
51
+
52
+ }
53
+ }
54
+
55
+ $wp_ulike = '<div id="wp-ulike-activity-'.$activityID.'" class="wpulike">';
56
+ $wp_ulike .= '<div class="counter">'.$counter.'</div>';
57
+ $wp_ulike .= '</div>';
58
+
59
+ $user_data = get_user_activities_data($activityID,$user_ID);
60
+ if(get_option('wp_ulike_user_like_box') == '1' && $user_data != '')
61
+ $wp_ulike .= '<p style="margin-top:5px">'.__('Users who have liked this activity:','alimir').'</p><ul id="tiles">' . $user_data . '</ul>';
62
+
63
+ if ($arg == 'put') {
64
+ return $wp_ulike;
65
+ }
66
+ else {
67
+ echo $wp_ulike;
68
+ }
69
+
70
+ }
71
+
72
+ else if (get_option('wp_ulike_onlyRegistered') == '1' && !is_user_logged_in()){
73
+ return '<p class="alert alert-info fade in" role="alert"><button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>'.__('You need to login in order to like this activity: ','alimir').'<a href="'.wp_login_url( get_permalink() ).'"> '.__('click here','alimir').' </a></p>';
74
+ }
75
+
76
+ }
77
+
78
+ //Process function
79
+ function wp_ulike_buddypress_process(){
80
+
81
+ global $wpdb,$user_ID;
82
+ $activityID = $_POST['id'];
83
+ $like = bp_activity_get_meta($activityID, '_activityliked') != '' ? bp_activity_get_meta($activityID, '_activityliked') : '0';
84
+ $user_status = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."ulike_activities WHERE activity_id = '$activityID' AND user_id = '$user_ID'");
85
+
86
+ if($activityID != '') {
87
+ if (!isset($_COOKIE['activity-liked-'.$activityID]) && $user_status == 0) {
88
+ $newLike = $like + 1;
89
+ bp_activity_update_meta($activityID, '_activityliked', $newLike);
90
+
91
+ setcookie('activity-liked-'.$activityID, time(), time()+3600*24*365, '/');
92
+
93
+ if(is_user_logged_in()):
94
+ $ip = wp_ulike_get_real_ip();
95
+ $wpdb->query("INSERT INTO ".$wpdb->prefix."ulike_activities VALUES ('', '$activityID', NOW(), '$ip', '$user_ID', 'like')");
96
+ //wp_ulike_bp_notification($user_ID,$activityID);
97
+ endif;
98
+
99
+ echo wp_ulike_format_number($newLike);
100
+ }
101
+ else if ($user_status != 0) {
102
+ if(get_user_activities_status($activityID,$user_ID) == "like"){
103
+ $newLike = $like - 1;
104
+ bp_activity_update_meta($activityID, '_activityliked', $newLike);
105
+
106
+ $wpdb->query("
107
+ UPDATE ".$wpdb->prefix."ulike_activities
108
+ SET status = 'dislike'
109
+ WHERE activity_id = '$activityID' AND user_id = '$user_ID'
110
+ ");
111
+
112
+ echo wp_ulike_format_number($newLike);
113
+ }
114
+ else{
115
+ $newLike = $like + 1;
116
+ bp_activity_update_meta($activityID, '_activityliked', $newLike);
117
+
118
+ $wpdb->query("
119
+ UPDATE ".$wpdb->prefix."ulike_activities
120
+ SET status = 'like'
121
+ WHERE activity_id = '$activityID' AND user_id = '$user_ID'
122
+ ");
123
+
124
+ echo wp_ulike_format_number($newLike);
125
+ }
126
+ }
127
+ else if (isset($_COOKIE['activity-liked-'.$activityID])&& $user_status == 0){
128
+ echo wp_ulike_format_number($like);
129
+ }
130
+
131
+ }
132
+ die();
133
+ }
lang/alimir-fa_IR.mo CHANGED
Binary file
lang/alimir-fa_IR.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WP ULike\n"
4
- "POT-Creation-Date: 2014-10-25 22:08+0330\n"
5
- "PO-Revision-Date: 2014-10-25 22:35+0330\n"
6
  "Last-Translator: Alimir <info@alimir.ir>\n"
7
  "Language-Team: alimir.ir <info@alimir.ir>\n"
8
  "Language: fa_IR\n"
@@ -16,7 +16,7 @@ msgstr ""
16
  "X-Poedit-SearchPath-0: .\n"
17
  "X-Poedit-SearchPath-1: ..\n"
18
 
19
- #: ../wp-ulike.php:16
20
  msgid "WP ULike"
21
  msgstr "وردپرس یولایک"
22
 
@@ -32,51 +32,203 @@ msgstr ""
32
  "سازی استایل ها و… تمامی قابلیت های یک سیستم خوب و حرفه ای رو در اختیار شما "
33
  "قرار میده."
34
 
35
- #: ../wp-ulike.php:69 ../inc/wp-widget.php:106
36
  msgid "Like"
37
  msgstr "لایک"
38
 
39
- #: ../wp-ulike.php:70
40
  msgid "You Like This"
41
  msgstr "این را پسندیده اید"
42
 
43
- #: ../wp-ulike.php:71
44
  msgid "You Dislike This"
45
  msgstr "لغو پسندیدن"
46
 
47
- #: ../inc/wp-functions.php:137 ../inc/wp-functions.php:147
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  msgid "liked"
49
  msgstr " پسندید"
50
 
51
- #: ../inc/wp-functions.php:137
52
  msgid "comment"
53
  msgstr " را در دیدگاهش"
54
 
55
- #: ../inc/wp-options.php:4
56
- msgid "WP Ulike"
57
- msgstr "تنظیمات افزونه یولایک"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
- #: ../inc/wp-options.php:34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  msgid "Configuration"
61
  msgstr "پیکربندی"
62
 
63
- #: ../inc/wp-options.php:40
 
 
 
 
64
  msgid "Image or text?"
65
  msgstr "متن یا تصویر؟"
66
 
67
- #: ../inc/wp-options.php:55
68
  msgid "Like Text"
69
  msgstr "متن دکمه لایک"
70
 
71
- #: ../inc/wp-options.php:63
72
  msgid "Dislike Text?"
73
  msgstr "متن دکمه دیسلایک"
74
 
75
- #: ../inc/wp-options.php:71
76
  msgid "Automatic display"
77
  msgstr "نمایش خودکار"
78
 
79
- #: ../inc/wp-options.php:75
80
  msgid ""
81
  "<strong>On all posts</strong> (home, archives, search) at the bottom of the "
82
  "post"
@@ -84,23 +236,23 @@ msgstr ""
84
  "<strong>نمایش در تمامی پست ها</strong> (خانه, بایگانی, جستجو)در بخش زیرین "
85
  "مطالب."
86
 
87
- #: ../inc/wp-options.php:77
88
  msgid "If you disable this option, you have to put manually the code"
89
  msgstr "اگر این قابلیت را غیر فعال کنید، باید به صورت دستی این کد را "
90
 
91
- #: ../inc/wp-options.php:77
92
  msgid "wherever you want in your template."
93
  msgstr "در قالب خود قرار دهید."
94
 
95
- #: ../inc/wp-options.php:81
96
  msgid "Comment likes"
97
  msgstr "لایک در دیدگاه ها"
98
 
99
- #: ../inc/wp-options.php:85
100
  msgid "<strong>On all comments</strong> at the bottom of the comment"
101
  msgstr "<strong>نمایش در تمامی دیدگاه ها</strong> در زیر متن هر دیدگاه"
102
 
103
- #: ../inc/wp-options.php:87
104
  msgid ""
105
  "If you disable this option, you have to put manually this code on comments "
106
  "text"
@@ -108,114 +260,118 @@ msgstr ""
108
  "اگر این قابلیت را غیر فعال کنید، باید به صورت دستی این کد را در متن دیدگاه "
109
  "ها قرار دهید "
110
 
111
- #: ../inc/wp-options.php:91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  msgid "Only registered Users"
113
  msgstr "محدودسازی لایک کاربران"
114
 
115
- #: ../inc/wp-options.php:95 ../inc/wp-options.php:105
116
- #: ../inc/wp-options.php:115 ../inc/wp-options.php:125
117
- #: ../inc/wp-options.php:135
118
  msgid "Activate"
119
  msgstr "فعال سازی"
120
 
121
- #: ../inc/wp-options.php:97
122
  msgid "<strong>Only</strong> registered users have permission to like posts."
123
  msgstr ""
124
  "با فعال سازی این گزینه، <strong>تنها</strong> کاربران عضو شده، می توانند "
125
  "مطالب را لایک کنند."
126
 
127
- #: ../inc/wp-options.php:101
128
  msgid "BuddyPress Activity"
129
  msgstr "فعالیت های بادی پرس"
130
 
131
- #: ../inc/wp-options.php:107
132
  msgid "insert new likes in buddyPress activity page"
133
  msgstr ""
134
  "با فعال سازی این گزینه، اطلاعات جدیدترین لایک ها به بخش فعالیت های بادی پرس "
135
  "اضافه خواهد شد."
136
 
137
- #: ../inc/wp-options.php:111
138
  msgid "Show Users Like Box"
139
  msgstr "نمایش باکس کاربران لایک کرده"
140
 
141
- #: ../inc/wp-options.php:117
142
  msgid "Active this option to show users avatar in like box."
143
  msgstr ""
144
  "با فعال سازی این گزینه، می توانید آواتار کاربران لایک کرده، را در زیر هر "
145
  "مطلب، نمایش دهید."
146
 
147
- #: ../inc/wp-options.php:121
148
  msgid "Format Number"
149
  msgstr "فرمت اعداد"
150
 
151
- #: ../inc/wp-options.php:127
152
  msgid "Convert numbers of Likes with string (kilobyte) format."
153
  msgstr ""
154
  "با فعال سازی این گزینه، می توانید اعداد بالای 1000 را با فرمت رشته ای "
155
  "(کیلوبایت) نمایش دهید."
156
 
157
- #: ../inc/wp-options.php:131
158
  msgid "Custom Style"
159
  msgstr "سفارشی سازی"
160
 
161
- #: ../inc/wp-options.php:137
162
  msgid "Active this option to see custom color settings."
163
  msgstr ""
164
  "با فعال سازی این گزینه، می توانید رنگ های دلخواه خود را در افزونه به کار "
165
  "ببرید."
166
 
167
- #: ../inc/wp-options.php:141
168
  msgid "Button style"
169
  msgstr "دکمه لایک"
170
 
171
- #: ../inc/wp-options.php:146 ../inc/wp-options.php:163
172
  msgid "Background"
173
  msgstr "رنگ پس زمینه"
174
 
175
- #: ../inc/wp-options.php:150 ../inc/wp-options.php:167
176
  msgid "Border Color"
177
  msgstr "رنگ حاشیه"
178
 
179
- #: ../inc/wp-options.php:154 ../inc/wp-options.php:171
180
  msgid "Text Color"
181
  msgstr "رنگ متن"
182
 
183
- #: ../inc/wp-options.php:158
184
  msgid "Counter Style"
185
  msgstr "باکس شمارنده"
186
 
187
- #: ../inc/wp-options.php:181
188
- msgid "Like this plugin?"
189
- msgstr "این پلاگین چندتا لایک داره؟!؟ :)"
190
-
191
- #: ../inc/wp-options.php:184
192
- msgid ""
193
- "Show your support by Rating 5 Star in <a href=\"http://wordpress.org/plugins/"
194
- "wp-ulike\"> Plugin Directory reviews</a>"
195
- msgstr ""
196
- "حمایتتون رو از این افزونه، با امتیاز 5 ستاره در <a href=\"http://wordpress."
197
- "org/plugins/wp-ulike\">مخزن وردپرس</a> مشخص کنید..."
198
-
199
- #: ../inc/wp-options.php:185
200
- msgid ""
201
- "Follow me on <a href=\"https://www.facebook.com/alimir.ir\"> Facebook</a>"
202
- msgstr ""
203
- "دنیای وردپرس و برنامه نویسی را در <a href=\"https://www.facebook.com/alimir."
204
- "ir\"> فیسبوک</a> دنبال کنید..."
205
-
206
- #: ../inc/wp-options.php:186
207
- msgid ""
208
- "Plugin Author Blog: <a href=\"http://alimir.ir\"> Wordpress & Programming "
209
- "World.</a>"
210
- msgstr ""
211
- "صفحه سازنده افزونه <a href=\"http://alimir.ir\"> دنیای وردپرس و برنامه "
212
- "نویسی</a>."
213
-
214
  #: ../inc/wp-ulike-comments.php:34 ../inc/wp-ulike-comments.php:50
215
  #: ../inc/wp-ulike-posts.php:35 ../inc/wp-ulike-posts.php:51
216
  msgid "Already Voted"
217
  msgstr "قبلا لایک کرده اید"
218
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  #: ../inc/wp-ulike-comments.php:61
220
  msgid "Users who have LIKED this comment:"
221
  msgstr "کاربرانی که این دیدگاه را پسندیده اند:"
@@ -224,10 +380,6 @@ msgstr "کاربرانی که این دیدگاه را پسندیده اند:"
224
  msgid "You need to login in order to like this comment: "
225
  msgstr "برای امتیاز دهی به این دیدگاه، لطفا وارد شوید: "
226
 
227
- #: ../inc/wp-ulike-comments.php:73 ../inc/wp-ulike-posts.php:75
228
- msgid "click here"
229
- msgstr "برای ورود کلیک کنید"
230
-
231
  #: ../inc/wp-ulike-posts.php:63
232
  msgid "Users who have LIKED this post:"
233
  msgstr "کاربرانی که این مطلب را پسندیده اند:"
@@ -288,6 +440,22 @@ msgstr "سایز آواتار کاربران:"
288
  msgid "Activate user like count"
289
  msgstr "تعداد لایک های هر کاربر رو نمایش بده"
290
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
  #~ msgid "<strong>Active</strong> this option."
292
  #~ msgstr "می خواهم این قابلیت را<strong>فعال</strong> کنم"
293
 
@@ -320,8 +488,5 @@ msgstr "تعداد لایک های هر کاربر رو نمایش بده"
320
  #~ "اگر پیش ازاین، از چارچوب جی کوئری در قالب خود استفاده کرده اید، این "
321
  #~ "قابلیت را غیر فعال کنید."
322
 
323
- #~ msgid "Translated in"
324
- #~ msgstr "فارسی سازی در "
325
-
326
  #~ msgid "wp and programming world"
327
  #~ msgstr "دنیای وردپرس و برنامه نویسی"
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WP ULike\n"
4
+ "POT-Creation-Date: 2014-11-09 01:48+0330\n"
5
+ "PO-Revision-Date: 2014-11-09 01:49+0330\n"
6
  "Last-Translator: Alimir <info@alimir.ir>\n"
7
  "Language-Team: alimir.ir <info@alimir.ir>\n"
8
  "Language: fa_IR\n"
16
  "X-Poedit-SearchPath-0: .\n"
17
  "X-Poedit-SearchPath-1: ..\n"
18
 
19
+ #: ../wp-ulike.php:16 ../inc/wp-options.php:9
20
  msgid "WP ULike"
21
  msgstr "وردپرس یولایک"
22
 
32
  "سازی استایل ها و… تمامی قابلیت های یک سیستم خوب و حرفه ای رو در اختیار شما "
33
  "قرار میده."
34
 
35
+ #: ../wp-ulike.php:87 ../inc/wp-widget.php:106
36
  msgid "Like"
37
  msgstr "لایک"
38
 
39
+ #: ../wp-ulike.php:88
40
  msgid "You Like This"
41
  msgstr "این را پسندیده اید"
42
 
43
+ #: ../wp-ulike.php:89
44
  msgid "You Dislike This"
45
  msgstr "لغو پسندیدن"
46
 
47
+ #: ../inc/about-page.php:39
48
+ msgid "Welcome to WP ULike"
49
+ msgstr "به وردپرس یولایک خوش آمدید"
50
+
51
+ #: ../inc/about-page.php:41
52
+ msgid ""
53
+ "Thanks for updating! This version is our leanest and most powerful version "
54
+ "yet."
55
+ msgstr ""
56
+ "با تشکر از بروز رسانی شما! نسخه جدید قویترین و کامل ترین نسخه منتشر شده از "
57
+ "این افزونه است."
58
+
59
+ #: ../inc/about-page.php:45
60
+ msgid "What’s New"
61
+ msgstr "موارد تازه"
62
+
63
+ #: ../inc/about-page.php:50 ../inc/wp-options.php:13
64
+ msgid "About WP ULike"
65
+ msgstr "درباره وردپرس یولایک"
66
+
67
+ #: ../inc/about-page.php:52
68
+ msgid ""
69
+ "WP ULike enables you to add Ajax Like button into your WordPress site and "
70
+ "allowing your visitors to like and dislike posts, pages, comments AND "
71
+ "buddypress activities. It features: Clean Design, Ajax feature to update the "
72
+ "data without reloading, Custom Like-Dislike Texts, Simple custom style with "
73
+ "color picker settings, BuddyPress activity support, Widget to show Most "
74
+ "Liked Posts And Most Liked Users avatars, Added automatically, RTL language "
75
+ "support, Simple configuration panel and many more..."
76
+ msgstr ""
77
+ " افزونه ایرانی یولایک، یک سیستم آژاکسی ساده و کاربردی برای ایجاد قابلیت لایک "
78
+ "(LIKE) در مطالب و دیدگاه های وردپرسی شماست و با بهره گیری از پنل تنظیمات، "
79
+ "پشتیبانی کامل از شیوه نامه rtl، نمایش بیشترین مطالب لایک شده، قابلیت سفارشی "
80
+ "سازی استایل ها و… تمامی قابلیت های یک سیستم خوب و حرفه ای رو در اختیار شما "
81
+ "قرار میده."
82
+
83
+ #: ../inc/about-page.php:58
84
+ msgid "New Administrative Tools"
85
+ msgstr "قابلیت های جدید مدیریتی"
86
+
87
+ #: ../inc/about-page.php:76
88
+ msgid "Credits"
89
+ msgstr ""
90
+
91
+ #: ../inc/about-page.php:85
92
+ msgid "Translations"
93
+ msgstr "ترجمه ها"
94
+
95
+ #: ../inc/about-page.php:88
96
+ msgid "Like this plugin?"
97
+ msgstr "این پلاگین چندتا لایک داره؟!؟ :)"
98
+
99
+ #: ../inc/about-page.php:89
100
+ msgid ""
101
+ "Show your support by Rating 5 Star in <a href=\"http://wordpress.org/plugins/"
102
+ "wp-ulike\"> Plugin Directory reviews</a>"
103
+ msgstr ""
104
+ "حمایتتون رو از این افزونه، با امتیاز 5 ستاره در <a href=\"http://wordpress."
105
+ "org/plugins/wp-ulike\">مخزن وردپرس</a> مشخص کنید..."
106
+
107
+ #: ../inc/wp-functions.php:157
108
+ msgid "WP ULike Activity"
109
+ msgstr ""
110
+
111
+ #: ../inc/wp-functions.php:168 ../inc/wp-functions.php:178
112
  msgid "liked"
113
  msgstr " پسندید"
114
 
115
+ #: ../inc/wp-functions.php:168
116
  msgid "comment"
117
  msgstr " را در دیدگاهش"
118
 
119
+ #: ../inc/wp-logs.php:35 ../inc/wp-logs.php:148 ../inc/wp-logs.php:261
120
+ msgid "WP ULike Logs"
121
+ msgstr "وقایع اتفاقیه در وردپرس یولایک"
122
+
123
+ #: ../inc/wp-logs.php:36 ../inc/wp-options.php:10
124
+ msgid "Post Likes Logs"
125
+ msgstr "وقایع لایک در نوشتارها"
126
+
127
+ #: ../inc/wp-logs.php:45 ../inc/wp-logs.php:158 ../inc/wp-logs.php:271
128
+ msgid "ID"
129
+ msgstr ""
130
+
131
+ #: ../inc/wp-logs.php:46 ../inc/wp-logs.php:159 ../inc/wp-logs.php:272
132
+ msgid "Username"
133
+ msgstr "نام کاربری"
134
+
135
+ #: ../inc/wp-logs.php:47 ../inc/wp-logs.php:160 ../inc/wp-logs.php:273
136
+ msgid "Status"
137
+ msgstr "وضعیت"
138
+
139
+ #: ../inc/wp-logs.php:48
140
+ msgid "Post ID"
141
+ msgstr "شناسه نوشتار"
142
+
143
+ #: ../inc/wp-logs.php:49
144
+ msgid "Post Title"
145
+ msgstr "عنوان نوشتار"
146
+
147
+ #: ../inc/wp-logs.php:50 ../inc/wp-logs.php:163 ../inc/wp-logs.php:275
148
+ msgid "Date / Time"
149
+ msgstr "تاریخ / زمان"
150
+
151
+ #: ../inc/wp-logs.php:51 ../inc/wp-logs.php:164 ../inc/wp-logs.php:276
152
+ msgid "IP"
153
+ msgstr "آدرس IP"
154
+
155
+ #: ../inc/wp-logs.php:98
156
+ msgid "Post Likes Logs Stats"
157
+ msgstr "وضعیت وقایع لایک در نوشتارها"
158
+
159
+ #: ../inc/wp-logs.php:102 ../inc/wp-logs.php:215 ../inc/wp-logs.php:324
160
+ msgid "Total Users Liked:"
161
+ msgstr "مجموع لایک کاربران:"
162
+
163
+ #: ../inc/wp-logs.php:106
164
+ msgid "Total Posts Liked:"
165
+ msgstr "تعداد مطالب لایک شده:"
166
+
167
+ #: ../inc/wp-logs.php:110 ../inc/wp-logs.php:223 ../inc/wp-logs.php:332
168
+ msgid "Total Likes Sum:"
169
+ msgstr "مجموع همه ی لایک ها:"
170
+
171
+ #: ../inc/wp-logs.php:149 ../inc/wp-options.php:11
172
+ msgid "Comment Likes Logs"
173
+ msgstr "وقایع لایک در دیدگاه ها"
174
+
175
+ #: ../inc/wp-logs.php:161
176
+ msgid "Comment ID"
177
+ msgstr "شناسه دیدگاه"
178
+
179
+ #: ../inc/wp-logs.php:162
180
+ msgid "Comment Author"
181
+ msgstr "نویسنده دیدگاه"
182
+
183
+ #: ../inc/wp-logs.php:211
184
+ msgid "Comment Likes Logs Stats"
185
+ msgstr "وضعیت وقایع لایک در دیدگاه ها"
186
 
187
+ #: ../inc/wp-logs.php:219
188
+ msgid "Total Comments Liked:"
189
+ msgstr "تعداد دیدگاه های لایک شده:"
190
+
191
+ #: ../inc/wp-logs.php:262 ../inc/wp-options.php:12
192
+ msgid "Activity Likes Logs"
193
+ msgstr "وقایع لایک در فعالیت ها"
194
+
195
+ #: ../inc/wp-logs.php:274
196
+ msgid "Activity ID"
197
+ msgstr "شناسه فعالیت"
198
+
199
+ #: ../inc/wp-logs.php:320
200
+ msgid "Activity Likes Logs Stats"
201
+ msgstr "وضعیت وقایع لایک در فعالیت های بادی پرس"
202
+
203
+ #: ../inc/wp-logs.php:328
204
+ msgid "Total Activities Liked:"
205
+ msgstr "مجموع فعالیت های لایک شده:"
206
+
207
+ #: ../inc/wp-options.php:49
208
  msgid "Configuration"
209
  msgstr "پیکربندی"
210
 
211
+ #: ../inc/wp-options.php:52
212
+ msgid "Settings saved."
213
+ msgstr "تنظیمات ذخیره شد"
214
+
215
+ #: ../inc/wp-options.php:59
216
  msgid "Image or text?"
217
  msgstr "متن یا تصویر؟"
218
 
219
+ #: ../inc/wp-options.php:74
220
  msgid "Like Text"
221
  msgstr "متن دکمه لایک"
222
 
223
+ #: ../inc/wp-options.php:82
224
  msgid "Dislike Text?"
225
  msgstr "متن دکمه دیسلایک"
226
 
227
+ #: ../inc/wp-options.php:90
228
  msgid "Automatic display"
229
  msgstr "نمایش خودکار"
230
 
231
+ #: ../inc/wp-options.php:94
232
  msgid ""
233
  "<strong>On all posts</strong> (home, archives, search) at the bottom of the "
234
  "post"
236
  "<strong>نمایش در تمامی پست ها</strong> (خانه, بایگانی, جستجو)در بخش زیرین "
237
  "مطالب."
238
 
239
+ #: ../inc/wp-options.php:96
240
  msgid "If you disable this option, you have to put manually the code"
241
  msgstr "اگر این قابلیت را غیر فعال کنید، باید به صورت دستی این کد را "
242
 
243
+ #: ../inc/wp-options.php:96
244
  msgid "wherever you want in your template."
245
  msgstr "در قالب خود قرار دهید."
246
 
247
+ #: ../inc/wp-options.php:100
248
  msgid "Comment likes"
249
  msgstr "لایک در دیدگاه ها"
250
 
251
+ #: ../inc/wp-options.php:104
252
  msgid "<strong>On all comments</strong> at the bottom of the comment"
253
  msgstr "<strong>نمایش در تمامی دیدگاه ها</strong> در زیر متن هر دیدگاه"
254
 
255
+ #: ../inc/wp-options.php:106
256
  msgid ""
257
  "If you disable this option, you have to put manually this code on comments "
258
  "text"
260
  "اگر این قابلیت را غیر فعال کنید، باید به صورت دستی این کد را در متن دیدگاه "
261
  "ها قرار دهید "
262
 
263
+ #: ../inc/wp-options.php:110
264
+ msgid "Activity likes"
265
+ msgstr "لایک در فعالیت ها"
266
+
267
+ #: ../inc/wp-options.php:114
268
+ msgid "<strong>On all buddypress activities</strong> at the top of activity"
269
+ msgstr ""
270
+ "<strong>نمایش در تمامی فعالیت های بادی پرس</strong> در بخش بالایی هر فعالیت"
271
+
272
+ #: ../inc/wp-options.php:116
273
+ msgid ""
274
+ "If you disable this option, you have to put manually this code on buddypres "
275
+ "activities content"
276
+ msgstr ""
277
+ "اگر این قابلیت را غیر فعال کنید، باید به صورت دستی این کد را در متن فعالیت "
278
+ "ها قرار دهید "
279
+
280
+ #: ../inc/wp-options.php:120
281
  msgid "Only registered Users"
282
  msgstr "محدودسازی لایک کاربران"
283
 
284
+ #: ../inc/wp-options.php:124 ../inc/wp-options.php:134
285
+ #: ../inc/wp-options.php:144 ../inc/wp-options.php:154
286
+ #: ../inc/wp-options.php:164
287
  msgid "Activate"
288
  msgstr "فعال سازی"
289
 
290
+ #: ../inc/wp-options.php:126
291
  msgid "<strong>Only</strong> registered users have permission to like posts."
292
  msgstr ""
293
  "با فعال سازی این گزینه، <strong>تنها</strong> کاربران عضو شده، می توانند "
294
  "مطالب را لایک کنند."
295
 
296
+ #: ../inc/wp-options.php:130
297
  msgid "BuddyPress Activity"
298
  msgstr "فعالیت های بادی پرس"
299
 
300
+ #: ../inc/wp-options.php:136
301
  msgid "insert new likes in buddyPress activity page"
302
  msgstr ""
303
  "با فعال سازی این گزینه، اطلاعات جدیدترین لایک ها به بخش فعالیت های بادی پرس "
304
  "اضافه خواهد شد."
305
 
306
+ #: ../inc/wp-options.php:140
307
  msgid "Show Users Like Box"
308
  msgstr "نمایش باکس کاربران لایک کرده"
309
 
310
+ #: ../inc/wp-options.php:146
311
  msgid "Active this option to show users avatar in like box."
312
  msgstr ""
313
  "با فعال سازی این گزینه، می توانید آواتار کاربران لایک کرده، را در زیر هر "
314
  "مطلب، نمایش دهید."
315
 
316
+ #: ../inc/wp-options.php:150
317
  msgid "Format Number"
318
  msgstr "فرمت اعداد"
319
 
320
+ #: ../inc/wp-options.php:156
321
  msgid "Convert numbers of Likes with string (kilobyte) format."
322
  msgstr ""
323
  "با فعال سازی این گزینه، می توانید اعداد بالای 1000 را با فرمت رشته ای "
324
  "(کیلوبایت) نمایش دهید."
325
 
326
+ #: ../inc/wp-options.php:160
327
  msgid "Custom Style"
328
  msgstr "سفارشی سازی"
329
 
330
+ #: ../inc/wp-options.php:166
331
  msgid "Active this option to see custom color settings."
332
  msgstr ""
333
  "با فعال سازی این گزینه، می توانید رنگ های دلخواه خود را در افزونه به کار "
334
  "ببرید."
335
 
336
+ #: ../inc/wp-options.php:170
337
  msgid "Button style"
338
  msgstr "دکمه لایک"
339
 
340
+ #: ../inc/wp-options.php:175 ../inc/wp-options.php:192
341
  msgid "Background"
342
  msgstr "رنگ پس زمینه"
343
 
344
+ #: ../inc/wp-options.php:179 ../inc/wp-options.php:196
345
  msgid "Border Color"
346
  msgstr "رنگ حاشیه"
347
 
348
+ #: ../inc/wp-options.php:183 ../inc/wp-options.php:200
349
  msgid "Text Color"
350
  msgstr "رنگ متن"
351
 
352
+ #: ../inc/wp-options.php:187
353
  msgid "Counter Style"
354
  msgstr "باکس شمارنده"
355
 
356
+ #: ../inc/wp-ulike-buddypress.php:34 ../inc/wp-ulike-buddypress.php:50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357
  #: ../inc/wp-ulike-comments.php:34 ../inc/wp-ulike-comments.php:50
358
  #: ../inc/wp-ulike-posts.php:35 ../inc/wp-ulike-posts.php:51
359
  msgid "Already Voted"
360
  msgstr "قبلا لایک کرده اید"
361
 
362
+ #: ../inc/wp-ulike-buddypress.php:61
363
+ msgid "Users who have liked this activity:"
364
+ msgstr "کاربرانی که این فعالیت را پسندیده اند:"
365
+
366
+ #: ../inc/wp-ulike-buddypress.php:73
367
+ msgid "You need to login in order to like this activity: "
368
+ msgstr "برای امتیاز دهی به این فعالیت، لطفا وارد شوید: "
369
+
370
+ #: ../inc/wp-ulike-buddypress.php:73 ../inc/wp-ulike-comments.php:73
371
+ #: ../inc/wp-ulike-posts.php:75
372
+ msgid "click here"
373
+ msgstr "برای ورود کلیک کنید"
374
+
375
  #: ../inc/wp-ulike-comments.php:61
376
  msgid "Users who have LIKED this comment:"
377
  msgstr "کاربرانی که این دیدگاه را پسندیده اند:"
380
  msgid "You need to login in order to like this comment: "
381
  msgstr "برای امتیاز دهی به این دیدگاه، لطفا وارد شوید: "
382
 
 
 
 
 
383
  #: ../inc/wp-ulike-posts.php:63
384
  msgid "Users who have LIKED this post:"
385
  msgstr "کاربرانی که این مطلب را پسندیده اند:"
440
  msgid "Activate user like count"
441
  msgstr "تعداد لایک های هر کاربر رو نمایش بده"
442
 
443
+ #~ msgid ""
444
+ #~ "Follow me on <a href=\"https://www.facebook.com/alimir.ir\"> Facebook</a>"
445
+ #~ msgstr ""
446
+ #~ "دنیای وردپرس و برنامه نویسی را در <a href=\"https://www.facebook.com/"
447
+ #~ "alimir.ir\"> فیسبوک</a> دنبال کنید..."
448
+
449
+ #~ msgid ""
450
+ #~ "Plugin Author Blog: <a href=\"http://alimir.ir\"> Wordpress & Programming "
451
+ #~ "World.</a>"
452
+ #~ msgstr ""
453
+ #~ "صفحه سازنده افزونه <a href=\"http://alimir.ir\"> دنیای وردپرس و برنامه "
454
+ #~ "نویسی</a>."
455
+
456
+ #~ msgid "WP Ulike"
457
+ #~ msgstr "تنظیمات افزونه یولایک"
458
+
459
  #~ msgid "<strong>Active</strong> this option."
460
  #~ msgstr "می خواهم این قابلیت را<strong>فعال</strong> کنم"
461
 
488
  #~ "اگر پیش ازاین، از چارچوب جی کوئری در قالب خود استفاده کرده اید، این "
489
  #~ "قابلیت را غیر فعال کنید."
490
 
 
 
 
491
  #~ msgid "wp and programming world"
492
  #~ msgstr "دنیای وردپرس و برنامه نویسی"
readme.txt CHANGED
@@ -5,15 +5,15 @@ Author: Ali Mirzaei
5
  Tags: wp ulike, wordpress youlike plugin, like button, rating, vote, voting, most liked posts, wordpress like page, wordpress like post, wordpress vote page, wordpress vote post, wp like page, wp like post, wp like plugin
6
  Requires at least: 3.0
7
  Tested up to: 4.0
8
- Stable tag: 1.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
- WP ULike plugin allows to integrate Ajax Like Button into your WordPress website to allow your visitors to like and dislike pages, posts and comments.
13
 
14
  == Description ==
15
 
16
- WP ULike plugin allows to integrate a beautiful Ajax Like Button into your wordPress website to allow your visitors to like and dislike pages, posts and comments. Its very simple to use and support a widget to display the most liked posts.
17
 
18
  = Demo =
19
 
@@ -28,6 +28,7 @@ WP ULike plugin allows to integrate a beautiful Ajax Like Button into your wordP
28
  * Added automatically (no Code required).
29
  * Shortcode support.
30
  * Comment likes support.
 
31
  * BuddyPress activity support.
32
  * Simple user like box with avatar support.
33
  * Custom Like-Dislike Texts.
@@ -38,11 +39,14 @@ WP ULike plugin allows to integrate a beautiful Ajax Like Button into your wordP
38
  * And so on...
39
 
40
  = How To Use? =
41
- Just install the plugin and use this function:
 
 
 
 
42
  `<?php if(function_exists('wp_ulike')) wp_ulike('get'); ?>`
43
- <strong>OR</strong> this shortcode:
44
  `[wp_ulike]`
45
- <strong>OR</strong> activate the "automatic display" in plugin configuration panel.
46
 
47
  = Translations =
48
  * English
@@ -54,18 +58,70 @@ Just install the plugin and use this function:
54
  = Plugin Author =
55
  Website: <a href="http://about.alimir.ir" target="_blank">Ali Mirzaei</a><br />
56
  Follow on <a href="https://www.facebook.com/alimir.ir" target="_blank">Facebook</a>
 
57
 
58
  == Installation ==
59
 
60
- 1. Upload plugin folder to the `/wp-content/plugins/` directory.
61
- 2. Activate the plugin through the `Plugins` menu in WordPress.
 
 
62
 
63
  == Screenshots ==
64
 
65
  Screenshots are available in <a href="http://preview.alimir.ir/wp-ulike-plugin" target="_blank">here</a>
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  == Changelog ==
68
 
 
 
 
 
 
 
 
 
 
 
 
69
  = 1.6 =
70
  * Added: Comment likes support.
71
  * Added: BuddyPress activity support.
@@ -100,6 +156,9 @@ Screenshots are available in <a href="http://preview.alimir.ir/wp-ulike-plugin"
100
 
101
  == Upgrade Notice ==
102
 
 
 
 
103
  = 1.6 =
104
  After plugin update: If the new database table won't fixed, try deactivating the plugin and reactivating that one at a time.
105
 
5
  Tags: wp ulike, wordpress youlike plugin, like button, rating, vote, voting, most liked posts, wordpress like page, wordpress like post, wordpress vote page, wordpress vote post, wp like page, wp like post, wp like plugin
6
  Requires at least: 3.0
7
  Tested up to: 4.0
8
+ Stable tag: 1.7
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
+ WP ULike enables you to add Ajax Like button into your WordPress and allowing your visitors to like and dislike posts,comments AND BP activities.
13
 
14
  == Description ==
15
 
16
+ WP ULike plugin allows to integrate a beautiful Ajax Like Button into your wordPress website to allow your visitors to like and dislike pages, posts, comments AND buddypress activities. Its very simple to use and supports many options.
17
 
18
  = Demo =
19
 
28
  * Added automatically (no Code required).
29
  * Shortcode support.
30
  * Comment likes support.
31
+ * Full likes logs support.
32
  * BuddyPress activity support.
33
  * Simple user like box with avatar support.
34
  * Custom Like-Dislike Texts.
39
  * And so on...
40
 
41
  = How To Use? =
42
+ Just install the plugin and activate the "automatic display" in plugin configuration panel. (WP ULike has three auto options for the post, comments and buddypress activities.)
43
+
44
+ Also you can use this function and shortcode for the post likes:
45
+
46
+ * Function:
47
  `<?php if(function_exists('wp_ulike')) wp_ulike('get'); ?>`
48
+ * Shortcode:
49
  `[wp_ulike]`
 
50
 
51
  = Translations =
52
  * English
58
  = Plugin Author =
59
  Website: <a href="http://about.alimir.ir" target="_blank">Ali Mirzaei</a><br />
60
  Follow on <a href="https://www.facebook.com/alimir.ir" target="_blank">Facebook</a>
61
+ You can catch catch him on twitter as @alimirir
62
 
63
  == Installation ==
64
 
65
+ 1. Open `wp-content/plugins` Folder
66
+ 2. Put: `Folder: wp-ulike`
67
+ 3. Activate `WP ULike` Plugin
68
+ 4. Go to `WP-Admin -> WP ULike`
69
 
70
  == Screenshots ==
71
 
72
  Screenshots are available in <a href="http://preview.alimir.ir/wp-ulike-plugin" target="_blank">here</a>
73
 
74
+ == Frequently Asked Questions ==
75
+
76
+ = How To Use this plugin? =
77
+ Just install the plugin and activate the "automatic display" in plugin configuration panel. (WP ULike has three auto options for the post, comments and buddypress activities.)
78
+
79
+ Also you can use this function and shortcode for the post likes:
80
+
81
+ * Function:
82
+ `<?php if(function_exists('wp_ulike')) wp_ulike('get'); ?>`
83
+ * Shortcode:
84
+ `[wp_ulike]`
85
+
86
+ = How To Change Format Number Function? =
87
+ * You can adding your changes on `wp_ulike_format_number` function with a simple filter. for example, if you want to remove the "+" character you can use this filter:
88
+ <code>
89
+ <?php
90
+ add_filter('wp_ulike_format_number','wp_ulike_new_format_number',10,3);
91
+ function wp_ulike_new_format_number($value, $num, $plus){
92
+ if ($num >= 1000 && get_option('wp_ulike_format_number') == '1'):
93
+ $value = round($num/1000, 2) . 'K';
94
+ else:
95
+ $value = $num;
96
+ endif;
97
+ return $value;
98
+ }
99
+ ?>
100
+ </code>
101
+
102
+ = How To Get Posts Likes Number? =
103
+ * Use this function on WP Loop:
104
+ <code>
105
+ <?php
106
+ if (function_exists('wp_ulike_get_post_likes')):
107
+ echo wp_ulike_get_post_likes(get_the_ID());
108
+ endif;
109
+ ?>
110
+ </code>
111
+
112
  == Changelog ==
113
 
114
+ = 1.7 =
115
+ * Added: Buddypress likes support.
116
+ * Added: Post likes logs.
117
+ * Added: Comment likes logs.
118
+ * Added: Buddypress likes logs.
119
+ * Added: pagination for the logs pages.
120
+ * Added: FAQ document on wordpress.org
121
+ * Added: get post likes function.
122
+ * Modified: New setting menu.
123
+ * Updated: language files.
124
+
125
  = 1.6 =
126
  * Added: Comment likes support.
127
  * Added: BuddyPress activity support.
156
 
157
  == Upgrade Notice ==
158
 
159
+ = 1.7 =
160
+ After plugin update: If the new database table won't fixed, try deactivating the plugin and reactivating that one at a time.
161
+
162
  = 1.6 =
163
  After plugin update: If the new database table won't fixed, try deactivating the plugin and reactivating that one at a time.
164
 
wp-ulike.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name:WP ULike
4
  Plugin URI: http://wordpress.org/plugins/wp-ulike
5
  Description: WP ULike plugin allows to integrate Like Button into your WordPress website to allow your visitors to like pages, posts AND comments. Its very simple to use and support a widget to display the most liked posts.
6
- Version: 1.6
7
  Author: Ali Mirzaei
8
  Author URI: http://about.alimir.ir
9
  Text Domain: alimir
@@ -17,7 +17,7 @@ License: GPL2
17
  __('WP ULike plugin allows to integrate Like Button into your WordPress website to allow your visitors to like pages, posts AND comments. Its very simple to use and support a widget to display the most liked posts.', 'alimir');
18
 
19
  //Do not change this value
20
- define('WP_ULIKE_DB_VERSION', '1.1');
21
 
22
  //register activation hook
23
  function wp_ulike_options() {
@@ -59,8 +59,27 @@ License: GPL2
59
  update_option('wp_ulike_dbVersion', WP_ULIKE_DB_VERSION);
60
  }
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  add_option('wp_ulike_onPage', '1', '', 'yes');
63
  add_option('wp_ulike_onComments', '1', '', 'yes');
 
64
  add_option('wp_ulike_onlyRegistered', '0', '', 'yes');
65
  add_option('wp_ulike_bp_activity_add', '0', '', 'yes');
66
  add_option('wp_ulike_user_like_box', '1', '', 'yes');
@@ -85,6 +104,7 @@ License: GPL2
85
  function wp_ulike_unset_options() {
86
  delete_option('wp_ulike_onPage');
87
  delete_option('wp_ulike_onComments');
 
88
  delete_option('wp_ulike_onlyRegistered');
89
  delete_option('wp_ulike_bp_activity_add');
90
  delete_option('wp_ulike_user_like_box');
@@ -97,6 +117,13 @@ License: GPL2
97
  }
98
  register_uninstall_hook(__FILE__, 'wp_ulike_unset_options');
99
 
 
 
 
 
 
 
 
100
  //Load plugin widget
101
  include( plugin_dir_path( __FILE__ ) . 'inc/wp-widget.php');
102
  //Load plugin setting panel
@@ -108,4 +135,6 @@ License: GPL2
108
  //Load WP ULike posts functions
109
  include( plugin_dir_path( __FILE__ ) . 'inc/wp-ulike-posts.php');
110
  //Load WP ULike comments functions
111
- include( plugin_dir_path( __FILE__ ) . 'inc/wp-ulike-comments.php');
 
 
3
  Plugin Name:WP ULike
4
  Plugin URI: http://wordpress.org/plugins/wp-ulike
5
  Description: WP ULike plugin allows to integrate Like Button into your WordPress website to allow your visitors to like pages, posts AND comments. Its very simple to use and support a widget to display the most liked posts.
6
+ Version: 1.7
7
  Author: Ali Mirzaei
8
  Author URI: http://about.alimir.ir
9
  Text Domain: alimir
17
  __('WP ULike plugin allows to integrate Like Button into your WordPress website to allow your visitors to like pages, posts AND comments. Its very simple to use and support a widget to display the most liked posts.', 'alimir');
18
 
19
  //Do not change this value
20
+ define('WP_ULIKE_DB_VERSION', '1.2');
21
 
22
  //register activation hook
23
  function wp_ulike_options() {
59
  update_option('wp_ulike_dbVersion', WP_ULIKE_DB_VERSION);
60
  }
61
 
62
+ $table_name_3 = $wpdb->prefix . "ulike_activities";
63
+ if($wpdb->get_var("show tables like '$table_name_3'") != $table_name_3) {
64
+ $sql = "CREATE TABLE " . $table_name_3 . " (
65
+ `id` bigint(11) NOT NULL AUTO_INCREMENT,
66
+ `activity_id` int(11) NOT NULL,
67
+ `date_time` datetime NOT NULL,
68
+ `ip` varchar(30) NOT NULL,
69
+ `user_id` int(11) NOT NULL,
70
+ `status` varchar(15) NOT NULL,
71
+ PRIMARY KEY (`id`)
72
+ );";
73
+
74
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
75
+ dbDelta($sql);
76
+
77
+ update_option('wp_ulike_dbVersion', WP_ULIKE_DB_VERSION);
78
+ }
79
+
80
  add_option('wp_ulike_onPage', '1', '', 'yes');
81
  add_option('wp_ulike_onComments', '1', '', 'yes');
82
+ add_option('wp_ulike_onActivities', '0', '', 'yes');
83
  add_option('wp_ulike_onlyRegistered', '0', '', 'yes');
84
  add_option('wp_ulike_bp_activity_add', '0', '', 'yes');
85
  add_option('wp_ulike_user_like_box', '1', '', 'yes');
104
  function wp_ulike_unset_options() {
105
  delete_option('wp_ulike_onPage');
106
  delete_option('wp_ulike_onComments');
107
+ delete_option('wp_ulike_onActivities');
108
  delete_option('wp_ulike_onlyRegistered');
109
  delete_option('wp_ulike_bp_activity_add');
110
  delete_option('wp_ulike_user_like_box');
117
  }
118
  register_uninstall_hook(__FILE__, 'wp_ulike_unset_options');
119
 
120
+ //get the plugin version
121
+ function wp_ulike_get_version() {
122
+ $plugin_data = get_plugin_data( __FILE__ );
123
+ $plugin_version = $plugin_data['Version'];
124
+ return $plugin_version;
125
+ }
126
+
127
  //Load plugin widget
128
  include( plugin_dir_path( __FILE__ ) . 'inc/wp-widget.php');
129
  //Load plugin setting panel
135
  //Load WP ULike posts functions
136
  include( plugin_dir_path( __FILE__ ) . 'inc/wp-ulike-posts.php');
137
  //Load WP ULike comments functions
138
+ include( plugin_dir_path( __FILE__ ) . 'inc/wp-ulike-comments.php');
139
+ //Load WP ULike buddypress functions
140
+ include( plugin_dir_path( __FILE__ ) . 'inc/wp-ulike-buddypress.php');