WP ULike - Version 1.1

Version Description

  • Add loading spinner.
  • Add new database table.
  • Add user dislike support.
  • Add Simple "user avatar box" at the bottom of every post.
  • Improve plugin security and authentication.
  • Update language files.
Download this release

Release Info

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

Code changes from version 1.0 to 1.1

assets/css/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
assets/css/loading.GIF ADDED
Binary file
assets/css/wp-ulike-rtl.css CHANGED
@@ -4,24 +4,40 @@
4
 
5
  .wpulike .counter a {
6
  cursor: pointer;
7
- display:inline !important;
8
- text-decoration:none;
9
-
10
  }
11
 
12
  .wpulike .counter a.image {
13
- background: #eaeff2 url(add-rtl.png) center center no-repeat;
14
  padding: 1px 20px;
15
- border: 1px solid #cbd3e8;
 
 
 
 
 
 
 
 
 
 
 
 
16
  border-radius: 3px;
17
  }
18
 
19
  .wpulike .counter a.text {
20
- background: #eaeff2;
21
  padding: 2px 15px;
22
- border: 1px solid #cbd3e8;
23
  border-radius: 3px;
24
- color: #5557a1;
 
 
 
 
 
 
25
  }
26
 
27
  .wpulike .count-box {
@@ -50,6 +66,7 @@
50
  -ms-transform: rotate(45deg);
51
  -o-transform: rotate(45deg);
52
  }
 
53
  .sr-only {
54
  position: absolute;
55
  width: 1px;
@@ -176,4 +193,112 @@ button.close {
176
  }
177
  .fade.in {
178
  opacity:1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  }
4
 
5
  .wpulike .counter a {
6
  cursor: pointer;
7
+ display:inline !important;
 
 
8
  }
9
 
10
  .wpulike .counter a.image {
11
+ background: #f1f1f1 url(add-rtl.png) center center no-repeat;
12
  padding: 1px 20px;
13
+ border: 1px solid #ddd;
14
+ border-radius: 3px;
15
+ }
16
+
17
+ .wpulike .counter a.image:hover{
18
+ background: #eee url(add-rtl.png) center center no-repeat;
19
+ border: 1px solid #ccc;
20
+ }
21
+
22
+ .wpulike .counter a.loading {
23
+ background: #f1f1f1 url(loading.GIF) center center no-repeat;
24
+ padding: 1px 20px;
25
+ border: 1px solid #ddd;
26
  border-radius: 3px;
27
  }
28
 
29
  .wpulike .counter a.text {
30
+ background: #f7f7f7;
31
  padding: 2px 15px;
32
+ border: 1px solid #cdcdcd;
33
  border-radius: 3px;
34
+ text-decoration:none;
35
+ color: #606060;
36
+ }
37
+
38
+ .wpulike .counter a.text:hover{
39
+ background: #eee;
40
+ border: 1px solid #ccc;
41
  }
42
 
43
  .wpulike .count-box {
66
  -ms-transform: rotate(45deg);
67
  -o-transform: rotate(45deg);
68
  }
69
+
70
  .sr-only {
71
  position: absolute;
72
  width: 1px;
193
  }
194
  .fade.in {
195
  opacity:1
196
+ }
197
+
198
+ #tiles {
199
+ list-style-type: none;
200
+ position: relative;
201
+ margin: 10px 0;
202
+ padding: 0;
203
+ }
204
+ #tiles li {
205
+ display:inline-table;
206
+ cursor: pointer;
207
+ }
208
+
209
+ #tiles li.inactive {
210
+ visibility: hidden;
211
+ opacity: 0;
212
+ }
213
+
214
+ #tiles li img {
215
+ display: block;
216
+ }
217
+
218
+ .tooltip {
219
+ position: absolute;
220
+ z-index: 1030;
221
+ display: block;
222
+ font-size: 11px;
223
+ line-height: 1.4;
224
+ opacity: 0;
225
+ filter: alpha(opacity=0);
226
+ visibility: visible;
227
+ }
228
+
229
+ .tooltip.in {
230
+ opacity: 0.8;
231
+ filter: alpha(opacity=80);
232
+ }
233
+
234
+ .tooltip.top {
235
+ padding: 5px 0;
236
+ margin-top: -3px;
237
+ }
238
+
239
+ .tooltip.right {
240
+ padding: 0 5px;
241
+ margin-left: 3px;
242
+ }
243
+
244
+ .tooltip.bottom {
245
+ padding: 5px 0;
246
+ margin-top: 3px;
247
+ }
248
+
249
+ .tooltip.left {
250
+ padding: 0 5px;
251
+ margin-left: -3px;
252
+ }
253
+
254
+ .tooltip-inner {
255
+ max-width: 200px;
256
+ padding: 8px;
257
+ color: #ffffff;
258
+ text-align: center;
259
+ text-decoration: none;
260
+ background-color: #000000;
261
+ -webkit-border-radius: 4px;
262
+ -moz-border-radius: 4px;
263
+ border-radius: 4px;
264
+ }
265
+
266
+ .tooltip-arrow {
267
+ position: absolute;
268
+ width: 0;
269
+ height: 0;
270
+ border-color: transparent;
271
+ border-style: solid;
272
+ }
273
+
274
+ .tooltip.top .tooltip-arrow {
275
+ bottom: 0;
276
+ left: 50%;
277
+ margin-left: -5px;
278
+ border-top-color: #000000;
279
+ border-width: 5px 5px 0;
280
+ }
281
+
282
+ .tooltip.right .tooltip-arrow {
283
+ top: 50%;
284
+ left: 0;
285
+ margin-top: -5px;
286
+ border-right-color: #000000;
287
+ border-width: 5px 5px 5px 0;
288
+ }
289
+
290
+ .tooltip.left .tooltip-arrow {
291
+ top: 50%;
292
+ right: 0;
293
+ margin-top: -5px;
294
+ border-left-color: #000000;
295
+ border-width: 5px 0 5px 5px;
296
+ }
297
+
298
+ .tooltip.bottom .tooltip-arrow {
299
+ top: 0;
300
+ left: 50%;
301
+ margin-left: -5px;
302
+ border-bottom-color: #000000;
303
+ border-width: 0 5px 5px;
304
  }
assets/css/wp-ulike.css CHANGED
@@ -4,13 +4,23 @@
4
 
5
  .wpulike .counter a {
6
  cursor: pointer;
7
- text-decoration:none;
8
  display:inline !important;
9
-
10
  }
11
 
12
  .wpulike .counter a.image {
13
- background: #f1f1f1 url(add.png) center center no-repeat;
 
 
 
 
 
 
 
 
 
 
 
 
14
  padding: 1px 20px;
15
  border: 1px solid #ddd;
16
  border-radius: 3px;
@@ -21,9 +31,15 @@
21
  padding: 2px 15px;
22
  border: 1px solid #cdcdcd;
23
  border-radius: 3px;
 
24
  color: #606060;
25
  }
