Yasr – Yet Another Stars Rating - Version 1.1.9

Version Description

  • FIXED: yasr_visitor_votes doesn't get vote on mobile
Download this release

Release Info

Developer Dudo
Plugin Icon 128x128 Yasr – Yet Another Stars Rating
Version 1.1.9
Comparing to
See all releases

Code changes from version 1.1.8 to 1.1.9

js/jquery.rateit.min.js CHANGED
@@ -1,4 +1,5 @@
1
/*! RateIt | v1.0.22 / 05/27/2014 | https://rateit.codeplex.com/license
2
http://rateit.codeplex.com | Twitter: @gjunge
3
*/
4
- !function(e){function t(e){var t=e.originalEvent.changedTouches,a=t[0],i="";switch(e.type){case"touchmove":i="mousemove";break;case"touchend":i="mouseup";break;default:return}var r=document.createEvent("MouseEvent");r.initMouseEvent(i,!0,!0,window,1,a.screenX,a.screenY,a.clientX,a.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(r),e.preventDefault()}e.rateit={aria:{resetLabel:"reset rating",ratingLabel:"rating"}},e.fn.rateit=function(a,i){var r=1,n={},s="init",l=function(e){return e.charAt(0).toUpperCase()+e.substr(1)};if(0===this.length)return this;var d=e.type(a);if("object"==d||void 0===a||null===a)n=e.extend({},e.fn.rateit.defaults,a);else{if("string"==d&&"reset"!==a&&void 0===i)return this.data("rateit"+l(a));"string"==d&&(s="setvalue")}return this.each(function(){var d=e(this),h=function(e,t){if(null!=t){var a="aria-value"+("value"==e?"now":e),i=d.find(".rateit-range");void 0!=i.attr(a)&&i.attr(a,t)}return arguments[0]="rateit"+l(e),d.data.apply(d,arguments)};if("reset"==a){var o=h("init");for(var v in o)d.data(v,o[v]);if(h("backingfld")){var u=e(h("backingfld"));u.val(h("value")),u.trigger("change"),u[0].min&&(u[0].min=h("min")),u[0].max&&(u[0].max=h("max")),u[0].step&&(u[0].step=h("step"))}d.trigger("reset")}d.hasClass("rateit")||d.addClass("rateit");var m="rtl"!=d.css("direction");if("setvalue"==s){if(!h("init"))throw"Can't set value before init";if("readonly"!=a||1!=i||h("readonly")||(d.find(".rateit-range").unbind(),h("wired",!1)),"value"==a&&(i=null==i?h("min"):Math.max(h("min"),Math.min(h("max"),i))),h("backingfld")){var u=e(h("backingfld"));"value"==a&&u.val(i),"min"==a&&u[0].min&&(u[0].min=i),"max"==a&&u[0].max&&(u[0].max=i),"step"==a&&u[0].step&&(u[0].step=i)}h(a,i)}if(!h("init")){if(h("min",isNaN(h("min"))?n.min:h("min")),h("max",isNaN(h("max"))?n.max:h("max")),h("step",h("step")||n.step),h("readonly",void 0!==h("readonly")?h("readonly"):n.readonly),h("resetable",void 0!==h("resetable")?h("resetable"):n.resetable),h("backingfld",h("backingfld")||n.backingfld),h("starwidth",h("starwidth")||n.starwidth),h("starheight",h("starheight")||n.starheight),h("value",Math.max(h("min"),Math.min(h("max"),isNaN(h("value"))?isNaN(n.value)?n.min:n.value:h("value")))),h("ispreset",void 0!==h("ispreset")?h("ispreset"):n.ispreset),h("backingfld")){var u=e(h("backingfld")).hide();if((u.attr("disabled")||u.attr("readonly"))&&h("readonly",!0),"INPUT"==u[0].nodeName&&("range"==u[0].type||"text"==u[0].type)&&(h("min",parseInt(u.attr("min"))||h("min")),h("max",parseInt(u.attr("max"))||h("max")),h("step",parseInt(u.attr("step"))||h("step"))),"SELECT"==u[0].nodeName&&u[0].options.length>1){h("min",isNaN(h("min"))?Number(u[0].options[0].value):h("min")),h("max",Number(u[0].options[u[0].length-1].value)),h("step",Number(u[0].options[1].value)-Number(u[0].options[0].value));var c=u.find("option[selected]");1==c.length&&h("value",c.val())}else h("value",u.val())}var g="DIV"==d[0].nodeName?"div":"span";r++;var f='<button id="rateit-reset-{{index}}" type="button" data-role="none" class="rateit-reset" aria-label="'+e.rateit.aria.resetLabel+'" aria-controls="rateit-range-{{index}}"></button><{{element}} id="rateit-range-{{index}}" class="rateit-range" tabindex="0" role="slider" aria-label="'+e.rateit.aria.ratingLabel+'" aria-owns="rateit-reset-{{index}}" aria-valuemin="'+h("min")+'" aria-valuemax="'+h("max")+'" aria-valuenow="'+h("value")+'"><{{element}} class="rateit-selected" style="height:'+h("starheight")+'px"></{{element}}><{{element}} class="rateit-hover" style="height:'+h("starheight")+'px"></{{element}}></{{element}}>';d.append(f.replace(/{{index}}/gi,r).replace(/{{element}}/gi,g)),m||(d.find(".rateit-reset").css("float","right"),d.find(".rateit-selected").addClass("rateit-selected-rtl"),d.find(".rateit-hover").addClass("rateit-hover-rtl")),h("init",JSON.parse(JSON.stringify(d.data())))}d.find(".rateit-selected, .rateit-hover").height(h("starheight"));var p=d.find(".rateit-range");p.width(h("starwidth")*(h("max")-h("min"))).height(h("starheight"));var b="rateit-preset"+(m?"":"-rtl");if(h("ispreset")?d.find(".rateit-selected").addClass(b):d.find(".rateit-selected").removeClass(b),null!=h("value")){var w=(h("value")-h("min"))*h("starwidth");d.find(".rateit-selected").width(w)}var x=d.find(".rateit-reset");x.data("wired")!==!0&&x.bind("click",function(t){t.preventDefault(),x.blur();var a=e.Event("beforereset");return d.trigger(a),a.isDefaultPrevented()?!1:(d.rateit("value",null),void d.trigger("reset"))}).data("wired",!0);var y=function(t,a){var i=a.changedTouches?a.changedTouches[0].pageX:a.pageX,r=i-e(t).offset().left;return m||(r=p.width()-r),r>p.width()&&(r=p.width()),0>r&&(r=0),w=Math.ceil(r/h("starwidth")*(1/h("step")))},N=function(e){var t=e*h("starwidth")*h("step"),a=p.find(".rateit-hover");if(a.data("width")!=t){p.find(".rateit-selected").hide(),a.width(t).show().data("width",t);var i=[e*h("step")+h("min")];d.trigger("hover",i).trigger("over",i)}},k=function(t){var a=e.Event("beforerated");return d.trigger(a,[t]),a.isDefaultPrevented()?!1:(h("value",t),h("backingfld")&&e(h("backingfld")).val(t).trigger("change"),h("ispreset")&&(p.find(".rateit-selected").removeClass(b),h("ispreset",!1)),p.find(".rateit-hover").hide(),p.find(".rateit-selected").width(t*h("starwidth")-h("min")*h("starwidth")).show(),d.trigger("hover",[null]).trigger("over",[null]).trigger("rated",[t]),!0)};h("readonly")?x.hide():(h("resetable")||x.hide(),h("wired")||(p.bind("touchmove touchend",t),p.mousemove(function(e){var t=y(this,e);N(t)}),p.mouseleave(function(e){p.find(".rateit-hover").hide().width(0).data("width",""),d.trigger("hover",[null]).trigger("over",[null]),p.find(".rateit-selected").show()}),p.click(function(e){var t=y(this,e),a=t*h("step")+h("min");k(a),p.blur()}),p.keyup(function(e){(38==e.which||e.which==(m?39:37))&&k(Math.min(h("value")+h("step"),h("max"))),(40==e.which||e.which==(m?37:39))&&k(Math.max(h("value")-h("step"),h("min")))}),h("wired",!0)),h("resetable")&&x.show()),p.attr("aria-readonly",h("readonly"))})},e.fn.rateit.defaults={min:0,max:5,step:.5,starwidth:16,starheight:16,readonly:!1,resetable:!0,ispreset:!1},e(function(){e("div.rateit, span.rateit").rateit()})}(jQuery);
1
/*! RateIt | v1.0.22 / 05/27/2014 | https://rateit.codeplex.com/license
2
http://rateit.codeplex.com | Twitter: @gjunge
3
*/
4
+ (function(n){function t(n){var u=n.originalEvent.changedTouches,t=u[0],i="",r;switch(n.type){case"touchmove":i="mousemove";break;case"touchend":i="mouseup";break;default:return}r=document.createEvent("MouseEvent");r.initMouseEvent(i,!0,!0,window,1,t.screenX,t.screenY,t.clientX,t.clientY,!1,!1,!1,!1,0,null);t.target.dispatchEvent(r);n.preventDefault()}n.rateit={aria:{resetLabel:"reset rating",ratingLabel:"rating"}};n.fn.rateit=function(i,r){var e=1,u={},o="init",s=function(n){return n.charAt(0).toUpperCase()+n.substr(1)},f;if(this.length===0)return this;if(f=n.type(i),f=="object"||i===undefined||i===null)u=n.extend({},n.fn.rateit.defaults,i);else{if(f=="string"&&i!=="reset"&&r===undefined)return this.data("rateit"+s(i));f=="string"&&(o="setvalue")}return this.each(function(){var c=n(this),f=function(n,t){if(t!=null){var i="aria-value"+(n=="value"?"now":n),r=c.find(".rateit-range");r.attr(i)!=undefined&&r.attr(i,t)}return arguments[0]="rateit"+s(n),c.data.apply(c,arguments)},p,w,v,h,b,g,nt,l,y,k,a;if(i=="reset"){p=f("init");for(w in p)c.data(w,p[w]);f("backingfld")&&(h=n(f("backingfld")),h.val(f("value")),h.trigger("change"),h[0].min&&(h[0].min=f("min")),h[0].max&&(h[0].max=f("max")),h[0].step&&(h[0].step=f("step")));c.trigger("reset")}if(c.hasClass("rateit")||c.addClass("rateit"),v=c.css("direction")!="rtl",o=="setvalue"){if(!f("init"))throw"Can't set value before init";i!="readonly"||r!=!0||f("readonly")||(c.find(".rateit-range").unbind(),f("wired",!1));i=="value"&&(r=r==null?f("min"):Math.max(f("min"),Math.min(f("max"),r)));f("backingfld")&&(h=n(f("backingfld")),i=="value"&&h.val(r),i=="min"&&h[0].min&&(h[0].min=r),i=="max"&&h[0].max&&(h[0].max=r),i=="step"&&h[0].step&&(h[0].step=r));f(i,r)}f("init")||(f("min",isNaN(f("min"))?u.min:f("min")),f("max",isNaN(f("max"))?u.max:f("max")),f("step",f("step")||u.step),f("readonly",f("readonly")!==undefined?f("readonly"):u.readonly),f("resetable",f("resetable")!==undefined?f("resetable"):u.resetable),f("backingfld",f("backingfld")||u.backingfld),f("starwidth",f("starwidth")||u.starwidth),f("starheight",f("starheight")||u.starheight),f("value",Math.max(f("min"),Math.min(f("max"),isNaN(f("value"))?isNaN(u.value)?u.min:u.value:f("value")))),f("ispreset",f("ispreset")!==undefined?f("ispreset"):u.ispreset),f("backingfld")&&(h=n(f("backingfld")).hide(),(h.attr("disabled")||h.attr("readonly"))&&f("readonly",!0),h[0].nodeName=="INPUT"&&(h[0].type=="range"||h[0].type=="text")&&(f("min",parseInt(h.attr("min"))||f("min")),f("max",parseInt(h.attr("max"))||f("max")),f("step",parseInt(h.attr("step"))||f("step"))),h[0].nodeName=="SELECT"&&h[0].options.length>1?(f("min",isNaN(f("min"))?Number(h[0].options[0].value):f("min")),f("max",Number(h[0].options[h[0].length-1].value)),f("step",Number(h[0].options[1].value)-Number(h[0].options[0].value)),b=h.find("option[selected]"),b.length==1&&f("value",b.val())):f("value",h.val())),g=c[0].nodeName=="DIV"?"div":"span",e++,nt='<button id="rateit-reset-{{index}}" type="button" data-role="none" class="rateit-reset" aria-label="'+n.rateit.aria.resetLabel+'" aria-controls="rateit-range-{{index}}"><\/button><{{element}} id="rateit-range-{{index}}" class="rateit-range" tabindex="0" role="slider" aria-label="'+n.rateit.aria.ratingLabel+'" aria-owns="rateit-reset-{{index}}" aria-valuemin="'+f("min")+'" aria-valuemax="'+f("max")+'" aria-valuenow="'+f("value")+'"><{{element}} class="rateit-selected" style="height:'+f("starheight")+'px"><\/{{element}}><{{element}} class="rateit-hover" style="height:'+f("starheight")+'px"><\/{{element}}><\/{{element}}>',c.append(nt.replace(/{{index}}/gi,e).replace(/{{element}}/gi,g)),v||(c.find(".rateit-reset").css("float","right"),c.find(".rateit-selected").addClass("rateit-selected-rtl"),c.find(".rateit-hover").addClass("rateit-hover-rtl")),f("init",JSON.parse(JSON.stringify(c.data()))));c.find(".rateit-selected, .rateit-hover").height(f("starheight"));l=c.find(".rateit-range");l.width(f("starwidth")*(f("max")-f("min"))).height(f("starheight"));y="rateit-preset"+(v?"":"-rtl");f("ispreset")?c.find(".rateit-selected").addClass(y):c.find(".rateit-selected").removeClass(y);f("value")!=null&&(k=(f("value")-f("min"))*f("starwidth"),c.find(".rateit-selected").width(k));a=c.find(".rateit-reset");a.data("wired")!==!0&&a.bind("click",function(t){t.preventDefault();a.blur();var i=n.Event("beforereset");if(c.trigger(i),i.isDefaultPrevented())return!1;c.rateit("value",null);c.trigger("reset")}).data("wired",!0);var tt=function(t,i){var u=i.changedTouches?i.changedTouches[0].pageX:i.pageX,r=u-n(t).offset().left;return v||(r=l.width()-r),r>l.width()&&(r=l.width()),r<0&&(r=0),k=Math.ceil(r/f("starwidth")*(1/f("step")))},it=function(n){var t=n*f("starwidth")*f("step"),r=l.find(".rateit-hover"),i;r.data("width")!=t&&(l.find(".rateit-selected").hide(),r.width(t).show().data("width",t),i=[n*f("step")+f("min")],c.trigger("hover",i).trigger("over",i))},d=function(t){var i=n.Event("beforerated");return(c.trigger(i,[t]),i.isDefaultPrevented())?!1:(f("value",t),f("backingfld")&&n(f("backingfld")).val(t).trigger("change"),f("ispreset")&&(l.find(".rateit-selected").removeClass(y),f("ispreset",!1)),l.find(".rateit-hover").hide(),l.find(".rateit-selected").width(t*f("starwidth")-f("min")*f("starwidth")).show(),c.trigger("hover",[null]).trigger("over",[null]).trigger("rated",[t]),!0)};f("readonly")?a.hide():(f("resetable")||a.hide(),f("wired")||(l.bind("touchmove touchend",t),l.mousemove(function(n){var t=tt(this,n);it(t)}),l.mouseleave(function(){l.find(".rateit-hover").hide().width(0).data("width","");c.trigger("hover",[null]).trigger("over",[null]);l.find(".rateit-selected").show()}),l.mouseup(function(n){var t=tt(this,n),i=t*f("step")+f("min");d(i);l.blur()}),l.keyup(function(n){(n.which==38||n.which==(v?39:37))&&d(Math.min(f("value")+f("step"),f("max")));(n.which==40||n.which==(v?37:39))&&d(Math.max(f("value")-f("step"),f("min")))}),f("wired",!0)),f("resetable")&&a.show());l.attr("aria-readonly",f("readonly"))})};n.fn.rateit.defaults={min:0,max:5,step:.5,starwidth:16,starheight:16,readonly:!1,resetable:!0,ispreset:!1};n(function(){n("div.rateit, span.rateit").rateit()})})(jQuery);
5
+
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: 5 star, admin, administrator, AJAX, five-star, javascript, jquery, post r
4
Requires at least: 3.5
5
Contributors: Dudo
6
Tested up to: 4.4.1
7
- Stable tag: 1.1.8
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
10
Yet Another Stars Rating is a simple plugin which allows you and / or your visitor to rate a post or element. Ideal for review's website
@@ -110,6 +110,9 @@ Of course not: you can easily add it on the visual editor just by clicking on th
110
111
== Changelog ==
112
113
= 1.1.8 =
114
* FIXED: added the rating type at the bottom of the post if no kind of rating exists for a post or page
115
4
Requires at least: 3.5
5
Contributors: Dudo
6
Tested up to: 4.4.1
7
+ Stable tag: 1.1.9
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
10
Yet Another Stars Rating is a simple plugin which allows you and / or your visitor to rate a post or element. Ideal for review's website
110
111
== Changelog ==
112
113
+ = 1.1.9 =
114
+ * FIXED: yasr_visitor_votes doesn't get vote on mobile
115
+
116
= 1.1.8 =
117
* FIXED: added the rating type at the bottom of the post if no kind of rating exists for a post or page
118
yet-another-stars-rating.php CHANGED
@@ -3,7 +3,7 @@
3
* Plugin Name: Yet Another Stars Rating
4
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
5
* Description: Yet Another Stars Rating turn your WordPress into a complete review website.
6
- * Version: 1.1.8
7
* Author: Dario Curvino
8
* Author URI: https://yetanotherstarsrating.com/
9
* Text Domain: yet-another-stars-rating
@@ -32,7 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
32
if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // Exit if accessed directly
33
34
35
- define('YASR_VERSION_NUM', '1.1.8');
36
37
//Plugin relative path
38
define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );
@@ -246,6 +246,8 @@ function yasr_update_version() {
246
247
global $version_installed;
248
249
//Remove july 2016
250
if ($version_installed && $version_installed < '1.0.5') {
251
3
* Plugin Name: Yet Another Stars Rating
4
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
5
* Description: Yet Another Stars Rating turn your WordPress into a complete review website.
6
+ * Version: 1.1.9
7
* Author: Dario Curvino
8
* Author URI: https://yetanotherstarsrating.com/
9
* Text Domain: yet-another-stars-rating
32
if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // Exit if accessed directly
33
34
35
+ define('YASR_VERSION_NUM', '1.1.9');
36
37
//Plugin relative path
38
define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );
246
247
global $version_installed;
248
249
+ global $wpdb;
250
+
251
//Remove july 2016
252
if ($version_installed && $version_installed < '1.0.5') {
253