Yasr – Yet Another Stars Rating - Version 2.9.5

Version Description

  • NEW FEATURE: In the settings, is now possible to customize the text when a rating is saved / updated
  • minor fixes
Download this release

Release Info

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

Code changes from version 2.9.4 to 2.9.5

admin/css/yasr-admin.css CHANGED
@@ -109,7 +109,7 @@
109
  }
110
 
111
  .yasr-element-row-container-description {
112
- color: #737272;
113
  margin-top: 5px;
114
  margin-left: 10px;
115
  margin-bottom: 15px;
109
  }
110
 
111
  .yasr-element-row-container-description {
112
+ color: #717070;
113
  margin-top: 5px;
114
  margin-left: 10px;
115
  margin-bottom: 15px;
admin/js/src/yasr-settings-page.js CHANGED
@@ -44,7 +44,9 @@ if (activeTab === 'general_settings') {
44
  document.getElementById('yasr-settings-custom-text-before-overall').value = 'Our Score';
45
  document.getElementById('yasr-settings-custom-text-before-visitor').value = 'Click to rate this post!';
46
  document.getElementById('yasr-settings-custom-text-after-visitor').value = '[Total: %total_count% Average: %average%]';
47
- document.getElementById('yasr-settings-custom-text-must-sign-in').value = 'You must sign in to vote';
 
 
48
  document.getElementById('yasr-settings-custom-text-already-rated').value = 'You have already voted for this article with %rating%';
49
  });
50
 
44
  document.getElementById('yasr-settings-custom-text-before-overall').value = 'Our Score';
45
  document.getElementById('yasr-settings-custom-text-before-visitor').value = 'Click to rate this post!';
46
  document.getElementById('yasr-settings-custom-text-after-visitor').value = '[Total: %total_count% Average: %average%]';
47
+ document.getElementById('yasr-settings-custom-text-rating-saved').value = 'Rating saved!';
48
+ document.getElementById('yasr-settings-custom-text-rating-updated').value = 'Rating updated!';
49
+ document.getElementById('yasr-settings-custom-text-must-sign-in').value = 'You must sign in to vote';
50
  document.getElementById('yasr-settings-custom-text-already-rated').value = 'You have already voted for this article with %rating%';
51
  });
52
 