26
 
 
 
 
 
 
27
  .wpulike .count-box {
28
  position: relative;
29
  background: #fff;
@@ -178,4 +194,112 @@ button.close {
178
  }
179
  .fade.in {
180
  opacity:1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  }
4
 
5
  .wpulike .counter a {
6
  cursor: pointer;
 
7
  display:inline !important;
 
8
  }
9
 
10
  .wpulike .counter a.image {
11
+ background: #f7f7f7 url(add.png) center center no-repeat;
12
+ padding: 2px 20px;
13
+ border: 1px solid #ddd;
14
+ border-radius: 3px;
15
+ }
16
+
17
+ .wpulike .counter a.image:hover{
18
+ background: #eee url(add.png) center center no-repeat;
19
+ border: 1px solid #ccc;
20
+ }
21
+
22
+ .wpulike .counter a.loading {
23
+ background: #eee url(loading.GIF) center center no-repeat;
24
  padding: 1px 20px;
25
  border: 1px solid #ddd;
26
  border-radius: 3px;
31
  padding: 2px 15px;
32
  border: 1px solid #cdcdcd;
33
  border-radius: 3px;
34
+ text-decoration:none;
35
  color: #606060;
36
  }
37
 
38
+ .wpulike .counter a.text:hover{
39
+ background: #eee;
40
+ border: 1px solid #ccc;
41
+ }
42
+
43
  .wpulike .count-box {
44
  position: relative;
45
  background: #fff;
194
  }
195
  .fade.in {
196
  opacity:1
197
+ }
198
+
199
+ #tiles {
200
+ list-style-type: none;
201
+ position: relative;
202
+ margin: 10px 0;
203
+ padding: 0;
204
+ }
205
+ #tiles li {
206
+ display:inline-table;
207
+ cursor: pointer;
208
+ }
209
+
210
+ #tiles li.inactive {
211
+ visibility: hidden;
212
+ opacity: 0;
213
+ }
214
+
215
+ #tiles li img {
216
+ display: block;
217
+ }
218
+
219
+ .tooltip {
220
+ position: absolute;
221
+ z-index: 1030;
222
+ display: block;
223
+ font-size: 11px;
224
+ line-height: 1.4;
225
+ opacity: 0;
226
+ filter: alpha(opacity=0);
227
+ visibility: visible;
228
+ }
229
+
230
+ .tooltip.in {
231
+ opacity: 0.8;
232
+ filter: alpha(opacity=80);
233
+ }
234
+
235
+ .tooltip.top {
236
+ padding: 5px 0;
237
+ margin-top: -3px;
238
+ }
239
+
240
+ .tooltip.right {
241
+ padding: 0 5px;
242
+ margin-left: 3px;
243
+ }
244
+
245
+ .tooltip.bottom {
246
+ padding: 5px 0;
247
+ margin-top: 3px;
248
+ }
249
+
250
+ .tooltip.left {
251
+ padding: 0 5px;
252
+ margin-left: -3px;
253
+ }
254
+
255
+ .tooltip-inner {
256
+ max-width: 200px;
257
+ padding: 8px;
258
+ color: #ffffff;
259
+ text-align: center;
260
+ text-decoration: none;
261
+ background-color: #000000;
262
+ -webkit-border-radius: 4px;
263
+ -moz-border-radius: 4px;
264
+ border-radius: 4px;
265
+ }
266
+
267
+ .tooltip-arrow {
268
+ position: absolute;
269
+ width: 0;
270
+ height: 0;
271
+ border-color: transparent;
272
+ border-style: solid;
273
+ }
274
+
275
+ .tooltip.top .tooltip-arrow {
276
+ bottom: 0;
277
+ left: 50%;
278
+ margin-left: -5px;
279
+ border-top-color: #000000;
280
+ border-width: 5px 5px 0;
281
+ }
282
+
283
+ .tooltip.right .tooltip-arrow {
284
+ top: 50%;
285
+ left: 0;
286
+ margin-top: -5px;
287
+ border-right-color: #000000;
288
+ border-width: 5px 5px 5px 0;
289
+ }
290
+
291
+ .tooltip.left .tooltip-arrow {
292
+ top: 50%;
293
+ right: 0;
294
+ margin-top: -5px;
295
+ border-left-color: #000000;
296
+ border-width: 5px 0 5px 5px;
297
+ }
298
+
299
+ .tooltip.bottom .tooltip-arrow {
300
+ top: 0;
301
+ left: 50%;
302
+ margin-left: -5px;
303
+ border-bottom-color: #000000;
304
+ border-width: 0 5px 5px;
305
  }
