Prep Plugin for release on WordPress.org (#23)

* Update translation text domain
* Escape everything that should be escaped.
* Add nonce checks where needed.
* Sanitize all inputs.
* Apply Code style changes across the codebase.
* Correct many deprecation notices.
* Optimize load order of many filters.
* Add Proper Build script
* Use emojii flags
* Fix i18n deprecation  notice for translating too early
* Put all scripts in footer and load async
This commit is contained in:
David Stone
2025-04-14 11:36:46 -06:00
committed by GitHub
parent a31cfcb565
commit d88e50df38
1087 changed files with 12586 additions and 18535 deletions

View File

@ -1 +1 @@
(()=>{"use strict";const e=(e,t=!1)=>({classes:[],has_icon:!1,original_value:e.innerHTML,get_icon(){return this.has_icon?'<span class="wu-spin wu-inline-block wu-mr-2"><span class="dashicons-wu-loader"></span></span>':""},clear_classes(){e.classList.remove(...this.classes)},add_classes(t){this.classes=t,e.classList.add(...t)},text(t,s,n=!1){return this.clear_classes(),n&&(this.has_icon=!this.has_icon),e.animate([{opacity:"1"},{opacity:"0.75"}],{duration:300,iterations:1}),setTimeout((()=>{this.add_classes(s??[]),e.innerHTML=this.get_icon()+t,e.style.opacity="0.75"}),300),this},done(t=5e3){return setTimeout((()=>{e.animate([{opacity:"0.75"},{opacity:"1"}],{duration:300,iterations:1}),setTimeout((()=>{this.clear_classes(),e.innerHTML=this.original_value,e.style.opacity="1"}),300)}),t),this}});document.addEventListener("DOMContentLoaded",(()=>{if(document.querySelectorAll(".wu-resend-verification-email").forEach((t=>t.addEventListener("click",(async s=>{s.preventDefault();const n=e(t,!0).text(wu_thank_you.i18n.resending_verification_email,["wu-text-gray-400"]),i=await fetch(wu_thank_you.ajaxurl,{method:"POST",body:JSON.stringify({action:"wu_resend_verification_email",_ajax_nonce:wu_thank_you.resend_verification_email_nonce})}),a=await i.json();a.success?n.text(wu_thank_you.i18n.email_sent,["wu-text-green-700"],!0).done():n.text(a.data[0].message,["wu-text-red-600"],!0).done()})))),!document.getElementById("wu-sites"))return;const{Vue:t,defineComponent:s}=window.wu_vue;window.wu_sites=new t(s({el:"#wu-sites",data:()=>({creating:wu_thank_you.creating,next_queue:parseInt(wu_thank_you.next_queue,10)+5,random:0,progress_in_seconds:0}),computed:{progress(){return Math.round(this.progress_in_seconds/this.next_queue*100)}},mounted(){if(wu_thank_you.has_pending_site)return void this.check_site_created();if(this.next_queue<=0||wu_thank_you.creating)return;const e=setInterval((()=>{this.progress_in_seconds++,this.progress_in_seconds>=this.next_queue&&(clearInterval(e),window.location.reload()),this.progress_in_seconds%5==0&&fetch("/wp-cron.php?doing_wp_cron")}),1e3)},methods:{async check_site_created(){const e=new URL(wu_thank_you.ajaxurl);e.searchParams.set("action","wu_check_pending_site_created"),e.searchParams.set("membership_hash",wu_thank_you.membership_hash);const t=await fetch(e).then((e=>e.json()));"completed"===t.publish_status?window.location.reload():(this.creating="running"===t.publish_status,setTimeout(this.check_site_created,3e3))}}}))}))})();
document.addEventListener("DOMContentLoaded",()=>{var e,t;document.querySelectorAll(".wu-resend-verification-email").forEach(s=>s.addEventListener("click",async e=>{e.preventDefault();var n,e={classes:[],has_icon:!1,original_value:(n=s).innerHTML,get_icon(){return this.has_icon?'<span class="wu-spin wu-inline-block wu-mr-2"><span class="dashicons-wu-loader"></span></span>':""},clear_classes(){n.classList.remove(...this.classes)},add_classes(e){this.classes=e,n.classList.add(...e)},text(e,t,s=!1){return this.clear_classes(),s&&(this.has_icon=!this.has_icon),n.animate([{opacity:"1"},{opacity:"0.75"}],{duration:300,iterations:1}),setTimeout(()=>{this.add_classes(t??[]),n.innerHTML=this.get_icon()+e,n.style.opacity="0.75"},300),this},done(e=5e3){return setTimeout(()=>{n.animate([{opacity:"0.75"},{opacity:"1"}],{duration:300,iterations:1}),setTimeout(()=>{this.clear_classes(),n.innerHTML=this.original_value,n.style.opacity="1"},300)},e),this}}.text(wu_thank_you.i18n.resending_verification_email,["wu-text-gray-400"]),t=await(await fetch(wu_thank_you.ajaxurl,{method:"POST",body:JSON.stringify({action:"wu_resend_verification_email",_ajax_nonce:wu_thank_you.resend_verification_email_nonce})})).json();(t.success?e.text(wu_thank_you.i18n.email_sent,["wu-text-green-700"],!0):e.text(t.data[0].message,["wu-text-red-600"],!0)).done()})),document.getElementById("wu-sites")&&({Vue:e,defineComponent:t}=window.wu_vue,window.wu_sites=new e(t({el:"#wu-sites",data(){return{creating:wu_thank_you.creating,next_queue:parseInt(wu_thank_you.next_queue,10)+5,random:0,progress_in_seconds:0}},computed:{progress(){return Math.round(this.progress_in_seconds/this.next_queue*100)}},mounted(){if(wu_thank_you.has_pending_site)this.check_site_created();else if(!(this.next_queue<=0||wu_thank_you.creating)){let e=setInterval(()=>{this.progress_in_seconds++,this.progress_in_seconds>=this.next_queue&&(clearInterval(e),window.location.reload()),this.progress_in_seconds%5==0&&fetch("/wp-cron.php?doing_wp_cron")},1e3)}},methods:{async check_site_created(){var e=new URL(wu_thank_you.ajaxurl),e=(e.searchParams.set("action","wu_check_pending_site_created"),e.searchParams.set("membership_hash",wu_thank_you.membership_hash),await fetch(e).then(e=>e.json()));"completed"===e.publish_status?window.location.reload():(this.creating="running"===e.publish_status,setTimeout(this.check_site_created,3e3))}}})))});