admin/js/yasr-settings.js CHANGED
@@ -1 +1 @@
1
- (()=>{var e;if(document.getElementsByClassName("nav-tab-active").length>0&&(e=document.getElementsByClassName("nav-tab-active")[0].id),"general_settings"===e){var t=document.getElementById("yasr_auto_insert_switch").checked,a=document.getElementById("yasr-general-options-stars-title-switch").checked;!1===t&&jQuery(".yasr-auto-insert-options-class").prop("disabled",!0),!1===a&&jQuery(".yasr-stars-title-options-class").prop("disabled",!0),document.getElementById("yasr_auto_insert_switch").addEventListener("change",(function(){this.checked?jQuery(".yasr-auto-insert-options-class").prop("disabled",!1):jQuery(".yasr-auto-insert-options-class").prop("disabled",!0)})),document.getElementById("yasr-general-options-stars-title-switch").addEventListener("change",(function(){this.checked?jQuery(".yasr-stars-title-options-class").prop("disabled",!1):jQuery(".yasr-stars-title-options-class").prop("disabled",!0)})),document.getElementById("yasr-settings-custom-texts").addEventListener("click",(function(){document.getElementById("yasr-settings-custom-text-before-overall").value="Our Score",document.getElementById("yasr-settings-custom-text-before-visitor").value="Click to rate this post!",document.getElementById("yasr-settings-custom-text-after-visitor").value="[Total: %total_count% Average: %average%]",document.getElementById("yasr-settings-custom-text-must-sign-in").value="You must sign in to vote",document.getElementById("yasr-settings-custom-text-already-rated").value="You have already voted for this article with %rating%"}))}if("style_options"===e&&(wp.codeEditor.initialize(document.getElementById("yasr_style_options_textarea"),yasr_cm_settings),jQuery("#yasr-color-scheme-preview-link").on("click",(function(){return jQuery("#yasr-color-scheme-preview").toggle("slow"),!1})),wp.hooks.doAction("yasrStyleOptions")),"manage_multi"===e){var n=parseInt(document.getElementById("n-multiset").value);if(jQuery("#yasr-multi-set-doc-link").on("click",(function(){jQuery("#yasr-multi-set-doc-box").toggle("slow")})),jQuery("#yasr-multi-set-doc-link-hide").on("click",(function(){jQuery("#yasr-multi-set-doc-box").toggle("slow")})),1===n){var r=jQuery("#yasr-edit-form-number-elements").attr("value");r++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(r>9)return jQuery("#yasr-element-limit").show(),jQuery("#yasr-add-field-edit-multiset").hide(),!1;var e=jQuery(document.createElement("tr"));e.html('<td colspan="2">Element #'+r+' <input type="text" name="edit-multi-set-element-'+r+'" value="" ></td>'),e.appendTo("#yasr-table-form-edit-multi-set"),r++}))}else n>1&&(jQuery("#yasr-button-select-set-edit-form").on("click",(function(){var e={action:"yasr_get_multi_set",set_id:jQuery("#yasr_select_edit_set").val()};return jQuery.post(ajaxurl,e,(function(e){jQuery("#yasr-multi-set-response").show(),jQuery("#yasr-multi-set-response").html(e)})),!1})),jQuery(document).ajaxComplete((function(){var e=jQuery("#yasr-edit-form-number-elements").attr("value");e++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(e>9)return jQuery("#yasr-element-limit").show(),jQuery("#yasr-add-field-edit-multiset").hide(),!1;var t=jQuery(document.createElement("tr"));t.html('<td colspan="2">Element #'+e+' <input type="text" name="edit-multi-set-element-'+e+'" value="" ></td>'),t.appendTo("#yasr-table-form-edit-multi-set"),e++}))})))}"migration_tools"===e&&(jQuery("#yasr-import-ratemypost-submit").on("click",(function(){document.getElementById("yasr-import-ratemypost-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var e={action:"yasr_import_ratemypost",nonce:document.getElementById("yasr-import-rmp-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-ratemypost-answer").innerHTML=e}))})),jQuery("#yasr-import-wppr-submit").on("click",(function(){document.getElementById("yasr-import-wppr-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var e={action:"yasr_import_wppr",nonce:document.getElementById("yasr-import-wppr-nonce").value};jQuery.post(ajaxurl,e,(function(e){document.getElementById("yasr-import-wppr-answer").innerHTML=e}))})),jQuery("#yasr-import-kksr-submit").on("click",(function(){document.getElementById("yasr-import-kksr-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var e={action:"yasr_import_kksr",nonce:document.getElementById("yasr-import-kksr-nonce").value};jQuery.post(ajaxurl,e,(function(e){document.getElementById("yasr-import-kksr-answer").innerHTML=e}))})),jQuery("#yasr-import-mr-submit").on("click",(function(){document.getElementById("yasr-import-mr-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var e={action:"yasr_import_mr",nonce:document.getElementById("yasr-import-mr-nonce").value};jQuery.post(ajaxurl,e,(function(e){document.getElementById("yasr-import-mr-answer").innerHTML=e}))})),wp.hooks.doAction("yasr_migration_page_bottom")),"rankings"===e&&wp.hooks.doAction("yasr_ranking_page_top")})(),(()=>{"use strict";var e,t,a=new Uint8Array(16);function n(){if(!t&&!(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(a)}const r=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,s=function(e){return"string"==typeof e&&r.test(e)};for(var o=[],i=0;i<256;++i)o.push((i+256).toString(16).substr(1));const l=function(e,t,a){var r=(e=e||{}).random||(e.rng||n)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){a=a||0;for(var i=0;i<16;++i)t[a+i]=r[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(o[e[t+0]]+o[e[t+1]]+o[e[t+2]]+o[e[t+3]]+"-"+o[e[t+4]]+o[e[t+5]]+"-"+o[e[t+6]]+o[e[t+7]]+"-"+o[e[t+8]]+o[e[t+9]]+"-"+o[e[t+10]]+o[e[t+11]]+o[e[t+12]]+o[e[t+13]]+o[e[t+14]]+o[e[t+15]]).toLowerCase();if(!s(a))throw TypeError("Stringified UUID is invalid");return a}(r)};function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function c(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t){return u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},u(e,t)}function m(e,t){if(t&&("object"===d(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}var p=wp.i18n.__,g=wp.element.render;function h(e){var t="yasr-ranking-element-"+l(),a=document.getElementById(e.tableId).dataset.rankingSize;return React.createElement("div",{id:t,ref:function(){return function(e,t){var a,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.1,r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],o=arguments.length>6&&void 0!==arguments[6]&&arguments[6];a=arguments.length>2&&void 0!==arguments[2]&&arguments[2]||document.getElementById(t),e=parseInt(e),raterJs({starSize:e,showToolTip:!1,element:a,step:n,readOnly:r,rating:s,rateCallback:o})}(a,t,!1,.1,!0,e.rating)}})}function f(e){if(void 0!==e.post.number_of_votes)return React.createElement("span",{className:"yasr-most-rated-text"},"[",p("Total:","yet-another-stars-rating")," ",e.post.number_of_votes,"  ",p("Average:","yet-another-stars-rating")," ",e.post.rating,"]");var t=e.text;return React.createElement("span",{className:"yasr-highest-rated-text"},t," ",e.post.rating)}function v(t){return React.createElement("td",{className:t.colClass},React.createElement("a",{href:t.post.link},function(t){if("string"!=typeof t||-1===t.indexOf("&"))return t;void 0===e&&(e=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),e.innerHTML=t;var a=e.textContent;return e.innerHTML="",a}(t.post.title)))}function _(e){var t="after",a=p("Rating:","yet-another-stars-rating"),n=new URLSearchParams(e.rankingParams);return null!==n.get("text_position")&&(t=n.get("text_position")),null!==n.get("custom_txt")&&(a=n.get("custom_txt")),"before"===t?React.createElement("td",{className:e.colClass},React.createElement(f,{post:e.post,tableId:e.tableId,text:a}),React.createElement(h,{rating:e.post.rating,tableId:e.tableId})):React.createElement("td",{className:e.colClass},React.createElement(h,{rating:e.post.rating,tableId:e.tableId}),React.createElement(f,{post:e.post,tableId:e.tableId,text:a}))}function b(e){var t="",a="";return"author_ranking"===e.source?(t="yasr-top-10-overall-left",a="yasr-top-10-overall-right"):"visitor_votes"===e.source&&(t="yasr-top-10-most-highest-left",a="yasr-top-10-most-highest-right"),React.createElement("tr",{className:e.trClass},React.createElement(v,{colClass:t,post:e.post}),React.createElement(_,{colClass:a,post:e.post,tableId:e.tableId,rankingParams:e.rankingParams}))}function E(e){return React.createElement("tbody",{id:e.tBodyId,style:{display:e.show}},e.data.map((function(t,a){var n="yasr-rankings-td-colored";return"author_ranking"===e.source&&(n="yasr-rankings-td-white"),a%2==0&&(n="yasr-rankings-td-white","author_ranking"===e.source&&(n="yasr-rankings-td-colored")),React.createElement(b,{key:t.post_id,source:e.source,tableId:e.tableId,rankingParams:e.rankingParams,post:t,trClass:n})})))}var k=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}(o,React.Component);var t,a,n,r,s=(n=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=y(n);if(r){var a=y(this).constructor;e=Reflect.construct(t,arguments,a)}else e=t.apply(this,arguments);return m(this,e)});function o(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(t=s.call(this,e)).state={error:null,isLoaded:!1,data:[],tableId:e.tableId,source:e.source,rankingParams:e.params,nonce:e.nonce},t}return t=o,a=[{key:"componentDidMount",value:function(){var e=this,t=JSON.parse(document.getElementById(this.state.tableId).dataset.rankingData),a={};if("yes"!==yasrCommonData.ajaxEnabled)console.info(p("Ajax Disabled, getting data from source","yet-another-stars-rating")),this.setState({isLoaded:!0,data:t});else if(this.state.source){var n=this.returnRestUrl();Promise.all(n.map((function(e){return fetch(e).then((function(e){return!0===e.ok?e.json():(console.info(p("Ajax Call Failed. Getting data from source")),"KO")})).then((function(e){"KO"===e?a=t:"overall_rating"===e.source||"author_multi"===e.source?a="overall_rating"===e.source?e.data_overall:e.data_mv:a[e.show]=e.data_vv})).catch((function(e){a=t,console.info(p(e))}))}))).then((function(t){e.setState({isLoaded:!0,data:a})})).catch((function(t){console.info(p(t)),e.setState({isLoaded:!0,data:a})}))}else this.setState({error:p("Invalid Data Source","yet-another-stars-rating")})}},{key:"returnRestUrl",value:function(){var e,t=""!==this.state.rankingParams?this.state.rankingParams:"",a=this.state.source,n="&nonce_rankings="+this.state.nonce,r="";if(""!==t&&!1!==t){var s=new URLSearchParams(t);null!==s.get("order_by")&&(r+="order_by="+s.get("order_by")),null!==s.get("limit")&&(r+="&limit="+s.get("limit")),null!==s.get("start_date")&&"0"!==s.get("start_date")&&(r+="&start_date="+s.get("start_date")),null!==s.get("end_date")&&"0"!==s.get("end_date")&&(r+="&end_date="+s.get("end_date")),null!==s.get("ctg")?r+="&ctg="+s.get("ctg"):null!==s.get("cpt")&&(r+="&cpt="+s.get("cpt")),""!==r&&(r="&"+(r=r.replace(/\s+/g,""))),"visitor_multi"!==a&&"author_multi"!==a||null!==s.get("setid")&&(r+="&setid="+s.get("setid"))}else r="";if("author_ranking"===a||"author_multi"===a)e=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&source="+a+r+n];else{var o="",i="";if(""!==t){var l=new URLSearchParams(t);null!==l.get("required_votes[most]")&&(o="&required_votes="+l.get("required_votes[most]")),null!==l.get("required_votes[highest]")&&(i="&required_votes="+l.get("required_votes[highest]"))}e=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=most&source="+a+r+o+n,yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+a+r+i+n]}return e}},{key:"rankingTableHead",value:function(e,t){var a=this.state.tableId,n="link-most-rated-posts-"+a,r="link-highest-rated-posts-"+a;if("author_ranking"!==e){var s=React.createElement("span",null,React.createElement("span",{id:n},p("Most Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:r,onClick:this.switchTBody.bind(this)},p("Highest Rated","yet-another-stars-rating")));return"highest"===t&&(s=React.createElement("span",null,React.createElement("span",{id:r},p("Highest Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:n,onClick:this.switchTBody.bind(this)},p("Most Rated","yet-another-stars-rating")))),React.createElement("thead",null,React.createElement("tr",{className:"yasr-rankings-td-colored yasr-rankings-heading"},React.createElement("th",null,p("Post","yet-another-stars-rating")),React.createElement("th",null,p("Order By","yet-another-stars-rating"),":  ",s)))}return React.createElement(React.Fragment,null)}},{key:"switchTBody",value:function(e){e.preventDefault();var t=e.target.id,a=this.state.tableId,n="link-most-rated-posts-"+a,r="link-highest-rated-posts-"+a,s="most-rated-posts-"+a,o="highest-rated-posts-"+a,i=document.getElementById(t),l=document.createElement("span");l.innerHTML=i.innerHTML,l.id=i.id,i.parentNode.replaceChild(l,i),t===n&&(document.getElementById(o).style.display="none",document.getElementById(s).style.display="",l=document.getElementById(r),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l)),t===r&&(document.getElementById(s).style.display="none",document.getElementById(o).style.display="",l=document.getElementById(n),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l))}},{key:"rankingTableBody",value:function(){var e=this.state,t=e.data,a=e.source,n=e.rankingParams;if("overall_rating"===a||"author_multi"===a)return React.createElement(E,{data:t,tableId:this.state.tableId,tBodyId:"overall_"+this.state.tableId,rankingParams:n,show:"table-row-group",source:a});var r=t.most,s=t.highest,o="table-row-group",i="none",l="most",d=o,c=i,u=new URLSearchParams(n);return null!==u.get("view")&&(l=u.get("view")),"highest"===l&&(d=i,c=o),React.createElement(React.Fragment,null,this.rankingTableHead(a,l),React.createElement(E,{data:r,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,rankingParams:n,show:d,source:a}),React.createElement(E,{data:s,tableId:this.state.tableId,tBodyId:"highest-rated-posts-"+this.state.tableId,rankingParams:n,show:c,source:a}))}},{key:"render",value:function(){var e=this.state,t=e.error,a=e.isLoaded;return t?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(t),"Error"))):!1===a?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,p("Loading Charts","yet-another-stars-rating")))):React.createElement(React.Fragment,null,this.rankingTableBody())}}],a&&c(t.prototype,a),o}();function I(){var e=document.getElementsByClassName("yasr-stars-rankings");if(e.length>0)for(var t=0;t<e.length;t++){var a=e.item(t).id,n=JSON.parse(e.item(t).dataset.rankingSource),r=JSON.parse(e.item(t).dataset.rankingParams),s=JSON.parse(e.item(t).dataset.rankingNonce),o=document.getElementById(a);g(React.createElement(k,{source:n,tableId:a,params:r,nonce:s}),o)}}I(),tippy(document.querySelectorAll(".yasr-copy-shortcode"),{content:"Copied! Insert into your post!",theme:"yasr",arrow:"true",arrowType:"round",trigger:"click"});var w,B=wp.i18n.__;if(document.getElementsByClassName("nav-tab-active").length>0&&(w=document.getElementsByClassName("nav-tab-active")[0].id),"rankings"===w){var R,j=function(e){var t=D.value,a=document.getElementById("yasr-builder-shortcode").textContent,n=["yasr_ov_ranking","yasr_most_or_highest_rated_posts","yasr_multi_set_ranking","yasr_visitor_multi_set_ranking"];n=wp.hooks.applyFilters("yasrBuilderDrawRankingsShortcodes",n),fetch(ajaxurl+"?action=yasr_rankings_preview_shortcode&shortcode="+t+"&full_shortcode="+a).then((function(e){return!0===e.ok?e.json():(console.info(B("Ajax Call Failed. Shortcode preview can't be done","yet-another-stars-rating")),"KO")})).catch((function(e){console.info(e)})).then((function(e){if("KO"!==e){var t=document.createElement("div");t.innerHTML=e,M.childNodes.length>0?M.replaceChild(t,M.childNodes[0]):M.appendChild(t)}})).then((function(e){n.forEach((function(e){t===e&&I()}))}))},x=function(e,t,a,n,r,s,o,i,l){e.style.display="",t.style.display="",s.style.display="",l.style.display="",a.style.display="none",n.style.display="none",r.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="none")},C=function(e,t,a,n,r,s,o,i,l){a.style.display="",n.style.display="",t.style.display="",s.style.display="",l.style.display="",e.style.display="none",r.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="none")},Q=function(e,t,a,n,r,s,o,i,l){r.style.display="",l.style.display="none",e.style.display="none",a.style.display="none",n.style.display="none",t.style.display="none",s.style.display="none",null!==o&&(o.style.display="none"),null!==i&&(i.style.display="none")},T=function(e,t,a,n,r,s,o,i){var l=arguments.length>8&&void 0!==arguments[8]&&arguments[8],d=arguments.length>9?arguments[9]:void 0;!0===l?(F.className="",F.classList.add("yasr-settings-row-24"),a.style.display="",n.style.display="",e.style.display="none"):(a.style.display="none",n.style.display="none",e.style.display=""),s.style.display="",t.style.display="",d.style.display="",r.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="")},L=".yasr-builder-elements-parents",S=".yasr-builder-elements-childs";jQuery(L).prop("disabled",!0),jQuery(S).prop("disabled",!0),jQuery(L).find("input").each((function(){jQuery(this).prop("disabled",!0)})),wp.hooks.doAction("yasrBuilderBegin",L,S);var P=[],H={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""};R=H.name,document.getElementById("yasr-builder-shortcode").textContent="["+R+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+R+"]");var O=document.getElementById("yasr-builder-button-preview"),N=document.getElementById("yasr-builder-copy-shortcode"),M=document.getElementById("yasr-builder-preview"),D=document.getElementById("yasr-ranking-source"),A=document.getElementById("yasr-ranking-multiset-select"),U=document.getElementById("yasr-builder-datepicker-start"),q=document.getElementById("yasr-builder-datepicker-end"),F=document.getElementById("yasr-builder-params-container"),z=document.getElementById("builder-vv-default-view"),J=document.getElementById("builder-vv-required-votes"),V=document.getElementById("builder-stars-size"),K=document.getElementById("builder-overall-text"),Y=document.getElementById("builder-username-options"),G=document.getElementById("builder-category"),$=document.getElementById("builder-cpt"),W=document.getElementById("yasr-ranking-multiset"),X=document.getElementById("yasr-builder-datepicker"),Z=D.value,ee=!1;U.value="",q.value="","yasr_ov_ranking"===Z?x(K,V,z,J,Y,G,$,W,X):"yasr_most_active_users"===Z||"yasr_top_reviewers"===Z?Q(K,V,z,J,Y,G,$,W,X):"yasr_multi_set_ranking"===Z?T(K,V,z,J,Y,G,$,W,!1,X):"yasr_visitor_multi_set_ranking"===Z?T(K,V,z,J,Y,G,$,W,!0,X):C(K,V,z,J,Y,G,$,W,X),document.addEventListener("change",(function(e){if("yasr-ranking-source"===e.target.id)F.className="",F.classList.add("yasr-settings-row-33"),M.innerHTML="",U.value="",q.value="",H={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""},"yasr_ov_ranking"===e.target.value?x(K,V,z,J,Y,G,$,W,X):"yasr_most_active_users"===e.target.value||"yasr_top_reviewers"===e.target.value?Q(K,V,z,J,Y,G,$,W,X):"yasr_multi_set_ranking"===e.target.value?(T(K,V,z,J,Y,G,$,W,!1,X),H.setid=" setid="+A[0].value):"yasr_visitor_multi_set_ranking"===e.target.value?(T(K,V,z,J,Y,G,$,W,!0,X),H.setid=" setid="+A[0].value):C(K,V,z,J,Y,G,$,W,X),H.name=e.target.value,R=H.name+H.setid;else{"yasr-ranking-multiset-select"===e.target.id&&(H.setid=" setid="+e.target.value),P=wp.hooks.applyFilters("yasrBuilderFilterShortcode",H);for(var t=2;H.length;t++)P.hasOwnProperty(H[t])&&(H[t]=P[t]);R=H.name+H.setid+H.rows+H.view+H.minvotesmost+H.minvoteshg+H.size+H.txtPosition+H.txt+H.display+H.start_date+H.end_date+H.category+H.cpt}document.getElementById("yasr-builder-shortcode").textContent="["+R+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+R+"]"),!0===ee&&"yasr-ranking-source"!==e.target.id&&"yasr-builder-category-radio"!==e.target.name&&j()})),N.onclick=function(e){var t,a;t=document.getElementById(e.target.id).getAttribute("data-shortcode"),(a=document.createElement("textarea")).value=t,a.setAttribute("readonly",""),a.style.position="absolute",a.style.left="-9999px",document.body.appendChild(a),a.select(),document.execCommand("copy"),document.body.removeChild(a)},O.onclick=function(e){j(),ee=!0}}})();
1
+ (()=>{var e;if(document.getElementsByClassName("nav-tab-active").length>0&&(e=document.getElementsByClassName("nav-tab-active")[0].id),"general_settings"===e){var t=document.getElementById("yasr_auto_insert_switch").checked,a=document.getElementById("yasr-general-options-stars-title-switch").checked;!1===t&&jQuery(".yasr-auto-insert-options-class").prop("disabled",!0),!1===a&&jQuery(".yasr-stars-title-options-class").prop("disabled",!0),document.getElementById("yasr_auto_insert_switch").addEventListener("change",(function(){this.checked?jQuery(".yasr-auto-insert-options-class").prop("disabled",!1):jQuery(".yasr-auto-insert-options-class").prop("disabled",!0)})),document.getElementById("yasr-general-options-stars-title-switch").addEventListener("change",(function(){this.checked?jQuery(".yasr-stars-title-options-class").prop("disabled",!1):jQuery(".yasr-stars-title-options-class").prop("disabled",!0)})),document.getElementById("yasr-settings-custom-texts").addEventListener("click",(function(){document.getElementById("yasr-settings-custom-text-before-overall").value="Our Score",document.getElementById("yasr-settings-custom-text-before-visitor").value="Click to rate this post!",document.getElementById("yasr-settings-custom-text-after-visitor").value="[Total: %total_count% Average: %average%]",document.getElementById("yasr-settings-custom-text-rating-saved").value="Rating saved!",document.getElementById("yasr-settings-custom-text-rating-updated").value="Rating updated!",document.getElementById("yasr-settings-custom-text-must-sign-in").value="You must sign in to vote",document.getElementById("yasr-settings-custom-text-already-rated").value="You have already voted for this article with %rating%"}))}if("style_options"===e&&(wp.codeEditor.initialize(document.getElementById("yasr_style_options_textarea"),yasr_cm_settings),jQuery("#yasr-color-scheme-preview-link").on("click",(function(){return jQuery("#yasr-color-scheme-preview").toggle("slow"),!1})),wp.hooks.doAction("yasrStyleOptions")),"manage_multi"===e){var n=parseInt(document.getElementById("n-multiset").value);if(jQuery("#yasr-multi-set-doc-link").on("click",(function(){jQuery("#yasr-multi-set-doc-box").toggle("slow")})),jQuery("#yasr-multi-set-doc-link-hide").on("click",(function(){jQuery("#yasr-multi-set-doc-box").toggle("slow")})),1===n){var r=jQuery("#yasr-edit-form-number-elements").attr("value");r++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(r>9)return jQuery("#yasr-element-limit").show(),jQuery("#yasr-add-field-edit-multiset").hide(),!1;var e=jQuery(document.createElement("tr"));e.html('<td colspan="2">Element #'+r+' <input type="text" name="edit-multi-set-element-'+r+'" value="" ></td>'),e.appendTo("#yasr-table-form-edit-multi-set"),r++}))}else n>1&&(jQuery("#yasr-button-select-set-edit-form").on("click",(function(){var e={action:"yasr_get_multi_set",set_id:jQuery("#yasr_select_edit_set").val()};return jQuery.post(ajaxurl,e,(function(e){jQuery("#yasr-multi-set-response").show(),jQuery("#yasr-multi-set-response").html(e)})),!1})),jQuery(document).ajaxComplete((function(){var e=jQuery("#yasr-edit-form-number-elements").attr("value");e++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(e>9)return jQuery("#yasr-element-limit").show(),jQuery("#yasr-add-field-edit-multiset").hide(),!1;var t=jQuery(document.createElement("tr"));t.html('<td colspan="2">Element #'+e+' <input type="text" name="edit-multi-set-element-'+e+'" value="" ></td>'),t.appendTo("#yasr-table-form-edit-multi-set"),e++}))})))}"migration_tools"===e&&(jQuery("#yasr-import-ratemypost-submit").on("click",(function(){document.getElementById("yasr-import-ratemypost-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var e={action:"yasr_import_ratemypost",nonce:document.getElementById("yasr-import-rmp-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-ratemypost-answer").innerHTML=e}))})),jQuery("#yasr-import-wppr-submit").on("click",(function(){document.getElementById("yasr-import-wppr-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var e={action:"yasr_import_wppr",nonce:document.getElementById("yasr-import-wppr-nonce").value};jQuery.post(ajaxurl,e,(function(e){document.getElementById("yasr-import-wppr-answer").innerHTML=e}))})),jQuery("#yasr-import-kksr-submit").on("click",(function(){document.getElementById("yasr-import-kksr-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var e={action:"yasr_import_kksr",nonce:document.getElementById("yasr-import-kksr-nonce").value};jQuery.post(ajaxurl,e,(function(e){document.getElementById("yasr-import-kksr-answer").innerHTML=e}))})),jQuery("#yasr-import-mr-submit").on("click",(function(){document.getElementById("yasr-import-mr-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var e={action:"yasr_import_mr",nonce:document.getElementById("yasr-import-mr-nonce").value};jQuery.post(ajaxurl,e,(function(e){document.getElementById("yasr-import-mr-answer").innerHTML=e}))})),wp.hooks.doAction("yasr_migration_page_bottom")),"rankings"===e&&wp.hooks.doAction("yasr_ranking_page_top")})(),(()=>{"use strict";var e,t,a=new Uint8Array(16);function n(){if(!t&&!(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(a)}const r=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,s=function(e){return"string"==typeof e&&r.test(e)};for(var o=[],i=0;i<256;++i)o.push((i+256).toString(16).substr(1));const l=function(e,t,a){var r=(e=e||{}).random||(e.rng||n)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){a=a||0;for(var i=0;i<16;++i)t[a+i]=r[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(o[e[t+0]]+o[e[t+1]]+o[e[t+2]]+o[e[t+3]]+"-"+o[e[t+4]]+o[e[t+5]]+"-"+o[e[t+6]]+o[e[t+7]]+"-"+o[e[t+8]]+o[e[t+9]]+"-"+o[e[t+10]]+o[e[t+11]]+o[e[t+12]]+o[e[t+13]]+o[e[t+14]]+o[e[t+15]]).toLowerCase();if(!s(a))throw TypeError("Stringified UUID is invalid");return a}(r)};function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function c(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t){return u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},u(e,t)}function m(e,t){if(t&&("object"===d(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}var p=wp.i18n.__,g=wp.element.render;function h(e){var t="yasr-ranking-element-"+l(),a=document.getElementById(e.tableId).dataset.rankingSize;return React.createElement("div",{id:t,ref:function(){return function(e,t){var a,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.1,r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],o=arguments.length>6&&void 0!==arguments[6]&&arguments[6];a=arguments.length>2&&void 0!==arguments[2]&&arguments[2]||document.getElementById(t),e=parseInt(e),raterJs({starSize:e,showToolTip:!1,element:a,step:n,readOnly:r,rating:s,rateCallback:o})}(a,t,!1,.1,!0,e.rating)}})}function f(e){if(void 0!==e.post.number_of_votes)return React.createElement("span",{className:"yasr-most-rated-text"},"[",p("Total:","yet-another-stars-rating")," ",e.post.number_of_votes,"  ",p("Average:","yet-another-stars-rating")," ",e.post.rating,"]");var t=e.text;return React.createElement("span",{className:"yasr-highest-rated-text"},t," ",e.post.rating)}function v(t){return React.createElement("td",{className:t.colClass},React.createElement("a",{href:t.post.link},function(t){if("string"!=typeof t||-1===t.indexOf("&"))return t;void 0===e&&(e=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),e.innerHTML=t;var a=e.textContent;return e.innerHTML="",a}(t.post.title)))}function _(e){var t="after",a=p("Rating:","yet-another-stars-rating"),n=new URLSearchParams(e.rankingParams);return null!==n.get("text_position")&&(t=n.get("text_position")),null!==n.get("custom_txt")&&(a=n.get("custom_txt")),"before"===t?React.createElement("td",{className:e.colClass},React.createElement(f,{post:e.post,tableId:e.tableId,text:a}),React.createElement(h,{rating:e.post.rating,tableId:e.tableId})):React.createElement("td",{className:e.colClass},React.createElement(h,{rating:e.post.rating,tableId:e.tableId}),React.createElement(f,{post:e.post,tableId:e.tableId,text:a}))}function b(e){var t="",a="";return"author_ranking"===e.source?(t="yasr-top-10-overall-left",a="yasr-top-10-overall-right"):"visitor_votes"===e.source&&(t="yasr-top-10-most-highest-left",a="yasr-top-10-most-highest-right"),React.createElement("tr",{className:e.trClass},React.createElement(v,{colClass:t,post:e.post}),React.createElement(_,{colClass:a,post:e.post,tableId:e.tableId,rankingParams:e.rankingParams}))}function E(e){return React.createElement("tbody",{id:e.tBodyId,style:{display:e.show}},e.data.map((function(t,a){var n="yasr-rankings-td-colored";return"author_ranking"===e.source&&(n="yasr-rankings-td-white"),a%2==0&&(n="yasr-rankings-td-white","author_ranking"===e.source&&(n="yasr-rankings-td-colored")),React.createElement(b,{key:t.post_id,source:e.source,tableId:e.tableId,rankingParams:e.rankingParams,post:t,trClass:n})})))}var k=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}(o,React.Component);var t,a,n,r,s=(n=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=y(n);if(r){var a=y(this).constructor;e=Reflect.construct(t,arguments,a)}else e=t.apply(this,arguments);return m(this,e)});function o(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(t=s.call(this,e)).state={error:null,isLoaded:!1,data:[],tableId:e.tableId,source:e.source,rankingParams:e.params,nonce:e.nonce},t}return t=o,a=[{key:"componentDidMount",value:function(){var e=this,t=JSON.parse(document.getElementById(this.state.tableId).dataset.rankingData),a={};if("yes"!==yasrCommonData.ajaxEnabled)console.info(p("Ajax Disabled, getting data from source","yet-another-stars-rating")),this.setState({isLoaded:!0,data:t});else if(this.state.source){var n=this.returnRestUrl();Promise.all(n.map((function(e){return fetch(e).then((function(e){return!0===e.ok?e.json():(console.info(p("Ajax Call Failed. Getting data from source")),"KO")})).then((function(e){"KO"===e?a=t:"overall_rating"===e.source||"author_multi"===e.source?a="overall_rating"===e.source?e.data_overall:e.data_mv:a[e.show]=e.data_vv})).catch((function(e){a=t,console.info(p(e))}))}))).then((function(t){e.setState({isLoaded:!0,data:a})})).catch((function(t){console.info(p(t)),e.setState({isLoaded:!0,data:a})}))}else this.setState({error:p("Invalid Data Source","yet-another-stars-rating")})}},{key:"returnRestUrl",value:function(){var e,t=""!==this.state.rankingParams?this.state.rankingParams:"",a=this.state.source,n="&nonce_rankings="+this.state.nonce,r="";if(""!==t&&!1!==t){var s=new URLSearchParams(t);null!==s.get("order_by")&&(r+="order_by="+s.get("order_by")),null!==s.get("limit")&&(r+="&limit="+s.get("limit")),null!==s.get("start_date")&&"0"!==s.get("start_date")&&(r+="&start_date="+s.get("start_date")),null!==s.get("end_date")&&"0"!==s.get("end_date")&&(r+="&end_date="+s.get("end_date")),null!==s.get("ctg")?r+="&ctg="+s.get("ctg"):null!==s.get("cpt")&&(r+="&cpt="+s.get("cpt")),""!==r&&(r="&"+(r=r.replace(/\s+/g,""))),"visitor_multi"!==a&&"author_multi"!==a||null!==s.get("setid")&&(r+="&setid="+s.get("setid"))}else r="";if("author_ranking"===a||"author_multi"===a)e=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&source="+a+r+n];else{var o="",i="";if(""!==t){var l=new URLSearchParams(t);null!==l.get("required_votes[most]")&&(o="&required_votes="+l.get("required_votes[most]")),null!==l.get("required_votes[highest]")&&(i="&required_votes="+l.get("required_votes[highest]"))}e=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=most&source="+a+r+o+n,yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+a+r+i+n]}return e}},{key:"rankingTableHead",value:function(e,t){var a=this.state.tableId,n="link-most-rated-posts-"+a,r="link-highest-rated-posts-"+a;if("author_ranking"!==e){var s=React.createElement("span",null,React.createElement("span",{id:n},p("Most Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:r,onClick:this.switchTBody.bind(this)},p("Highest Rated","yet-another-stars-rating")));return"highest"===t&&(s=React.createElement("span",null,React.createElement("span",{id:r},p("Highest Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:n,onClick:this.switchTBody.bind(this)},p("Most Rated","yet-another-stars-rating")))),React.createElement("thead",null,React.createElement("tr",{className:"yasr-rankings-td-colored yasr-rankings-heading"},React.createElement("th",null,p("Post","yet-another-stars-rating")),React.createElement("th",null,p("Order By","yet-another-stars-rating"),":  ",s)))}return React.createElement(React.Fragment,null)}},{key:"switchTBody",value:function(e){e.preventDefault();var t=e.target.id,a=this.state.tableId,n="link-most-rated-posts-"+a,r="link-highest-rated-posts-"+a,s="most-rated-posts-"+a,o="highest-rated-posts-"+a,i=document.getElementById(t),l=document.createElement("span");l.innerHTML=i.innerHTML,l.id=i.id,i.parentNode.replaceChild(l,i),t===n&&(document.getElementById(o).style.display="none",document.getElementById(s).style.display="",l=document.getElementById(r),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l)),t===r&&(document.getElementById(s).style.display="none",document.getElementById(o).style.display="",l=document.getElementById(n),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l))}},{key:"rankingTableBody",value:function(){var e=this.state,t=e.data,a=e.source,n=e.rankingParams;if("overall_rating"===a||"author_multi"===a)return React.createElement(E,{data:t,tableId:this.state.tableId,tBodyId:"overall_"+this.state.tableId,rankingParams:n,show:"table-row-group",source:a});var r=t.most,s=t.highest,o="table-row-group",i="none",l="most",d=o,c=i,u=new URLSearchParams(n);return null!==u.get("view")&&(l=u.get("view")),"highest"===l&&(d=i,c=o),React.createElement(React.Fragment,null,this.rankingTableHead(a,l),React.createElement(E,{data:r,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,rankingParams:n,show:d,source:a}),React.createElement(E,{data:s,tableId:this.state.tableId,tBodyId:"highest-rated-posts-"+this.state.tableId,rankingParams:n,show:c,source:a}))}},{key:"render",value:function(){var e=this.state,t=e.error,a=e.isLoaded;return t?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(t),"Error"))):!1===a?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,p("Loading Charts","yet-another-stars-rating")))):React.createElement(React.Fragment,null,this.rankingTableBody())}}],a&&c(t.prototype,a),o}();function I(){var e=document.getElementsByClassName("yasr-stars-rankings");if(e.length>0)for(var t=0;t<e.length;t++){var a=e.item(t).id,n=JSON.parse(e.item(t).dataset.rankingSource),r=JSON.parse(e.item(t).dataset.rankingParams),s=JSON.parse(e.item(t).dataset.rankingNonce),o=document.getElementById(a);g(React.createElement(k,{source:n,tableId:a,params:r,nonce:s}),o)}}I(),tippy(document.querySelectorAll(".yasr-copy-shortcode"),{content:"Copied! Insert into your post!",theme:"yasr",arrow:"true",arrowType:"round",trigger:"click"});var w,B=wp.i18n.__;if(document.getElementsByClassName("nav-tab-active").length>0&&(w=document.getElementsByClassName("nav-tab-active")[0].id),"rankings"===w){var R,j=function(e){var t=D.value,a=document.getElementById("yasr-builder-shortcode").textContent,n=["yasr_ov_ranking","yasr_most_or_highest_rated_posts","yasr_multi_set_ranking","yasr_visitor_multi_set_ranking"];n=wp.hooks.applyFilters("yasrBuilderDrawRankingsShortcodes",n),fetch(ajaxurl+"?action=yasr_rankings_preview_shortcode&shortcode="+t+"&full_shortcode="+a).then((function(e){return!0===e.ok?e.json():(console.info(B("Ajax Call Failed. Shortcode preview can't be done","yet-another-stars-rating")),"KO")})).catch((function(e){console.info(e)})).then((function(e){if("KO"!==e){var t=document.createElement("div");t.innerHTML=e,M.childNodes.length>0?M.replaceChild(t,M.childNodes[0]):M.appendChild(t)}})).then((function(e){n.forEach((function(e){t===e&&I()}))}))},x=function(e,t,a,n,r,s,o,i,l){e.style.display="",t.style.display="",s.style.display="",l.style.display="",a.style.display="none",n.style.display="none",r.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="none")},C=function(e,t,a,n,r,s,o,i,l){a.style.display="",n.style.display="",t.style.display="",s.style.display="",l.style.display="",e.style.display="none",r.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="none")},Q=function(e,t,a,n,r,s,o,i,l){r.style.display="",l.style.display="none",e.style.display="none",a.style.display="none",n.style.display="none",t.style.display="none",s.style.display="none",null!==o&&(o.style.display="none"),null!==i&&(i.style.display="none")},T=function(e,t,a,n,r,s,o,i){var l=arguments.length>8&&void 0!==arguments[8]&&arguments[8],d=arguments.length>9?arguments[9]:void 0;!0===l?(F.className="",F.classList.add("yasr-settings-row-24"),a.style.display="",n.style.display="",e.style.display="none"):(a.style.display="none",n.style.display="none",e.style.display=""),s.style.display="",t.style.display="",d.style.display="",r.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="")},L=".yasr-builder-elements-parents",S=".yasr-builder-elements-childs";jQuery(L).prop("disabled",!0),jQuery(S).prop("disabled",!0),jQuery(L).find("input").each((function(){jQuery(this).prop("disabled",!0)})),wp.hooks.doAction("yasrBuilderBegin",L,S);var P=[],H={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""};R=H.name,document.getElementById("yasr-builder-shortcode").textContent="["+R+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+R+"]");var O=document.getElementById("yasr-builder-button-preview"),N=document.getElementById("yasr-builder-copy-shortcode"),M=document.getElementById("yasr-builder-preview"),D=document.getElementById("yasr-ranking-source"),A=document.getElementById("yasr-ranking-multiset-select"),U=document.getElementById("yasr-builder-datepicker-start"),q=document.getElementById("yasr-builder-datepicker-end"),F=document.getElementById("yasr-builder-params-container"),z=document.getElementById("builder-vv-default-view"),J=document.getElementById("builder-vv-required-votes"),V=document.getElementById("builder-stars-size"),K=document.getElementById("builder-overall-text"),Y=document.getElementById("builder-username-options"),G=document.getElementById("builder-category"),$=document.getElementById("builder-cpt"),W=document.getElementById("yasr-ranking-multiset"),X=document.getElementById("yasr-builder-datepicker"),Z=D.value,ee=!1;U.value="",q.value="","yasr_ov_ranking"===Z?x(K,V,z,J,Y,G,$,W,X):"yasr_most_active_users"===Z||"yasr_top_reviewers"===Z?Q(K,V,z,J,Y,G,$,W,X):"yasr_multi_set_ranking"===Z?T(K,V,z,J,Y,G,$,W,!1,X):"yasr_visitor_multi_set_ranking"===Z?T(K,V,z,J,Y,G,$,W,!0,X):C(K,V,z,J,Y,G,$,W,X),document.addEventListener("change",(function(e){if("yasr-ranking-source"===e.target.id)F.className="",F.classList.add("yasr-settings-row-33"),M.innerHTML="",U.value="",q.value="",H={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""},"yasr_ov_ranking"===e.target.value?x(K,V,z,J,Y,G,$,W,X):"yasr_most_active_users"===e.target.value||"yasr_top_reviewers"===e.target.value?Q(K,V,z,J,Y,G,$,W,X):"yasr_multi_set_ranking"===e.target.value?(T(K,V,z,J,Y,G,$,W,!1,X),H.setid=" setid="+A[0].value):"yasr_visitor_multi_set_ranking"===e.target.value?(T(K,V,z,J,Y,G,$,W,!0,X),H.setid=" setid="+A[0].value):C(K,V,z,J,Y,G,$,W,X),H.name=e.target.value,R=H.name+H.setid;else{"yasr-ranking-multiset-select"===e.target.id&&(H.setid=" setid="+e.target.value),P=wp.hooks.applyFilters("yasrBuilderFilterShortcode",H);for(var t=2;H.length;t++)P.hasOwnProperty(H[t])&&(H[t]=P[t]);R=H.name+H.setid+H.rows+H.view+H.minvotesmost+H.minvoteshg+H.size+H.txtPosition+H.txt+H.display+H.start_date+H.end_date+H.category+H.cpt}document.getElementById("yasr-builder-shortcode").textContent="["+R+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+R+"]"),!0===ee&&"yasr-ranking-source"!==e.target.id&&"yasr-builder-category-radio"!==e.target.name&&j()})),N.onclick=function(e){var t,a;t=document.getElementById(e.target.id).getAttribute("data-shortcode"),(a=document.createElement("textarea")).value=t,a.setAttribute("readonly",""),a.style.position="absolute",a.style.left="-9999px",document.body.appendChild(a),a.select(),document.execCommand("copy"),document.body.removeChild(a)},O.onclick=function(e){j(),ee=!0}}})();
admin/settings/classes/YasrSettings.php CHANGED
@@ -59,6 +59,7 @@ class YasrSettings {
59
  );
60
 
61
  $option = get_option('yasr_general_options');
 
62
 
63
  //This is to avoid undefined offset
64
  if ($option && $option['auto_insert_enabled'] === 0) {
@@ -91,6 +92,14 @@ class YasrSettings {
91
  );
92
  }
93
 
 
 
 
 
 
 
 
 
94
  if(!isset($option['custom_text_user_voted'])) {
95
  $option['custom_text_user_voted'] =
96
  __('You have already voted for this article with rating ', 'yet-another-stars-rating') . '%rating%';
@@ -218,7 +227,7 @@ class YasrSettings {
218
  </strong>
219
  <div class="yasr-onoffswitch-big">
220
  <input type="checkbox" name="yasr_general_options[auto_insert_enabled]" class="yasr-onoffswitch-checkbox"
221
- value="1" id="yasr_auto_insert_switch" <?php if ($option['auto_insert_enabled'] == 1) {
222
  echo " checked='checked' ";
223
  } ?> >
224
  <label class="yasr-onoffswitch-label" for="yasr_auto_insert_switch">
@@ -546,12 +555,25 @@ class YasrSettings {
546
  'id' => 'yasr-settings-custom-text-must-sign-in',
547
  'class' => 'yasr-general-options-text-before'
548
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
549
  'txt_vv_rated' => array (
550
  'name' => 'custom_text_user_voted',
551
  'description' => __('Custom text to display when an user has already rated', 'yet-another-stars-rating'),
552
  'id' => 'yasr-settings-custom-text-already-rated',
553
  'class' => 'yasr-general-options-text-before'
554
- )
555
  );
556
  ?>
557
  <div class="yasr-settings-row-45">
@@ -932,9 +954,9 @@ class YasrSettings {
932
  echo $string_input;
933
 
934
  if(isset($property['description']) && $property['description'] !== '') {
935
- echo wp_kses_post('<div class="yasr-element-row-container-description">'
936
- . $property['description'] .
937
- '</div>');
938
  }
939
 
940
  }
59
  );
60
 
61
  $option = get_option('yasr_general_options');
62
+ $option['auto_insert_enabled'] = (int)$option['auto_insert_enabled'];
63
 
64
  //This is to avoid undefined offset
65
  if ($option && $option['auto_insert_enabled'] === 0) {
92
  );
93
  }
94
 
95
+ if(!isset($option['custom_text_rating_saved'])) {
96
+ $option['custom_text_rating_saved'] = __('Rating saved!', 'yet-another-stars-rating');
97
+ }
98
+
99
+ if(!isset($option['custom_text_rating_updated'])) {
100
+ $option['custom_text_rating_updated'] = __('Rating updated!', 'yet-another-stars-rating');
101
+ }
102
+
103
  if(!isset($option['custom_text_user_voted'])) {
104
  $option['custom_text_user_voted'] =
105
  __('You have already voted for this article with rating ', 'yet-another-stars-rating') . '%rating%';
227
  </strong>
228
  <div class="yasr-onoffswitch-big">
229
  <input type="checkbox" name="yasr_general_options[auto_insert_enabled]" class="yasr-onoffswitch-checkbox"
230
+ value="1" id="yasr_auto_insert_switch" <?php if ($option['auto_insert_enabled'] === 1) {
231
  echo " checked='checked' ";
232
  } ?> >
233
  <label class="yasr-onoffswitch-label" for="yasr_auto_insert_switch">
555
  'id' => 'yasr-settings-custom-text-must-sign-in',
556
  'class' => 'yasr-general-options-text-before'
557
  ),
558
+ 'txt_vv_rating_saved' => array (
559
+ 'name' => 'custom_text_rating_saved',
560
+ 'description' => __('Custom text to display when rating is saved', 'yet-another-stars-rating'),
561
+ 'id' => 'yasr-settings-custom-text-rating-saved',
562
+ 'class' => 'yasr-general-options-text-before'
563
+ ),
564
+ 'txt_vv_rating_updated' => array (
565
+ 'name' => 'custom_text_rating_updated',
566
+ 'description' => __('Custom text to display when rating is updated (only for logged in users)',
567
+ 'yet-another-stars-rating'),
568
+ 'id' => 'yasr-settings-custom-text-rating-updated',
569
+ 'class' => 'yasr-general-options-text-before'
570
+ ),
571
  'txt_vv_rated' => array (
572
  'name' => 'custom_text_user_voted',
573
  'description' => __('Custom text to display when an user has already rated', 'yet-another-stars-rating'),
574
  'id' => 'yasr-settings-custom-text-already-rated',
575
  'class' => 'yasr-general-options-text-before'
576
+ ),
577
  );
578
  ?>
579
  <div class="yasr-settings-row-45">
954
  echo $string_input;
955
 
956
  if(isset($property['description']) && $property['description'] !== '') {
957
+ echo '<div class="yasr-element-row-container-description">';
958
+ echo esc_html($property['description']);
959
+ echo '</div>';
960
  }
961
 
962
  }
includes/classes/YasrIncludesFilters.php CHANGED
@@ -26,11 +26,13 @@ class YasrIncludesFilters {
26
  public function filterCustomTexts($yasr_stored_options) {
27
  $this->yasr_stored_options = $yasr_stored_options;
28
 
29
- add_filter('yasr_cstm_text_before_overall', array($this, 'filterTextOverall'));
30
  add_filter('yasr_cstm_text_before_vv', array($this, 'filterTextVVBefore'), 10, 3);
31
  add_filter('yasr_cstm_text_after_vv', array($this, 'filterTextVVAfter'), 10, 3);
32
- add_filter('yasr_cstm_text_already_voted', array($this, 'filterTextAlreadyVoted'), 10, 2);
33
- add_filter('yasr_must_sign_in', array($this, 'filterTextMustSignIn'));
 
 
34
  }
35
 
36
  /**
@@ -71,8 +73,9 @@ class YasrIncludesFilters {
71
  * @return string|string[]
72
  */
73
  public function filterTextOverall ($overall_rating) {
 
74
  if(array_key_exists('text_before_overall', $this->yasr_stored_options)) {
75
- $custom_text = htmlspecialchars_decode($this->yasr_stored_options['text_before_overall']);
76
  } else {
77
  $custom_text = '';
78
  }
@@ -92,8 +95,9 @@ class YasrIncludesFilters {
92
  * @return string|string[]
93
  */
94
  public function filterTextVVBefore ($number_of_votes, $average_rating, $unique_id) {
 
95
  if(array_key_exists('text_before_visitor_rating', $this->yasr_stored_options)) {
96
- $custom_text = htmlspecialchars_decode($this->yasr_stored_options['text_before_visitor_rating']);
97
  } else {
98
  $custom_text = '';
99
  }
@@ -113,9 +117,10 @@ class YasrIncludesFilters {
113
  * @return string|string[]
114
  */
115
  public function filterTextVVAfter ($number_of_votes, $average_rating, $unique_id) {
 
116
  if(array_key_exists('text_after_visitor_rating', $this->yasr_stored_options)) {
117
  $custom_text = '<span id="yasr-vv-text-container-'.$unique_id.'" class="yasr-vv-text-container">';
118
- $custom_text .= htmlspecialchars_decode($this->yasr_stored_options['text_after_visitor_rating']);
119
  $custom_text .= '</span>';
120
  } else {
121
  $custom_text = '';
@@ -123,9 +128,50 @@ class YasrIncludesFilters {
123
  return $this->strReplaceInput($custom_text, $number_of_votes, $average_rating, $unique_id);
124
  }
125
 
126
- public function filterTextAlreadyVoted ($default_text, $rating) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  if(array_key_exists('custom_text_user_voted', $this->yasr_stored_options)) {
128
- $custom_text = htmlspecialchars_decode($this->yasr_stored_options['custom_text_user_voted']);
129
  } else {
130
  $custom_text = '';
131
  }
@@ -138,9 +184,10 @@ class YasrIncludesFilters {
138
  *
139
  * @return mixed|string|void
140
  */
141
- public function filterTextMustSignIn ($default_text) {
 
142
  if(array_key_exists('custom_text_must_sign_in', $this->yasr_stored_options)) {
143
- $custom_text = htmlspecialchars_decode($this->yasr_stored_options['custom_text_must_sign_in']);
144
  } else {
145
  $custom_text = '';
146
  }
26
  public function filterCustomTexts($yasr_stored_options) {
27
  $this->yasr_stored_options = $yasr_stored_options;
28
 
29
+ add_filter('yasr_cstm_text_before_overall', array($this, 'filterTextOverall'), 10);
30
  add_filter('yasr_cstm_text_before_vv', array($this, 'filterTextVVBefore'), 10, 3);
31
  add_filter('yasr_cstm_text_after_vv', array($this, 'filterTextVVAfter'), 10, 3);
32
+ add_filter('yasr_vv_saved_text', array($this, 'filterTextRatingSaved'), 10);
33
+ add_filter('yasr_vv_updated_text', array($this, 'filterTextRatingUpdated'), 10);
34
+ add_filter('yasr_cstm_text_already_voted', array($this, 'filterTextAlreadyVoted'), 10);
35
+ add_filter('yasr_must_sign_in', array($this, 'filterTextMustSignIn'),10);
36
  }
37
 
38
  /**
73
  * @return string|string[]
74
  */
75
  public function filterTextOverall ($overall_rating) {
76
+ //no need to escape, it is done later when string is printed
77
  if(array_key_exists('text_before_overall', $this->yasr_stored_options)) {
78
+ $custom_text = $this->yasr_stored_options['text_before_overall'];
79
  } else {
80
  $custom_text = '';
81
  }
95
  * @return string|string[]
96
  */
97
  public function filterTextVVBefore ($number_of_votes, $average_rating, $unique_id) {
98
+ //no need to escape, it is done later when string is printed
99
  if(array_key_exists('text_before_visitor_rating', $this->yasr_stored_options)) {
100
+ $custom_text = $this->yasr_stored_options['text_before_visitor_rating'];
101
  } else {
102
  $custom_text = '';
103
  }
117
  * @return string|string[]
118
  */
119
  public function filterTextVVAfter ($number_of_votes, $average_rating, $unique_id) {
120
+ //no need to escape, it is done later when string is printed
121
  if(array_key_exists('text_after_visitor_rating', $this->yasr_stored_options)) {
122
  $custom_text = '<span id="yasr-vv-text-container-'.$unique_id.'" class="yasr-vv-text-container">';
123
+ $custom_text .= $this->yasr_stored_options['text_after_visitor_rating'];
124
  $custom_text .= '</span>';
125
  } else {
126
  $custom_text = '';
128
  return $this->strReplaceInput($custom_text, $number_of_votes, $average_rating, $unique_id);
129
  }
130
 
131
+ /**
132
+ * @author Dario Curvino <@dudo>
133
+ * @since 2.9.5
134
+ * @param $rating_saved
135
+ *
136
+ * @return mixed
137
+ */
138
+ public function filterTextRatingSaved() {
139
+ if(array_key_exists('custom_text_rating_saved', $this->yasr_stored_options)) {
140
+ //no need to escape, it is done later when string is printed
141
+ $custom_text = $this->yasr_stored_options['custom_text_rating_saved'];
142
+ } else {
143
+ $custom_text = '';
144
+ }
145
+ return $custom_text;
146
+ }
147
+
148
+ /**
149
+ * @author Dario Curvino <@dudo>
150
+ * @since 2.9.5
151
+ *
152
+ * @return mixed
153
+ */
154
+ public function filterTextRatingUpdated() {
155
+ if(array_key_exists('custom_text_rating_updated', $this->yasr_stored_options)) {
156
+ //no need to escape, it is done later when string is printed
157
+ $custom_text = $this->yasr_stored_options['custom_text_rating_updated'];
158
+ } else {
159
+ $custom_text = '';
160
+ }
161
+ return $custom_text;
162
+ }
163
+
164
+ /**
165
+ * @author Dario Curvino <@dudo>
166
+ * @since 2.6.6
167
+ * @param $rating
168
+ *
169
+ * @return array|string|string[]
170
+ */
171
+ public function filterTextAlreadyVoted ($rating) {
172
+ //no need to escape, it is done later when string is printed
173
  if(array_key_exists('custom_text_user_voted', $this->yasr_stored_options)) {
174
+ $custom_text = $this->yasr_stored_options['custom_text_user_voted'];
175
  } else {
176
  $custom_text = '';
177
  }
184
  *
185
  * @return mixed|string|void
186
  */
187
+ public function filterTextMustSignIn () {
188
+ //no need to escape, it is done later when string is printed
189
  if(array_key_exists('custom_text_must_sign_in', $this->yasr_stored_options)) {
190
+ $custom_text = $this->yasr_stored_options['custom_text_must_sign_in'];
191
  } else {
192
  $custom_text = '';
193
  }
includes/classes/YasrPhpFieldsHelper.php CHANGED
@@ -377,8 +377,9 @@ if (!class_exists('YasrPhpFieldsHelper') ) {
377
  $span_label = '<br />' . $span_label;
378
  }
379
  }
 
380
 
381
- echo sprintf(
382
  '<div class="yasr-option-div">
383
  <label for="%s">
384
  <input type="radio"
@@ -388,13 +389,20 @@ if (!class_exists('YasrPhpFieldsHelper') ) {
388
  id="%s"
389
  %s
390
  >
391
- <img src="%syasr-stars-%s.png"
392
- class="yasr-img-option-size" alt=%s>
393
- %s
394
  </label>
395
  </div>',
396
- $id_string, $name, $size, $class, $id_string, $checked, YASR_IMG_DIR, $size, $size,
397
- $span_label
 
 
 
 
 
 
 
398
  );
399
 
400
  } //end foreach
377
  $span_label = '<br />' . $span_label;
378
  }
379
  }
380
+ $src = YASR_IMG_DIR . 'yasr-stars-'.$size.'.png';
381
 
382
+ printf(
383
  '<div class="yasr-option-div">
384
  <label for="%s">
385
  <input type="radio"
389
  id="%s"
390
  %s
391
  >
392
+ <img src="%s"
393
+ class="yasr-img-option-size" alt=%s>
394
+ %s
395
  </label>
396
  </div>',
397
+ esc_attr($id_string),
398
+ esc_attr($name),
399
+ esc_attr($size),
400
+ esc_attr($class),
401
+ esc_attr($id_string),
402
+ esc_attr($checked),
403
+ esc_url($src),
404
+ esc_attr($size),
405
+ wp_kses_post($span_label)
406
  );
407
 
408
  } //end foreach
includes/shortcodes/classes/YasrOverallRating.php CHANGED
@@ -126,7 +126,7 @@ class YasrOverallRating extends YasrShortcode {
126
  $text_before_star = apply_filters('yasr_cstm_text_before_overall', $this->overall_rating);
127
 
128
  return "<div class='yasr-container-custom-text-and-overall'>
129
- <span id='yasr-custom-text-before-overall'>".htmlspecialchars_decode($text_before_star )."</span>
130
  </div>";
131
 
132
  }
126
  $text_before_star = apply_filters('yasr_cstm_text_before_overall', $this->overall_rating);
127
 
128
  return "<div class='yasr-container-custom-text-and-overall'>
129
+ <span id='yasr-custom-text-before-overall'>".esc_html($text_before_star)."</span>
130
  </div>";
131
 
132
  }
includes/shortcodes/classes/YasrShortcode.php CHANGED
@@ -95,7 +95,12 @@ abstract class YasrShortcode
95
  wp_enqueue_script(
96
  'yasr-ov-multi',
97
  YASR_JS_DIR_INCLUDES . 'shortcodes/overall-multiset.js',
98
- array( 'jquery', 'rater', 'wp-i18n' ),
 
 
 
 
 
99
  YASR_VERSION_NUM,
100
  true
101
  );
@@ -116,7 +121,8 @@ abstract class YasrShortcode
116
  'jquery',
117
  'rater',
118
  'wp-i18n',
119
- 'wp-element'
 
120
  ),
121
  YASR_VERSION_NUM,
122
  true
95
  wp_enqueue_script(
96
  'yasr-ov-multi',
97
  YASR_JS_DIR_INCLUDES . 'shortcodes/overall-multiset.js',
98
+ array(
99
+ 'jquery',
100
+ 'rater',
101
+ 'wp-i18n',
102
+ 'yasr-global-data'
103
+ ),
104
  YASR_VERSION_NUM,
105
  true
106
  );
121
  'jquery',
122
  'rater',
123
  'wp-i18n',
124
+ 'wp-element',
125
+ 'yasr-global-data'
126
  ),
127
  YASR_VERSION_NUM,
128
  true
includes/shortcodes/classes/YasrShortcodesAjax.php CHANGED
@@ -199,18 +199,17 @@ class YasrShortcodesAjax {
199
  $total_rating = ($user_votes_sum / $number_of_votes);
200
  $medium_rating = round($total_rating, 1);
201
 
 
 
202
  //Default text when rating is saved
203
  if ($result_update_log) {
204
- $rating_saved_text = __('Rating Updated!', 'yet-another-stars-rating');
205
  }
206
  else {
207
- $rating_saved_text = __('Rating Saved!', 'yet-another-stars-rating');
208
  }
209
 
210
- //Customize it
211
- $rating_saved_text = wp_kses_post(apply_filters('yasr_vv_saved_text', $rating_saved_text));
212
-
213
- $rating_saved_span = '<span class="yasr-small-block-bold" id="yasr-vote-saved">' . $rating_saved_text
214
  . '</span>';
215
 
216
  return array(
199
  $total_rating = ($user_votes_sum / $number_of_votes);
200
  $medium_rating = round($total_rating, 1);
201
 
202
+ $rating_saved_text = '';
203
+
204
  //Default text when rating is saved
205
  if ($result_update_log) {
206
+ $rating_saved_text = apply_filters('yasr_vv_updated_text', $rating_saved_text);
207
  }
208
  else {
209
+ $rating_saved_text = apply_filters('yasr_vv_saved_text', $rating_saved_text);
210
  }
211
 
212
+ $rating_saved_span = '<span class="yasr-small-block-bold" id="yasr-vote-saved">' . esc_html($rating_saved_text)
 
 
 
213
  . '</span>';
214
 
215
  return array(
includes/shortcodes/classes/YasrVisitorMultiSet.php CHANGED
@@ -163,8 +163,7 @@ class YasrVisitorMultiSet extends YasrMultiSet {
163
  $this->button = $this->button_html_disabled;
164
  $this->star_readonly = 'true';
165
  $this->span_message_content = '<span class="yasr-visitor-votes-must-sign-in">';
166
- $default_text = __('You must sign in to vote', 'yet-another-stars-rating');
167
- $this->span_message_content .= wp_kses_post(apply_filters('yasr_must_sign_in', $default_text));
168
  $this->span_message_content .= '</span>';
169
  }
170
  }
163
  $this->button = $this->button_html_disabled;
164
  $this->star_readonly = 'true';
165
  $this->span_message_content = '<span class="yasr-visitor-votes-must-sign-in">';
166
+ $this->span_message_content .= esc_html(apply_filters('yasr_must_sign_in', ''));
 
167
  $this->span_message_content .= '</span>';
168
  }
169
  }
includes/shortcodes/classes/YasrVisitorVotes.php CHANGED
@@ -91,7 +91,7 @@ class YasrVisitorVotes extends YasrShortcode {
91
  * @since 2.8.5
92
  */
93
  public function loadVVScripts() {
94
- $array_dep = array('jquery', 'rater', 'wp-i18n');
95
 
96
  if(self::$tippy_loaded === true) {
97
  $array_dep[] = 'tippy';
@@ -241,21 +241,19 @@ class YasrVisitorVotes extends YasrShortcode {
241
 
242
  //if rating is not false, show the text after the stars
243
  if($rating) {
244
- $default_text = __('You\'ve already voted this article with ', 'yet-another-stars-rating') . $rating;
245
- $custom_text = wp_kses_post(apply_filters('yasr_cstm_text_already_voted', $default_text, $rating));
246
  } else {
247
  $custom_text = '';
248
  }
249
 
250
- $span_bottom_line_content .= ($custom_text);
251
  $span_bottom_line_content .= '</span>';
252
  }
253
 
254
  //If only logged in users can vote
255
  elseif ($stars_enabled === 'false_not_logged') {
256
  $span_bottom_line_content = "<span class='yasr-visitor-votes-must-sign-in'>";
257
- $default_text = __('You must sign in to vote', 'yet-another-stars-rating');
258
- $span_bottom_line_content .= wp_kses_post(apply_filters('yasr_must_sign_in', $default_text));
259
  //if custom text is defined
260
  $span_bottom_line_content .= '</span>';
261
  }
@@ -282,7 +280,6 @@ class YasrVisitorVotes extends YasrShortcode {
282
  */
283
  protected function textBeforeStars($number_of_votes, $average_rating) {
284
  $custom_text_before_star = apply_filters('yasr_cstm_text_before_vv', $number_of_votes, $average_rating, $this->unique_id);
285
-
286
  $class_text_before = 'yasr-custom-text-vv-before yasr-custom-text-vv-before-'.$this->post_id;
287
 
288
  return '<div class="'.$class_text_before.'">'
91
  * @since 2.8.5
92
  */
93
  public function loadVVScripts() {
94
+ $array_dep = array('jquery', 'rater', 'wp-i18n', 'yasr-global-data');
95
 
96
  if(self::$tippy_loaded === true) {
97
  $array_dep[] = 'tippy';
241
 
242
  //if rating is not false, show the text after the stars
243
  if($rating) {
244
+ $custom_text = wp_kses_post(apply_filters('yasr_cstm_text_already_voted', $rating));
 
245
  } else {
246
  $custom_text = '';
247
  }
248
 
249
+ $span_bottom_line_content .= $custom_text;
250
  $span_bottom_line_content .= '</span>';
251
  }
252
 
253
  //If only logged in users can vote
254
  elseif ($stars_enabled === 'false_not_logged') {
255
  $span_bottom_line_content = "<span class='yasr-visitor-votes-must-sign-in'>";
256
+ $span_bottom_line_content .= esc_html(apply_filters('yasr_must_sign_in', ''));
 
257
  //if custom text is defined
258
  $span_bottom_line_content .= '</span>';
259
  }
280
  */
281
  protected function textBeforeStars($number_of_votes, $average_rating) {
282
  $custom_text_before_star = apply_filters('yasr_cstm_text_before_vv', $number_of_votes, $average_rating, $this->unique_id);
 
283
  $class_text_before = 'yasr-custom-text-vv-before yasr-custom-text-vv-before-'.$this->post_id;
284
 
285
  return '<div class="'.$class_text_before.'">'
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: rating, rate post, rate page, star rating, google rating, votes
4
  Requires at least: 5.0
5
  Contributors: Dudo
6
  Tested up to: 5.9
7
- Stable tag: 2.9.4
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
  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
@@ -197,6 +197,10 @@ Yes, YASR is 100% fully compatible with PHP 8
197
 
198
  The full changelog can be found in the plugin's directory. Recent entries:
199
 
 
 
 
 
200
  = 2.9.4 =
201
  * Minor changes
202
 
@@ -211,8 +215,6 @@ The full changelog can be found in the plugin's directory. Recent entries:
211
  = 2.9.1 =
212
  * FIXED: if shortcode exists for a post or page, but there are no ratings, wrong rich snippets are returned
213
 
214
-
215
-
216
  = 2.9.0 =
217
  * FIXED: ranking yasr_most_or_highest_rated_posts doesn't load in some circumstances
218
 
@@ -227,7 +229,6 @@ The full changelog can be found in the plugin's directory. Recent entries:
227
  * FIXED: Import functions from external plugins is now compatible with mysql8
228
  * FIXED: itemTypename didn't get saved into Rich snippet options above the editor
229
 
230
-
231
  = 2.8.7 =
232
  * TWEAKED: added a check to improve compatibility with external plugins
233
  * TWEAKED: removed old and useless languages files: only three were left to use as example
@@ -254,11 +255,9 @@ WordPress version 5.6
254
  * FIXED: link to trial page
255
  * TWEAKED: added some hooks
256
 
257
-
258
  = 2.8.2 =
259
  * FIXED: if "Enable stars next to the title?" is activated, the ratings also appears in rss feed.
260
 
261
-
262
  = 2.8.1 =
263
  * FIXED: error that could occurs in some circumstances
264
 
@@ -273,7 +272,6 @@ a php warning is returned
273
  = 2.7.9 =
274
  * FIXED: missing stats in some circumstances for yasr_visitor_votes shortcode
275
 
276
-
277
  = 2.7.8 =
278
  * FIXED: error when "Load results with AJAX?" is enabled, and the attribute "readonly" is set to yasr_visitor_votes shortcode
279
  * TWEAKED: css minor changes
@@ -307,11 +305,9 @@ The class yasr-total-average-container has be renamed yasr-vv-stats-text-contain
307
  * NEW FEATURE: new shortcode: yasr_visitor_multi_set_ranking : this will show rankings from yasr_visitor_multiset
308
  * TWEAKED: minor fixes
309
 
310
-
311
  = 2.7.1 =
312
  * FIXED: minor bugs that could happen in rare circumstances
313
 
314
-
315
  = 2.7.0 =
316
  * FIXED: fixed warning that can return on fresh installations
317
 
4
  Requires at least: 5.0
5
  Contributors: Dudo
6
  Tested up to: 5.9
7
+ Stable tag: 2.9.5
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
  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
197
 
198
  The full changelog can be found in the plugin's directory. Recent entries:
199
 
200
+ = 2.9.5 =
201
+ * NEW FEATURE: In the settings, is now possible to customize the text when a rating is saved / updated
202
+ * minor fixes
203
+
204
  = 2.9.4 =
205
  * Minor changes
206
 
215
  = 2.9.1 =
216
  * FIXED: if shortcode exists for a post or page, but there are no ratings, wrong rich snippets are returned
217
 
 
 
218
  = 2.9.0 =
219
  * FIXED: ranking yasr_most_or_highest_rated_posts doesn't load in some circumstances
220
 
229
  * FIXED: Import functions from external plugins is now compatible with mysql8
230
  * FIXED: itemTypename didn't get saved into Rich snippet options above the editor
231
 
 
232
  = 2.8.7 =
233
  * TWEAKED: added a check to improve compatibility with external plugins
234
  * TWEAKED: removed old and useless languages files: only three were left to use as example
255
  * FIXED: link to trial page
256
  * TWEAKED: added some hooks
257
 
 
258
  = 2.8.2 =
259
  * FIXED: if "Enable stars next to the title?" is activated, the ratings also appears in rss feed.
260
 
 
261
  = 2.8.1 =
262
  * FIXED: error that could occurs in some circumstances
263
 
272
  = 2.7.9 =
273
  * FIXED: missing stats in some circumstances for yasr_visitor_votes shortcode
274
 
 
275
  = 2.7.8 =
276
  * FIXED: error when "Load results with AJAX?" is enabled, and the attribute "readonly" is set to yasr_visitor_votes shortcode
277
  * TWEAKED: css minor changes
305
  * NEW FEATURE: new shortcode: yasr_visitor_multi_set_ranking : this will show rankings from yasr_visitor_multiset
306
  * TWEAKED: minor fixes
307
 
 
308
  = 2.7.1 =
309
  * FIXED: minor bugs that could happen in rare circumstances
310
 
 
311
  = 2.7.0 =
312
  * FIXED: fixed warning that can return on fresh installations
313
 
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.9.4
8
  * Requires at least: 5.6
9
  * Requires PHP: 5.4
10
  * Author: Dario Curvino
@@ -78,7 +78,7 @@ if ( !function_exists( 'yasr_fs' ) ) {
78
  yasr_fs();
79
  // Signal that SDK was initiated.
80
  do_action( 'yasr_fs_loaded' );
81
- define( 'YASR_VERSION_NUM', '2.9.4' );
82
  //Plugin absolute path
83
  //e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
84
  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.9.5
8
  * Requires at least: 5.6
9
  * Requires PHP: 5.4
10
  * Author: Dario Curvino
78
  yasr_fs();
79
  // Signal that SDK was initiated.
80
  do_action( 'yasr_fs_loaded' );
81
+ define( 'YASR_VERSION_NUM', '2.9.5' );
82
  //Plugin absolute path
83
  //e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
84
  define( 'YASR_ABSOLUTE_PATH', __DIR__ );