assets/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
assets/js/function.txt CHANGED
@@ -1,7 +1,6 @@
1
- function likeThis(postId) {
2
  if (postId != '') {
3
- jQuery('#wp-ulike-' + postId + ' .counter').html('<a class="text">' + ulike_obj.likeText + '</a><span class="count-box">...</span>');
4
-
5
  jQuery.ajax({
6
  type:'POST',
7
  url: ulike_obj.ajaxurl,
@@ -10,7 +9,15 @@ function likeThis(postId) {
10
  id: postId
11
  },
12
  success: function(value) {
13
- jQuery('#wp-ulike-' + postId + ' .counter').html('<a class="text">' + ulike_obj.likeText + '</a><span class="count-box">'+value+ '</span>');
 
 
 
 
 
 
 
 
14
  }
15
  });
16
  }
1
+ function likeThis(postId, n1, n2) {
2
  if (postId != '') {
3
+ jQuery('#wp-ulike-' + postId + ' .counter').html('<a class="loading"></a><span class="count-box">...</span>');
 
4
  jQuery.ajax({
5
  type:'POST',
6
  url: ulike_obj.ajaxurl,
9
  id: postId
10
  },
11
  success: function(value) {
12
+ if(n1+n2 == 1){
13
+ jQuery('#wp-ulike-' + postId + ' .counter').html("<a onclick='likeThis("+postId+",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-' + postId + ' .counter').html("<a onclick='likeThis("+postId+",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-' + postId + ' .counter').html("<a class='text user-tooltip' title='Already Voted'>" + ulike_obj.likeText + "</a><span class='count-box'>"+value+"</span>");
20
+ }
21
  }
22
  });
23
  }
assets/js/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
assets/js/wp-ulike.js CHANGED
@@ -1,3 +1 @@
1
- if("undefined"==typeof jQuery)throw new Error("WP Ulike's JavaScript requires jQuery");+function(t){"use strict";function n(){var t=document.createElement("bootstrap"),n={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var r in n)if(void 0!==t.style[r])return{end:n[r]};return!1}t.fn.emulateTransitionEnd=function(n){var r=!1,e=this;t(this).one("bsTransitionEnd",function(){r=!0});var i=function(){r||t(e).trigger(t.support.transition.end)};return setTimeout(i,n),this},t(function(){t.support.transition=n(),t.support.transition&&(t.event.special.bsTransitionEnd={bindType:t.support.transition.end,delegateType:t.support.transition.end,handle:function(n){return t(n.target).is(this)?n.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery);
2
- if("undefined"==typeof jQuery)throw new Error("WP Ulike's JavaScript requires jQuery");+function(t){"use strict";function e(e){return this.each(function(){var r=t(this),n=r.data("bs.alert");n||r.data("bs.alert",n=new a(this)),"string"==typeof e&&n[e].call(r)})}var r='[data-dismiss="alert"]',a=function(e){t(e).on("click",r,this.close)};a.VERSION="3.2.0",a.prototype.close=function(e){function r(){s.detach().trigger("closed.bs.alert").remove()}var a=t(this),n=a.attr("data-target");n||(n=a.attr("href"),n=n&&n.replace(/.*(?=#[^\s]*$)/,""));var s=t(n);e&&e.preventDefault(),s.length||(s=a.hasClass("alert")?a:a.parent()),s.trigger(e=t.Event("close.bs.alert")),e.isDefaultPrevented()||(s.removeClass("in"),t.support.transition&&s.hasClass("fade")?s.one("bsTransitionEnd",r).emulateTransitionEnd(150):r())};var n=t.fn.alert;t.fn.alert=e,t.fn.alert.Constructor=a,t.fn.alert.noConflict=function(){return t.fn.alert=n,this},t(document).on("click.bs.alert.data-api",r,a.prototype.close)}(jQuery);
3
- function likeThis(e){""!=e&&(jQuery("#wp-ulike-"+e+" .counter").html('<a class="text">'+ulike_obj.likeText+'</a><span class="count-box">...</span>'),jQuery.ajax({type:"POST",url:ulike_obj.ajaxurl,data:{action:"ulikeprocess",id:e},success:function(a){jQuery("#wp-ulike-"+e+" .counter").html('<a class="text">'+ulike_obj.likeText+'</a><span class="count-box">'+a+"</span>")}}))}
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>")}}))}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()});
 
 
inc/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
inc/wp-functions.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ //get real IP
4
+ function wp_ulike_get_real_ip() {
5
+ if (getenv('HTTP_CLIENT_IP')) {
6
+ $ip = getenv('HTTP_CLIENT_IP');
7
+ } elseif (getenv('HTTP_X_FORWARDED_FOR')) {
8
+ $ip = getenv('HTTP_X_FORWARDED_FOR');
9
+ } elseif (getenv('HTTP_X_FORWARDED')) {
10
+ $ip = getenv('HTTP_X_FORWARDED');
11
+ } elseif (getenv('HTTP_FORWARDED_FOR')) {
12
+ $ip = getenv('HTTP_FORWARDED_FOR');
13
+ } elseif (getenv('HTTP_FORWARDED')) {
14
+ $ip = getenv('HTTP_FORWARDED');
15
+ } else {
16
+ $ip = $_SERVER['REMOTE_ADDR'];
17
+ }
18
+
19
+ return $ip;
20
+ }
21
+
22
+ //get users data and list their avatar
23
+ function get_user_data($post_ID,$user_ID){
24
+ global $wpdb;
25
+ $users_list = '';
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):
41
+ $user_info = get_userdata($get_user->user_id);
42
+ $users_list .= '<li><a class="user-tooltip" title="'.$user_info->display_name.'">'.get_avatar( $user_info->user_email, 32, '' , 'avatar').'</a></li>';
43
+ endif;
44
+ }
45
+
46
+ return $users_list;
47
+
48
+ }
49
+
50
+ //get user status (like or dislike)
51
+ function get_user_status($post_ID,$user_ID){
52
+ global $wpdb;
53
+ $like_status = $wpdb->get_var("SELECT status FROM ".$wpdb->prefix."ulike WHERE post_id = '$post_ID' AND user_id = '$user_ID'");
54
+ if ($like_status == "like")
55
+ return "like";
56
+ else
57
+ return "dislike";
58
+ }
59
+
60
+ //add ULike button to the posts
61
+ if (get_option('wp_ulike_onPage') == '1') {
62
+ function wp_put_ulike($content) {
63
+ if(!is_feed() && !is_page()) {
64
+ $content.= wp_ulike('put');
65
+ }
66
+ return $content;
67
+ }
68
+
69
+ add_filter('the_content', 'wp_put_ulike');
70
+ }
inc/wp-options.php CHANGED
@@ -11,7 +11,9 @@ function wp_ulike_register_mysettings() { // whitelist options
11
  register_setting( 'wp_ulike_options', 'wp_ulike_textOrImage' );
12
  register_setting( 'wp_ulike_options', 'wp_ulike_text' );
13
  register_setting( 'wp_ulike_options', 'wp_ulike_btn_text' );
 
14
  register_setting( 'wp_ulike_options', 'wp_ulike_onlyRegistered' );
 
15
  }
16
 
17
 
@@ -27,7 +29,7 @@ function wp_ulike_settings_page() {
27
  <tr valign="top">
28
  <th scope="row"><?php _e('Image or text?', 'alimir'); ?></th>
29
  <td>
30
- <label for="wp_ulike_textOrImage" style="padding:3px 20px 3px; background: url(<?php echo plugins_url('assets/css/add.png', dirname(__FILE__)); ?>) no-repeat right center;">
31
  <?php echo get_option('wp_ulike_textOrImage') == 'image' ? '<input type="radio" name="wp_ulike_textOrImage" id="wp_ulike_textOrImage" value="image" checked="checked">' : '<input type="radio" name="wp_ulike_textOrImage" id="wp_ulike_textOrImage" value="image">'; ?>
32
  </label>
33
  <label for="wp_ulike_text">
@@ -37,13 +39,21 @@ function wp_ulike_settings_page() {
37
  </td>
38
  </tr>
39
  <tr valign="top">
40
- <th scope="row"><?php _e('Liked Text?', 'alimir'); ?></th>
41
  <td>
42
  <label for="wp_ulike_btn_text">
43
  <input type="text" name="wp_ulike_btn_text" id="wp_ulike_btn_text" value="<?php echo get_option('wp_ulike_btn_text'); ?>" />
44
  </label>
45
  </td>
46
  </tr>
 
 
 
 
 
 
 
 
47
  <tr valign="top">
48
  <th scope="row"><?php _e('Automatic display', 'alimir'); ?></th>
49
  <td>
@@ -64,6 +74,16 @@ function wp_ulike_settings_page() {
64
  <p class="description"><?php _e('<strong>Only</strong> registered users have permission to like posts.', 'alimir'); ?></p>
65
  </td>
66
  </tr>
 
 
 
 
 
 
 
 
 
 
67
  </table>
68
  <?php submit_button(); ?>
69
  </form>
11
  register_setting( 'wp_ulike_options', 'wp_ulike_textOrImage' );
12
  register_setting( 'wp_ulike_options', 'wp_ulike_text' );
13
  register_setting( 'wp_ulike_options', 'wp_ulike_btn_text' );
14
+ register_setting( 'wp_ulike_options', 'wp_ulike_dislike_text' );
15
  register_setting( 'wp_ulike_options', 'wp_ulike_onlyRegistered' );
16
+ register_setting( 'wp_ulike_options', 'wp_ulike_user_like_box' );
17
  }
18
 
19
 
29
  <tr valign="top">
30
  <th scope="row"><?php _e('Image or text?', 'alimir'); ?></th>
31
  <td>
32
+ <label for="wp_ulike_textOrImage" style="padding:3px 10px 3px; background: url(<?php echo plugins_url('assets/css/add.png', dirname(__FILE__)); ?>) no-repeat right center;">
33
  <?php echo get_option('wp_ulike_textOrImage') == 'image' ? '<input type="radio" name="wp_ulike_textOrImage" id="wp_ulike_textOrImage" value="image" checked="checked">' : '<input type="radio" name="wp_ulike_textOrImage" id="wp_ulike_textOrImage" value="image">'; ?>
34
  </label>
35
  <label for="wp_ulike_text">
39
  </td>
40
  </tr>
41
  <tr valign="top">
42
+ <th scope="row"><?php _e('Like Text', 'alimir'); ?></th>
43
  <td>
44
  <label for="wp_ulike_btn_text">
45
  <input type="text" name="wp_ulike_btn_text" id="wp_ulike_btn_text" value="<?php echo get_option('wp_ulike_btn_text'); ?>" />
46
  </label>
47
  </td>
48
  </tr>
49
+ <tr valign="top">
50
+ <th scope="row"><?php _e('Dislike Text?', 'alimir'); ?></th>
51
+ <td>
52
+ <label for="wp_ulike_dislike_text">
53
+ <input type="text" name="wp_ulike_dislike_text" id="wp_ulike_dislike_text" value="<?php echo get_option('wp_ulike_dislike_text'); ?>" />
54
+ </label>
55
+ </td>
56
+ </tr>
57
  <tr valign="top">
58
  <th scope="row"><?php _e('Automatic display', 'alimir'); ?></th>
59
  <td>
74
  <p class="description"><?php _e('<strong>Only</strong> registered users have permission to like posts.', 'alimir'); ?></p>
75
  </td>
76
  </tr>
77
+ <tr valign="top">
78
+ <th scope="row"><?php _e('Show Users Like Box', 'alimir'); ?></th>
79
+ <td>
80
+ <label for="wp_ulike_user_like_box">
81
+ <?php echo get_option('wp_ulike_user_like_box') == '1' ? '<input type="checkbox" name="wp_ulike_user_like_box" id="wp_ulike_user_like_box" value="1" checked="checked">' : '<input type="checkbox" name="wp_ulike_user_like_box" id="wp_ulike_user_like_box" value="1">'; ?>
82
+ <?php _e('Activate', 'alimir'); ?>
83
+ </label>
84
+ <p class="description"><?php _e('Active this option to show users avatar in like box.', 'alimir'); ?></p>
85
+ </td>
86
+ </tr>
87
  </table>
88
  <?php submit_button(); ?>
89
  </form>
inc/wp-script.php CHANGED
@@ -7,7 +7,8 @@ function enqueueScripts() {
7
 
8
  wp_localize_script( 'wp_ulike', 'ulike_obj', array(
9
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
10
- 'likeText' => get_option('wp_ulike_btn_text')
 
11
  ));
12
  add_action('wp_ajax_ulikeprocess','wp_ulike_process');
13
  add_action('wp_ajax_nopriv_ulikeprocess', 'wp_ulike_process');
7
 
8
  wp_localize_script( 'wp_ulike', 'ulike_obj', array(
9
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
10
+ 'likeText' => get_option('wp_ulike_btn_text'),
11
+ 'disLikeText' => get_option('wp_ulike_dislike_text')
12
  ));
13
  add_action('wp_ajax_ulikeprocess','wp_ulike_process');
14
  add_action('wp_ajax_nopriv_ulikeprocess', 'wp_ulike_process');
index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
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: I-Like-This\n"
4
- "POT-Creation-Date: 2014-08-28 11:21+0330\n"
5
- "PO-Revision-Date: 2014-08-28 11:21+0330\n"
6
  "Last-Translator: Alimir <info@alimir.ir>\n"
7
  "Language-Team: alimir.ir <info@alimir.ir>\n"
8
  "Language: Persian\n"
@@ -26,15 +26,35 @@ msgid ""
26
  "to allow your visitors to like pages and posts. Its very simple to use and "
27
  "support a widget to display the most liked posts."
28
  msgstr ""
29
- "یولایک، یک افزونه ساده و سبک برای راه اندازی سیستم \"لایک مطالب\" در وبلاگ "
30
- "یا وبسایت شماست :) - این پلاگین توسط علی میرزائی و در دنیای وردپرس و برنامه "
31
- "نویسی منتشر شده است."
32
 
33
- #: ../wp-ulike.php:81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  msgid "You need to login in order to like this post: "
35
  msgstr "برای امتیاز دهی به این مطلب، لطفا وارد شوید: "
36
 
37
- #: ../wp-ulike.php:81
38
  msgid "click here"
39
  msgstr "برای ورود کلیک کنید"
40
 
@@ -42,23 +62,27 @@ msgstr "برای ورود کلیک کنید"
42
  msgid "WP Ulike"
43
  msgstr "تنظیمات یولایک"
44
 
45
- #: ../inc/wp-options.php:22
46
  msgid "Configuration"
47
  msgstr "پیکربندی"
48
 
49
- #: ../inc/wp-options.php:28
50
  msgid "Image or text?"
51
  msgstr "متن یا تصویر؟"
52
 
53
- #: ../inc/wp-options.php:40
54
- msgid "Liked Text?"
55
- msgstr "متن دکمه پس از لایک"
 
 
 
 
56
 
57
- #: ../inc/wp-options.php:48
58
  msgid "Automatic display"
59
  msgstr "نمایش خودکار"
60
 
61
- #: ../inc/wp-options.php:52
62
  msgid ""
63
  "<strong>On all posts</strong> (home, archives, search) at the bottom of the "
64
  "post"
@@ -66,31 +90,47 @@ msgstr ""
66
  "<strong>نمایش در تمامی پست ها</strong> (خانه, بایگانی, جستجو)در بخش زیرین "
67
  "مطالب."
68
 
69
- #: ../inc/wp-options.php:54
70
  msgid "If you disable this option, you have to put manually the code"
71
  msgstr "اگر این قابلیت را غیر فعال کنید، باید به صورت دستی این کد را "
72
 
73
- #: ../inc/wp-options.php:54
74
  msgid "wherever you want in your template."
75
  msgstr "در قالب خود قرار دهید."
76
 
77
- #: ../inc/wp-options.php:58
78
  msgid "Only registered Users"
79
  msgstr "محدودسازی لایک کاربران"
80
 
81
- #: ../inc/wp-options.php:62
82
  msgid "<strong>Active</strong> this option."
83
- msgstr "<strong>فعال کردن</strong> این قابلیت."
84
 
85
- #: ../inc/wp-options.php:64
86
  msgid "<strong>Only</strong> registered users have permission to like posts."
87
- msgstr "<strong>تنها</strong> کاربران عضو شده، می توانند مطالب را لایک کنند.."
 
 
88
 
89
- #: ../inc/wp-options.php:74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  msgid "Like this plugin?"
91
  msgstr "این پلاگین چندتا لایک داره؟!؟ :)"
92
 
93
- #: ../inc/wp-options.php:77
94
  msgid ""
95
  "Show your support by Rating 5 Star in <a href=\"http://wordpress.org/plugins/"
96
  "wp-ulike\"> Plugin Directory reviews</a>"
@@ -98,14 +138,14 @@ msgstr ""
98
  "حمایتتون رو از این افزونه، با امتیاز 5 ستاره در <a href=\"http://wordpress."
99
  "org/plugins/wp-ulike\">مخزن وردپرس</a> مشخص کنید..."
100
 
101
- #: ../inc/wp-options.php:78
102
  msgid ""
103
  "Follow me on <a href=\"https://www.facebook.com/alimir.ir\"> Facebook</a>"
104
  msgstr ""
105
  "دنیای وردپرس و برنامه نویسی را در <a href=\"https://www.facebook.com/alimir."
106
  "ir\"> فیسبوک</a> دنبال کنید..."
107
 
108
- #: ../inc/wp-options.php:79
109
  msgid ""
110
  "Plugin Author Blog: <a href=\"http://alimir.ir\"> Wordpress & Programming "
111
  "World.</a>"
@@ -157,9 +197,6 @@ msgstr "نمایش شمارشگر"
157
  #~ "اگر پیش ازاین، از چارچوب جی کوئری در قالب خود استفاده کرده اید، این "
158
  #~ "قابلیت را غیر فعال کنید."
159
 
160
- #~ msgid "I Like This"
161
- #~ msgstr "افزونه لایک وردپرس"
162
-
163
  #~ msgid "Translated in"
164
  #~ msgstr "فارسی سازی در "
165
 
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: I-Like-This\n"
4
+ "POT-Creation-Date: 2014-09-09 16:54+0330\n"
5
+ "PO-Revision-Date: 2014-09-09 16:54+0330\n"
6
  "Last-Translator: Alimir <info@alimir.ir>\n"
7
  "Language-Team: alimir.ir <info@alimir.ir>\n"
8
  "Language: Persian\n"
26
  "to allow your visitors to like pages and posts. Its very simple to use and "
27
  "support a widget to display the most liked posts."
28
  msgstr ""
29
+ "یولایک، یه افزونه ی ساده و سبک ایرونی، برای راه اندازی سیستم \"لایک مطالب\" "
30
+ "در وبلاگ یا وبسایت شماست :) - این پلاگین توسط علی میرزائی و در دنیای وردپرس "
31
+ "و برنامه نویسی توسعه داده شده."
32
 
33
+ #: ../wp-ulike.php:56
34
+ msgid "Like"
35
+ msgstr "لایک"
36
+
37
+ #: ../wp-ulike.php:57
38
+ msgid "You Like This"
39
+ msgstr "شما این را پسندیده اید"
40
+
41
+ #: ../wp-ulike.php:58
42
+ msgid "You Dislike This"
43
+ msgstr "شما این را نپسندیده اید"
44
+
45
+ #: ../wp-ulike.php:115 ../wp-ulike.php:131
46
+ msgid "Already Voted"
47
+ msgstr "قبلا لایک کرده اید"
48
+
49
+ #: ../wp-ulike.php:142
50
+ msgid "Users who have LIKED this post:"
51
+ msgstr "کاربرانی که این مطلب را پسندیده اند:"
52
+
53
+ #: ../wp-ulike.php:154
54
  msgid "You need to login in order to like this post: "
55
  msgstr "برای امتیاز دهی به این مطلب، لطفا وارد شوید: "
56
 
57
+ #: ../wp-ulike.php:154
58
  msgid "click here"
59
  msgstr "برای ورود کلیک کنید"
60
 
62
  msgid "WP Ulike"
63
  msgstr "تنظیمات یولایک"
64
 
65
+ #: ../inc/wp-options.php:24
66
  msgid "Configuration"
67
  msgstr "پیکربندی"
68
 
69
+ #: ../inc/wp-options.php:30
70
  msgid "Image or text?"
71
  msgstr "متن یا تصویر؟"
72
 
73
+ #: ../inc/wp-options.php:42
74
+ msgid "Like Text"
75
+ msgstr "متن دکمه لایک"
76
+
77
+ #: ../inc/wp-options.php:50
78
+ msgid "Dislike Text?"
79
+ msgstr "متن دکمه دیسلایک"
80
 
81
+ #: ../inc/wp-options.php:58
82
  msgid "Automatic display"
83
  msgstr "نمایش خودکار"
84
 
85
+ #: ../inc/wp-options.php:62
86
  msgid ""
87
  "<strong>On all posts</strong> (home, archives, search) at the bottom of the "
88
  "post"
90
  "<strong>نمایش در تمامی پست ها</strong> (خانه, بایگانی, جستجو)در بخش زیرین "
91
  "مطالب."
92
 
93
+ #: ../inc/wp-options.php:64
94
  msgid "If you disable this option, you have to put manually the code"
95
  msgstr "اگر این قابلیت را غیر فعال کنید، باید به صورت دستی این کد را "
96
 
97
+ #: ../inc/wp-options.php:64
98
  msgid "wherever you want in your template."
99
  msgstr "در قالب خود قرار دهید."
100
 
101
+ #: ../inc/wp-options.php:68
102
  msgid "Only registered Users"
103
  msgstr "محدودسازی لایک کاربران"
104
 
105
+ #: ../inc/wp-options.php:72
106
  msgid "<strong>Active</strong> this option."
107
+ msgstr "می خواهم این قابلیت را<strong>فعال</strong> کنم"
108
 
109
+ #: ../inc/wp-options.php:74
110
  msgid "<strong>Only</strong> registered users have permission to like posts."
111
+ msgstr ""
112
+ "با فعال سازی این گزینه، <strong>تنها</strong> کاربران عضو شده، می توانند "
113
+ "مطالب را لایک کنند."
114
 
115
+ #: ../inc/wp-options.php:78
116
+ msgid "Show Users Like Box"
117
+ msgstr "نمایش باکس کاربران لایک کرده"
118
+
119
+ #: ../inc/wp-options.php:82
120
+ msgid "Activate"
121
+ msgstr "فعال سازی"
122
+
123
+ #: ../inc/wp-options.php:84
124
+ msgid "Active this option to show users avatar in like box."
125
+ msgstr ""
126
+ "با فعال سازی این گزینه، می توانید آواتار کاربران لایک کرده، را در زیر هر "
127
+ "مطلب، نمایش دهید."
128
+
129
+ #: ../inc/wp-options.php:94
130
  msgid "Like this plugin?"
131
  msgstr "این پلاگین چندتا لایک داره؟!؟ :)"
132
 
133
+ #: ../inc/wp-options.php:97
134
  msgid ""
135
  "Show your support by Rating 5 Star in <a href=\"http://wordpress.org/plugins/"
136
  "wp-ulike\"> Plugin Directory reviews</a>"
138
  "حمایتتون رو از این افزونه، با امتیاز 5 ستاره در <a href=\"http://wordpress."
139
  "org/plugins/wp-ulike\">مخزن وردپرس</a> مشخص کنید..."
140
 
141
+ #: ../inc/wp-options.php:98
142
  msgid ""
143
  "Follow me on <a href=\"https://www.facebook.com/alimir.ir\"> Facebook</a>"
144
  msgstr ""
145
  "دنیای وردپرس و برنامه نویسی را در <a href=\"https://www.facebook.com/alimir."
146
  "ir\"> فیسبوک</a> دنبال کنید..."
147
 
148
+ #: ../inc/wp-options.php:99
149
  msgid ""
150
  "Plugin Author Blog: <a href=\"http://alimir.ir\"> Wordpress & Programming "
151
  "World.</a>"
197
  #~ "اگر پیش ازاین، از چارچوب جی کوئری در قالب خود استفاده کرده اید، این "
198
  #~ "قابلیت را غیر فعال کنید."
199
 
 
 
 
200
  #~ msgid "Translated in"
201
  #~ msgstr "فارسی سازی در "
202
 
lang/alimir-fr_FR.mo CHANGED
Binary file
lang/alimir-fr_FR.po CHANGED
@@ -2,7 +2,7 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WP ULike\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2014-08-28 11:21+0330\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Alimir <info@alimir.ir>\n"
8
  "Language-Team: \n"
@@ -27,11 +27,31 @@ msgid ""
27
  "support a widget to display the most liked posts."
28
  msgstr ""
29
 
30
- #: ../wp-ulike.php:81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  msgid "You need to login in order to like this post: "
32
  msgstr ""
33
 
34
- #: ../wp-ulike.php:81
35
  msgid "click here"
36
  msgstr ""
37
 
@@ -39,23 +59,27 @@ msgstr ""
39
  msgid "WP Ulike"
40
  msgstr ""
41
 
42
- #: ../inc/wp-options.php:22
43
  msgid "Configuration"
44
  msgstr "Configuration"
45
 
46
- #: ../inc/wp-options.php:28
47
  msgid "Image or text?"
48
  msgstr "Image ou texte?"
49
 
50
- #: ../inc/wp-options.php:40
51
- msgid "Liked Text?"
 
 
 
 
52
  msgstr ""
53
 
54
- #: ../inc/wp-options.php:48
55
  msgid "Automatic display"
56
  msgstr "Affichage automatique"
57
 
58
- #: ../inc/wp-options.php:52
59
  msgid ""
60
  "<strong>On all posts</strong> (home, archives, search) at the bottom of the "
61
  "post"
@@ -63,43 +87,55 @@ msgstr ""
63
  "<strong>Pour tous les articles</strong> (accueil, archives, recherche) au "
64
  "fond de l'article."
65
 
66
- #: ../inc/wp-options.php:54
67
  msgid "If you disable this option, you have to put manually the code"
68
  msgstr ""
69
  "Si vous désactivez cette option, vous devez ajouter manuellement le code"
70
 
71
- #: ../inc/wp-options.php:54
72
  msgid "wherever you want in your template."
73
  msgstr "n'importe où vous le souhaitez dans votre thème."
74
 
75
- #: ../inc/wp-options.php:58
76
  msgid "Only registered Users"
77
  msgstr ""
78
 
79
- #: ../inc/wp-options.php:62
80
  msgid "<strong>Active</strong> this option."
81
  msgstr ""
82
 
83
- #: ../inc/wp-options.php:64
84
  msgid "<strong>Only</strong> registered users have permission to like posts."
85
  msgstr ""
86
 
87
- #: ../inc/wp-options.php:74
 
 
 
 
 
 
 
 
 
 
 
 
88
  msgid "Like this plugin?"
89
  msgstr "Vous aimez ce plugin?"
90
 
91
- #: ../inc/wp-options.php:77
92
  msgid ""
93
  "Show your support by Rating 5 Star in <a href=\"http://wordpress.org/plugins/"
94
  "wp-ulike\"> Plugin Directory reviews</a>"
95
  msgstr ""
96
 
97
- #: ../inc/wp-options.php:78
98
  msgid ""
99
  "Follow me on <a href=\"https://www.facebook.com/alimir.ir\"> Facebook</a>"
100
  msgstr ""
101
 
102
- #: ../inc/wp-options.php:79
103
  msgid ""
104
  "Plugin Author Blog: <a href=\"http://alimir.ir\"> Wordpress & Programming "
105
  "World.</a>"
2
  msgstr ""
3
  "Project-Id-Version: WP ULike\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2014-09-04 15:00+0330\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Alimir <info@alimir.ir>\n"
8
  "Language-Team: \n"
27
  "support a widget to display the most liked posts."
28
  msgstr ""
29
 
30
+ #: ../wp-ulike.php:55
31
+ msgid "Like"
32
+ msgstr ""
33
+
34
+ #: ../wp-ulike.php:56
35
+ msgid "You Like This"
36
+ msgstr ""
37
+
38
+ #: ../wp-ulike.php:57
39
+ msgid "You Dislike This"
40
+ msgstr ""
41
+
42
+ #: ../wp-ulike.php:114 ../wp-ulike.php:130
43
+ msgid "Already Voted"
44
+ msgstr ""
45
+
46
+ #: ../wp-ulike.php:141
47
+ msgid "Users who have LIKED this post:"
48
+ msgstr ""
49
+
50
+ #: ../wp-ulike.php:153
51
  msgid "You need to login in order to like this post: "
52
  msgstr ""
53
 
54
+ #: ../wp-ulike.php:153
55
  msgid "click here"
56
  msgstr ""
57
 
59
  msgid "WP Ulike"
60
  msgstr ""
61
 
62
+ #: ../inc/wp-options.php:24
63
  msgid "Configuration"
64
  msgstr "Configuration"
65
 
66
+ #: ../inc/wp-options.php:30
67
  msgid "Image or text?"
68
  msgstr "Image ou texte?"
69
 
70
+ #: ../inc/wp-options.php:42
71
+ msgid "Like Text"
72
+ msgstr ""
73
+
74
+ #: ../inc/wp-options.php:50
75
+ msgid "Dislike Text?"
76
  msgstr ""
77
 
78
+ #: ../inc/wp-options.php:58
79
  msgid "Automatic display"
80
  msgstr "Affichage automatique"
81
 
82
+ #: ../inc/wp-options.php:62
83
  msgid ""
84
  "<strong>On all posts</strong> (home, archives, search) at the bottom of the "
85
  "post"
87
  "<strong>Pour tous les articles</strong> (accueil, archives, recherche) au "
88
  "fond de l'article."
89
 
90
+ #: ../inc/wp-options.php:64
91
  msgid "If you disable this option, you have to put manually the code"
92
  msgstr ""
93
  "Si vous désactivez cette option, vous devez ajouter manuellement le code"
94
 
95
+ #: ../inc/wp-options.php:64
96
  msgid "wherever you want in your template."
97
  msgstr "n'importe où vous le souhaitez dans votre thème."
98
 
99
+ #: ../inc/wp-options.php:68
100
  msgid "Only registered Users"
101
  msgstr ""
102
 
103
+ #: ../inc/wp-options.php:72
104
  msgid "<strong>Active</strong> this option."
105
  msgstr ""
106
 
107
+ #: ../inc/wp-options.php:74
108
  msgid "<strong>Only</strong> registered users have permission to like posts."
109
  msgstr ""
110
 
111
+ #: ../inc/wp-options.php:78
112
+ msgid "Show Users Like Box"
113
+ msgstr ""
114
+
115
+ #: ../inc/wp-options.php:82
116
+ msgid "Activate"
117
+ msgstr ""
118
+
119
+ #: ../inc/wp-options.php:84
120
+ msgid "Active this option to show users avatar in like box."
121
+ msgstr ""
122
+
123
+ #: ../inc/wp-options.php:94
124
  msgid "Like this plugin?"
125
  msgstr "Vous aimez ce plugin?"
126
 
127
+ #: ../inc/wp-options.php:97
128
  msgid ""
129
  "Show your support by Rating 5 Star in <a href=\"http://wordpress.org/plugins/"
130
  "wp-ulike\"> Plugin Directory reviews</a>"
131
  msgstr ""
132
 
133
+ #: ../inc/wp-options.php:98
134
  msgid ""
135
  "Follow me on <a href=\"https://www.facebook.com/alimir.ir\"> Facebook</a>"
136
  msgstr ""
137
 
138
+ #: ../inc/wp-options.php:99
139
  msgid ""
140
  "Plugin Author Blog: <a href=\"http://alimir.ir\"> Wordpress & Programming "
141
  "World.</a>"
lang/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
readme.txt CHANGED
@@ -3,17 +3,17 @@ Contributors: alimir
3
  Donate link: http://alimir.ir
4
  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.1
7
- Tested up to: 3.9.2
8
- Stable tag: 1.0
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 pages and posts.
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 pages and posts. Its very simple to use and support a widget to display the most liked posts.
17
 
18
  = Demo =
19
 
@@ -21,14 +21,20 @@ WP ULike plugin allows to integrate a beautiful Ajax Like Button into your wordP
21
 
22
  = Features =
23
 
24
- * A counter/button to submit and display the number of likes.
25
- * A widget and a function to display the most liked posts.
 
 
 
 
 
 
26
  * Simple configuration panel.
27
- * Full RTL support.
28
  * And so on...
29
 
30
  = How To Use? =
31
- * Just install the plugin and use `<?php if(function_exists('wp_ulike')) wp_ulike('get'); ?>` function or activate the "automatic display" in plugin setting panel.
32
 
33
  = Translations =
34
  * English
@@ -50,10 +56,18 @@ Screenshots are available in <a href="http://preview.alimir.ir/wp-ulike-plugin"
50
 
51
  == Changelog ==
52
 
53
- = 1.0.0 =
 
 
 
 
 
 
 
 
54
  * The initial version
55
 
56
  == Upgrade Notice ==
57
 
58
- = 1.0.0 =
59
  The initial version
3
  Donate link: http://alimir.ir
4
  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.1
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 and posts.
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 and posts. Its very simple to use and support a widget to display the most liked posts.
17
 
18
  = Demo =
19
 
21
 
22
  = Features =
23
 
24
+ * Clean Design.
25
+ * Ajax feature to update the data without reloading.
26
+ * Visitors do not have to register or log in to use the Like Button.
27
+ * Compatible with WP version 3.0 & above.
28
+ * Added automatically (no Code required).
29
+ * Simple likeBox to show users avatar.
30
+ * Custom Like-Dislike Texts.
31
+ * Widget to show 'Most Liked' posts.
32
  * Simple configuration panel.
33
+ * Support RTL & language file.
34
  * And so on...
35
 
36
  = How To Use? =
37
+ * Just install the plugin and use `<?php if(function_exists('wp_ulike')) wp_ulike('get'); ?>` function or activate the "automatic display" in plugin configuration panel.
38
 
39
  = Translations =
40
  * English
56
 
57
  == Changelog ==
58
 
59
+ = 1.1 =
60
+ * Add loading spinner.
61
+ * Add new database table.
62
+ * Add user dislike support.
63
+ * Add Simple "user avatar box" at the bottom of every post.
64
+ * Improve plugin security and authentication.
65
+ * Update language files.
66
+
67
+ = 1.0 =
68
  * The initial version
69
 
70
  == Upgrade Notice ==
71
 
72
+ = 1.0 =
73
  The initial version
wp-ulike.php CHANGED
@@ -3,9 +3,9 @@
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 and posts. Its very simple to use and support a widget to display the most liked posts.
6
- Version: 1.0
7
  Author: Ali Mirzaei
8
- Author URI: http://alimir.ir
9
  Text Domain: alimir
10
  Domain Path: /lang/
11
  License: GPL2
@@ -22,96 +22,191 @@ License: GPL2
22
  include( plugin_dir_path( __FILE__ ) . 'inc/wp-options.php');
23
  //Load Scripts
24
  include( plugin_dir_path( __FILE__ ) . 'inc/wp-script.php');
 
 
 
 
 
25
 
26
  function wp_ulike_options() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  add_option('wp_ulike_onPage', '1', '', 'yes');
28
  add_option('wp_ulike_onlyRegistered', '0', '', 'yes');
 
29
  add_option('wp_ulike_textOrImage', 'image', '', 'yes');
30
- add_option('wp_ulike_text', 'Like', '', 'yes');
31
- add_option('wp_ulike_btn_text', 'You Liked Before', '', 'yes');
 
32
  }
33
 
34
  register_activation_hook(__FILE__, 'wp_ulike_options');
35
 
36
- function wp_ulike_unsetOptions() {
 
 
 
 
 
 
 
 
37
 
38
  delete_option('wp_ulike_onPage');
39
  delete_option('wp_ulike_textOrImage');
40
  delete_option('wp_ulike_text');
41
  delete_option('wp_ulike_btn_text');
 
42
  delete_option('wp_ulike_onlyRegistered');
43
  }
44
 
45
- register_uninstall_hook(__FILE__, 'wp_ulike_unsetOptions');
46
-
47
  //main function
48
  function wp_ulike($arg) {
49
- global $post;
 
50
  $post_ID = $post->ID;
 
51
  $liked = get_post_meta($post_ID, '_liked', true) != '' ? '+' . get_post_meta($post_ID, '_liked', true) : '0';
52
 
53
-
54
  if ( (get_option('wp_ulike_onlyRegistered') != '1') or (get_option('wp_ulike_onlyRegistered') == '1' && is_user_logged_in()) ){
55
 
56
- if (!isset($_COOKIE['liked-'.$post_ID])) {
57
- if (get_option('wp_ulike_textOrImage') == 'image') {
58
- $counter = '<a onclick="likeThis('.$post_ID.');" class="image"></a><span class="count-box">'.$liked.'</span>';
 
 
 
 
 
 
 
 
59
  }
60
- else {
61
- $counter = '<a onclick="likeThis('.$post_ID.');" class="text">'.get_option('wp_ulike_text').'</a><span class="count-box">'.$liked.'</span>';
 
 
 
 
 
62
  }
63
- }
64
- else {
65
- $counter = '<a class="text">'.get_option('wp_ulike_btn_text').'</a><span class="count-box">'.$liked.'</span>';
66
- }
67
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
 
69
  $wp_ulike = '<div id="wp-ulike-'.$post_ID.'" class="wpulike">';
70
- $wp_ulike .= '<div class="counter">'.$counter.'</div>';
71
  $wp_ulike .= '</div>';
72
 
 
 
 
 
73
  if ($arg == 'put') {
74
  return $wp_ulike;
75
  }
76
  else {
77
  echo $wp_ulike;
78
  }
 
79
  }
 
80
  else if (get_option('wp_ulike_onlyRegistered') == '1' && !is_user_logged_in()){
81
- 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 post: ','alimir').'<a href="'.wp_login_url().'"> '.__('click here','alimir').' </a></p>';
82
  }
 
83
  }
84
 
85
  //Process function
86
  function wp_ulike_process(){
 
 
87
  $post_ID = $_POST['id'];
88
  $like = get_post_meta($post_ID, '_liked', true);
89
-
90
- if($post_ID != '') {
91
 
92
- if (!isset($_COOKIE['liked-'.$post_ID])) {
 
93
  $newLike = $like + 1;
94
  update_post_meta($post_ID, '_liked', $newLike);
95
 
96
  setcookie('liked-'.$post_ID, time(), time()+3600*24*365, '/');
 
 
 
 
 
97
 
98
  echo '+' . $newLike;
99
  }
100
- else {
101
- echo $like;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  }
103
- }
104
- die();
105
- }
106
-
107
- //add to post/pages
108
- if (get_option('wp_ulike_onPage') == '1') {
109
- function wp_put_ulike($content) {
110
- if(!is_feed() && !is_page()) {
111
- $content.= wp_ulike('put');
112
  }
113
- return $content;
114
  }
115
-
116
- add_filter('the_content', 'wp_put_ulike');
117
  }
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 and posts. Its very simple to use and support a widget to display the most liked posts.
6
+ Version: 1.1
7
  Author: Ali Mirzaei
8
+ Author URI: http://about.alimir.ir
9
  Text Domain: alimir
10
  Domain Path: /lang/
11
  License: GPL2
22
  include( plugin_dir_path( __FILE__ ) . 'inc/wp-options.php');
23
  //Load Scripts
24
  include( plugin_dir_path( __FILE__ ) . 'inc/wp-script.php');
25
+ //Load Functions
26
+ include( plugin_dir_path( __FILE__ ) . 'inc/wp-functions.php');
27
+
28
+ //Do not change this value
29
+ define('WP_ULIKE_DB_VERSION', '1.0');
30
 
31
  function wp_ulike_options() {
32
+
33
+ global $wpdb;
34
+ $table_name = $wpdb->prefix . "ulike";
35
+ if($wpdb->get_var("show tables like '$table_name'") != $table_name) {
36
+ $sql = "CREATE TABLE " . $table_name . " (
37
+ `id` bigint(11) NOT NULL AUTO_INCREMENT,
38
+ `post_id` int(11) NOT NULL,
39
+ `date_time` datetime NOT NULL,
40
+ `ip` varchar(30) NOT NULL,
41
+ `user_id` int(11) NOT NULL,
42
+ `status` varchar(15) NOT NULL,
43
+ PRIMARY KEY (`id`)
44
+ );";
45
+
46
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
47
+ dbDelta($sql);
48
+
49
+ add_option('wp_ulike_dbVersion', WP_ULIKE_DB_VERSION);
50
+ }
51
+
52
  add_option('wp_ulike_onPage', '1', '', 'yes');
53
  add_option('wp_ulike_onlyRegistered', '0', '', 'yes');
54
+ add_option('wp_ulike_user_like_box', '1', '', 'yes');
55
  add_option('wp_ulike_textOrImage', 'image', '', 'yes');
56
+ add_option('wp_ulike_text', __('Like','alimir'), '', 'yes');
57
+ add_option('wp_ulike_btn_text', __('You Like This','alimir'), '', 'yes');
58
+ add_option('wp_ulike_dislike_text', __('You Dislike This','alimir'), '', 'yes');
59
  }
60
 
61
  register_activation_hook(__FILE__, 'wp_ulike_options');
62
 
63
+ function wp_ulike_unset_options() {
64
+
65
+ global $wpdb;
66
+ $current_db_version = get_option('wp_ulike_dbVersion');
67
+
68
+ if ($current_db_version != WP_ULIKE_DB_VERSION) {
69
+ $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."ulike");
70
+ update_option('wp_ulike_dbVersion', $current_db_version);
71
+ }
72
 
73
  delete_option('wp_ulike_onPage');
74
  delete_option('wp_ulike_textOrImage');
75
  delete_option('wp_ulike_text');
76
  delete_option('wp_ulike_btn_text');
77
+ delete_option('wp_ulike_user_like_box');
78
  delete_option('wp_ulike_onlyRegistered');
79
  }
80
 
81
+ register_uninstall_hook(__FILE__, 'wp_ulike_unset_options');
82
+
83
  //main function
84
  function wp_ulike($arg) {
85
+
86
+ global $post,$wpdb,$user_ID;
87
  $post_ID = $post->ID;
88
+ $counter = '';
89
  $liked = get_post_meta($post_ID, '_liked', true) != '' ? '+' . get_post_meta($post_ID, '_liked', true) : '0';
90
 
 
91
  if ( (get_option('wp_ulike_onlyRegistered') != '1') or (get_option('wp_ulike_onlyRegistered') == '1' && is_user_logged_in()) ){
92
 
93
+
94
+ if(is_user_logged_in()){
95
+ $user_status = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."ulike WHERE post_id = '$post_ID' AND user_id = '$user_ID'");
96
+
97
+ if(!isset($_COOKIE['liked-'.$post_ID]) && $user_status == 0){
98
+ if (get_option('wp_ulike_textOrImage') == 'image') {
99
+ $counter = '<a onclick="likeThis('.$post_ID.', 1, 0);" class="image"></a><span class="count-box">'.$liked.'</span>';
100
+ }
101
+ else {
102
+ $counter = '<a onclick="likeThis('.$post_ID.', 1, 0);" class="text">'.get_option('wp_ulike_text').'</a><span class="count-box">'.$liked.'</span>';
103
+ }
104
  }
105
+ else if($user_status != 0){
106
+ if(get_user_status($post_ID,$user_ID) == "like"){
107
+ $counter = '<a onclick="likeThis('.$post_ID.', 1, 1);" class="text">'.get_option('wp_ulike_btn_text').'</a><span class="count-box">'.$liked.'</span>';
108
+ }
109
+ else if(get_user_status($post_ID,$user_ID) == "dislike"){
110
+ $counter = '<a onclick="likeThis('.$post_ID.', 1, 0);" class="text">'.get_option('wp_ulike_dislike_text').'</a><span class="count-box">'.$liked.'</span>';
111
+ }
112
  }
113
+
114
+ else if(isset($_COOKIE['liked-'.$post_ID]) && $user_status == 0){
115
+ $counter = '<a class="text user-tooltip" title="'.__('Already Voted','alimir').'">'.get_option('wp_ulike_btn_text').'</a><span class="count-box">'.$liked.'</span>';
116
+ }
117
+ }
118
+ else{
119
+ if(!isset($_COOKIE['liked-'.$post_ID])){
120
+
121
+ if (get_option('wp_ulike_textOrImage') == 'image') {
122
+ $counter = '<a onclick="likeThis('.$post_ID.', 1, 2);" class="image"></a><span class="count-box">'.$liked.'</span>';
123
+ }
124
+ else {
125
+ $counter = '<a onclick="likeThis('.$post_ID.', 1, 2);" class="text">'.get_option('wp_ulike_text').'</a><span class="count-box">'.$liked.'</span>';
126
+ }
127
+
128
+ }
129
+ else{
130
+
131
+ $counter = '<a class="text user-tooltip" title="'.__('Already Voted','alimir').'">'.get_option('wp_ulike_btn_text').'</a><span class="count-box">'.$liked.'</span>';
132
+
133
+ }
134
+ }
135
 
136
  $wp_ulike = '<div id="wp-ulike-'.$post_ID.'" class="wpulike">';
137
+ $wp_ulike .= '<div class="counter">'.$counter.'</div>';
138
  $wp_ulike .= '</div>';
139
 
140
+ $user_data = get_user_data($post_ID,$user_ID);
141
+ if(get_option('wp_ulike_user_like_box') == '1' && $user_data != '')
142
+ $wp_ulike .= '<br /><p style="margin-top:5px">'.__('Users who have LIKED this post:','alimir').'</p><ul id="tiles">' . $user_data . '</ul>';
143
+
144
  if ($arg == 'put') {
145
  return $wp_ulike;
146
  }
147
  else {
148
  echo $wp_ulike;
149
  }
150
+
151
  }
152
+
153
  else if (get_option('wp_ulike_onlyRegistered') == '1' && !is_user_logged_in()){
154
+ 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 post: ','alimir').'<a href="'.wp_login_url( get_permalink() ).'"> '.__('click here','alimir').' </a></p>';
155
  }
156
+
157
  }
158
 
159
  //Process function
160
  function wp_ulike_process(){
161
+
162
+ global $wpdb,$user_ID;
163
  $post_ID = $_POST['id'];
164
  $like = get_post_meta($post_ID, '_liked', true);
165
+ $user_status = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."ulike WHERE post_id = '$post_ID' AND user_id = '$user_ID'");
 
166
 
167
+ if($post_ID != '') {
168
+ if (!isset($_COOKIE['liked-'.$post_ID]) && $user_status == 0) {
169
  $newLike = $like + 1;
170
  update_post_meta($post_ID, '_liked', $newLike);
171
 
172
  setcookie('liked-'.$post_ID, time(), time()+3600*24*365, '/');
173
+
174
+ if(is_user_logged_in()):
175
+ $ip = wp_ulike_get_real_ip();
176
+ $wpdb->query("INSERT INTO ".$wpdb->prefix."ulike VALUES ('', '$post_ID', NOW(), '$ip', '$user_ID', 'like')");
177
+ endif;
178
 
179
  echo '+' . $newLike;
180
  }
181
+ else if ($user_status != 0) {
182
+ if(get_user_status($post_ID,$user_ID) == "like"){
183
+ $newLike = $like - 1;
184
+ update_post_meta($post_ID, '_liked', $newLike);
185
+
186
+ $wpdb->query("
187
+ UPDATE ".$wpdb->prefix."ulike
188
+ SET status = 'dislike'
189
+ WHERE post_id = '$post_ID' AND user_id = '$user_ID'
190
+ ");
191
+
192
+ echo '+' . $newLike;
193
+ }
194
+ else{
195
+ $newLike = $like + 1;
196
+ update_post_meta($post_ID, '_liked', $newLike);
197
+
198
+ $wpdb->query("
199
+ UPDATE ".$wpdb->prefix."ulike
200
+ SET status = 'like'
201
+ WHERE post_id = '$post_ID' AND user_id = '$user_ID'
202
+ ");
203
+
204
+ echo '+' . $newLike;
205
+ }
206
  }
207
+ else if (isset($_COOKIE['liked-'.$post_ID]) && $user_status == 0){
208
+ echo '+' . $like;
 
 
 
 
 
 
 
209
  }
 
210
  }
211
+ die();
 
212
  }