Version Description
- FIXED: filters on yasr_add_schema() functions
- TWEAKED: disabled right click on rating
- TWEAKED: install function is wrapped on register_activation_hook
Download this release
Release Info
Developer | Dudo |
Plugin | Yasr – Yet Another Stars Rating |
Version | 1.1.7 |
Comparing to | |
See all releases |
Code changes from version 1.1.6 to 1.1.7
- js/jquery.rateit.min.js +1 -2
- lib/yasr-db-functions.php +0 -3
- lib/yasr-functions.php +10 -8
- readme.txt +8 -2
- yet-another-stars-rating.php +63 -40
js/jquery.rateit.min.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
/*! RateIt | v1.0.22 / 05/27/2014 | https://rateit.codeplex.com/license
|
2 |
http://rateit.codeplex.com | Twitter: @gjunge
|
3 |
*/
|
4 |
-
|
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);
|
|
lib/yasr-db-functions.php
CHANGED
@@ -122,9 +122,6 @@ function yasr_install() {
|
|
122 |
$style_options['scheme_color_multiset'] = 'light';
|
123 |
|
124 |
update_option("yasr_style_options", $style_options);
|
125 |
-
|
126 |
-
|
127 |
-
do_action( 'yasr_scripts_on_install');
|
128 |
|
129 |
|
130 |
}
|
122 |
$style_options['scheme_color_multiset'] = 'light';
|
123 |
|
124 |
update_option("yasr_style_options", $style_options);
|
|
|
|
|
|
|
125 |
|
126 |
|
127 |
}
|
lib/yasr-functions.php
CHANGED
@@ -312,15 +312,15 @@ add_filter('the_content', 'yasr_add_schema');
|
|
312 |
|
313 |
$review_choosen = yasr_get_snippet_type();
|
314 |
|
315 |
-
|
|
|
316 |
|
317 |
-
|
318 |
-
|
319 |
-
/*if ($schema) {
|
320 |
|
321 |
return $content . $schema;
|
322 |
|
323 |
-
}
|
324 |
|
325 |
if (YASR_SNIPPET == 'overall_rating') {
|
326 |
|
@@ -459,13 +459,15 @@ add_filter('the_content', 'yasr_add_schema');
|
|
459 |
|
460 |
$rich_snippet["@context"] = "http://schema.org/";
|
461 |
|
462 |
-
|
|
|
463 |
|
464 |
-
if
|
|
|
465 |
|
466 |
return $content . $script_type . $schema . $end_script_type;
|
467 |
|
468 |
-
}
|
469 |
|
470 |
if (YASR_SNIPPET == 'overall_rating') {
|
471 |
|
312 |
|
313 |
$review_choosen = yasr_get_snippet_type();
|
314 |
|
315 |
+
//if doesn't exists a filter for yasr_filter_schema_microdata $review_chosen value is assigned to $schema...
|
316 |
+
$schema = apply_filters( 'yasr_filter_schema_microdata', $review_choosen );
|
317 |
|
318 |
+
//So check here if $schema != $review_choosen
|
319 |
+
if ($schema != $review_choosen) {
|
|
|
320 |
|
321 |
return $content . $schema;
|
322 |
|
323 |
+
}
|
324 |
|
325 |
if (YASR_SNIPPET == 'overall_rating') {
|
326 |
|
459 |
|
460 |
$rich_snippet["@context"] = "http://schema.org/";
|
461 |
|
462 |
+
//if doesn't exists a filter for yasr_filter_schema_microdata $review_chosen value is assigned to $schema...
|
463 |
+
$schema = apply_filters( 'yasr_filter_schema_jsonld', $review_choosen );
|
464 |
|
465 |
+
//So check here if $schema != $review_choosen
|
466 |
+
if ($schema != $review_choosen) {
|
467 |
|
468 |
return $content . $script_type . $schema . $end_script_type;
|
469 |
|
470 |
+
}
|
471 |
|
472 |
if (YASR_SNIPPET == 'overall_rating') {
|
473 |
|
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
|
7 |
-
Stable tag: 1.1.
|
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,7 +110,13 @@ Of course not: you can easily add it on the visual editor just by clicking on th
|
|
110 |
|
111 |
== Changelog ==
|
112 |
|
113 |
-
1.1.
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
* FIXED: Rich snippet non added in some cases
|
115 |
|
116 |
= 1.1.5 =
|
4 |
Requires at least: 3.5
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 4.4
|
7 |
+
Stable tag: 1.1.7
|
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.7 =
|
114 |
+
* FIXED: filters on yasr_add_schema() functions
|
115 |
+
* TWEAKED: disabled right click on rating
|
116 |
+
* TWEAKED: install function is wrapped on register_activation_hook
|
117 |
+
|
118 |
+
|
119 |
+
= 1.1.6 =
|
120 |
* FIXED: Rich snippet non added in some cases
|
121 |
|
122 |
= 1.1.5 =
|
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.
|
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.
|
36 |
|
37 |
//Plugin relative path
|
38 |
define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );
|
@@ -198,16 +198,6 @@ require (YASR_ABSOLUTE_PATH . '/lib/yasr-ajax-functions.php');
|
|
198 |
|
199 |
require (YASR_ABSOLUTE_PATH . '/lib/yasr-shortcode-functions.php');
|
200 |
|
201 |
-
$version_installed = get_option('yasr-version') ;
|
202 |
-
|
203 |
-
//If this is a fresh new installation
|
204 |
-
|
205 |
-
if (!$version_installed ) {
|
206 |
-
|
207 |
-
yasr_install();
|
208 |
-
|
209 |
-
}
|
210 |
-
|
211 |
global $wpdb;
|
212 |
|
213 |
define ("YASR_VOTES_TABLE", $wpdb->prefix . 'yasr_votes');
|
@@ -225,62 +215,95 @@ define ("YASR_LOADER_IMAGE", YASR_IMG_DIR . "/loader.gif");
|
|
225 |
|
226 |
/****** backward compatibility functions ******/
|
227 |
|
228 |
-
|
229 |
-
if ($version_installed && $version_installed < '1.0.5') {
|
230 |
|
231 |
-
|
232 |
|
233 |
-
|
234 |
|
235 |
-
$style_options['scheme_color_multiset'] = $multiset_options['scheme_color'];
|
236 |
|
237 |
-
|
|
|
238 |
|
239 |
-
|
240 |
|
241 |
-
|
242 |
|
243 |
-
|
|
|
244 |
|
245 |
-
|
|
|
|
|
246 |
|
247 |
}
|
248 |
|
249 |
-
//remove end may 2016
|
250 |
-
if ($version_installed && $version_installed < '1.0.2') {
|
251 |
|
252 |
-
$wpdb->query("ALTER TABLE " . YASR_MULTI_SET_FIELDS_TABLE . " CHANGE field_name field_name VARCHAR( 40 )
|
253 |
-
CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ;");
|
254 |
|
255 |
-
|
256 |
|
257 |
-
|
258 |
-
if ($version_installed && $version_installed < '0.9.9') {
|
259 |
|
260 |
-
$
|
261 |
|
262 |
-
|
|
|
263 |
|
264 |
-
|
265 |
|
|
|
266 |
|
267 |
-
|
268 |
-
if ($version_installed && $version_installed < '0.9.7') {
|
269 |
|
270 |
-
|
271 |
|
272 |
-
|
273 |
|
274 |
-
|
275 |
|
|
|
276 |
|
277 |
-
|
278 |
|
|
|
|
|
|
|
|
|
279 |
|
280 |
-
|
|
|
|
|
|
|
281 |
|
282 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
|
284 |
}
|
285 |
|
|
|
286 |
?>
|
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.7
|
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.7');
|
36 |
|
37 |
//Plugin relative path
|
38 |
define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );
|
198 |
|
199 |
require (YASR_ABSOLUTE_PATH . '/lib/yasr-shortcode-functions.php');
|
200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
global $wpdb;
|
202 |
|
203 |
define ("YASR_VOTES_TABLE", $wpdb->prefix . 'yasr_votes');
|
215 |
|
216 |
/****** backward compatibility functions ******/
|
217 |
|
218 |
+
$version_installed = get_option('yasr-version');
|
|
|
219 |
|
220 |
+
global $version_installed;
|
221 |
|
222 |
+
//TODO use transient for version installed
|
223 |
|
|
|
224 |
|
225 |
+
//Run this only on plugin activation (doesn't work on update)
|
226 |
+
register_activation_hook( __FILE__, 'yasr_on_activation' );
|
227 |
|
228 |
+
function yasr_on_activation () {
|
229 |
|
230 |
+
global $version_installed;
|
231 |
|
232 |
+
//If this is a fresh new installation
|
233 |
+
if (!$version_installed ) {
|
234 |
|
235 |
+
yasr_install();
|
236 |
+
|
237 |
+
}
|
238 |
|
239 |
}
|
240 |
|
|
|
|
|
241 |
|
|
|
|
|
242 |
|
243 |
+
add_action('plugins_loaded', 'yasr_update_version' );
|
244 |
|
245 |
+
function yasr_update_version() {
|
|
|
246 |
|
247 |
+
global $version_installed;
|
248 |
|
249 |
+
//Remove july 2016
|
250 |
+
if ($version_installed && $version_installed < '1.0.5') {
|
251 |
|
252 |
+
$multiset_options = get_option('yasr_multiset_options');
|
253 |
|
254 |
+
if($multiset_options && $multiset_options['scheme_color'] != '') {
|
255 |
|
256 |
+
$style_options['scheme_color_multiset'] = $multiset_options['scheme_color'];
|
|
|
257 |
|
258 |
+
}
|
259 |
|
260 |
+
else {
|
261 |
|
262 |
+
$style_options['scheme_color_multiset'] = 'light';
|
263 |
|
264 |
+
}
|
265 |
|
266 |
+
update_option("yasr_style_options", $style_options);
|
267 |
|
268 |
+
}
|
269 |
+
|
270 |
+
//remove end may 2016
|
271 |
+
if ($version_installed && $version_installed < '1.0.2') {
|
272 |
|
273 |
+
$wpdb->query("ALTER TABLE " . YASR_MULTI_SET_FIELDS_TABLE . " CHANGE field_name field_name VARCHAR( 40 )
|
274 |
+
CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ;");
|
275 |
+
|
276 |
+
}
|
277 |
|
278 |
+
//Remove end April 2016
|
279 |
+
if ($version_installed && $version_installed < '0.9.9') {
|
280 |
+
|
281 |
+
$stored_options['snippet_format'] = 'microdata';
|
282 |
+
|
283 |
+
update_option("yasr_general_options", $stored_options);
|
284 |
+
|
285 |
+
}
|
286 |
+
|
287 |
+
|
288 |
+
//Remove end March 2016
|
289 |
+
if ($version_installed && $version_installed < '0.9.7') {
|
290 |
+
|
291 |
+
$stored_options['snippet_itemtype'] = 'Product';
|
292 |
+
|
293 |
+
update_option("yasr_general_options", $stored_options);
|
294 |
+
|
295 |
+
}
|
296 |
+
|
297 |
+
/****** End backward compatibility functions ******/
|
298 |
+
|
299 |
+
|
300 |
+
if ($version_installed != YASR_VERSION_NUM) {
|
301 |
+
|
302 |
+
update_option('yasr-version', YASR_VERSION_NUM);
|
303 |
+
|
304 |
+
}
|
305 |
|
306 |
}
|
307 |
|
308 |
+
|
309 |
?>
|