Version Description
- TWEAKED: Using GET instead of POST when getting rest response
Download this release
Release Info
Developer | Dudo |
Plugin | Yasr – Yet Another Stars Rating |
Version | 2.3.8 |
Comparing to | |
See all releases |
Code changes from version 2.3.7 to 2.3.8
- credits.txt +4 -0
- includes/js/src/yasr-front.js +2 -2
- includes/js/yasr-front.js +1 -1
- includes/rest/classes/YasrCustomFields.php +14 -10
- readme.txt +11 -20
- yet-another-stars-rating.php +2 -2
credits.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
External Libraries: [Rater](https://github.com/fredolss/rater-js), [tippy](https://atomiks.github.io/tippyjs/)
|
2 |
+
|
3 |
+
Flat star icon made by [Freepik](http://www.freepik.com)
|
4 |
+
from [www.flaticon.com](https://www.flaticon.com/) is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/)
|
includes/js/src/yasr-front.js
CHANGED
@@ -104,7 +104,7 @@ function yasrDrawTipsProgress (yasrStatsInDom) {
|
|
104 |
onShow: function onShow(tip) {
|
105 |
|
106 |
if (htmlId !== htmlIdChecked) {
|
107 |
-
jQuery.
|
108 |
response = JSON.parse(response);
|
109 |
tip.setContent(response);
|
110 |
});
|
@@ -183,7 +183,7 @@ function yasrVisitorVotesFront (yasrRaterVVInDom) {
|
|
183 |
|
184 |
let urlVisitorVotes = 'wp/v2/'+ cpt +'/' + postId + '?_fields=yasr_visitor_votes&_wpnonce='+yasrCommonData.nonce;
|
185 |
|
186 |
-
jQuery.
|
187 |
function (data) {
|
188 |
readonly = data.yasr_visitor_votes.stars_attributes.read_only;
|
189 |
|
104 |
onShow: function onShow(tip) {
|
105 |
|
106 |
if (htmlId !== htmlIdChecked) {
|
107 |
+
jQuery.get(yasrCommonData.ajaxurl, data, function (response) {
|
108 |
response = JSON.parse(response);
|
109 |
tip.setContent(response);
|
110 |
});
|
183 |
|
184 |
let urlVisitorVotes = 'wp/v2/'+ cpt +'/' + postId + '?_fields=yasr_visitor_votes&_wpnonce='+yasrCommonData.nonce;
|
185 |
|
186 |
+
jQuery.get(yasrCommonData.restEndpoint + urlVisitorVotes).done(
|
187 |
function (data) {
|
188 |
readonly = data.yasr_visitor_votes.stars_attributes.read_only;
|
189 |
|
includes/js/yasr-front.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t){var e={};function r(a){if(e[a])return e[a].exports;var n=e[a]={i:a,l:!1,exports:{}};return t[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=t,r.c=e,r.d=function(t,e,a){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(a,n,function(e){return t[e]}.bind(null,n));return a},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){t.exports=r(1)},function(t,e){const{__:r}=wp.i18n;function a(t,e){t=parseInt(t),raterJs({starSize:t,step:.1,showToolTip:!1,readOnly:!0,element:document.getElementById(e)})}function n(t,e,r,a,n,s,
|
1 |
+
!function(t){var e={};function r(a){if(e[a])return e[a].exports;var n=e[a]={i:a,l:!1,exports:{}};return t[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=t,r.c=e,r.d=function(t,e,a){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(a,n,function(e){return t[e]}.bind(null,n));return a},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){t.exports=r(1)},function(t,e){const{__:r}=wp.i18n;function a(t,e){t=parseInt(t),raterJs({starSize:t,step:.1,showToolTip:!1,readOnly:!0,element:document.getElementById(e)})}function n(t,e,r,a,n,i,s,u,d){e=parseFloat(e),a=o(a),raterJs({starSize:t,rating:e,step:1,showToolTip:!1,readOnly:a,element:document.getElementById(n),rateCallback:function(t,e){document.getElementById(d).innerHTML=yasrCommonData.loaderHtml;var a={action:"yasr_send_visitor_rating",rating:t,post_id:r,nonce_visitor:s,is_singular:u};this.setRating(t),this.disable(),jQuery.post(yasrCommonData.ajaxurl,a,(function(t){t=JSON.parse(t),document.getElementById(d).innerHTML=t})),e()}})}function o(t){return null!=t&&""!==t||(t=!0),"true"!==t&&"1"!==t||(t=!0),"false"!==t&&"0"!==t||(t=!1),t}document.addEventListener("DOMContentLoaded",(function(t){var e=document.getElementsByClassName("yasr-rater-stars");e.length>0&&function(t){for(var e=0;e<t.length;e++){var r=t.item(e).id;a(t.item(e).getAttribute("data-rater-starsize"),r)}}(e);var i=document.getElementsByClassName("yasr-rater-stars-visitor-votes");i.length>0&&function(t){for(var e=0;e<t.length;e++)!function(e){let a=t.item(e).getAttribute("data-rating"),o=t.item(e).getAttribute("data-rater-readonly"),i=t.item(e).getAttribute("data-rater-postid"),s=t.item(e).id,u=s.replace("yasr-visitor-votes-rater-",""),d=parseInt(t.item(e).getAttribute("data-rater-starsize")),l=t.item(e).getAttribute("data-rater-nonce"),m=t.item(e).getAttribute("data-issingular"),c="yasr-vv-votes-number-container-"+u,y="yasr-vv-average-container-"+u,f="yasr-visitor-votes-container-after-stars-"+u,v=!1;if("yes"===yasrCommonData.ajaxEnabled){let g=t.item(e).getAttribute("data-cpt");""===g&&(g="posts");let p="wp/v2/"+g+"/"+i+"?_fields=yasr_visitor_votes&_wpnonce="+yasrCommonData.nonce;jQuery.get(yasrCommonData.restEndpoint+p).done((function(t){if(o=t.yasr_visitor_votes.stars_attributes.read_only,a=t.yasr_visitor_votes.number_of_votes>0?t.yasr_visitor_votes.sum_votes/t.yasr_visitor_votes.number_of_votes:0,a=a.toFixed(1),a=parseFloat(a),document.getElementById(c).innerHTML=t.yasr_visitor_votes.number_of_votes,document.getElementById(y).innerHTML=a,n(d,a,i,o,s,u,l,m,f),!1!==t.yasr_visitor_votes.stars_attributes.span_bottom){v=t.yasr_visitor_votes.stars_attributes.span_bottom,document.getElementById(f).insertAdjacentHTML("beforeend",v)}})).fail((function(t,e,c,y){console.info(r("YASR ajax call failed. Showing ratings from html","yet-another-stars-rating")),n(d,a,i,o,s,u,l,m,f)}))}else n(d,a,i,o,s,u,l,m,f)}(e)}(i);var s=document.getElementsByClassName("yasr-multiset-visitors-rater");if(s.length>0&&function(t){for(var e="",r=[],a=0;a<t.length;a++)!function(a){var n=t.item(a).id,i=t.item(a).getAttribute("data-rater-readonly");i=o(i);var s=document.querySelector("#"+n);raterJs({starSize:16,step:1,showToolTip:!1,readOnly:i,element:s,rateCallback:function(t,a){var n=s.getAttribute("data-rater-postid"),o=s.getAttribute("data-rater-setid"),i=s.getAttribute("data-rater-set-field-id");t=t.toFixed(1);var u=parseInt(t);this.setRating(u),e={postid:n,setid:o,field:i,rating:u},r.push(e),a()}})}(a);jQuery(".yasr-send-visitor-multiset").on("click",(function(){const t=this.getAttribute("data-postid"),e=this.getAttribute("data-setid"),a=this.getAttribute("data-nonce");jQuery("#yasr-send-visitor-multiset-"+t+"-"+e).hide(),jQuery("#yasr-loader-multiset-visitor-"+t+"-"+e).show();var n={action:"yasr_visitor_multiset_field_vote",nonce:a,post_id:t,rating:r,set_type:e};jQuery.post(yasrCommonData.ajaxurl,n,(function(r){jQuery("#yasr-loader-multiset-visitor-"+t+"-"+e).text(r)}))}))}(s),i&&"yes"===yasrCommonData.visitorStatsEnabled){var u=document.getElementsByClassName("yasr-dashicons-visitor-stats");u&&function(t){for(var e=!1,r=0;r<t.length;r++)!function(r){var a="#"+t.item(r).id,n={action:"yasr_stats_visitors_votes",post_id:t.item(r).getAttribute("data-postid")};tippy(a,{content:'<span style="color: #0a0a0a">Loading...</span>',theme:"yasr",arrow:"true",arrowType:"round",onShow:function(t){a!==e&&jQuery.get(yasrCommonData.ajaxurl,n,(function(e){e=JSON.parse(e),t.setContent(e)}))},onHidden:function(){e=a}})}(r)}(u)}"undefined"!=typeof yasrMostHighestRanking&&(document.getElementById("yasr-highest-rated-posts").style.display="none")}))}]);
|
includes/rest/classes/YasrCustomFields.php
CHANGED
@@ -46,18 +46,22 @@ class YasrCustomFields extends WP_REST_Controller {
|
|
46 |
'type' => 'object',
|
47 |
'context' => array('view', 'edit'),
|
48 |
// In JSON Schema you can specify object properties in the properties attribute.
|
49 |
-
'properties' => array
|
50 |
-
(
|
51 |
-
'
|
52 |
-
|
53 |
-
|
54 |
-
'
|
55 |
-
|
56 |
-
|
57 |
-
'read_only'
|
58 |
'type' => 'boolean',
|
59 |
),
|
60 |
-
|
|
|
|
|
|
|
|
|
61 |
);
|
62 |
|
63 |
//Register Visitor Votes
|
46 |
'type' => 'object',
|
47 |
'context' => array('view', 'edit'),
|
48 |
// In JSON Schema you can specify object properties in the properties attribute.
|
49 |
+
'properties' => array (
|
50 |
+
'sum_votes' => array(
|
51 |
+
'type' => 'integer',
|
52 |
+
),
|
53 |
+
'number_of_votes' => array(
|
54 |
+
'type' => 'integer',
|
55 |
+
),
|
56 |
+
'stars_attributes' => array(
|
57 |
+
'read_only' => array(
|
58 |
'type' => 'boolean',
|
59 |
),
|
60 |
+
'span_bottom' => array(
|
61 |
+
'type' => 'boolean',
|
62 |
+
)
|
63 |
+
)
|
64 |
+
),
|
65 |
);
|
66 |
|
67 |
//Register Visitor Votes
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Requires at least: 4.9.0
|
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 5.5
|
7 |
Requires PHP: 5.3
|
8 |
-
Stable tag: 2.3.
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
|
@@ -30,18 +30,16 @@ You can either place the overall rating automatically at the beginning or the en
|
|
30 |
You can give your users the ability to vote, pasting the shortcode [yasr_visitor_votes] where you want the stars to appear.
|
31 |
If you're using the new Gutenberg editor, just click on the "+" icon to add a block and search for Yasr Visitor Votes
|
32 |
Again, this can be placed automatically at the beginning or the end of each post; the option is in "Settings" -> "Yet Another Stars Rating: Settings".
|
33 |
-
[Click here if you use a caching plugin](https://wordpress.org/plugins/yet-another-stars-rating/#does%20it%20work%20with%20caching%20plugins%3F)
|
34 |
|
35 |
= Multi Set =
|
36 |
-
Multisets give the opportunity to score different aspects for each review: for example, if you're reviewing a videogame, you can create the aspects "Graphics",
|
37 |
-
"Gameplay", "Story", etc.
|
38 |
|
39 |
= Migration tools =
|
40 |
You can easily migrate from *WP-PostRatings*, *kk Star Ratings*, *Rate My Post* and *Multi Rating*
|
41 |
A tab will appear in the settings if one of these plugin is detected.
|
42 |
|
43 |
= Supported itemtypes =
|
44 |
-
|
45 |
BlogPosting ✝,
|
46 |
Book,
|
47 |
Course,
|
@@ -76,22 +74,19 @@ In this video I'll show you the "Auto Insert" feature and manual placement of ya
|
|
76 |
Do you want more feature? [Check out Yasr Pro!](https://yetanotherstarsrating.com/#yasr-pro)
|
77 |
|
78 |
== Installation ==
|
79 |
-
1.
|
80 |
-
2.
|
81 |
-
3. Go to the Yet Another Star Rating menu in Settings and set your options.
|
82 |
|
83 |
== Frequently Asked Questions ==
|
84 |
|
85 |
= What is "Overall Rating"? =
|
86 |
-
It is the vote given by who writes the review: readers are able to see this vote in read-only mode. Reviewer can vote using the box on the top
|
87 |
|
88 |
= What is "Visitor Rating"? =
|
89 |
It is the vote that allows your visitors to vote: just paste this shortcode **[yasr_visitor_votes]** where you want the stars to appear.
|
90 |
-
[See the supported caching plugins](https://wordpress.org/plugins/yet-another-stars-rating/#does%20it%20work%20with%20caching%20plugins%3F)
|
91 |
|
92 |
[Demo page for Overall Rating and Vistor Rating](https://yetanotherstarsrating.com/yasr-basics-shortcode/)
|
93 |
|
94 |
-
|
95 |
= What is "Multi Set"? =
|
96 |
It is the feature that makes YASR awesome. Multisets give the opportunity to score different aspects for each review: for example, if you're reviewing a videogame, you can create the aspects "Graphics", "Gameplay", "Story", etc. and give a vote for each one. To create a set, just go in "Settings" -> "Yet Another Stars Rating: Settings" and click on the "Multi Sets" tab. To insert it into a post, just paste the shortcode that YASR will create for you.
|
97 |
|
@@ -118,7 +113,7 @@ If you're using the new Gutenberg editor, you don't need at all: just use the bl
|
|
118 |
If, instead, you're using the classic editor, in the visual tab just click the "Yasr Shortcode" button above the editor
|
119 |
|
120 |
= Does it work with caching plugins? =
|
121 |
-
|
122 |
In the settings, just select "yes" to "Load results with AJAX".
|
123 |
YASR has been tested with:
|
124 |
* Wp Super Cache
|
@@ -147,6 +142,9 @@ If doesn't, you should work on your seo reputation.
|
|
147 |
|
148 |
The full changelog can be found in the plugin's directory. Recent entries:
|
149 |
|
|
|
|
|
|
|
150 |
= 2.3.7 =
|
151 |
* FIXED: Minor changes
|
152 |
|
@@ -230,12 +228,5 @@ fields where reset
|
|
230 |
* PriceRange
|
231 |
* Telephone
|
232 |
|
233 |
-
More to come in the next realeses :)
|
234 |
-
|
235 |
= Additional Info =
|
236 |
-
|
237 |
-
[tippy](https://atomiks.github.io/tippyjs/)
|
238 |
-
|
239 |
-
Flat star icon made by[Freepik](http://www.freepik.com)
|
240 |
-
from [www.flaticon.com](https://www.flaticon.com/) is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/)
|
241 |
-
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 5.5
|
7 |
Requires PHP: 5.3
|
8 |
+
Stable tag: 2.3.8
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
|
30 |
You can give your users the ability to vote, pasting the shortcode [yasr_visitor_votes] where you want the stars to appear.
|
31 |
If you're using the new Gutenberg editor, just click on the "+" icon to add a block and search for Yasr Visitor Votes
|
32 |
Again, this can be placed automatically at the beginning or the end of each post; the option is in "Settings" -> "Yet Another Stars Rating: Settings".
|
|
|
33 |
|
34 |
= Multi Set =
|
35 |
+
Multisets give the opportunity to score different aspects for each review: for example, if you're reviewing a videogame, you can create the aspects "Graphics", "Gameplay", "Story", etc.
|
|
|
36 |
|
37 |
= Migration tools =
|
38 |
You can easily migrate from *WP-PostRatings*, *kk Star Ratings*, *Rate My Post* and *Multi Rating*
|
39 |
A tab will appear in the settings if one of these plugin is detected.
|
40 |
|
41 |
= Supported itemtypes =
|
42 |
+
YASR supports the following schema.org itemtypes:
|
43 |
BlogPosting ✝,
|
44 |
Book,
|
45 |
Course,
|
74 |
Do you want more feature? [Check out Yasr Pro!](https://yetanotherstarsrating.com/#yasr-pro)
|
75 |
|
76 |
== Installation ==
|
77 |
+
1. Navigate to Dashboard -> Plugins -> Add New and search for YASR
|
78 |
+
2. Click on "Installa Now" and than "Activate"
|
|
|
79 |
|
80 |
== Frequently Asked Questions ==
|
81 |
|
82 |
= What is "Overall Rating"? =
|
83 |
+
It is the vote given by who writes the review: readers are able to see this vote in read-only mode. Reviewer can vote using the box on the top right in the editor screen. Remember to insert this shortcode **[yasr_overall_rating]** to make it appear where you like.
|
84 |
|
85 |
= What is "Visitor Rating"? =
|
86 |
It is the vote that allows your visitors to vote: just paste this shortcode **[yasr_visitor_votes]** where you want the stars to appear.
|
|
|
87 |
|
88 |
[Demo page for Overall Rating and Vistor Rating](https://yetanotherstarsrating.com/yasr-basics-shortcode/)
|
89 |
|
|
|
90 |
= What is "Multi Set"? =
|
91 |
It is the feature that makes YASR awesome. Multisets give the opportunity to score different aspects for each review: for example, if you're reviewing a videogame, you can create the aspects "Graphics", "Gameplay", "Story", etc. and give a vote for each one. To create a set, just go in "Settings" -> "Yet Another Stars Rating: Settings" and click on the "Multi Sets" tab. To insert it into a post, just paste the shortcode that YASR will create for you.
|
92 |
|
113 |
If, instead, you're using the classic editor, in the visual tab just click the "Yasr Shortcode" button above the editor
|
114 |
|
115 |
= Does it work with caching plugins? =
|
116 |
+
Since version 2.3.0 YASR works with *every caching plugin available out there*.
|
117 |
In the settings, just select "yes" to "Load results with AJAX".
|
118 |
YASR has been tested with:
|
119 |
* Wp Super Cache
|
142 |
|
143 |
The full changelog can be found in the plugin's directory. Recent entries:
|
144 |
|
145 |
+
= 2.3.8 =
|
146 |
+
* TWEAKED: Using GET instead of POST when getting rest response
|
147 |
+
|
148 |
= 2.3.7 =
|
149 |
* FIXED: Minor changes
|
150 |
|
228 |
* PriceRange
|
229 |
* Telephone
|
230 |
|
|
|
|
|
231 |
= Additional Info =
|
232 |
+
See credits.txt file
|
|
|
|
|
|
|
|
|
|
yet-another-stars-rating.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Yet Another Stars Rating
|
5 |
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
|
6 |
* Description: Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
|
7 |
-
* Version: 2.3.
|
8 |
* Author: Dario Curvino
|
9 |
* Author URI: https://dariocurvino.it/
|
10 |
* Text Domain: yet-another-stars-rating
|
@@ -76,7 +76,7 @@ if ( !function_exists( 'yasr_fs' ) ) {
|
|
76 |
yasr_fs();
|
77 |
// Signal that SDK was initiated.
|
78 |
do_action( 'yasr_fs_loaded' );
|
79 |
-
define( 'YASR_VERSION_NUM', '2.3.
|
80 |
//Plugin absolute path
|
81 |
//e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
|
82 |
define( 'YASR_ABSOLUTE_PATH', __DIR__ );
|
4 |
* Plugin Name: Yet Another Stars Rating
|
5 |
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
|
6 |
* Description: Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
|
7 |
+
* Version: 2.3.8
|
8 |
* Author: Dario Curvino
|
9 |
* Author URI: https://dariocurvino.it/
|
10 |
* Text Domain: yet-another-stars-rating
|
76 |
yasr_fs();
|
77 |
// Signal that SDK was initiated.
|
78 |
do_action( 'yasr_fs_loaded' );
|
79 |
+
define( 'YASR_VERSION_NUM', '2.3.8' );
|
80 |
//Plugin absolute path
|
81 |
//e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
|
82 |
define( 'YASR_ABSOLUTE_PATH', __DIR__ );
|