Yasr – Yet Another Stars Rating - Version 2.9.4

Version Description

  • Minor changes
Download this release

Release Info

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

Code changes from version 2.9.3 to 2.9.4

admin/editor/yasr-metabox-top-right.php CHANGED
@@ -64,9 +64,8 @@ wp_nonce_field('yasr_nonce_is_post_review_action', 'yasr_nonce_is_post_review');
64
  //Show this message if auto insert is off or if auto insert is not set to show overall rating (so if it is set to visitor rating)
65
  if( YASR_AUTO_INSERT_ENABLED === 0 || (YASR_AUTO_INSERT_ENABLED === 1 && YASR_AUTO_INSERT_WHAT === 'visitor_rating') ) {
66
  echo "<div>";
67
- esc_html_e ('Remember to insert this shortcode <strong>[yasr_overall_rating]</strong>
68
- where you want to display this rating',
69
- 'yet-another-stars-rating');
70
  echo "</div>";
71
  }
72
  ?>
64
  //Show this message if auto insert is off or if auto insert is not set to show overall rating (so if it is set to visitor rating)
65
  if( YASR_AUTO_INSERT_ENABLED === 0 || (YASR_AUTO_INSERT_ENABLED === 1 && YASR_AUTO_INSERT_WHAT === 'visitor_rating') ) {
66
  echo "<div>";
67
+ printf(esc_html__ ('Remember to insert this shortcode %s[yasr_overall_rating]%s
68
+ where you want to display this rating.','yet-another-stars-rating'), '<strong>', '</strong>');
 
69
  echo "</div>";
70
  }
71
  ?>
admin/js/guten/yasr-guten-misc.js CHANGED
@@ -1 +1 @@
1
- (()=>{var e={245:(e,t,a)=>{"use strict";a.r(t),a.d(t,{YasrBlocksPanel:()=>R,YasrDivRatingOverall:()=>E,YasrNoSettingsPanel:()=>b,YasrPrintInputId:()=>h,YasrPrintSelectSize:()=>g,YasrProText:()=>v,yasrLabelSelectSize:()=>i,yasrLeaveThisBlankText:()=>m,yasrOptionalText:()=>s,yasrOverallDescription:()=>d,yasrSelectSizeChoose:()=>c,yasrSelectSizeLarge:()=>y,yasrSelectSizeMedium:()=>p,yasrSelectSizeSmall:()=>u,yasrVisitorVotesDescription:()=>f});var r=a(245),n=wp.i18n.__,l=wp.components.PanelBody,o=wp.blockEditor.InspectorControls,s=n("All these settings are optional","yet-another-stars-rating"),i=n("Choose Size","yet-another-stars-rating"),c=n("Choose stars size","yet-another-stars-rating"),u=n("Small","yet-another-stars-rating"),p=n("Medium","yet-another-stars-rating"),y=n("Large","yet-another-stars-rating"),m=n("Leave this blank if you don't know what you're doing.","yet-another-stars-rating"),d=n("Remember: only the post author can rate here.","yet-another-stars-rating"),f=n("This is the star set where your users will be able to vote","yet-another-stars-rating");function g(e){return React.createElement("form",null,React.createElement("select",{value:e.size,onChange:function(t){return(0,e.setAttributes)({size:(a=t).target.querySelector("option:checked").value}),void a.preventDefault();var a}},React.createElement("option",{value:"--"},r.yasrSelectSizeChoose),React.createElement("option",{value:"small"},r.yasrSelectSizeSmall),React.createElement("option",{value:"medium"},r.yasrSelectSizeMedium),React.createElement("option",{value:"large"},r.yasrSelectSizeLarge)))}function h(e){var t;return!1!==e.postId&&(t=e.postId),React.createElement("div",null,React.createElement("input",{type:"text",size:"4",defaultValue:t,onKeyPress:function(t){return function(e,t){if("Enter"===t.key){var a=t.target.value;!0!==/^\d+$/.test(a)&&""!==a||e({postId:a}),t.preventDefault()}}(e.setAttributes,t)}}))}function v(){var e=n("To be able to customize this ranking, you need","yet-another-stars-rating"),t=n("You can buy the plugin, including support, updates and upgrades, on","yet-another-stars-rating");return React.createElement("h3",null,e," ",React.createElement("a",{href:"https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings#yasr-pro"},"Yasr Pro."),React.createElement("br",null),t," ",React.createElement("a",{href:"https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings"},"yetanotherstarsrating.com"))}function b(e){return React.createElement("div",null,React.createElement(v,null))}function R(e){var t;return"visitors"===e.block&&(t=f),"overall"===e.block&&(t=d),React.createElement(o,null,"overall"===e.block&&React.createElement(E,null),React.createElement(l,{title:"Settings"},React.createElement("h3",null,s),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,i),React.createElement("div",null,React.createElement(g,{size:e.size,setAttributes:e.setAttributes}))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(h,{postId:e.postId,setAttributes:e.setAttributes}),React.createElement("div",{className:"yasr-guten-block-explain"},m)),React.createElement("div",{className:"yasr-guten-block-panel"},t)))}function E(e){var t=n("Rate this article / item","yet-another-stars-rating"),a=wp.data.select("core/editor").getCurrentPost().meta.yasr_overall_rating,r=function(e,t){e=e.toFixed(1),e=parseFloat(e),wp.data.dispatch("core/editor").editPost({meta:{yasr_overall_rating:e}}),this.setRating(e),t()};return React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},t,React.createElement("div",{id:"overall-rater",ref:function(){return function(e,t){var a,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.1,n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],l=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:r,readOnly:n,rating:l,rateCallback:o})}(32,"overall-rater",!1,.1,!1,a,r)}}))}}},t={};function a(r){var n=t[r];if(void 0!==n)return n.exports;var l=t[r]={exports:{}};return e[r](l,l.exports,a),l.exports}a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{function e(t){return(e="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})(t)}function t(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function r(t,a){return!a||"object"!==e(a)&&"function"!=typeof a?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t):a}function n(e){return(n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var l=wp.i18n.__,o=wp.blocks.registerBlockType,s=wp.components,i=s.PanelBody,c=(s.PanelRow,wp.element.Fragment),u=wp.editor,p=(u.BlockControls,u.InspectorControls),y=l("All these settings are optional","yet-another-stars-rating"),m=l("Choose Size","yet-another-stars-rating"),d=l("Choose stars size","yet-another-stars-rating"),f=l("Small","yet-another-stars-rating"),g=l("Medium","yet-another-stars-rating"),h=l("Large","yet-another-stars-rating"),v=l("Leave this blank if you don't know what you're doing.","yet-another-stars-rating"),b=l("Remember: only the post author can rate here.","yet-another-stars-rating"),R=l("This is the star set where your users will be able to vote","yet-another-stars-rating"),E=l('This block is now deprecated. It will still work, but I suggest to replace it with the new one by simply removing it and adding "Yasr Overall Rating" again.',"yet-another-stars-rating"),w=l('This block is now deprecated. It will still work, but I suggest to replace it with the new one by simply removing it and adding "Yasr Visitors Votes" again.',"yet-another-stars-rating");o("yet-another-stars-rating/yasr-overall-rating",{title:l("[DEPRECATED]Yasr: Overall Rating","yet-another-stars-rating"),description:E,icon:"star-half",keywords:[l("rating","yet-another-stars-rating"),l("author","yet-another-stars-rating"),l("overall","yet-another-stars-rating")],attributes:{overallRatingMeta:{type:"number",source:"meta",meta:"yasr_overall_rating"},size:{type:"string",default:"--"},postId:{type:"string",default:"--"}},edit:function(e){var o,s=e.attributes,u=s.overallRatingMeta,R=s.size,E=s.postId,w=e.setAttributes,_=e.isSelected,k=u,S=null,P=null;"--"!==R&&(S=' size="'+R+'"'),o=/^\d+$/.test(E),"--"!==E&&!0===o&&(P=' postid="'+E+'"');var O=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&&a(e,t)}(p,React.Component);var o,s,i,c,u=(i=p,c=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=n(i);if(c){var a=n(this).constructor;e=Reflect.construct(t,arguments,a)}else e=t.apply(this,arguments);return r(this,e)});function p(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,p),(t=u.call(this,e)).yasrOverallRateThis=l("Rate this article / item","yet-another-stars-rating"),t}return o=p,(s=[{key:"render",value:function(){return React.createElement("div",null,this.yasrOverallRateThis,React.createElement("div",null,React.createElement("div",{id:"overall-rater",ref:function(){return raterJs({starSize:32,step:.1,showToolTip:!1,rating:k,readOnly:!1,element:document.querySelector("#overall-rater"),rateCallback:function(e,t){e=e.toFixed(1),e=parseFloat(e),w({overallRatingMeta:e}),this.setRating(e),t()}})}})))}}])&&t(o.prototype,s),p}();function z(){return React.createElement("form",null,React.createElement("select",{value:R,onChange:I},React.createElement("option",{value:"--"},d),React.createElement("option",{value:"small"},f),React.createElement("option",{value:"medium"},g),React.createElement("option",{value:"large"},h)))}function I(e){var t=e.target.querySelector("option:checked");w({size:t.value}),e.preventDefault()}function C(){return React.createElement("div",null,React.createElement("input",{type:"text",size:"4",onKeyPress:T}))}function T(e){if("Enter"===e.key){var t=e.target.value;!0!==/^\d+$/.test(t)&&""!==t||w({postId:t}),e.preventDefault()}}function x(e){return React.createElement(p,null,React.createElement("div",{class:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement(O,null)),React.createElement(i,{title:"Settings"},React.createElement("h3",null,y),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,m),React.createElement("div",null,React.createElement(z,null))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(C,null),React.createElement("div",{className:"yasr-guten-block-explain"},v)),React.createElement("div",{className:"yasr-guten-block-panel"},b)))}return React.createElement(c,null,React.createElement(x,null),React.createElement("div",{className:e.className},"[yasr_overall_rating",S,P,"]",_&&React.createElement(z,null)))},save:function(e){var t=e.attributes,a=t.size,r=t.postId,n="",l=r;return a&&(n+='size="'+a+'"'),r&&("--"===r&&(l=wp.data.select("core/editor").getCurrentPostId()),n+=' postid="'+l+'"'),React.createElement("div",null,"[yasr_overall_rating ",n,"]")}}),o("yet-another-stars-rating/yasr-visitor-votes",{title:l("[DEPRECATED]Yasr: Visitor Votes","yet-another-stars-rating"),description:w,icon:"star-half",keywords:[l("rating","yet-another-stars-rating"),l("visitor","yet-another-stars-rating"),l("votes","yet-another-stars-rating")],attributes:{size:{type:"string",default:"--"},postId:{type:"string",default:"--"}},edit:function(e){var t,a=e.attributes,r=a.size,n=a.postId,l=e.setAttributes,o=e.isSelected,s=null,u=null;function b(){return React.createElement("form",null,React.createElement("select",{value:r,onChange:E},React.createElement("option",{value:"--"},d),React.createElement("option",{value:"small"},f),React.createElement("option",{value:"medium"},g),React.createElement("option",{value:"large"},h)))}function E(e){var t=e.target.querySelector("option:checked");l({size:t.value}),e.preventDefault()}function w(){return React.createElement("div",null,React.createElement("input",{type:"text",size:"4",onKeyPress:_}))}function _(e){if("Enter"===e.key){var t=e.target.value;!0!==/^\d+$/.test(t)&&""!==t||l({postId:t}),e.preventDefault()}}function k(e){return React.createElement(p,null,React.createElement(i,{title:"Settings"},React.createElement("h3",null,y),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,m),React.createElement("div",null,React.createElement(b,null))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(w,null),React.createElement("div",{className:"yasr-guten-block-explain"},v)),React.createElement("div",{className:"yasr-guten-block-panel"},R)))}return t=/^\d+$/.test(n),"--"!==r&&(s=' size="'+r+'"'),"--"!==n&&!0===t&&(u=' postid="'+n+'"'),React.createElement(c,null,React.createElement(k,null),React.createElement("div",{className:e.className},"[yasr_visitor_votes",s,u,"]",o&&React.createElement(b,null)))},save:function(e){var t=e.attributes,a=t.size,r=t.postId,n="",l=r;return a&&(n+='size="'+a+'"'),r&&("--"===r&&(l=wp.data.select("core/editor").getCurrentPostId()),n+=' postid="'+l+'"'),React.createElement("div",null,"[yasr_visitor_votes ",n,"]")}}),wp.data.dispatch("core/edit-post").hideBlockTypes("yet-another-stars-rating/yasr-overall-rating"),wp.data.dispatch("core/edit-post").hideBlockTypes("yet-another-stars-rating/yasr-visitor-votes")})(),(()=>{"use strict";var e=a(245);function t(e){return(t="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})(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t,a){return t&&n(e.prototype,t),a&&n(e,a),e}function o(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&&s(e,t)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e){var t=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}}();return function(){var a,r=p(e);if(t){var n=p(this).constructor;a=Reflect.construct(r,arguments,n)}else a=r.apply(this,arguments);return c(this,a)}}function c(e,a){return!a||"object"!==t(a)&&"function"!=typeof a?u(e):a}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var y=wp.i18n.__,m=wp.plugins.registerPlugin,d=wp.editPost,f=d.PluginSidebar,g=d.PluginSidebarMoreMenuItem,h=wp.components.PanelBody,v=wp.element.Fragment,b=function(){return React.createElement("div",null)},R=function(e){o(a,React.Component);var t=i(a);function a(e){var n;r(this,a),n=t.call(this,e);var l=!1;return"yes"===wp.data.select("core/editor").getCurrentPost().meta.yasr_auto_insert_disabled&&(l=!0),n.state={postExcluded:l},n.yasrUpdatePostMetaAutoInsert=n.yasrUpdatePostMetaAutoInsert.bind(u(n)),n}return l(a,[{key:"yasrUpdatePostMetaAutoInsert",value:function(e){var t=e.target,a="checkbox"===t.type?t.checked:t.value;this.setState({postExcluded:a}),!0===a?wp.data.dispatch("core/editor").editPost({meta:{yasr_auto_insert_disabled:"yes"}}):wp.data.dispatch("core/editor").editPost({meta:{yasr_auto_insert_disabled:"no"}})}},{key:"render",value:function(){return React.createElement("div",{className:"yasr-guten-block-panel-center"},React.createElement("hr",null),React.createElement("label",null,React.createElement("span",null,y("Disable auto insert for this post or page?","yet-another-stars-rating"))),React.createElement("div",{className:"yasr-onoffswitch-big yasr-onoffswitch-big-center",id:"yasr-switcher-disable-auto-insert"},React.createElement("input",{type:"checkbox",name:"yasr_auto_insert_disabled",className:"yasr-onoffswitch-checkbox",value:"yes",id:"yasr-auto-insert-disabled-switch",defaultChecked:this.state.postExcluded,onChange:this.yasrUpdatePostMetaAutoInsert}),React.createElement("label",{className:"yasr-onoffswitch-label",htmlFor:"yasr-auto-insert-disabled-switch"},React.createElement("span",{className:"yasr-onoffswitch-inner"}),React.createElement("span",{className:"yasr-onoffswitch-switch"}))))}}]),a}(),E=function(t){o(n,React.Component);var a=i(n);function n(e){var t;r(this,n),t=a.call(this,e);var l=!1;return"disabled"!==yasrConstantGutenberg.autoInsert&&(l=!0),t.state={yasrAutoInsertEnabled:l},t}return l(n,[{key:"render",value:function(){var t=[React.createElement(b,{key:0})];return wp.hooks.doAction("yasr_below_panel",t),React.createElement(v,null,React.createElement(g,{name:"yasr-sidebar",type:"sidebar",target:"yasr-guten-sidebar"},y("YASR post settings","yet-another-stars-rating")),React.createElement(f,{name:"yasr-guten-sidebar",title:"YASR Settings"},React.createElement(h,null,React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement(e.YasrDivRatingOverall,null),React.createElement("div",null,y('This is the same value that you find the "Yasr: Overall Rating" block.',"yet-another-stars-rating")),this.state.yasrAutoInsertEnabled&&React.createElement(R,null),t))))}}]),n}();m("yasr-sidebar",{icon:"star-half",title:y("Yasr: Page Settings","yet-another-stars-rating"),render:E})})()})();
1
+ (()=>{var e={245:(e,t,a)=>{"use strict";a.r(t),a.d(t,{YasrBlocksPanel:()=>R,YasrDivRatingOverall:()=>E,YasrNoSettingsPanel:()=>b,YasrPrintInputId:()=>v,YasrPrintSelectSize:()=>g,YasrProText:()=>h,yasrLabelSelectSize:()=>i,yasrLeaveThisBlankText:()=>m,yasrOptionalText:()=>s,yasrOverallDescription:()=>d,yasrSelectSizeChoose:()=>c,yasrSelectSizeLarge:()=>p,yasrSelectSizeMedium:()=>y,yasrSelectSizeSmall:()=>u,yasrVisitorVotesDescription:()=>f});var r=a(245),n=wp.i18n.__,o=wp.components.PanelBody,l=wp.blockEditor.InspectorControls,s=n("All these settings are optional","yet-another-stars-rating"),i=n("Choose Size","yet-another-stars-rating"),c=n("Choose stars size","yet-another-stars-rating"),u=n("Small","yet-another-stars-rating"),y=n("Medium","yet-another-stars-rating"),p=n("Large","yet-another-stars-rating"),m=n("Leave this blank if you don't know what you're doing.","yet-another-stars-rating"),d=n("Remember: only the post author can rate here.","yet-another-stars-rating"),f=n("This is the star set where your users will be able to vote","yet-another-stars-rating");function g(e){return React.createElement("form",null,React.createElement("select",{value:e.size,onChange:function(t){return(0,e.setAttributes)({size:(a=t).target.querySelector("option:checked").value}),void a.preventDefault();var a}},React.createElement("option",{value:"--"},r.yasrSelectSizeChoose),React.createElement("option",{value:"small"},r.yasrSelectSizeSmall),React.createElement("option",{value:"medium"},r.yasrSelectSizeMedium),React.createElement("option",{value:"large"},r.yasrSelectSizeLarge)))}function v(e){var t;return!1!==e.postId&&(t=e.postId),React.createElement("div",null,React.createElement("input",{type:"text",size:"4",defaultValue:t,onKeyPress:function(t){return function(e,t){if("Enter"===t.key){var a=t.target.value;!0!==/^\d+$/.test(a)&&""!==a||e({postId:a}),t.preventDefault()}}(e.setAttributes,t)}}))}function h(){var e=n("To be able to customize this ranking, you need","yet-another-stars-rating"),t=n("You can buy the plugin, including support, updates and upgrades, on","yet-another-stars-rating");return React.createElement("h3",null,e," ",React.createElement("a",{href:"https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings#yasr-pro"},"Yasr Pro."),React.createElement("br",null),t," ",React.createElement("a",{href:"https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings"},"yetanotherstarsrating.com"))}function b(e){return React.createElement("div",null,React.createElement(h,null))}function R(e){var t;return"visitors"===e.block&&(t=f),"overall"===e.block&&(t=d),React.createElement(l,null,"overall"===e.block&&React.createElement(E,null),React.createElement(o,{title:"Settings"},React.createElement("h3",null,s),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,i),React.createElement("div",null,React.createElement(g,{size:e.size,setAttributes:e.setAttributes}))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(v,{postId:e.postId,setAttributes:e.setAttributes}),React.createElement("div",{className:"yasr-guten-block-explain"},m)),React.createElement("div",{className:"yasr-guten-block-panel"},t)))}function E(e){var t=n("Rate this article / item","yet-another-stars-rating"),a=wp.data.select("core/editor").getCurrentPost().meta.yasr_overall_rating,r=function(e,t){e=e.toFixed(1),e=parseFloat(e),wp.data.dispatch("core/editor").editPost({meta:{yasr_overall_rating:e}}),this.setRating(e),t()};return React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},t,React.createElement("div",{id:"overall-rater",ref:function(){return function(e,t){var a,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.1,n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],l=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:r,readOnly:n,rating:o,rateCallback:l})}(32,"overall-rater",!1,.1,!1,a,r)}}))}}},t={};function a(r){var n=t[r];if(void 0!==n)return n.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,a),o.exports}a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{function e(t){return e="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},e(t)}function t(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t){return a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},a(e,t)}function r(t,a){if(a&&("object"===e(a)||"function"==typeof a))return a;if(void 0!==a)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}(t)}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}var o=wp.i18n.__,l=wp.blocks.registerBlockType,s=wp.components,i=s.PanelBody,c=(s.PanelRow,wp.element.Fragment),u=wp.editor,y=(u.BlockControls,u.InspectorControls),p=o("All these settings are optional","yet-another-stars-rating"),m=o("Choose Size","yet-another-stars-rating"),d=o("Choose stars size","yet-another-stars-rating"),f=o("Small","yet-another-stars-rating"),g=o("Medium","yet-another-stars-rating"),v=o("Large","yet-another-stars-rating"),h=o("Leave this blank if you don't know what you're doing.","yet-another-stars-rating"),b=o("Remember: only the post author can rate here.","yet-another-stars-rating"),R=o("This is the star set where your users will be able to vote","yet-another-stars-rating"),E=o('This block is now deprecated. It will still work, but I suggest to replace it with the new one by simply removing it and adding "Yasr Overall Rating" again.',"yet-another-stars-rating"),w=o('This block is now deprecated. It will still work, but I suggest to replace it with the new one by simply removing it and adding "Yasr Visitors Votes" again.',"yet-another-stars-rating");l("yet-another-stars-rating/yasr-overall-rating",{title:o("[DEPRECATED]Yasr: Overall Rating","yet-another-stars-rating"),description:E,icon:"star-half",keywords:[o("rating","yet-another-stars-rating"),o("author","yet-another-stars-rating"),o("overall","yet-another-stars-rating")],attributes:{overallRatingMeta:{type:"number",source:"meta",meta:"yasr_overall_rating"},size:{type:"string",default:"--"},postId:{type:"string",default:"--"}},edit:function(e){var l,s=e.attributes,u=s.overallRatingMeta,R=s.size,E=s.postId,w=e.setAttributes,_=e.isSelected,k=u,S=null,P=null;"--"!==R&&(S=' size="'+R+'"'),l=/^\d+$/.test(E),"--"!==E&&!0===l&&(P=' postid="'+E+'"');var O=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&&a(e,t)}(y,React.Component);var l,s,i,c,u=(i=y,c=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=n(i);if(c){var a=n(this).constructor;e=Reflect.construct(t,arguments,a)}else e=t.apply(this,arguments);return r(this,e)});function y(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,y),(t=u.call(this,e)).yasrOverallRateThis=o("Rate this article / item","yet-another-stars-rating"),t}return l=y,(s=[{key:"render",value:function(){return React.createElement("div",null,this.yasrOverallRateThis,React.createElement("div",null,React.createElement("div",{id:"overall-rater",ref:function(){return raterJs({starSize:32,step:.1,showToolTip:!1,rating:k,readOnly:!1,element:document.querySelector("#overall-rater"),rateCallback:function(e,t){e=e.toFixed(1),e=parseFloat(e),w({overallRatingMeta:e}),this.setRating(e),t()}})}})))}}])&&t(l.prototype,s),y}();function z(){return React.createElement("form",null,React.createElement("select",{value:R,onChange:I},React.createElement("option",{value:"--"},d),React.createElement("option",{value:"small"},f),React.createElement("option",{value:"medium"},g),React.createElement("option",{value:"large"},v)))}function I(e){var t=e.target.querySelector("option:checked");w({size:t.value}),e.preventDefault()}function T(){return React.createElement("div",null,React.createElement("input",{type:"text",size:"4",onKeyPress:C}))}function C(e){if("Enter"===e.key){var t=e.target.value;!0!==/^\d+$/.test(t)&&""!==t||w({postId:t}),e.preventDefault()}}function x(e){return React.createElement(y,null,React.createElement("div",{class:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement(O,null)),React.createElement(i,{title:"Settings"},React.createElement("h3",null,p),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,m),React.createElement("div",null,React.createElement(z,null))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(T,null),React.createElement("div",{className:"yasr-guten-block-explain"},h)),React.createElement("div",{className:"yasr-guten-block-panel"},b)))}return React.createElement(c,null,React.createElement(x,null),React.createElement("div",{className:e.className},"[yasr_overall_rating",S,P,"]",_&&React.createElement(z,null)))},save:function(e){var t=e.attributes,a=t.size,r=t.postId,n="",o=r;return a&&(n+='size="'+a+'"'),r&&("--"===r&&(o=wp.data.select("core/editor").getCurrentPostId()),n+=' postid="'+o+'"'),React.createElement("div",null,"[yasr_overall_rating ",n,"]")}}),l("yet-another-stars-rating/yasr-visitor-votes",{title:o("[DEPRECATED]Yasr: Visitor Votes","yet-another-stars-rating"),description:w,icon:"star-half",keywords:[o("rating","yet-another-stars-rating"),o("visitor","yet-another-stars-rating"),o("votes","yet-another-stars-rating")],attributes:{size:{type:"string",default:"--"},postId:{type:"string",default:"--"}},edit:function(e){var t,a=e.attributes,r=a.size,n=a.postId,o=e.setAttributes,l=e.isSelected,s=null,u=null;function b(){return React.createElement("form",null,React.createElement("select",{value:r,onChange:E},React.createElement("option",{value:"--"},d),React.createElement("option",{value:"small"},f),React.createElement("option",{value:"medium"},g),React.createElement("option",{value:"large"},v)))}function E(e){var t=e.target.querySelector("option:checked");o({size:t.value}),e.preventDefault()}function w(){return React.createElement("div",null,React.createElement("input",{type:"text",size:"4",onKeyPress:_}))}function _(e){if("Enter"===e.key){var t=e.target.value;!0!==/^\d+$/.test(t)&&""!==t||o({postId:t}),e.preventDefault()}}function k(e){return React.createElement(y,null,React.createElement(i,{title:"Settings"},React.createElement("h3",null,p),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,m),React.createElement("div",null,React.createElement(b,null))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(w,null),React.createElement("div",{className:"yasr-guten-block-explain"},h)),React.createElement("div",{className:"yasr-guten-block-panel"},R)))}return t=/^\d+$/.test(n),"--"!==r&&(s=' size="'+r+'"'),"--"!==n&&!0===t&&(u=' postid="'+n+'"'),React.createElement(c,null,React.createElement(k,null),React.createElement("div",{className:e.className},"[yasr_visitor_votes",s,u,"]",l&&React.createElement(b,null)))},save:function(e){var t=e.attributes,a=t.size,r=t.postId,n="",o=r;return a&&(n+='size="'+a+'"'),r&&("--"===r&&(o=wp.data.select("core/editor").getCurrentPostId()),n+=' postid="'+o+'"'),React.createElement("div",null,"[yasr_visitor_votes ",n,"]")}}),wp.data.dispatch("core/edit-post").hideBlockTypes("yet-another-stars-rating/yasr-overall-rating"),wp.data.dispatch("core/edit-post").hideBlockTypes("yet-another-stars-rating/yasr-visitor-votes")})(),(()=>{"use strict";var e=a(245);function t(e){return t="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},t(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,a){return t&&n(e.prototype,t),a&&n(e,a),e}function l(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&&s(e,t)}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}function i(e){var t=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}}();return function(){var a,r=y(e);if(t){var n=y(this).constructor;a=Reflect.construct(r,arguments,n)}else a=r.apply(this,arguments);return c(this,a)}}function c(e,a){if(a&&("object"===t(a)||"function"==typeof a))return a;if(void 0!==a)throw new TypeError("Derived constructors may only return object or undefined");return u(e)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}var p=wp.i18n.__,m=wp.plugins.registerPlugin,d=wp.editPost,f=d.PluginSidebar,g=d.PluginSidebarMoreMenuItem,v=wp.components.PanelBody,h=wp.element.Fragment,b=function(){return React.createElement("div",null)},R=function(e){l(a,React.Component);var t=i(a);function a(e){var n;r(this,a),n=t.call(this,e);var o=!1;return"yes"===wp.data.select("core/editor").getCurrentPost().meta.yasr_auto_insert_disabled&&(o=!0),n.state={postExcluded:o},n.yasrUpdatePostMetaAutoInsert=n.yasrUpdatePostMetaAutoInsert.bind(u(n)),n}return o(a,[{key:"yasrUpdatePostMetaAutoInsert",value:function(e){var t=e.target,a="checkbox"===t.type?t.checked:t.value;this.setState({postExcluded:a}),!0===a?wp.data.dispatch("core/editor").editPost({meta:{yasr_auto_insert_disabled:"yes"}}):wp.data.dispatch("core/editor").editPost({meta:{yasr_auto_insert_disabled:"no"}})}},{key:"render",value:function(){return React.createElement("div",{className:"yasr-guten-block-panel-center"},React.createElement("hr",null),React.createElement("label",null,React.createElement("span",null,p("Disable auto insert for this post or page?","yet-another-stars-rating"))),React.createElement("div",{className:"yasr-onoffswitch-big yasr-onoffswitch-big-center",id:"yasr-switcher-disable-auto-insert"},React.createElement("input",{type:"checkbox",name:"yasr_auto_insert_disabled",className:"yasr-onoffswitch-checkbox",value:"yes",id:"yasr-auto-insert-disabled-switch",defaultChecked:this.state.postExcluded,onChange:this.yasrUpdatePostMetaAutoInsert}),React.createElement("label",{className:"yasr-onoffswitch-label",htmlFor:"yasr-auto-insert-disabled-switch"},React.createElement("span",{className:"yasr-onoffswitch-inner"}),React.createElement("span",{className:"yasr-onoffswitch-switch"}))))}}]),a}(),E=function(t){l(n,React.Component);var a=i(n);function n(e){var t;r(this,n),t=a.call(this,e);var o=!1;return"disabled"!==yasrConstantGutenberg.autoInsert&&(o=!0),t.state={yasrAutoInsertEnabled:o},t}return o(n,[{key:"render",value:function(){var t=[React.createElement(b,{key:0})];return wp.hooks.doAction("yasr_below_panel",t),React.createElement(h,null,React.createElement(g,{name:"yasr-sidebar",type:"sidebar",target:"yasr-guten-sidebar"},p("YASR post settings","yet-another-stars-rating")),React.createElement(f,{name:"yasr-guten-sidebar",title:"YASR Settings"},React.createElement(v,null,React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement(e.YasrDivRatingOverall,null),React.createElement("div",null,p('This is the same value that you find the "Yasr: Overall Rating" block.',"yet-another-stars-rating")),this.state.yasrAutoInsertEnabled&&React.createElement(R,null),t))))}}]),n}();m("yasr-sidebar",{icon:"star-half",title:p("Yasr: Page Settings","yet-another-stars-rating"),render:E})})()})();
admin/js/yasr-pricing-page.js CHANGED
@@ -1 +1 @@
1
- (()=>{function e(t){return(e="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})(t)}function t(e,t){for(var c=0;c<t.length;c++){var a=t[c];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(t,c){return!c||"object"!==e(c)&&"function"!=typeof c?n(t):c}function n(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e){var t="$";return"eur"===e.name&&(t="€"),React.createElement("small",null,t," ")}function i(e){var t="/year";return"monthly"===e.name&&(t="/month"),"lifetime"===e.name&&(t=""),React.createElement("small",null,t)}function s(e){var t=" 1 website";return"plus"===e.license&&(t=" 5 websites"),"enterprise"===e.license&&(t=" 30 websites"),React.createElement("ul",{className:"PT-Features"},"annual"===e.cycle&&React.createElement("li",{className:"yasr-pricing-table-feature"},React.createElement("strong",null,"1 year")," of supports and updates ",React.createElement("br",null),"for",React.createElement("strong",null,t)),"monthly"===e.cycle&&React.createElement("li",{className:"yasr-pricing-table-feature"},React.createElement("strong",null,"1 month")," of supports and updates ",React.createElement("br",null),"for",React.createElement("strong",null,t)),"lifetime"===e.cycle&&React.createElement("li",{className:"yasr-pricing-table-feature"},React.createElement("strong",null,"Lifetime")," updates and support",React.createElement("br",null),"for",React.createElement("strong",null,t)),React.createElement("li",{className:"yasr-pricing-table-feature"},"User reviews"),React.createElement("li",{className:"yasr-pricing-table-feature"},"Custom rankings"),React.createElement("li",{className:"yasr-pricing-table-feature"},"20 + ready to use themes"),React.createElement("li",{className:"yasr-pricing-table-feature"},"Upload your own theme"),React.createElement("li",{className:"yasr-pricing-table-feature"},"Add fake ratings"),React.createElement("li",{className:"yasr-pricing-table-feature"},"Direct email support"),"lifetime"===e.cycle&&React.createElement("li",{className:"yasr-pricing-table-feature"},"We setup the plugin for free ",React.createElement("br",null),"(only lifetime plans)"))}function u(e){var t="",c=1,a="";return"single"===e.license?(a="eur"===e.currency?5399:1933,t="monthly"===e.cycle?"eur"===e.currency?"4.49":"4.99":"lifetime"===e.cycle?"eur"===e.currency?"129.99":"149.99":"eur"===e.currency?"41.99":"47.88"):"plus"===e.license?(c=5,a="eur"===e.currency?5400:1935,t="monthly"===e.cycle?"eur"===e.currency?"8.99":"9.99":"lifetime"===e.cycle?"eur"===e.currency?"249.99":"289.99":"eur"===e.currency?"83.88":"95.88"):"enterprise"===e.license&&(c=30,a="eur"===e.currency?5550:5549,t="monthly"===e.cycle?"eur"===e.currency?"12.99":"14.99":"lifetime"===e.cycle?"eur"===e.currency?"359.99":"439.99":"eur"===e.currency?"119.88":"143.88"),React.createElement("div",{className:"yasr-pring-table-price"},React.createElement(l,{name:e.currency}),React.createElement("span",null,t),React.createElement(i,{name:e.cycle}),React.createElement(o,{cycle:e.cycle,currency:e.currency,license:e.license}),React.createElement("p",{className:"PT-CTA"},React.createElement("a",{href:"#",className:"yasr-buy-button",onClick:function(t){!function(e,t,c,a){var n={plugin_id:256,billing_cycle:e,pricing_id:a,licenses:t,id:"yasr_checkout",page:"yasr_settings_page-pricing",checkout:"true",plan_id:"2778",plan_name:"yasrpro",disable_licenses_selector:!0,hide_billing_cycles:!0,currency:c},r=[];for(var l in n){var i=encodeURIComponent(l),s=encodeURIComponent(n[l]);r.push(i+"="+s)}r=r.join("&");var u=yasrCommonData.adminUrl+"admin.php?"+r;window.open(u,"_self")}(e.cycle,c,e.currency,a),t.preventDefault()}},"Buy YASR ")))}function o(e){if("annual"===e.cycle){var t;return t="plus"===e.license?"eur"===e.currency?"6.99":"7.99":"enterprise"===e.license?"eur"===e.currency?"9.99":"11.99":"eur"===e.currency?"3.49":"3.99",React.createElement("p",{className:"yasr-pricing-table-price-desc"},React.createElement(l,{name:e.currency}),t," /month")}return React.createElement(React.Fragment,null)}var y=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&&c(e,t)}(p,React.Component);var l,i,o,y,m=(o=p,y=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=r(o);if(y){var c=r(this).constructor;e=Reflect.construct(t,arguments,c)}else e=t.apply(this,arguments);return a(this,e)});function p(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,p),(t=m.call(this,e)).state={currencyName:"usd",cycle:"annual"},t.updateCurrency=t.updateCurrency.bind(n(t)),t.updateCycle=t.updateCycle.bind(n(t)),t}return l=p,(i=[{key:"updateCurrency",value:function(e){var t=e.target;!0===("checkbox"===t.type?t.checked:t.value)?this.setState({currencyName:"eur"}):this.setState({currencyName:"usd"})}},{key:"updateCycle",value:function(e){this.setState({cycle:e.target.value})}},{key:"render",value:function(){return React.createElement(React.Fragment,null,React.createElement("div",{id:"yasr-radio-billing-cycle"},React.createElement("input",{type:"radio",id:"yasr-billing-cycle-monthly",name:"billing-cycle",value:"monthly",onChange:this.updateCycle,checked:"monthly"===this.state.cycle}),React.createElement("label",{htmlFor:"yasr-billing-cycle-monthly"},"Monthly"),React.createElement("input",{type:"radio",id:"yasr-billing-cycle-annual",name:"billing-cycle",value:"annual",onChange:this.updateCycle,checked:"annual"===this.state.cycle}),React.createElement("label",{htmlFor:"yasr-billing-cycle-annual"},"Annual"),React.createElement("input",{type:"radio",id:"yasr-billing-cycle-lifetime",name:"billing-cycle",value:"lifetime",onChange:this.updateCycle,checked:"lifetime"===this.state.cycle}),React.createElement("label",{htmlFor:"yasr-billing-cycle-lifetime"},"Lifetime")),React.createElement("div",{id:"yasr-pricing-table"},React.createElement("div",{className:"yasr-pricing-table-item"},React.createElement("header",{className:"yasr-pricing-table-heading"},React.createElement("h2",{className:"yasr-pricing-table-title"},"Plus"),React.createElement("p",{className:"yasr-pricing-table-subtitle"},"5 websites")),React.createElement(s,{cycle:this.state.cycle,license:"plus"}),React.createElement("div",{className:"yasr-pricing-table-footer"},React.createElement(u,{cycle:this.state.cycle,currency:this.state.currencyName,license:"plus"}))),React.createElement("div",{className:"yasr-pricing-table-item is-highlighted"},React.createElement("header",{className:"yasr-pricing-table-heading"},React.createElement("h2",{className:"yasr-pricing-table-title"},"Single"),React.createElement("p",{className:"yasr-pricing-table-subtitle"}," 1 website")),React.createElement(s,{cycle:this.state.cycle,license:"single"}),React.createElement("div",{className:"yasr-pricing-table-footer"},React.createElement(u,{cycle:this.state.cycle,currency:this.state.currencyName,license:"single"}))),React.createElement("div",{className:"yasr-pricing-table-item"},React.createElement("header",{className:"yasr-pricing-table-heading"},React.createElement("h2",{className:"yasr-pricing-table-title"},"Enterprise"),React.createElement("p",{className:"yasr-pricing-table-subtitle"}," 30 websites")),React.createElement(s,{cycle:this.state.cycle,license:"enterprise"}),React.createElement("div",{className:"yasr-pricing-table-footer"},React.createElement(u,{cycle:this.state.cycle,currency:this.state.currencyName,license:"enterprise"})))),React.createElement("div",{id:"switch-container"},React.createElement("span",{className:"yasr-pricing-text-switcher"}," Display Prices In US $ "),React.createElement("label",{className:"yasr-pricing-switch"},React.createElement("input",{type:"checkbox",onChange:this.updateCurrency}),React.createElement("span",{className:"yasr-pricing-slider"})),React.createElement("span",{className:"yasr-pricing-text-switcher"}," €")))}}])&&t(l.prototype,i),p}();ReactDOM.render(React.createElement(y,null),document.getElementById("yasr-table-container"));var m=document.getElementById("yasr-link-policy"),p=document.getElementById("yasr-link-policy-faq"),f=document.getElementById("yasr-refund-policy"),d=document.getElementById("yasr-close-modal-policy");m.addEventListener("click",(function(){f.style.display="block",document.body.style.backgroundColor="rgba(0,0,0,0.7)"})),p.addEventListener("click",(function(){f.style.display="block",document.body.style.backgroundColor="rgba(0,0,0,0.7)"})),d.onclick=function(){f.style.display="none",document.body.style.backgroundColor="#f1f1f1"}})();
1
+ (()=>{function e(t){return e="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},e(t)}function t(e,t){for(var c=0;c<t.length;c++){var a=t[c];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function c(e,t){return c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},c(e,t)}function a(t,c){if(c&&("object"===e(c)||"function"==typeof c))return c;if(void 0!==c)throw new TypeError("Derived constructors may only return object or undefined");return r(t)}function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}function l(e){var t="$";return"eur"===e.name&&(t="€"),React.createElement("small",null,t," ")}function i(e){var t="/year";return"monthly"===e.name&&(t="/month"),"lifetime"===e.name&&(t=""),React.createElement("small",null,t)}function s(e){var t=" 1 website";return"plus"===e.license&&(t=" 5 websites"),"enterprise"===e.license&&(t=" 30 websites"),React.createElement("ul",{className:"PT-Features"},"annual"===e.cycle&&React.createElement("li",{className:"yasr-pricing-table-feature"},React.createElement("strong",null,"1 year")," of supports and updates ",React.createElement("br",null),"for",React.createElement("strong",null,t)),"monthly"===e.cycle&&React.createElement("li",{className:"yasr-pricing-table-feature"},React.createElement("strong",null,"1 month")," of supports and updates ",React.createElement("br",null),"for",React.createElement("strong",null,t)),"lifetime"===e.cycle&&React.createElement("li",{className:"yasr-pricing-table-feature"},React.createElement("strong",null,"Lifetime")," updates and support",React.createElement("br",null),"for",React.createElement("strong",null,t)),React.createElement("li",{className:"yasr-pricing-table-feature"},"User reviews"),React.createElement("li",{className:"yasr-pricing-table-feature"},"Custom rankings"),React.createElement("li",{className:"yasr-pricing-table-feature"},"20 + ready to use themes"),React.createElement("li",{className:"yasr-pricing-table-feature"},"Upload your own theme"),React.createElement("li",{className:"yasr-pricing-table-feature"},"Add fake ratings"),React.createElement("li",{className:"yasr-pricing-table-feature"},"Direct email support"),"lifetime"===e.cycle&&React.createElement("li",{className:"yasr-pricing-table-feature"},"We setup the plugin for free ",React.createElement("br",null),"(only lifetime plans)"))}function u(e){var t="",c=1,a="";return"single"===e.license?(a="eur"===e.currency?5399:1933,t="monthly"===e.cycle?"eur"===e.currency?"4.49":"4.99":"lifetime"===e.cycle?"eur"===e.currency?"129.99":"149.99":"eur"===e.currency?"41.99":"47.88"):"plus"===e.license?(c=5,a="eur"===e.currency?5400:1935,t="monthly"===e.cycle?"eur"===e.currency?"8.99":"9.99":"lifetime"===e.cycle?"eur"===e.currency?"249.99":"289.99":"eur"===e.currency?"83.88":"95.88"):"enterprise"===e.license&&(c=30,a="eur"===e.currency?5550:5549,t="monthly"===e.cycle?"eur"===e.currency?"12.99":"14.99":"lifetime"===e.cycle?"eur"===e.currency?"359.99":"439.99":"eur"===e.currency?"119.88":"143.88"),React.createElement("div",{className:"yasr-pring-table-price"},React.createElement(l,{name:e.currency}),React.createElement("span",null,t),React.createElement(i,{name:e.cycle}),React.createElement(o,{cycle:e.cycle,currency:e.currency,license:e.license}),React.createElement("p",{className:"PT-CTA"},React.createElement("a",{href:"#",className:"yasr-buy-button",onClick:function(t){!function(e,t,c,a){var r={plugin_id:256,billing_cycle:e,pricing_id:a,licenses:t,id:"yasr_checkout",page:"yasr_settings_page-pricing",checkout:"true",plan_id:"2778",plan_name:"yasrpro",disable_licenses_selector:!0,hide_billing_cycles:!0,currency:c},n=[];for(var l in r){var i=encodeURIComponent(l),s=encodeURIComponent(r[l]);n.push(i+"="+s)}n=n.join("&");var u=yasrCommonData.adminUrl+"admin.php?"+n;window.open(u,"_self")}(e.cycle,c,e.currency,a),t.preventDefault()}},"Buy YASR ")))}function o(e){if("annual"===e.cycle){var t;return t="plus"===e.license?"eur"===e.currency?"6.99":"7.99":"enterprise"===e.license?"eur"===e.currency?"9.99":"11.99":"eur"===e.currency?"3.49":"3.99",React.createElement("p",{className:"yasr-pricing-table-price-desc"},React.createElement(l,{name:e.currency}),t," /month")}return React.createElement(React.Fragment,null)}var y=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&&c(e,t)}(p,React.Component);var l,i,o,y,m=(o=p,y=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=n(o);if(y){var c=n(this).constructor;e=Reflect.construct(t,arguments,c)}else e=t.apply(this,arguments);return a(this,e)});function p(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,p),(t=m.call(this,e)).state={currencyName:"usd",cycle:"annual"},t.updateCurrency=t.updateCurrency.bind(r(t)),t.updateCycle=t.updateCycle.bind(r(t)),t}return l=p,(i=[{key:"updateCurrency",value:function(e){var t=e.target;!0===("checkbox"===t.type?t.checked:t.value)?this.setState({currencyName:"eur"}):this.setState({currencyName:"usd"})}},{key:"updateCycle",value:function(e){this.setState({cycle:e.target.value})}},{key:"render",value:function(){return React.createElement(React.Fragment,null,React.createElement("div",{id:"yasr-radio-billing-cycle"},React.createElement("input",{type:"radio",id:"yasr-billing-cycle-monthly",name:"billing-cycle",value:"monthly",onChange:this.updateCycle,checked:"monthly"===this.state.cycle}),React.createElement("label",{htmlFor:"yasr-billing-cycle-monthly"},"Monthly"),React.createElement("input",{type:"radio",id:"yasr-billing-cycle-annual",name:"billing-cycle",value:"annual",onChange:this.updateCycle,checked:"annual"===this.state.cycle}),React.createElement("label",{htmlFor:"yasr-billing-cycle-annual"},"Annual"),React.createElement("input",{type:"radio",id:"yasr-billing-cycle-lifetime",name:"billing-cycle",value:"lifetime",onChange:this.updateCycle,checked:"lifetime"===this.state.cycle}),React.createElement("label",{htmlFor:"yasr-billing-cycle-lifetime"},"Lifetime")),React.createElement("div",{id:"yasr-pricing-table"},React.createElement("div",{className:"yasr-pricing-table-item"},React.createElement("header",{className:"yasr-pricing-table-heading"},React.createElement("h2",{className:"yasr-pricing-table-title"},"Plus"),React.createElement("p",{className:"yasr-pricing-table-subtitle"},"5 websites")),React.createElement(s,{cycle:this.state.cycle,license:"plus"}),React.createElement("div",{className:"yasr-pricing-table-footer"},React.createElement(u,{cycle:this.state.cycle,currency:this.state.currencyName,license:"plus"}))),React.createElement("div",{className:"yasr-pricing-table-item is-highlighted"},React.createElement("header",{className:"yasr-pricing-table-heading"},React.createElement("h2",{className:"yasr-pricing-table-title"},"Single"),React.createElement("p",{className:"yasr-pricing-table-subtitle"}," 1 website")),React.createElement(s,{cycle:this.state.cycle,license:"single"}),React.createElement("div",{className:"yasr-pricing-table-footer"},React.createElement(u,{cycle:this.state.cycle,currency:this.state.currencyName,license:"single"}))),React.createElement("div",{className:"yasr-pricing-table-item"},React.createElement("header",{className:"yasr-pricing-table-heading"},React.createElement("h2",{className:"yasr-pricing-table-title"},"Enterprise"),React.createElement("p",{className:"yasr-pricing-table-subtitle"}," 30 websites")),React.createElement(s,{cycle:this.state.cycle,license:"enterprise"}),React.createElement("div",{className:"yasr-pricing-table-footer"},React.createElement(u,{cycle:this.state.cycle,currency:this.state.currencyName,license:"enterprise"})))),React.createElement("div",{id:"switch-container"},React.createElement("span",{className:"yasr-pricing-text-switcher"}," Display Prices In US $ "),React.createElement("label",{className:"yasr-pricing-switch"},React.createElement("input",{type:"checkbox",onChange:this.updateCurrency}),React.createElement("span",{className:"yasr-pricing-slider"})),React.createElement("span",{className:"yasr-pricing-text-switcher"}," €")))}}])&&t(l.prototype,i),p}();ReactDOM.render(React.createElement(y,null),document.getElementById("yasr-table-container"));var m=document.getElementById("yasr-link-policy"),p=document.getElementById("yasr-link-policy-faq"),f=document.getElementById("yasr-refund-policy"),d=document.getElementById("yasr-close-modal-policy");m.addEventListener("click",(function(){f.style.display="block",document.body.style.backgroundColor="rgba(0,0,0,0.7)"})),p.addEventListener("click",(function(){f.style.display="block",document.body.style.backgroundColor="rgba(0,0,0,0.7)"})),d.onclick=function(){f.style.display="none",document.body.style.backgroundColor="#f1f1f1"}})();
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})(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})(e,t)}function m(e,t){return!t||"object"!==d(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(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())}}])&&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")},L=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="")},T=".yasr-builder-elements-parents",S=".yasr-builder-elements-childs";jQuery(T).prop("disabled",!0),jQuery(S).prop("disabled",!0),jQuery(T).find("input").each((function(){jQuery(this).prop("disabled",!0)})),wp.hooks.doAction("yasrBuilderBegin",T,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?L(K,V,z,J,Y,G,$,W,!1,X):"yasr_visitor_multi_set_ranking"===Z?L(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?(L(K,V,z,J,Y,G,$,W,!1,X),H.setid=" setid="+A[0].value):"yasr_visitor_multi_set_ranking"===e.target.value?(L(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-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/aspect_style/yasr-settings-style-functions.php CHANGED
@@ -85,8 +85,8 @@ function yasr_style_section_callback() {
85
  function yasr_color_scheme_multiset_callback($style_options) {
86
 
87
  $array_options = array (
88
- 'light' => __('Light', 'yet-another-stars-rating-pro'),
89
- 'dark' => __('Dark', 'yasr-yet-another-stars-rating')
90
  );
91
  $default = $style_options['scheme_color_multiset'];
92
  $name = 'yasr_style_options[scheme_color_multiset]';
85
  function yasr_color_scheme_multiset_callback($style_options) {
86
 
87
  $array_options = array (
88
+ 'light' => __('Light', 'yet-another-stars-rating'),
89
+ 'dark' => __('Dark', 'yet-another-stars-rating')
90
  );
91
  $default = $style_options['scheme_color_multiset'];
92
  $name = 'yasr_style_options[scheme_color_multiset]';
admin/settings/classes/YasrImportRatingPlugins.php CHANGED
@@ -51,7 +51,7 @@ class YasrImportRatingPlugins {
51
 
52
  $rmp_table = $wpdb->prefix . 'rmp_analytics';
53
 
54
- if ($wpdb->get_var("SHOW TABLES LIKE '$rmp_table'") === $rmp_table) {
55
  return true;
56
  }
57
  return false;
@@ -178,18 +178,16 @@ class YasrImportRatingPlugins {
178
  global $wpdb;
179
 
180
  $logs = $wpdb->get_results(
181
- "
182
- SELECT pm.post_id,
183
- MAX(CASE WHEN pm.meta_key = 'ratings_average' THEN pm.meta_value END) as ratings_average,
184
- MAX(CASE WHEN pm.meta_key = 'ratings_users' THEN pm.meta_value END) as ratings_users
185
- FROM $wpdb->postmeta as pm,
186
- $wpdb->posts as p
187
- WHERE pm.meta_key IN ('ratings_average', 'ratings_users')
188
- AND pm.meta_value <> 0
189
- AND pm.post_id = p.ID
190
- GROUP BY pm.post_id
191
- ORDER BY pm.post_id
192
- "
193
  );
194
 
195
  if (empty($logs)) {
@@ -204,18 +202,16 @@ class YasrImportRatingPlugins {
204
  global $wpdb;
205
 
206
  $logs = $wpdb->get_results(
207
- "
208
- SELECT pm.post_id,
209
- MAX(CASE WHEN pm.meta_key = '_kksr_avg' THEN pm.meta_value END) as ratings_average,
210
- MAX(CASE WHEN pm.meta_key = '_kksr_casts' THEN pm.meta_value END) as ratings_users
211
- FROM $wpdb->postmeta as pm,
212
- $wpdb->posts as p
213
- WHERE pm.meta_key IN ('_kksr_avg', '_kksr_casts')
214
- AND pm.meta_value <> 0
215
- AND pm.post_id = p.ID
216
- GROUP BY pm.post_id
217
- ORDER BY pm.post_id
218
- "
219
  );
220
 
221
  if (empty($logs)) {
@@ -232,14 +228,13 @@ class YasrImportRatingPlugins {
232
 
233
  //get logs
234
  $logs = $wpdb->get_results(
235
- "
236
- SELECT rmp.post AS post_id,
237
- rmp.value as vote,
238
- rmp.time AS date,
239
- p.ID
240
- FROM $rmp_table AS rmp,
241
- $wpdb->posts AS p
242
- WHERE rmp.post = p.id"
243
  );
244
 
245
  if (empty($logs)) {
@@ -254,18 +249,16 @@ class YasrImportRatingPlugins {
254
  global $wpdb;
255
 
256
  $logs = $wpdb->get_results(
257
- "
258
- SELECT pm.post_id,
259
- MAX(CASE WHEN pm.meta_key = 'mr_rating_results_star_rating' THEN pm.meta_value END) as ratings_average,
260
- MAX(CASE WHEN pm.meta_key = 'mr_rating_results_count_entries' THEN pm.meta_value END) as ratings_users
261
- FROM $wpdb->postmeta as pm,
262
- $wpdb->posts as p
263
- WHERE pm.meta_key IN ('mr_rating_results_star_rating', 'mr_rating_results_count_entries')
264
- AND pm.meta_value <> 0
265
- AND pm.post_id = p.ID
266
- GROUP BY pm.post_id
267
- ORDER BY pm.post_id
268
- "
269
  );
270
 
271
  if (empty($logs)) {
51
 
52
  $rmp_table = $wpdb->prefix . 'rmp_analytics';
53
 
54
+ if ($wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE '%s'", $rmp_table)) === $rmp_table) {
55
  return true;
56
  }
57
  return false;
178
  global $wpdb;
179
 
180
  $logs = $wpdb->get_results(
181
+ "SELECT pm.post_id,
182
+ MAX(CASE WHEN pm.meta_key = 'ratings_average' THEN pm.meta_value END) as ratings_average,
183
+ MAX(CASE WHEN pm.meta_key = 'ratings_users' THEN pm.meta_value END) as ratings_users
184
+ FROM $wpdb->postmeta as pm,
185
+ $wpdb->posts as p
186
+ WHERE pm.meta_key IN ('ratings_average', 'ratings_users')
187
+ AND pm.meta_value <> 0
188
+ AND pm.post_id = p.ID
189
+ GROUP BY pm.post_id
190
+ ORDER BY pm.post_id"
 
 
191
  );
192
 
193
  if (empty($logs)) {
202
  global $wpdb;
203
 
204
  $logs = $wpdb->get_results(
205
+ "SELECT pm.post_id,
206
+ MAX(CASE WHEN pm.meta_key = '_kksr_avg' THEN pm.meta_value END) as ratings_average,
207
+ MAX(CASE WHEN pm.meta_key = '_kksr_casts' THEN pm.meta_value END) as ratings_users
208
+ FROM $wpdb->postmeta as pm,
209
+ $wpdb->posts as p
210
+ WHERE pm.meta_key IN ('_kksr_avg', '_kksr_casts')
211
+ AND pm.meta_value <> 0
212
+ AND pm.post_id = p.ID
213
+ GROUP BY pm.post_id
214
+ ORDER BY pm.post_id"
 
 
215
  );
216
 
217
  if (empty($logs)) {
228
 
229
  //get logs
230
  $logs = $wpdb->get_results(
231
+ "SELECT rmp.post AS post_id,
232
+ rmp.value as vote,
233
+ rmp.time AS date,
234
+ p.ID
235
+ FROM $rmp_table AS rmp,
236
+ $wpdb->posts AS p
237
+ WHERE rmp.post = p.id"
 
238
  );
239
 
240
  if (empty($logs)) {
249
  global $wpdb;
250
 
251
  $logs = $wpdb->get_results(
252
+ "SELECT pm.post_id,
253
+ MAX(CASE WHEN pm.meta_key = 'mr_rating_results_star_rating' THEN pm.meta_value END) as ratings_average,
254
+ MAX(CASE WHEN pm.meta_key = 'mr_rating_results_count_entries' THEN pm.meta_value END) as ratings_users
255
+ FROM $wpdb->postmeta as pm,
256
+ $wpdb->posts as p
257
+ WHERE pm.meta_key IN ('mr_rating_results_star_rating', 'mr_rating_results_count_entries')
258
+ AND pm.meta_value <> 0
259
+ AND pm.post_id = p.ID
260
+ GROUP BY pm.post_id
261
+ ORDER BY pm.post_id"
 
 
262
  );
263
 
264
  if (empty($logs)) {
admin/settings/migrations/yasr-settings-migration-functions.php CHANGED
@@ -37,7 +37,7 @@ function yasr_import_wppr_callback() {
37
  }
38
 
39
  if (!current_user_can( 'manage_options' ) ) {
40
- die(__( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ));
41
  }
42
 
43
  global $wpdb;
@@ -52,7 +52,7 @@ function yasr_import_wppr_callback() {
52
  $logs = $wppr->yasr_return_wppr_data();
53
 
54
  if(empty($logs)) {
55
- echo json_encode(__('No WP Post Rating data found'));
56
  } else {
57
  $result = false;
58
 
@@ -87,7 +87,7 @@ function yasr_import_wppr_callback() {
87
  if ($result) {
88
  yasr_save_option_imported_plugin('wppr');
89
 
90
- $string_to_return = __('Woot! All data have been imported!', 'yet-another-stars-rating');
91
  echo json_encode($string_to_return);
92
  }
93
 
@@ -110,7 +110,7 @@ function yasr_import_kksr_callback() {
110
  }
111
 
112
  if (!current_user_can( 'manage_options' ) ) {
113
- die(__( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ));
114
  }
115
 
116
  global $wpdb;
@@ -122,7 +122,7 @@ function yasr_import_kksr_callback() {
122
  $logs= $kksr->yasr_return_kksr_data();
123
 
124
  if(empty($logs)) {
125
- echo json_encode(__('No KK Star Ratings data found'));
126
  } else {
127
  $result = false;
128
 
@@ -150,7 +150,7 @@ function yasr_import_kksr_callback() {
150
  if ($result) {
151
  yasr_save_option_imported_plugin('kksr');
152
 
153
- $string_to_return = __('Woot! All data have been imported!', 'yet-another-stars-rating');
154
  echo json_encode($string_to_return);
155
  }
156
 
@@ -173,7 +173,7 @@ function yasr_import_ratemypost_callback() {
173
  }
174
 
175
  if (!current_user_can( 'manage_options' ) ) {
176
- die(__( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ));
177
  }
178
 
179
  global $wpdb;
@@ -184,7 +184,7 @@ function yasr_import_ratemypost_callback() {
184
  $logs=$rmp->yasr_return_rmp_data();
185
 
186
  if(empty($logs)) {
187
- echo json_encode(__('No Rate My Post data found'));
188
  } else {
189
  $result = false;
190
 
@@ -206,7 +206,7 @@ function yasr_import_ratemypost_callback() {
206
  if ($result) {
207
  yasr_save_option_imported_plugin('rmp');
208
 
209
- $string_to_return = __('Woot! All data have been imported!', 'yet-another-stars-rating');
210
  echo json_encode($string_to_return);
211
  }
212
  }
@@ -228,7 +228,7 @@ function yasr_import_mr_callback() {
228
  }
229
 
230
  if (!current_user_can( 'manage_options' ) ) {
231
- die(__( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ));
232
  }
233
 
234
  global $wpdb;
@@ -240,7 +240,7 @@ function yasr_import_mr_callback() {
240
  $logs=$mr_exists->yasr_return_mr_data();
241
 
242
  if(empty($logs)) {
243
- echo json_encode(__('No Multi Rating data found'));
244
  } else {
245
  $result = false;
246
 
@@ -269,7 +269,7 @@ function yasr_import_mr_callback() {
269
  if ($result) {
270
  yasr_save_option_imported_plugin('mr');
271
 
272
- $string_to_return = __('Woot! All data have been imported!', 'yet-another-stars-rating');
273
  echo json_encode($string_to_return);
274
  }
275
 
@@ -291,12 +291,12 @@ function yasr_save_option_imported_plugin($plugin) {
291
  function yasr_import_plugin_alert_box($plugin, $number_of_queries) {
292
 
293
  echo '<div class="yasr-alert-box">';
294
- echo sprintf(__(
295
  'To import %s seems like %s %d %s INSERT queries are necessary. %s
296
  There is nothing wrong with that, but some hosting provider can have a query limit/hour. %s
297
  I strongly suggest to contact your hosting and ask about your plan limit',
298
  'yet-another-stars-rating'
299
- ),$plugin, '<strong>', $number_of_queries, '</strong>', '<br />','<br />');
300
  echo '</div>';
301
 
302
  }
37
  }
38
 
39
  if (!current_user_can( 'manage_options' ) ) {
40
+ die(esc_html__( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ));
41
  }
42
 
43
  global $wpdb;
52
  $logs = $wppr->yasr_return_wppr_data();
53
 
54
  if(empty($logs)) {
55
+ echo json_encode(esc_html__('No WP Post Rating data found'));
56
  } else {
57
  $result = false;
58
 
87
  if ($result) {
88
  yasr_save_option_imported_plugin('wppr');
89
 
90
+ $string_to_return = esc_html__('Woot! All data have been imported!', 'yet-another-stars-rating');
91
  echo json_encode($string_to_return);
92
  }
93
 
110
  }
111
 
112
  if (!current_user_can( 'manage_options' ) ) {
113
+ die(esc_html__( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ));
114
  }
115
 
116
  global $wpdb;
122
  $logs= $kksr->yasr_return_kksr_data();
123
 
124
  if(empty($logs)) {
125
+ echo json_encode(esc_html__('No KK Star Ratings data found'));
126
  } else {
127
  $result = false;
128
 
150
  if ($result) {
151
  yasr_save_option_imported_plugin('kksr');
152
 
153
+ $string_to_return = esc_html__('Woot! All data have been imported!', 'yet-another-stars-rating');
154
  echo json_encode($string_to_return);
155
  }
156
 
173
  }
174
 
175
  if (!current_user_can( 'manage_options' ) ) {
176
+ die(esc_html__( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ));
177
  }
178
 
179
  global $wpdb;
184
  $logs=$rmp->yasr_return_rmp_data();
185
 
186
  if(empty($logs)) {
187
+ echo json_encode(esc_html__('No Rate My Post data found'));
188
  } else {
189
  $result = false;
190
 
206
  if ($result) {
207
  yasr_save_option_imported_plugin('rmp');
208
 
209
+ $string_to_return = esc_html__('Woot! All data have been imported!', 'yet-another-stars-rating');
210
  echo json_encode($string_to_return);
211
  }
212
  }
228
  }
229
 
230
  if (!current_user_can( 'manage_options' ) ) {
231
+ die(esc_html__( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ));
232
  }
233
 
234
  global $wpdb;
240
  $logs=$mr_exists->yasr_return_mr_data();
241
 
242
  if(empty($logs)) {
243
+ echo json_encode(esc_html__('No Multi Rating data found'));
244
  } else {
245
  $result = false;
246
 
269
  if ($result) {
270
  yasr_save_option_imported_plugin('mr');
271
 
272
+ $string_to_return = esc_html__('Woot! All data have been imported!', 'yet-another-stars-rating');
273
  echo json_encode($string_to_return);
274
  }
275
 
291
  function yasr_import_plugin_alert_box($plugin, $number_of_queries) {
292
 
293
  echo '<div class="yasr-alert-box">';
294
+ echo wp_kses_post(sprintf(__(
295
  'To import %s seems like %s %d %s INSERT queries are necessary. %s
296
  There is nothing wrong with that, but some hosting provider can have a query limit/hour. %s
297
  I strongly suggest to contact your hosting and ask about your plan limit',
298
  'yet-another-stars-rating'
299
+ ),$plugin, '<strong>', $number_of_queries, '</strong>', '<br />','<br />'));
300
  echo '</div>';
301
 
302
  }
admin/settings/multiset/yasr-settings-functions-multiset-page.php CHANGED
@@ -116,7 +116,7 @@ $n_multi_set = (int)$wpdb->num_rows; //wpdb->num_rows always store the last of t
116
  <?php
117
  settings_fields('yasr_multiset_options_group');
118
  do_settings_sections('yasr_multiset_tab');
119
- submit_button(__('Save'));
120
  ?>
121
  </form>
122
  </div>
116
  <?php
117
  settings_fields('yasr_multiset_options_group');
118
  do_settings_sections('yasr_multiset_tab');
119
+ submit_button(esc_html__('Save', 'yet-another-stars-rating'));
120
  ?>
121
  </form>
122
  </div>
admin/settings/yasr-settings-functions-misc.php CHANGED
@@ -91,7 +91,7 @@ function yasr_settings_tabs( $active_tab )
91
  */
92
  function yasr_description_auto_insert()
93
  {
94
- $name = __( 'Auto Insert Options', 'yet_another-stars-rating' );
95
  $div_desc = '<div class="yasr-settings-description">';
96
  $description = sprintf( __( 'Automatically adds YASR in your posts or pages. %s
97
  Disable this if you prefer to use shortcodes.', 'yet-another-stars-rating' ), '<br />' );
@@ -107,7 +107,7 @@ function yasr_description_auto_insert()
107
  */
108
  function yasr_description_stars_title()
109
  {
110
- $name = __( 'Enable stars next to the title?', 'yet_another-stars-rating' );
111
  $div_desc = '<div class="yasr-settings-description">';
112
  $description = __( 'Enable this if you want to show stars next to the title', 'yet-another-stars-rating' );
113
  $end_div = '.</div>';
@@ -121,7 +121,7 @@ function yasr_description_stars_title()
121
  */
122
  function yasr_description_archive_page()
123
  {
124
- $name = __( 'Archive Pages', 'yet_another-stars-rating' );
125
  $div_desc = '<div class="yasr-settings-description">';
126
  $description = __( 'Enable or disable these settings if you want to show ratings in archive pages (categories, tags, etc.)', 'yet-another-stars-rating' );
127
  $end_div = '.</div>';
@@ -135,7 +135,7 @@ function yasr_description_archive_page()
135
  */
136
  function yasr_description_vv_stats()
137
  {
138
- $name = __( 'Show stats for visitors votes?', 'yet_another-stars-rating' );
139
  $div_desc = '<div class="yasr-settings-description">';
140
  $description = sprintf( __( 'Enable or disable the chart bar icon (and tooltip hover it) next to the %syasr_visitor_votes%s shortcode', 'yet-another-stars-rating' ), '<em>', '</em>' );
141
  $end_div = '.</div>';
@@ -149,7 +149,7 @@ function yasr_description_vv_stats()
149
  */
150
  function yasr_description_allow_vote()
151
  {
152
- $name = __( 'Who is allowed to vote?', 'yet_another-stars-rating' );
153
  $div_desc = '<div class="yasr-settings-description">';
154
  $description = sprintf(
155
  __( 'Select who can rate your posts for %syasr_visitor_votes%s and %syasr_visitor_multiset%s shortcodes', 'yet-another-stars-rating' ),
@@ -169,7 +169,7 @@ function yasr_description_allow_vote()
169
  */
170
  function yasr_description_cstm_txt()
171
  {
172
- $name = __( 'Custom texts', 'yet_another-stars-rating' );
173
  $div_desc = '<div class="yasr-settings-description">';
174
  $description = __( 'Auto insert custom texts to show before or after the stars', 'yet-another-stars-rating' );
175
  $end_div = '.</div>';
@@ -183,7 +183,7 @@ function yasr_description_cstm_txt()
183
  */
184
  function yasr_description_strucutured_data()
185
  {
186
- $name = __( 'Stuctured data options', 'yet_another-stars-rating' );
187
  $div_desc = '<div class="yasr-settings-description">';
188
  $description = __( 'If ratings in a post or page are found, YASR will create structured data to show them in search results
189
  (SERP)', 'yet-another-stars-rating' );
@@ -229,7 +229,7 @@ function yasr_upgrade_pro_box()
229
  ?></strong></li>
230
  </ul>
231
  <a href="<?php
232
- echo yasr_fs()->get_upgrade_url() ;
233
  ?>">
234
  <button class="button button-primary">
235
  <span style="font-size: large; font-weight: bold;">
@@ -243,7 +243,7 @@ function yasr_upgrade_pro_box()
243
  --- or ---
244
  </div>
245
  <a href="<?php
246
- echo yasr_fs()->get_trial_url() ;
247
  ?>">
248
  <button class="button button-primary">
249
  <span style="display: block; font-size: large; font-weight: bold; margin: -3px;">
@@ -377,13 +377,13 @@ function yasr_cnrt()
377
  {
378
  $text = '<div style="text-align: center">';
379
  $text .= '<a href="https://wordpress.org/plugins/comments-not-replied-to/">';
380
- $text .= '<img src="'.esc_attr(YASR_IMG_DIR).'/cnrt.png" alt="cnrt" width="110">';
381
  $text .= '<div>Comments Not Replied To</div>';
382
  $text .= '</a>';
383
  $text .= '</div>';
384
  $text .= '<div style="margin-top: 15px;">';
385
  $text .= __( '"Comments Not Replied To" introduces a new area in the administrative dashboard that allows you to
386
- see what comments to which you - as the site author - have not yet replied.', 'movie-helper' );
387
  $text .= '</div>';
388
  return $text;
389
  }
91
  */
92
  function yasr_description_auto_insert()
93
  {
94
+ $name = __( 'Auto Insert Options', 'yet-another-stars-rating' );
95
  $div_desc = '<div class="yasr-settings-description">';
96
  $description = sprintf( __( 'Automatically adds YASR in your posts or pages. %s
97
  Disable this if you prefer to use shortcodes.', 'yet-another-stars-rating' ), '<br />' );
107
  */
108
  function yasr_description_stars_title()
109
  {
110
+ $name = __( 'Enable stars next to the title?', 'yet-another-stars-rating' );
111
  $div_desc = '<div class="yasr-settings-description">';
112
  $description = __( 'Enable this if you want to show stars next to the title', 'yet-another-stars-rating' );
113
  $end_div = '.</div>';
121
  */
122
  function yasr_description_archive_page()
123
  {
124
+ $name = __( 'Archive Pages', 'yet-another-stars-rating' );
125
  $div_desc = '<div class="yasr-settings-description">';
126
  $description = __( 'Enable or disable these settings if you want to show ratings in archive pages (categories, tags, etc.)', 'yet-another-stars-rating' );
127
  $end_div = '.</div>';
135
  */
136
  function yasr_description_vv_stats()
137
  {
138
+ $name = __( 'Show stats for visitors votes?', 'yet-another-stars-rating' );
139
  $div_desc = '<div class="yasr-settings-description">';
140
  $description = sprintf( __( 'Enable or disable the chart bar icon (and tooltip hover it) next to the %syasr_visitor_votes%s shortcode', 'yet-another-stars-rating' ), '<em>', '</em>' );
141
  $end_div = '.</div>';
149
  */
150
  function yasr_description_allow_vote()
151
  {
152
+ $name = __( 'Who is allowed to vote?', 'yet-another-stars-rating' );
153
  $div_desc = '<div class="yasr-settings-description">';
154
  $description = sprintf(
155
  __( 'Select who can rate your posts for %syasr_visitor_votes%s and %syasr_visitor_multiset%s shortcodes', 'yet-another-stars-rating' ),
169
  */
170
  function yasr_description_cstm_txt()
171
  {
172
+ $name = __( 'Custom texts', 'yet-another-stars-rating' );
173
  $div_desc = '<div class="yasr-settings-description">';
174
  $description = __( 'Auto insert custom texts to show before or after the stars', 'yet-another-stars-rating' );
175
  $end_div = '.</div>';
183
  */
184
  function yasr_description_strucutured_data()
185
  {
186
+ $name = __( 'Stuctured data options', 'yet-another-stars-rating' );
187
  $div_desc = '<div class="yasr-settings-description">';
188
  $description = __( 'If ratings in a post or page are found, YASR will create structured data to show them in search results
189
  (SERP)', 'yet-another-stars-rating' );
229
  ?></strong></li>
230
  </ul>
231
  <a href="<?php
232
+ echo esc_url( yasr_fs()->get_upgrade_url() ) ;
233
  ?>">
234
  <button class="button button-primary">
235
  <span style="font-size: large; font-weight: bold;">
243
  --- or ---
244
  </div>
245
  <a href="<?php
246
+ echo esc_url( yasr_fs()->get_trial_url() ) ;
247
  ?>">
248
  <button class="button button-primary">
249
  <span style="display: block; font-size: large; font-weight: bold; margin: -3px;">
377
  {
378
  $text = '<div style="text-align: center">';
379
  $text .= '<a href="https://wordpress.org/plugins/comments-not-replied-to/">';
380
+ $text .= '<img src="' . esc_attr( YASR_IMG_DIR ) . '/cnrt.png" alt="cnrt" width="110">';
381
  $text .= '<div>Comments Not Replied To</div>';
382
  $text .= '</a>';
383
  $text .= '</div>';
384
  $text .= '<div style="margin-top: 15px;">';
385
  $text .= __( '"Comments Not Replied To" introduces a new area in the administrative dashboard that allows you to
386
+ see what comments to which you - as the site author - have not yet replied.', 'yet-another-stars-rating' );
387
  $text .= '</div>';
388
  return $text;
389
  }
includes/img/cnrt.png ADDED
Binary file
includes/js/catch-inifite-scroll.js CHANGED
@@ -1 +1 @@
1
- (()=>{"use strict";function t(t,e){var a,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.1,s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],i=arguments.length>6&&void 0!==arguments[6]&&arguments[6];a=r||document.getElementById(e),t=parseInt(t),raterJs({starSize:t,showToolTip:!1,element:a,step:n,readOnly:s,rating:o,rateCallback:i})}function e(t){return null!=t&&""!==t||(t=!0),"true"!==t&&"1"!==t||(t=!0),"false"!==t&&"0"!==t||(t=!1),t}wp.i18n.__;for(var a=["yasr-rater-stars","yasr-multiset-visitors-rater"],r=0;r<a.length;r++)n(a[r]);function n(a){var r=document.getElementsByClassName(a);r.length>0&&("yasr-rater-stars"===a&&function(e){for(var a=0;a<e.length;a++)if(!1===e.item(a).classList.contains("yasr-star-rating")){var r=e.item(a),n=r.id;t(r.getAttribute("data-rater-starsize"),n,r)}}(r),"yasr-multiset-visitors-rater"===a&&function(a){for(var r="",n=[],s=0;s<a.length;s++)!function(s){if(!1===a.item(s).classList.contains("yasr-star-rating")){var o=a.item(s),i=o.id,l=o.getAttribute("data-rater-readonly");l=e(l);t(16,i,o,1,l,!1,(function(t,e){var a=o.getAttribute("data-rater-postid"),s=o.getAttribute("data-rater-setid"),i=o.getAttribute("data-rater-set-field-id");t=t.toFixed(1);var l=parseInt(t);this.setRating(l),r={postid:a,setid:s,field:i,rating:l},n.push(r),e()}))}}(s);jQuery(".yasr-send-visitor-multiset").on("click",(function(){var 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 r={action:"yasr_visitor_multiset_field_vote",nonce:a,post_id:t,rating:n,set_id:e};jQuery.post(yasrCommonData.ajaxurl,r,(function(a){var r;r=(a=JSON.parse(a)).text,jQuery("#yasr-loader-multiset-visitor-"+t+"-"+e).text(r)}))}))}(r))}var s,o,i=wp.i18n.__;function l(t){if(t.length>0&&(function(t){for(var a=0;a<t.length;a++)!function(a){if(!1===t.item(a).classList.contains("yasr-star-rating")){var r=t.item(a),n=r.getAttribute("data-rating"),s=r.getAttribute("data-readonly-attribute"),o=r.getAttribute("data-rater-readonly");null===s&&(s=!1),s=e(s),o=e(o),!0===s&&(o=!0);var l=r.getAttribute("data-rater-postid"),u=r.id,d=u.replace("yasr-visitor-votes-rater-",""),m=parseInt(r.getAttribute("data-rater-starsize")),g=r.getAttribute("data-rater-nonce"),y=r.getAttribute("data-issingular"),v="yasr-vv-votes-number-container-"+d,f="yasr-vv-average-container-"+d,p="yasr-vv-bottom-container-"+d,h="yasr-vv-loader-"+d,_=document.getElementById(v),b=document.getElementById(f),E=document.getElementById(p),R=document.getElementById(h);if("yes"===yasrCommonData.ajaxEnabled){null!==R&&(R.innerHTML=yasrCommonData.loaderHtml);var k={action:"yasr_load_vv",post_id:l};jQuery.get(yasrCommonData.ajaxurl,k).done((function(t){var e,a=JSON.parse(t);e=!0===s||a.yasr_visitor_votes.stars_attributes.read_only,n=(n=a.yasr_visitor_votes.number_of_votes>0?a.yasr_visitor_votes.sum_votes/a.yasr_visitor_votes.number_of_votes:0).toFixed(1),n=parseFloat(n),c(m,n,l,e,u,0,g,y,_,b,R,E),!0!==s&&(null!==_&&(_.innerHTML=a.yasr_visitor_votes.number_of_votes),null!==b&&(b.innerHTML=n),!1!==a.yasr_visitor_votes.stars_attributes.span_bottom&&null!==E&&(E.innerHTML=a.yasr_visitor_votes.stars_attributes.span_bottom,E.style.display=""))})).fail((function(t,e,a,r){console.info(i("YASR ajax call failed. Showing ratings from html","yet-another-stars-rating")),c(m,n,l,o,u,0,g,y,_,b,R,E),!0!==s&&(E.style.display="")}))}else c(m,n,l,o,u,0,g,y,_,b,R,E)}}(a)}(t),"yes"===yasrCommonData.visitorStatsEnabled)){var a=document.getElementsByClassName("yasr-dashicons-visitor-stats");a&&function(t){for(var e,a,r=!1,n=0;n<t.length;n++)!function(n){var s="#"+t.item(n).id,o=t.item(n).getAttribute("data-postid");0===n&&null!==(e=document.getElementsByClassName("yasr-vv-text-container"))&&(a=window.getComputedStyle(e[0],null).getPropertyValue("color")),a&&(document.getElementById(t.item(n).id).style.fill=a);var i={action:"yasr_stats_visitors_votes",post_id:o};tippy(s,{allowHTML:!0,content:'<span style="color: #0a0a0a">Loading...</span>',theme:"yasr",arrow:!0,arrowType:"round",onShow:function(t){s!==r&&jQuery.post(yasrCommonData.ajaxurl,i,(function(e){e=JSON.parse(e),t.setContent(u(e))}))},onHidden:function(){r=s}})}(n)}(a)}}function c(a,r,n,s,o,i,l,c,u,d,m,g){r=parseFloat(r),s=e(s);var y=document.getElementById(o);null!==m&&(m.innerHTML=""),t(a,o,y,1,s,r,(function(t,e){null!==m&&(m.innerHTML=yasrCommonData.loaderHtml);var a={action:"yasr_send_visitor_rating",rating:t,post_id:n,nonce_visitor:l,is_singular:c};this.setRating(t),this.disable(),jQuery.post(yasrCommonData.ajaxurl,a,(function(t){var e,a,r;"success"===(t=JSON.parse(t)).status?(e=t.number_of_votes,a=t.average_rating,r=t.rating_saved_text,null!==u&&(u.innerHTML=e),null!==d&&(d.innerHTML=a)):r=t.text,null!==g&&(g.innerHTML=r,g.style.display=""),null!==m&&(m.innerHTML="")})),e()}))}function u(t){var e=t.medium_rating;delete t.medium_rating;for(var a=0,r=1;r<=5;r++)(1===r||t[r].n_of_votes>a)&&(a=t[r].n_of_votes);var n=Math.log(a)*Math.LOG10E+1|0,s="5%";n<=3&&(s="5%"),n>3&&n<=5&&(s="10%"),n>5&&(s="15%");var o='<div class="yasr-visitors-stats-tooltip">';o+='<span id="yasr-medium-rating-tooltip">'+e+" "+i("out of 5 stars","yet-another-stars-rating")+"</span>",o+='<div class="yasr-progress-bars-container">';for(var l=i("stars","yet-another-stars-rating"),c=0,u=0,d=5;d>0;d--)1===d&&(l=i("star","yet-another-stars-rating")),void 0!==t[d]&&(c=t[d].progressbar,u=t[d].n_of_votes),o+="<div class='yasr-progress-bar-row-container yasr-w3-container'>\n <div class='yasr-progress-bar-name'>".concat(d," ").concat(l,"</div> \n <div class='yasr-single-progress-bar-container'> \n <div class='yasr-w3-border'> \n <div class='yasr-w3-amber' style='height:17px;width:").concat(c,"'></div> \n </div>\n </div> \n <div class='yasr-progress-bar-votes-count' style=\"flex-basis:").concat(s,' ">').concat(u,"</div>\n </div>");return o+"</div></div>"}l(document.getElementsByClassName("yasr-rater-stars-vv"));var d=new Uint8Array(16);function m(){if(!o&&!(o="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 o(d)}const g=/^(?:[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,y=function(t){return"string"==typeof t&&g.test(t)};for(var v=[],f=0;f<256;++f)v.push((f+256).toString(16).substr(1));const p=function(t,e,a){var r=(t=t||{}).random||(t.rng||m)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){a=a||0;for(var n=0;n<16;++n)e[a+n]=r[n];return e}return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(v[t[e+0]]+v[t[e+1]]+v[t[e+2]]+v[t[e+3]]+"-"+v[t[e+4]]+v[t[e+5]]+"-"+v[t[e+6]]+v[t[e+7]]+"-"+v[t[e+8]]+v[t[e+9]]+"-"+v[t[e+10]]+v[t[e+11]]+v[t[e+12]]+v[t[e+13]]+v[t[e+14]]+v[t[e+15]]).toLowerCase();if(!y(a))throw TypeError("Stringified UUID is invalid");return a}(r)};function h(t){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _(t,e){for(var a=0;a<e.length;a++){var r=e[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function b(t,e){return(b=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function E(t,e){return!e||"object"!==h(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function R(t){return(R=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var k=wp.i18n.__,I=wp.element.render;function w(e){var a="yasr-ranking-element-"+p(),r=document.getElementById(e.tableId).dataset.rankingSize;return React.createElement("div",{id:a,ref:function(){return t(r,a,!1,.1,!0,e.rating)}})}function C(t){if(void 0!==t.post.number_of_votes)return React.createElement("span",{className:"yasr-most-rated-text"},"[",k("Total:","yet-another-stars-rating")," ",t.post.number_of_votes,"  ",k("Average:","yet-another-stars-rating")," ",t.post.rating,"]");var e=t.text;return React.createElement("span",{className:"yasr-highest-rated-text"},e," ",t.post.rating)}function x(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===s&&(s=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),s.innerHTML=t;var e=s.textContent;return s.innerHTML="",e}(t.post.title)))}function L(t){var e="after",a=k("Rating:","yet-another-stars-rating"),r=new URLSearchParams(t.rankingParams);return null!==r.get("text_position")&&(e=r.get("text_position")),null!==r.get("custom_txt")&&(a=r.get("custom_txt")),"before"===e?React.createElement("td",{className:t.colClass},React.createElement(C,{post:t.post,tableId:t.tableId,text:a}),React.createElement(w,{rating:t.post.rating,tableId:t.tableId})):React.createElement("td",{className:t.colClass},React.createElement(w,{rating:t.post.rating,tableId:t.tableId}),React.createElement(C,{post:t.post,tableId:t.tableId,text:a}))}function B(t){var e="",a="";return"author_ranking"===t.source?(e="yasr-top-10-overall-left",a="yasr-top-10-overall-right"):"visitor_votes"===t.source&&(e="yasr-top-10-most-highest-left",a="yasr-top-10-most-highest-right"),React.createElement("tr",{className:t.trClass},React.createElement(x,{colClass:e,post:t.post}),React.createElement(L,{colClass:a,post:t.post,tableId:t.tableId,rankingParams:t.rankingParams}))}function T(t){return React.createElement("tbody",{id:t.tBodyId,style:{display:t.show}},t.data.map((function(e,a){var r="yasr-rankings-td-colored";return"author_ranking"===t.source&&(r="yasr-rankings-td-white"),a%2==0&&(r="yasr-rankings-td-white","author_ranking"===t.source&&(r="yasr-rankings-td-colored")),React.createElement(B,{key:e.post_id,source:t.source,tableId:t.tableId,rankingParams:t.rankingParams,post:e,trClass:r})})))}var S=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&b(t,e)}(o,React.Component);var e,a,r,n,s=(r=o,n=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(t){return!1}}(),function(){var t,e=R(r);if(n){var a=R(this).constructor;t=Reflect.construct(e,arguments,a)}else t=e.apply(this,arguments);return E(this,t)});function o(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(e=s.call(this,t)).state={error:null,isLoaded:!1,data:[],tableId:t.tableId,source:t.source,rankingParams:t.params,nonce:t.nonce},e}return e=o,(a=[{key:"componentDidMount",value:function(){var t=this,e=JSON.parse(document.getElementById(this.state.tableId).dataset.rankingData),a={};if("yes"!==yasrCommonData.ajaxEnabled)console.info(k("Ajax Disabled, getting data from source","yet-another-stars-rating")),this.setState({isLoaded:!0,data:e});else if(this.state.source){var r=this.returnRestUrl();Promise.all(r.map((function(t){return fetch(t).then((function(t){return!0===t.ok?t.json():(console.info(k("Ajax Call Failed. Getting data from source")),"KO")})).then((function(t){"KO"===t?a=e:"overall_rating"===t.source||"author_multi"===t.source?a="overall_rating"===t.source?t.data_overall:t.data_mv:a[t.show]=t.data_vv})).catch((function(t){a=e,console.info(k(t))}))}))).then((function(e){t.setState({isLoaded:!0,data:a})})).catch((function(e){console.info(k(e)),t.setState({isLoaded:!0,data:a})}))}else this.setState({error:k("Invalid Data Source","yet-another-stars-rating")})}},{key:"returnRestUrl",value:function(){var t,e=""!==this.state.rankingParams?this.state.rankingParams:"",a=this.state.source,r="&nonce_rankings="+this.state.nonce,n="";if(""!==e&&!1!==e){var s=new URLSearchParams(e);null!==s.get("order_by")&&(n+="order_by="+s.get("order_by")),null!==s.get("limit")&&(n+="&limit="+s.get("limit")),null!==s.get("start_date")&&"0"!==s.get("start_date")&&(n+="&start_date="+s.get("start_date")),null!==s.get("end_date")&&"0"!==s.get("end_date")&&(n+="&end_date="+s.get("end_date")),null!==s.get("ctg")?n+="&ctg="+s.get("ctg"):null!==s.get("cpt")&&(n+="&cpt="+s.get("cpt")),""!==n&&(n="&"+(n=n.replace(/\s+/g,""))),"visitor_multi"!==a&&"author_multi"!==a||null!==s.get("setid")&&(n+="&setid="+s.get("setid"))}else n="";if("author_ranking"===a||"author_multi"===a)t=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&source="+a+n+r];else{var o="",i="";if(""!==e){var l=new URLSearchParams(e);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]"))}t=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=most&source="+a+n+o+r,yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+a+n+i+r]}return t}},{key:"rankingTableHead",value:function(t,e){var a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a;if("author_ranking"!==t){var s=React.createElement("span",null,React.createElement("span",{id:r},k("Most Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:n,onClick:this.switchTBody.bind(this)},k("Highest Rated","yet-another-stars-rating")));return"highest"===e&&(s=React.createElement("span",null,React.createElement("span",{id:n},k("Highest Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:r,onClick:this.switchTBody.bind(this)},k("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,k("Post","yet-another-stars-rating")),React.createElement("th",null,k("Order By","yet-another-stars-rating"),":  ",s)))}return React.createElement(React.Fragment,null)}},{key:"switchTBody",value:function(t){t.preventDefault();var e=t.target.id,a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a,s="most-rated-posts-"+a,o="highest-rated-posts-"+a,i=document.getElementById(e),l=document.createElement("span");l.innerHTML=i.innerHTML,l.id=i.id,i.parentNode.replaceChild(l,i),e===r&&(document.getElementById(o).style.display="none",document.getElementById(s).style.display="",l=document.getElementById(n),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l)),e===n&&(document.getElementById(s).style.display="none",document.getElementById(o).style.display="",l=document.getElementById(r),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l))}},{key:"rankingTableBody",value:function(){var t=this.state,e=t.data,a=t.source,r=t.rankingParams;if("overall_rating"===a||"author_multi"===a)return React.createElement(T,{data:e,tableId:this.state.tableId,tBodyId:"overall_"+this.state.tableId,rankingParams:r,show:"table-row-group",source:a});var n=e.most,s=e.highest,o="table-row-group",i="none",l="most",c=o,u=i,d=new URLSearchParams(r);return null!==d.get("view")&&(l=d.get("view")),"highest"===l&&(c=i,u=o),React.createElement(React.Fragment,null,this.rankingTableHead(a,l),React.createElement(T,{data:n,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,rankingParams:r,show:c,source:a}),React.createElement(T,{data:s,tableId:this.state.tableId,tBodyId:"highest-rated-posts-"+this.state.tableId,rankingParams:r,show:u,source:a}))}},{key:"render",value:function(){var t=this.state,e=t.error,a=t.isLoaded;return e?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(e),"Error"))):!1===a?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,k("Loading Charts","yet-another-stars-rating")))):React.createElement(React.Fragment,null,this.rankingTableBody())}}])&&_(e.prototype,a),o}();function j(){var t=document.getElementsByClassName("yasr-stars-rankings");if(t.length>0)for(var e=0;e<t.length;e++){var a=t.item(e).id,r=JSON.parse(t.item(e).dataset.rankingSource),n=JSON.parse(t.item(e).dataset.rankingParams),s=JSON.parse(t.item(e).dataset.rankingNonce),o=document.getElementById(a);I(React.createElement(S,{source:r,tableId:a,params:n,nonce:s}),o)}}j(),jQuery(document).ajaxComplete((function(t,e,a){var r=yasrCommonData.siteUrl+"/page/";a.url.includes(r)&&(function(){for(var t=["yasr-rater-stars","yasr-multiset-visitors-rater"],e=0;e<t.length;e++)n(t[e])}(),l(document.getElementsByClassName("yasr-rater-stars-vv")),j())}))})();
1
+ (()=>{"use strict";function t(t,e){var a,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.1,s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],i=arguments.length>6&&void 0!==arguments[6]&&arguments[6];a=r||document.getElementById(e),t=parseInt(t),raterJs({starSize:t,showToolTip:!1,element:a,step:n,readOnly:s,rating:o,rateCallback:i})}function e(t){return null!=t&&""!==t||(t=!0),"true"!==t&&"1"!==t||(t=!0),"false"!==t&&"0"!==t||(t=!1),t}wp.i18n.__;for(var a=["yasr-rater-stars","yasr-multiset-visitors-rater"],r=0;r<a.length;r++)n(a[r]);function n(a){var r=document.getElementsByClassName(a);r.length>0&&("yasr-rater-stars"===a&&function(e){for(var a=0;a<e.length;a++)if(!1===e.item(a).classList.contains("yasr-star-rating")){var r=e.item(a),n=r.id;t(r.getAttribute("data-rater-starsize"),n,r)}}(r),"yasr-multiset-visitors-rater"===a&&function(a){for(var r="",n=[],s=0;s<a.length;s++)!function(s){if(!1===a.item(s).classList.contains("yasr-star-rating")){var o=a.item(s),i=o.id,l=o.getAttribute("data-rater-readonly");l=e(l);t(16,i,o,1,l,!1,(function(t,e){var a=o.getAttribute("data-rater-postid"),s=o.getAttribute("data-rater-setid"),i=o.getAttribute("data-rater-set-field-id");t=t.toFixed(1);var l=parseInt(t);this.setRating(l),r={postid:a,setid:s,field:i,rating:l},n.push(r),e()}))}}(s);jQuery(".yasr-send-visitor-multiset").on("click",(function(){var 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 r={action:"yasr_visitor_multiset_field_vote",nonce:a,post_id:t,rating:n,set_id:e};jQuery.post(yasrCommonData.ajaxurl,r,(function(a){var r;r=(a=JSON.parse(a)).text,jQuery("#yasr-loader-multiset-visitor-"+t+"-"+e).text(r)}))}))}(r))}var s,o,i=wp.i18n.__;function l(t){if(t.length>0&&(function(t){for(var a=0;a<t.length;a++)!function(a){if(!1===t.item(a).classList.contains("yasr-star-rating")){var r=t.item(a),n=r.getAttribute("data-rating"),s=r.getAttribute("data-readonly-attribute"),o=r.getAttribute("data-rater-readonly");null===s&&(s=!1),s=e(s),o=e(o),!0===s&&(o=!0);var l=r.getAttribute("data-rater-postid"),u=r.id,d=u.replace("yasr-visitor-votes-rater-",""),m=parseInt(r.getAttribute("data-rater-starsize")),g=r.getAttribute("data-rater-nonce"),y=r.getAttribute("data-issingular"),v="yasr-vv-votes-number-container-"+d,f="yasr-vv-average-container-"+d,p="yasr-vv-bottom-container-"+d,h="yasr-vv-loader-"+d,_=document.getElementById(v),b=document.getElementById(f),E=document.getElementById(p),R=document.getElementById(h);if("yes"===yasrCommonData.ajaxEnabled){null!==R&&(R.innerHTML=yasrCommonData.loaderHtml);var k={action:"yasr_load_vv",post_id:l};jQuery.get(yasrCommonData.ajaxurl,k).done((function(t){var e,a=JSON.parse(t);e=!0===s||a.yasr_visitor_votes.stars_attributes.read_only,n=(n=a.yasr_visitor_votes.number_of_votes>0?a.yasr_visitor_votes.sum_votes/a.yasr_visitor_votes.number_of_votes:0).toFixed(1),n=parseFloat(n),c(m,n,l,e,u,0,g,y,_,b,R,E),!0!==s&&(null!==_&&(_.innerHTML=a.yasr_visitor_votes.number_of_votes),null!==b&&(b.innerHTML=n),!1!==a.yasr_visitor_votes.stars_attributes.span_bottom&&null!==E&&(E.innerHTML=a.yasr_visitor_votes.stars_attributes.span_bottom,E.style.display=""))})).fail((function(t,e,a,r){console.info(i("YASR ajax call failed. Showing ratings from html","yet-another-stars-rating")),c(m,n,l,o,u,0,g,y,_,b,R,E),!0!==s&&(E.style.display="")}))}else c(m,n,l,o,u,0,g,y,_,b,R,E)}}(a)}(t),"yes"===yasrCommonData.visitorStatsEnabled)){var a=document.getElementsByClassName("yasr-dashicons-visitor-stats");a&&function(t){for(var e,a,r=!1,n=0;n<t.length;n++)!function(n){var s="#"+t.item(n).id,o=t.item(n).getAttribute("data-postid");0===n&&null!==(e=document.getElementsByClassName("yasr-vv-text-container"))&&(a=window.getComputedStyle(e[0],null).getPropertyValue("color")),a&&(document.getElementById(t.item(n).id).style.fill=a);var i={action:"yasr_stats_visitors_votes",post_id:o};tippy(s,{allowHTML:!0,content:'<span style="color: #0a0a0a">Loading...</span>',theme:"yasr",arrow:!0,arrowType:"round",onShow:function(t){s!==r&&jQuery.post(yasrCommonData.ajaxurl,i,(function(e){e=JSON.parse(e),t.setContent(u(e))}))},onHidden:function(){r=s}})}(n)}(a)}}function c(a,r,n,s,o,i,l,c,u,d,m,g){r=parseFloat(r),s=e(s);var y=document.getElementById(o);null!==m&&(m.innerHTML=""),t(a,o,y,1,s,r,(function(t,e){null!==m&&(m.innerHTML=yasrCommonData.loaderHtml);var a={action:"yasr_send_visitor_rating",rating:t,post_id:n,nonce_visitor:l,is_singular:c};this.setRating(t),this.disable(),jQuery.post(yasrCommonData.ajaxurl,a,(function(t){var e,a,r;"success"===(t=JSON.parse(t)).status?(e=t.number_of_votes,a=t.average_rating,r=t.rating_saved_text,null!==u&&(u.innerHTML=e),null!==d&&(d.innerHTML=a)):r=t.text,null!==g&&(g.innerHTML=r,g.style.display=""),null!==m&&(m.innerHTML="")})),e()}))}function u(t){var e=t.medium_rating;delete t.medium_rating;for(var a=0,r=1;r<=5;r++)(1===r||t[r].n_of_votes>a)&&(a=t[r].n_of_votes);var n=Math.log(a)*Math.LOG10E+1|0,s="5%";n<=3&&(s="5%"),n>3&&n<=5&&(s="10%"),n>5&&(s="15%");var o='<div class="yasr-visitors-stats-tooltip">';o+='<span id="yasr-medium-rating-tooltip">'+e+" "+i("out of 5 stars","yet-another-stars-rating")+"</span>",o+='<div class="yasr-progress-bars-container">';for(var l=i("stars","yet-another-stars-rating"),c=0,u=0,d=5;d>0;d--)1===d&&(l=i("star","yet-another-stars-rating")),void 0!==t[d]&&(c=t[d].progressbar,u=t[d].n_of_votes),o+="<div class='yasr-progress-bar-row-container yasr-w3-container'>\n <div class='yasr-progress-bar-name'>".concat(d," ").concat(l,"</div> \n <div class='yasr-single-progress-bar-container'> \n <div class='yasr-w3-border'> \n <div class='yasr-w3-amber' style='height:17px;width:").concat(c,"'></div> \n </div>\n </div> \n <div class='yasr-progress-bar-votes-count' style=\"flex-basis:").concat(s,' ">').concat(u,"</div>\n </div>");return o+"</div></div>"}l(document.getElementsByClassName("yasr-rater-stars-vv"));var d=new Uint8Array(16);function m(){if(!o&&!(o="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 o(d)}const g=/^(?:[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,y=function(t){return"string"==typeof t&&g.test(t)};for(var v=[],f=0;f<256;++f)v.push((f+256).toString(16).substr(1));const p=function(t,e,a){var r=(t=t||{}).random||(t.rng||m)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){a=a||0;for(var n=0;n<16;++n)e[a+n]=r[n];return e}return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(v[t[e+0]]+v[t[e+1]]+v[t[e+2]]+v[t[e+3]]+"-"+v[t[e+4]]+v[t[e+5]]+"-"+v[t[e+6]]+v[t[e+7]]+"-"+v[t[e+8]]+v[t[e+9]]+"-"+v[t[e+10]]+v[t[e+11]]+v[t[e+12]]+v[t[e+13]]+v[t[e+14]]+v[t[e+15]]).toLowerCase();if(!y(a))throw TypeError("Stringified UUID is invalid");return a}(r)};function h(t){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h(t)}function _(t,e){for(var a=0;a<e.length;a++){var r=e[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function b(t,e){return b=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},b(t,e)}function E(t,e){if(e&&("object"===h(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function R(t){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},R(t)}var k=wp.i18n.__,I=wp.element.render;function w(e){var a="yasr-ranking-element-"+p(),r=document.getElementById(e.tableId).dataset.rankingSize;return React.createElement("div",{id:a,ref:function(){return t(r,a,!1,.1,!0,e.rating)}})}function C(t){if(void 0!==t.post.number_of_votes)return React.createElement("span",{className:"yasr-most-rated-text"},"[",k("Total:","yet-another-stars-rating")," ",t.post.number_of_votes,"  ",k("Average:","yet-another-stars-rating")," ",t.post.rating,"]");var e=t.text;return React.createElement("span",{className:"yasr-highest-rated-text"},e," ",t.post.rating)}function x(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===s&&(s=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),s.innerHTML=t;var e=s.textContent;return s.innerHTML="",e}(t.post.title)))}function L(t){var e="after",a=k("Rating:","yet-another-stars-rating"),r=new URLSearchParams(t.rankingParams);return null!==r.get("text_position")&&(e=r.get("text_position")),null!==r.get("custom_txt")&&(a=r.get("custom_txt")),"before"===e?React.createElement("td",{className:t.colClass},React.createElement(C,{post:t.post,tableId:t.tableId,text:a}),React.createElement(w,{rating:t.post.rating,tableId:t.tableId})):React.createElement("td",{className:t.colClass},React.createElement(w,{rating:t.post.rating,tableId:t.tableId}),React.createElement(C,{post:t.post,tableId:t.tableId,text:a}))}function T(t){var e="",a="";return"author_ranking"===t.source?(e="yasr-top-10-overall-left",a="yasr-top-10-overall-right"):"visitor_votes"===t.source&&(e="yasr-top-10-most-highest-left",a="yasr-top-10-most-highest-right"),React.createElement("tr",{className:t.trClass},React.createElement(x,{colClass:e,post:t.post}),React.createElement(L,{colClass:a,post:t.post,tableId:t.tableId,rankingParams:t.rankingParams}))}function B(t){return React.createElement("tbody",{id:t.tBodyId,style:{display:t.show}},t.data.map((function(e,a){var r="yasr-rankings-td-colored";return"author_ranking"===t.source&&(r="yasr-rankings-td-white"),a%2==0&&(r="yasr-rankings-td-white","author_ranking"===t.source&&(r="yasr-rankings-td-colored")),React.createElement(T,{key:e.post_id,source:t.source,tableId:t.tableId,rankingParams:t.rankingParams,post:e,trClass:r})})))}var S=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&b(t,e)}(o,React.Component);var e,a,r,n,s=(r=o,n=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(t){return!1}}(),function(){var t,e=R(r);if(n){var a=R(this).constructor;t=Reflect.construct(e,arguments,a)}else t=e.apply(this,arguments);return E(this,t)});function o(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(e=s.call(this,t)).state={error:null,isLoaded:!1,data:[],tableId:t.tableId,source:t.source,rankingParams:t.params,nonce:t.nonce},e}return e=o,(a=[{key:"componentDidMount",value:function(){var t=this,e=JSON.parse(document.getElementById(this.state.tableId).dataset.rankingData),a={};if("yes"!==yasrCommonData.ajaxEnabled)console.info(k("Ajax Disabled, getting data from source","yet-another-stars-rating")),this.setState({isLoaded:!0,data:e});else if(this.state.source){var r=this.returnRestUrl();Promise.all(r.map((function(t){return fetch(t).then((function(t){return!0===t.ok?t.json():(console.info(k("Ajax Call Failed. Getting data from source")),"KO")})).then((function(t){"KO"===t?a=e:"overall_rating"===t.source||"author_multi"===t.source?a="overall_rating"===t.source?t.data_overall:t.data_mv:a[t.show]=t.data_vv})).catch((function(t){a=e,console.info(k(t))}))}))).then((function(e){t.setState({isLoaded:!0,data:a})})).catch((function(e){console.info(k(e)),t.setState({isLoaded:!0,data:a})}))}else this.setState({error:k("Invalid Data Source","yet-another-stars-rating")})}},{key:"returnRestUrl",value:function(){var t,e=""!==this.state.rankingParams?this.state.rankingParams:"",a=this.state.source,r="&nonce_rankings="+this.state.nonce,n="";if(""!==e&&!1!==e){var s=new URLSearchParams(e);null!==s.get("order_by")&&(n+="order_by="+s.get("order_by")),null!==s.get("limit")&&(n+="&limit="+s.get("limit")),null!==s.get("start_date")&&"0"!==s.get("start_date")&&(n+="&start_date="+s.get("start_date")),null!==s.get("end_date")&&"0"!==s.get("end_date")&&(n+="&end_date="+s.get("end_date")),null!==s.get("ctg")?n+="&ctg="+s.get("ctg"):null!==s.get("cpt")&&(n+="&cpt="+s.get("cpt")),""!==n&&(n="&"+(n=n.replace(/\s+/g,""))),"visitor_multi"!==a&&"author_multi"!==a||null!==s.get("setid")&&(n+="&setid="+s.get("setid"))}else n="";if("author_ranking"===a||"author_multi"===a)t=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&source="+a+n+r];else{var o="",i="";if(""!==e){var l=new URLSearchParams(e);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]"))}t=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=most&source="+a+n+o+r,yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+a+n+i+r]}return t}},{key:"rankingTableHead",value:function(t,e){var a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a;if("author_ranking"!==t){var s=React.createElement("span",null,React.createElement("span",{id:r},k("Most Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:n,onClick:this.switchTBody.bind(this)},k("Highest Rated","yet-another-stars-rating")));return"highest"===e&&(s=React.createElement("span",null,React.createElement("span",{id:n},k("Highest Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:r,onClick:this.switchTBody.bind(this)},k("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,k("Post","yet-another-stars-rating")),React.createElement("th",null,k("Order By","yet-another-stars-rating"),":  ",s)))}return React.createElement(React.Fragment,null)}},{key:"switchTBody",value:function(t){t.preventDefault();var e=t.target.id,a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a,s="most-rated-posts-"+a,o="highest-rated-posts-"+a,i=document.getElementById(e),l=document.createElement("span");l.innerHTML=i.innerHTML,l.id=i.id,i.parentNode.replaceChild(l,i),e===r&&(document.getElementById(o).style.display="none",document.getElementById(s).style.display="",l=document.getElementById(n),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l)),e===n&&(document.getElementById(s).style.display="none",document.getElementById(o).style.display="",l=document.getElementById(r),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l))}},{key:"rankingTableBody",value:function(){var t=this.state,e=t.data,a=t.source,r=t.rankingParams;if("overall_rating"===a||"author_multi"===a)return React.createElement(B,{data:e,tableId:this.state.tableId,tBodyId:"overall_"+this.state.tableId,rankingParams:r,show:"table-row-group",source:a});var n=e.most,s=e.highest,o="table-row-group",i="none",l="most",c=o,u=i,d=new URLSearchParams(r);return null!==d.get("view")&&(l=d.get("view")),"highest"===l&&(c=i,u=o),React.createElement(React.Fragment,null,this.rankingTableHead(a,l),React.createElement(B,{data:n,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,rankingParams:r,show:c,source:a}),React.createElement(B,{data:s,tableId:this.state.tableId,tBodyId:"highest-rated-posts-"+this.state.tableId,rankingParams:r,show:u,source:a}))}},{key:"render",value:function(){var t=this.state,e=t.error,a=t.isLoaded;return e?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(e),"Error"))):!1===a?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,k("Loading Charts","yet-another-stars-rating")))):React.createElement(React.Fragment,null,this.rankingTableBody())}}])&&_(e.prototype,a),o}();function j(){var t=document.getElementsByClassName("yasr-stars-rankings");if(t.length>0)for(var e=0;e<t.length;e++){var a=t.item(e).id,r=JSON.parse(t.item(e).dataset.rankingSource),n=JSON.parse(t.item(e).dataset.rankingParams),s=JSON.parse(t.item(e).dataset.rankingNonce),o=document.getElementById(a);I(React.createElement(S,{source:r,tableId:a,params:n,nonce:s}),o)}}j(),jQuery(document).ajaxComplete((function(t,e,a){var r=yasrCommonData.siteUrl+"/page/";a.url.includes(r)&&(function(){for(var t=["yasr-rater-stars","yasr-multiset-visitors-rater"],e=0;e<t.length;e++)n(t[e])}(),l(document.getElementsByClassName("yasr-rater-stars-vv")),j())}))})();
includes/js/shortcodes/rankings.js CHANGED
@@ -1 +1 @@
1
- (()=>{"use strict";var t,e,a=new Uint8Array(16);function n(){if(!e&&!(e="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 e(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,o=function(t){return"string"==typeof t&&r.test(t)};for(var s=[],i=0;i<256;++i)s.push((i+256).toString(16).substr(1));const l=function(t,e,a){var r=(t=t||{}).random||(t.rng||n)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){a=a||0;for(var i=0;i<16;++i)e[a+i]=r[i];return e}return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(s[t[e+0]]+s[t[e+1]]+s[t[e+2]]+s[t[e+3]]+"-"+s[t[e+4]]+s[t[e+5]]+"-"+s[t[e+6]]+s[t[e+7]]+"-"+s[t[e+8]]+s[t[e+9]]+"-"+s[t[e+10]]+s[t[e+11]]+s[t[e+12]]+s[t[e+13]]+s[t[e+14]]+s[t[e+15]]).toLowerCase();if(!o(a))throw TypeError("Stringified UUID is invalid");return a}(r)};function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){for(var a=0;a<e.length;a++){var n=e[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function d(t,e){return(d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function m(t,e){return!e||"object"!==c(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function g(t){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=wp.i18n.__,f=wp.element.render;function p(t){var e="yasr-ranking-element-"+l(),a=document.getElementById(t.tableId).dataset.rankingSize;return React.createElement("div",{id:e,ref:function(){return function(t,e){var a,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.1,r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];a=arguments.length>2&&void 0!==arguments[2]&&arguments[2]||document.getElementById(e),t=parseInt(t),raterJs({starSize:t,showToolTip:!1,element:a,step:n,readOnly:r,rating:o,rateCallback:s})}(a,e,!1,.1,!0,t.rating)}})}function y(t){if(void 0!==t.post.number_of_votes)return React.createElement("span",{className:"yasr-most-rated-text"},"[",h("Total:","yet-another-stars-rating")," ",t.post.number_of_votes,"  ",h("Average:","yet-another-stars-rating")," ",t.post.rating,"]");var e=t.text;return React.createElement("span",{className:"yasr-highest-rated-text"},e," ",t.post.rating)}function v(e){return React.createElement("td",{className:e.colClass},React.createElement("a",{href:e.post.link},function(e){if("string"!=typeof e||-1===e.indexOf("&"))return e;void 0===t&&(t=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),t.innerHTML=e;var a=t.textContent;return t.innerHTML="",a}(e.post.title)))}function b(t){var e="after",a=h("Rating:","yet-another-stars-rating"),n=new URLSearchParams(t.rankingParams);return null!==n.get("text_position")&&(e=n.get("text_position")),null!==n.get("custom_txt")&&(a=n.get("custom_txt")),"before"===e?React.createElement("td",{className:t.colClass},React.createElement(y,{post:t.post,tableId:t.tableId,text:a}),React.createElement(p,{rating:t.post.rating,tableId:t.tableId})):React.createElement("td",{className:t.colClass},React.createElement(p,{rating:t.post.rating,tableId:t.tableId}),React.createElement(y,{post:t.post,tableId:t.tableId,text:a}))}function R(t){var e="",a="";return"author_ranking"===t.source?(e="yasr-top-10-overall-left",a="yasr-top-10-overall-right"):"visitor_votes"===t.source&&(e="yasr-top-10-most-highest-left",a="yasr-top-10-most-highest-right"),React.createElement("tr",{className:t.trClass},React.createElement(v,{colClass:e,post:t.post}),React.createElement(b,{colClass:a,post:t.post,tableId:t.tableId,rankingParams:t.rankingParams}))}function E(t){return React.createElement("tbody",{id:t.tBodyId,style:{display:t.show}},t.data.map((function(e,a){var n="yasr-rankings-td-colored";return"author_ranking"===t.source&&(n="yasr-rankings-td-white"),a%2==0&&(n="yasr-rankings-td-white","author_ranking"===t.source&&(n="yasr-rankings-td-colored")),React.createElement(R,{key:e.post_id,source:t.source,tableId:t.tableId,rankingParams:t.rankingParams,post:e,trClass:n})})))}var _=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&d(t,e)}(s,React.Component);var e,a,n,r,o=(n=s,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(t){return!1}}(),function(){var t,e=g(n);if(r){var a=g(this).constructor;t=Reflect.construct(e,arguments,a)}else t=e.apply(this,arguments);return m(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(e=o.call(this,t)).state={error:null,isLoaded:!1,data:[],tableId:t.tableId,source:t.source,rankingParams:t.params,nonce:t.nonce},e}return e=s,(a=[{key:"componentDidMount",value:function(){var t=this,e=JSON.parse(document.getElementById(this.state.tableId).dataset.rankingData),a={};if("yes"!==yasrCommonData.ajaxEnabled)console.info(h("Ajax Disabled, getting data from source","yet-another-stars-rating")),this.setState({isLoaded:!0,data:e});else if(this.state.source){var n=this.returnRestUrl();Promise.all(n.map((function(t){return fetch(t).then((function(t){return!0===t.ok?t.json():(console.info(h("Ajax Call Failed. Getting data from source")),"KO")})).then((function(t){"KO"===t?a=e:"overall_rating"===t.source||"author_multi"===t.source?a="overall_rating"===t.source?t.data_overall:t.data_mv:a[t.show]=t.data_vv})).catch((function(t){a=e,console.info(h(t))}))}))).then((function(e){t.setState({isLoaded:!0,data:a})})).catch((function(e){console.info(h(e)),t.setState({isLoaded:!0,data:a})}))}else this.setState({error:h("Invalid Data Source","yet-another-stars-rating")})}},{key:"returnRestUrl",value:function(){var t,e=""!==this.state.rankingParams?this.state.rankingParams:"",a=this.state.source,n="&nonce_rankings="+this.state.nonce,r="";if(""!==e&&!1!==e){var o=new URLSearchParams(e);null!==o.get("order_by")&&(r+="order_by="+o.get("order_by")),null!==o.get("limit")&&(r+="&limit="+o.get("limit")),null!==o.get("start_date")&&"0"!==o.get("start_date")&&(r+="&start_date="+o.get("start_date")),null!==o.get("end_date")&&"0"!==o.get("end_date")&&(r+="&end_date="+o.get("end_date")),null!==o.get("ctg")?r+="&ctg="+o.get("ctg"):null!==o.get("cpt")&&(r+="&cpt="+o.get("cpt")),""!==r&&(r="&"+(r=r.replace(/\s+/g,""))),"visitor_multi"!==a&&"author_multi"!==a||null!==o.get("setid")&&(r+="&setid="+o.get("setid"))}else r="";if("author_ranking"===a||"author_multi"===a)t=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&source="+a+r+n];else{var s="",i="";if(""!==e){var l=new URLSearchParams(e);null!==l.get("required_votes[most]")&&(s="&required_votes="+l.get("required_votes[most]")),null!==l.get("required_votes[highest]")&&(i="&required_votes="+l.get("required_votes[highest]"))}t=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=most&source="+a+r+s+n,yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+a+r+i+n]}return t}},{key:"rankingTableHead",value:function(t,e){var a=this.state.tableId,n="link-most-rated-posts-"+a,r="link-highest-rated-posts-"+a;if("author_ranking"!==t){var o=React.createElement("span",null,React.createElement("span",{id:n},h("Most Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:r,onClick:this.switchTBody.bind(this)},h("Highest Rated","yet-another-stars-rating")));return"highest"===e&&(o=React.createElement("span",null,React.createElement("span",{id:r},h("Highest Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:n,onClick:this.switchTBody.bind(this)},h("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,h("Post","yet-another-stars-rating")),React.createElement("th",null,h("Order By","yet-another-stars-rating"),":  ",o)))}return React.createElement(React.Fragment,null)}},{key:"switchTBody",value:function(t){t.preventDefault();var e=t.target.id,a=this.state.tableId,n="link-most-rated-posts-"+a,r="link-highest-rated-posts-"+a,o="most-rated-posts-"+a,s="highest-rated-posts-"+a,i=document.getElementById(e),l=document.createElement("span");l.innerHTML=i.innerHTML,l.id=i.id,i.parentNode.replaceChild(l,i),e===n&&(document.getElementById(s).style.display="none",document.getElementById(o).style.display="",l=document.getElementById(r),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l)),e===r&&(document.getElementById(o).style.display="none",document.getElementById(s).style.display="",l=document.getElementById(n),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l))}},{key:"rankingTableBody",value:function(){var t=this.state,e=t.data,a=t.source,n=t.rankingParams;if("overall_rating"===a||"author_multi"===a)return React.createElement(E,{data:e,tableId:this.state.tableId,tBodyId:"overall_"+this.state.tableId,rankingParams:n,show:"table-row-group",source:a});var r=e.most,o=e.highest,s="table-row-group",i="none",l="most",c=s,u=i,d=new URLSearchParams(n);return null!==d.get("view")&&(l=d.get("view")),"highest"===l&&(c=i,u=s),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:c,source:a}),React.createElement(E,{data:o,tableId:this.state.tableId,tBodyId:"highest-rated-posts-"+this.state.tableId,rankingParams:n,show:u,source:a}))}},{key:"render",value:function(){var t=this.state,e=t.error,a=t.isLoaded;return e?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(e),"Error"))):!1===a?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,h("Loading Charts","yet-another-stars-rating")))):React.createElement(React.Fragment,null,this.rankingTableBody())}}])&&u(e.prototype,a),s}();!function(){var t=document.getElementsByClassName("yasr-stars-rankings");if(t.length>0)for(var e=0;e<t.length;e++){var a=t.item(e).id,n=JSON.parse(t.item(e).dataset.rankingSource),r=JSON.parse(t.item(e).dataset.rankingParams),o=JSON.parse(t.item(e).dataset.rankingNonce),s=document.getElementById(a);f(React.createElement(_,{source:n,tableId:a,params:r,nonce:o}),s)}}()})();
1
+ (()=>{"use strict";var t,e,a=new Uint8Array(16);function r(){if(!e&&!(e="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 e(a)}const n=/^(?:[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,o=function(t){return"string"==typeof t&&n.test(t)};for(var s=[],i=0;i<256;++i)s.push((i+256).toString(16).substr(1));const l=function(t,e,a){var n=(t=t||{}).random||(t.rng||r)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,e){a=a||0;for(var i=0;i<16;++i)e[a+i]=n[i];return e}return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(s[t[e+0]]+s[t[e+1]]+s[t[e+2]]+s[t[e+3]]+"-"+s[t[e+4]]+s[t[e+5]]+"-"+s[t[e+6]]+s[t[e+7]]+"-"+s[t[e+8]]+s[t[e+9]]+"-"+s[t[e+10]]+s[t[e+11]]+s[t[e+12]]+s[t[e+13]]+s[t[e+14]]+s[t[e+15]]).toLowerCase();if(!o(a))throw TypeError("Stringified UUID is invalid");return a}(n)};function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function u(t,e){for(var a=0;a<e.length;a++){var r=e[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function d(t,e){return d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},d(t,e)}function m(t,e){if(e&&("object"===c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function g(t){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},g(t)}var h=wp.i18n.__,f=wp.element.render;function y(t){var e="yasr-ranking-element-"+l(),a=document.getElementById(t.tableId).dataset.rankingSize;return React.createElement("div",{id:e,ref:function(){return function(t,e){var a,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.1,n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];a=arguments.length>2&&void 0!==arguments[2]&&arguments[2]||document.getElementById(e),t=parseInt(t),raterJs({starSize:t,showToolTip:!1,element:a,step:r,readOnly:n,rating:o,rateCallback:s})}(a,e,!1,.1,!0,t.rating)}})}function p(t){if(void 0!==t.post.number_of_votes)return React.createElement("span",{className:"yasr-most-rated-text"},"[",h("Total:","yet-another-stars-rating")," ",t.post.number_of_votes,"  ",h("Average:","yet-another-stars-rating")," ",t.post.rating,"]");var e=t.text;return React.createElement("span",{className:"yasr-highest-rated-text"},e," ",t.post.rating)}function v(e){return React.createElement("td",{className:e.colClass},React.createElement("a",{href:e.post.link},function(e){if("string"!=typeof e||-1===e.indexOf("&"))return e;void 0===t&&(t=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),t.innerHTML=e;var a=t.textContent;return t.innerHTML="",a}(e.post.title)))}function b(t){var e="after",a=h("Rating:","yet-another-stars-rating"),r=new URLSearchParams(t.rankingParams);return null!==r.get("text_position")&&(e=r.get("text_position")),null!==r.get("custom_txt")&&(a=r.get("custom_txt")),"before"===e?React.createElement("td",{className:t.colClass},React.createElement(p,{post:t.post,tableId:t.tableId,text:a}),React.createElement(y,{rating:t.post.rating,tableId:t.tableId})):React.createElement("td",{className:t.colClass},React.createElement(y,{rating:t.post.rating,tableId:t.tableId}),React.createElement(p,{post:t.post,tableId:t.tableId,text:a}))}function R(t){var e="",a="";return"author_ranking"===t.source?(e="yasr-top-10-overall-left",a="yasr-top-10-overall-right"):"visitor_votes"===t.source&&(e="yasr-top-10-most-highest-left",a="yasr-top-10-most-highest-right"),React.createElement("tr",{className:t.trClass},React.createElement(v,{colClass:e,post:t.post}),React.createElement(b,{colClass:a,post:t.post,tableId:t.tableId,rankingParams:t.rankingParams}))}function E(t){return React.createElement("tbody",{id:t.tBodyId,style:{display:t.show}},t.data.map((function(e,a){var r="yasr-rankings-td-colored";return"author_ranking"===t.source&&(r="yasr-rankings-td-white"),a%2==0&&(r="yasr-rankings-td-white","author_ranking"===t.source&&(r="yasr-rankings-td-colored")),React.createElement(R,{key:e.post_id,source:t.source,tableId:t.tableId,rankingParams:t.rankingParams,post:e,trClass:r})})))}var _=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&d(t,e)}(s,React.Component);var e,a,r,n,o=(r=s,n=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(t){return!1}}(),function(){var t,e=g(r);if(n){var a=g(this).constructor;t=Reflect.construct(e,arguments,a)}else t=e.apply(this,arguments);return m(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(e=o.call(this,t)).state={error:null,isLoaded:!1,data:[],tableId:t.tableId,source:t.source,rankingParams:t.params,nonce:t.nonce},e}return e=s,(a=[{key:"componentDidMount",value:function(){var t=this,e=JSON.parse(document.getElementById(this.state.tableId).dataset.rankingData),a={};if("yes"!==yasrCommonData.ajaxEnabled)console.info(h("Ajax Disabled, getting data from source","yet-another-stars-rating")),this.setState({isLoaded:!0,data:e});else if(this.state.source){var r=this.returnRestUrl();Promise.all(r.map((function(t){return fetch(t).then((function(t){return!0===t.ok?t.json():(console.info(h("Ajax Call Failed. Getting data from source")),"KO")})).then((function(t){"KO"===t?a=e:"overall_rating"===t.source||"author_multi"===t.source?a="overall_rating"===t.source?t.data_overall:t.data_mv:a[t.show]=t.data_vv})).catch((function(t){a=e,console.info(h(t))}))}))).then((function(e){t.setState({isLoaded:!0,data:a})})).catch((function(e){console.info(h(e)),t.setState({isLoaded:!0,data:a})}))}else this.setState({error:h("Invalid Data Source","yet-another-stars-rating")})}},{key:"returnRestUrl",value:function(){var t,e=""!==this.state.rankingParams?this.state.rankingParams:"",a=this.state.source,r="&nonce_rankings="+this.state.nonce,n="";if(""!==e&&!1!==e){var o=new URLSearchParams(e);null!==o.get("order_by")&&(n+="order_by="+o.get("order_by")),null!==o.get("limit")&&(n+="&limit="+o.get("limit")),null!==o.get("start_date")&&"0"!==o.get("start_date")&&(n+="&start_date="+o.get("start_date")),null!==o.get("end_date")&&"0"!==o.get("end_date")&&(n+="&end_date="+o.get("end_date")),null!==o.get("ctg")?n+="&ctg="+o.get("ctg"):null!==o.get("cpt")&&(n+="&cpt="+o.get("cpt")),""!==n&&(n="&"+(n=n.replace(/\s+/g,""))),"visitor_multi"!==a&&"author_multi"!==a||null!==o.get("setid")&&(n+="&setid="+o.get("setid"))}else n="";if("author_ranking"===a||"author_multi"===a)t=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&source="+a+n+r];else{var s="",i="";if(""!==e){var l=new URLSearchParams(e);null!==l.get("required_votes[most]")&&(s="&required_votes="+l.get("required_votes[most]")),null!==l.get("required_votes[highest]")&&(i="&required_votes="+l.get("required_votes[highest]"))}t=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=most&source="+a+n+s+r,yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+a+n+i+r]}return t}},{key:"rankingTableHead",value:function(t,e){var a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a;if("author_ranking"!==t){var o=React.createElement("span",null,React.createElement("span",{id:r},h("Most Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:n,onClick:this.switchTBody.bind(this)},h("Highest Rated","yet-another-stars-rating")));return"highest"===e&&(o=React.createElement("span",null,React.createElement("span",{id:n},h("Highest Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:r,onClick:this.switchTBody.bind(this)},h("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,h("Post","yet-another-stars-rating")),React.createElement("th",null,h("Order By","yet-another-stars-rating"),":  ",o)))}return React.createElement(React.Fragment,null)}},{key:"switchTBody",value:function(t){t.preventDefault();var e=t.target.id,a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a,o="most-rated-posts-"+a,s="highest-rated-posts-"+a,i=document.getElementById(e),l=document.createElement("span");l.innerHTML=i.innerHTML,l.id=i.id,i.parentNode.replaceChild(l,i),e===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)),e===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))}},{key:"rankingTableBody",value:function(){var t=this.state,e=t.data,a=t.source,r=t.rankingParams;if("overall_rating"===a||"author_multi"===a)return React.createElement(E,{data:e,tableId:this.state.tableId,tBodyId:"overall_"+this.state.tableId,rankingParams:r,show:"table-row-group",source:a});var n=e.most,o=e.highest,s="table-row-group",i="none",l="most",c=s,u=i,d=new URLSearchParams(r);return null!==d.get("view")&&(l=d.get("view")),"highest"===l&&(c=i,u=s),React.createElement(React.Fragment,null,this.rankingTableHead(a,l),React.createElement(E,{data:n,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,rankingParams:r,show:c,source:a}),React.createElement(E,{data:o,tableId:this.state.tableId,tBodyId:"highest-rated-posts-"+this.state.tableId,rankingParams:r,show:u,source:a}))}},{key:"render",value:function(){var t=this.state,e=t.error,a=t.isLoaded;return e?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(e),"Error"))):!1===a?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,h("Loading Charts","yet-another-stars-rating")))):React.createElement(React.Fragment,null,this.rankingTableBody())}}])&&u(e.prototype,a),s}();!function(){var t=document.getElementsByClassName("yasr-stars-rankings");if(t.length>0)for(var e=0;e<t.length;e++){var a=t.item(e).id,r=JSON.parse(t.item(e).dataset.rankingSource),n=JSON.parse(t.item(e).dataset.rankingParams),o=JSON.parse(t.item(e).dataset.rankingNonce),s=document.getElementById(a);f(React.createElement(_,{source:r,tableId:a,params:n,nonce:o}),s)}}()})();
includes/yasr-widgets.php CHANGED
@@ -73,9 +73,8 @@ class Yasr_Overall_Rating_Widget extends WP_Widget {
73
 
74
  $widget_overall_rating = shortcode_overall_rating_callback($size);
75
 
76
- echo $widget_overall_rating;
77
-
78
- echo $args['after_widget'];
79
 
80
  }
81
 
@@ -239,14 +238,13 @@ class Yasr_Visitor_Votes_Widget extends WP_Widget {
239
  $atts['size'] = $instance['size'];
240
  if ($instance['readonly'] === 'yes') {
241
  $atts['readonly'] = $instance['readonly'];
242
- $widget_visitor_votes = shortcode_visitor_votes_callback($atts);
243
- } else {
244
- $widget_visitor_votes = shortcode_visitor_votes_callback($atts);
245
  }
246
 
 
 
247
  echo $widget_visitor_votes;
248
 
249
- echo $args['after_widget'];
250
 
251
  }
252
 
@@ -448,8 +446,8 @@ class Yasr_Recent_Ratings_Widget extends WP_Widget {
448
  $link = get_permalink($result->post_id);
449
  $vote = round($result->vote);
450
 
451
- $widget_recent_ratings .= "<tr>
452
- <td width=\"40%\" class=\"yasr-widget-recent-ratings-td\">";
453
 
454
  $widget_recent_ratings .=
455
  sprintf(
@@ -467,24 +465,23 @@ class Yasr_Recent_Ratings_Widget extends WP_Widget {
467
  <a href="' . $link . '"> '. $title_post .'</a>
468
  </span>';
469
 
470
- $widget_recent_ratings .= "</td>
471
- </tr>";
472
 
473
  } //End foreach
474
 
475
  } else {
476
- $widget_recent_ratings .= "<tr>
477
  <td>
478
- ". __('No recent ratings yet' , 'yet-another-stars-ratings') ."
479
  </td>
480
- </tr>";
481
  }
482
 
483
  $widget_recent_ratings .= "</table>";
484
 
485
- echo $widget_recent_ratings;
486
-
487
- echo $args['after_widget'];
488
 
489
  }
490
 
73
 
74
  $widget_overall_rating = shortcode_overall_rating_callback($size);
75
 
76
+ echo wp_kses_post($widget_overall_rating);
77
+ echo wp_kses_post($args['after_widget']);
 
78
 
79
  }
80
 
238
  $atts['size'] = $instance['size'];
239
  if ($instance['readonly'] === 'yes') {
240
  $atts['readonly'] = $instance['readonly'];
 
 
 
241
  }
242
 
243
+ $widget_visitor_votes = shortcode_visitor_votes_callback($atts);
244
+
245
  echo $widget_visitor_votes;
246
 
247
+ echo wp_kses_post($args['after_widget']);
248
 
249
  }
250
 
446
  $link = get_permalink($result->post_id);
447
  $vote = round($result->vote);
448
 
449
+ $widget_recent_ratings .= '<tr>
450
+ <td class="yasr-widget-recent-ratings-td">';
451
 
452
  $widget_recent_ratings .=
453
  sprintf(
465
  <a href="' . $link . '"> '. $title_post .'</a>
466
  </span>';
467
 
468
+ $widget_recent_ratings .= '</td>
469
+ </tr>';
470
 
471
  } //End foreach
472
 
473
  } else {
474
+ $widget_recent_ratings .= '<tr>
475
  <td>
476
+ '. __('No recent ratings yet' , 'yet-another-stars-rating') .'
477
  </td>
478
+ </tr>';
479
  }
480
 
481
  $widget_recent_ratings .= "</table>";
482
 
483
+ echo wp_kses_post($widget_recent_ratings);
484
+ echo wp_kses_post($args['after_widget']);
 
485
 
486
  }
487
 
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.3
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,9 @@ 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.3 =
201
  * TWEAKED: Added support for Catch Infinite Scroll
202
 
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
 
198
  The full changelog can be found in the plugin's directory. Recent entries:
199
 
200
+ = 2.9.4 =
201
+ * Minor changes
202
+
203
  = 2.9.3 =
204
  * TWEAKED: Added support for Catch Infinite Scroll
205
 
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.3
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.3' );
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__ );
@@ -143,7 +143,9 @@ if ( !function_exists( 'yasr_fs' ) ) {
143
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'yasr_add_links_below_plugin_name' );
144
  function yasr_add_links_below_plugin_name( $links )
145
  {
146
- $settings_link = '<a href="' . admin_url( 'options-general.php?page=yasr_settings_page' ) . '">General Settings</a>';
 
 
147
  //array_unshit adds to the begin of array
148
  array_unshift( $links, $settings_link );
149
  return $links;
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
  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__ );
143
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'yasr_add_links_below_plugin_name' );
144
  function yasr_add_links_below_plugin_name( $links )
145
  {
146
+ $settings_link = '<a href="' . esc_url( admin_url( 'options-general.php?page=yasr_settings_page' ) ) . '">';
147
+ $settings_link .= __( 'Settings', 'yet-another-stars-rating' );
148
+ $settings_link .= '</a>';
149
  //array_unshit adds to the begin of array
150
  array_unshift( $links, $settings_link );
151
  return $links;