Plugin Directory

Changeset 3380469


Ignore:
Timestamp:
10/18/2025 10:37:05 AM (3 months ago)
Author:
maartenbelmans
Message:
  • Improvement: improved code for translations.
  • Improvement: improved error handling when MailChimp sends back an error.
  • Improvement: escape all output.
  • Improvement: sanitize all values coming from user input.
  • Fix: fixed an issue with the default disclaimer and explainer text not showing in the backend when creating a wheel.
Location:
wp-optin-wheel
Files:
137 added
36 edited

Legend:

Unmodified
Added
Removed
  • wp-optin-wheel/trunk/admin/js/admin.min.js

    r3272834 r3380469  
    99var Core;!function(t){!function(t){!function(t){var e=function(){function t(){}return t.getSlug=function(){return jQuery("[data-context]").data("slug")},t.getSettings=function(){var e=jQuery("#"+t.getSlug()+"-form").serializeArray(),n={};return e.forEach(function(e,r){var a=e.name.replace(t.getSettingsKey()+"[","").replace("]","");n[a]=e.value}),n},t.getSettingsKey=function(){return jQuery("[data-context]").data("settings-key")},t.getAdminAjaxUrl=function(){return jQuery("[data-context]").data("admin-ajax-url")},t}();t.Context=e}(t.Helpers||(t.Helpers={}))}(t.Admin||(t.Admin={}))}(Core||(Core={}));
    1010var Core;!function(e){!function(e){!function(e){var n=function(){function e(){}return e.initDependencies=function(e){var n=this;jQuery("[data-dependency]").each(function(e,i){jQuery(i).data("dependency").forEach(function(e){var t=n.findDependencyById(e.element_id);null===t?n.dependencies.push({id:e.element_id,values:[{show_element:jQuery(i).attr("name"),value:e.value}]}):t.values.push({value:e.value,show_element:jQuery(i).attr("name")})})}),this.dependencies.forEach(function(i){var t=jQuery('[name="'+e+"["+i.id+']"],[name="'+i.id+'"]').not(".skip-dependency");t.on("change",function(c){var d=t.val();t.is(":checkbox")&&(d=t.is(":checked")),t.is(":radio")&&(d=t.filter(":checked").val()),n.hideAllElementsInDependency(e,i),n.findElementsWithValue(i.values,d).forEach(function(e){jQuery('[name="'+e+'"]').closest("tr").show()})}),t.trigger("change")})},e.findElementsWithValue=function(e,n){var i=[];return e.forEach(function(e){e.value==n.toString()&&i.push(e.show_element)}),i},e.hideAllElementsInDependency=function(e,n){n.values.forEach(function(e){jQuery('[name="'+e.show_element+'"]').closest("tr").hide()})},e.findDependencyById=function(e){for(var n=0;n<this.dependencies.length;n++){var i=this.dependencies[n];if(i.id===e)return i}return null},e.dependencies=[],e}();e.Dependencies=n}(e.Helpers||(e.Helpers={}))}(e.Admin||(e.Admin={}))}(Core||(Core={}));
    11 var WOFAdmin;!function(e){var t=function(){function t(){var t=this;this.lists=[],this.providers=[],window.canSaveData=!0,jQuery.ajaxSetup({data:{wof_nonce:jQuery(".wof-nonce").data("nonce")}}),this.formBuilderForLists=new e.Components.FormBuilderLists(jQuery("div.form-builder-for-lists")),this.wheelCtrl=new e.Controllers.CreateWheelCtrl(this.formBuilderForLists),this.wheelsListCtrl=new e.Controllers.WheelsListCtrl,this.gdprCtrl=new e.Controllers.Gdpr;var i=Core.Admin.Helpers.Context.getSettings();this.initEvents(),this.onSettingsChanged(i),this.initSetEditMode(),this.fetchLog(i),this.setLists(i),window.tinymce&&window.tinymce.on("AddEditor",function(e){setTimeout(function(){var i=e.editor;"disclaimer"===i.id&&i.setContent(t.wheelCtrl.model.disclaimer),"explainer"===i.id&&i.setContent(t.wheelCtrl.model.explainer),t.setTinyMCE(t.wheelCtrl.model,!1)},1050)},!0),jQuery('[name="mb-wof-lite-settings[mailchimp_api]"]').on("change input",function(){window.canSaveData=!0,jQuery(".mb-wof-key-error").remove(),/^[a-f0-9]{32}-us\d+$/i.test(jQuery(this).val())||(window.canSaveData=!1,jQuery('<div class="mb-wof-key-error" style="color:red;padding-top:5px;">Invalid API key. Can not save data.</div>').insertAfter(jQuery(this)))})}return t.prototype.setLists=function(t){var i=this;t.mailchimp_api&&!this.fetchedMCLists&&e.Api.Mail.getMailChimpLists().then(function(e){i.fetchedMCLists=!0,i.providers.push({id:"mailchimp",title:"MailChimp"}),i.lists.push({listProvider:"mailchimp",lists:e}),i.drawListDropdowns()})},t.prototype.fetchLog=function(t){"true"==t.log&&e.Api.Log.getLog().then(function(e){jQuery("[name=wof-log]").val(e)})},t.prototype.initEvents=function(){var t=this;Core.Admin.Dispatcher.subscribe("wof-wheel:created",function(){t.wheelsListCtrl.getWheelsList()}),Core.Admin.Dispatcher.subscribe("settings:changed",function(e){t.onSettingsChanged(e)}),Core.Admin.Dispatcher.subscribe("settings:saved",function(e){t.setLists(e)}),jQuery('[name="mb-wof-settings[woo_coupons]"]').on("change",function(e){jQuery(e.currentTarget).is(":checked")?(jQuery(".wof-wc-title").show(),jQuery(".wof-value-title").hide()):(jQuery(".wof-wc-title").hide(),jQuery(".wof-value-title").show()),jQuery("[name=wof-slice-type]").trigger("change")}),jQuery("select[name=list]").on("change",function(e){t.wheelCtrl.model.list=jQuery(e.currentTarget).val()}),jQuery("select[name=list_provider]").on("change",function(e){t.wheelCtrl.model.list_provider=jQuery(e.currentTarget).val(),t.wheelCtrl.model.list=null,t.drawListDropdowns()}),jQuery(".btn-clear-log").on("click",function(t){t.preventDefault(),e.Api.Log.clearLog(),jQuery("[name=wof-log]").val("")})},t.prototype.onSettingsChanged=function(e){void 0===e&&(e=null),e=e||Core.Admin.Helpers.Context.getSettings(),"true"==e.log?jQuery(".wof-log-wrapper").closest("tr").show():jQuery(".wof-log-wrapper").closest("tr").hide(),e.mailchimp_api?(jQuery(".error-mail-lists").hide(),jQuery(".wof-step-1").show()):(jQuery(".error-mail-lists").show(),jQuery(".wof-step-1").hide())},t.prototype.drawListDropdowns=function(){if(!this.wheelCtrl.model.list_provider&&this.providers.length>0&&(this.wheelCtrl.model.list_provider=this.providers[0].id),!this.wheelCtrl.model.list&&this.providers.length>0){var t=e.helpers.Collections.findBy(this.lists,"listProvider",this.wheelCtrl.model.list_provider);null!=t&&t.lists.length&&(this.wheelCtrl.model.list=t.lists[0].id)}if(this.wheelCtrl.model.list_provider){var i=jQuery("select[name=list_provider]").empty();this.providers.forEach(function(e){jQuery("<option />",{val:e.id,text:e.title}).appendTo(i)}),i.val(this.wheelCtrl.model.list_provider)}if(this.wheelCtrl.model.list){var r=jQuery("select[name=list]").empty(),t=e.helpers.Collections.findBy(this.lists,"listProvider",this.wheelCtrl.model.list_provider);t.lists.forEach(function(e){jQuery("<option />",{val:e.id,text:e.title}).appendTo(r)}),r.val(this.wheelCtrl.model.list)}},t.prototype.initSetEditMode=function(){var e=this;Core.Admin.Dispatcher.subscribe("wof-wheel:edit",function(t){e.wheelCtrl.setEditMode(),e.wheelCtrl.resetStepTracker(t),Core.Admin.Dispatcher.publish("tab:activate","options-addwheel"),e.drawListDropdowns(),e.formBuilderForLists.setFields(e.wheelCtrl.model.fields),e.formBuilderForLists.drawTableRows(),jQuery(".color-picker").each(function(e,i){var r=jQuery(i),o=""+t[r.attr("name")];r.closest(".wp-picker-container").find(".wp-picker-clear").trigger("click"),r.wpColorPicker("color",o)}),e.setTinyMCE(t),Core.Admin.Main.initChoicePickers(),e.gdprCtrl.initGdprSettingOptions(e.wheelCtrl.model.fields,e.wheelCtrl.model.optin_if_checked),Core.Admin.Main.loading()})},t.prototype.setTinyMCE=function(e,t){void 0===t&&(t=!0);var i=this.getTinyMCEEditor("explainer");i&&(t&&i.setContent(e.explainer?e.explainer:""),i.off("change",this.explainerOn),this.explainerOn=function(){e.explainer=i.getContent()},i.on("change",this.explainerOn));var r=this.getTinyMCEEditor("disclaimer");r&&(t&&r.setContent(e.disclaimer?e.disclaimer:""),r.off("change",this.disclaimerOn),this.disclaimerOn=function(){e.disclaimer=r.getContent()},r.on("change",this.disclaimerOn))},t.prototype.getTinyMCEEditor=function(e){if(void 0===window.tinymce)return null;for(var t=0;t<window.tinymce.editors.length;t++){var i=window.tinymce.editors[t];if(i.id===e)return i}return null},t}();e.Main=t}(WOFAdmin||(WOFAdmin={})),jQuery(document).ready(function(){new WOFAdmin.Main,window.waitForFinalEvent=function(){}});
     11var WOFAdmin;!function(e){var t=function(){function t(){var t=this;this.lists=[],this.providers=[],window.canSaveData=!0,jQuery.ajaxSetup({data:{wof_nonce:jQuery(".wof-nonce").data("nonce")}}),this.formBuilderForLists=new e.Components.FormBuilderLists(jQuery("div.form-builder-for-lists")),this.wheelCtrl=new e.Controllers.CreateWheelCtrl(this.formBuilderForLists),this.wheelsListCtrl=new e.Controllers.WheelsListCtrl,this.gdprCtrl=new e.Controllers.Gdpr;var i=Core.Admin.Helpers.Context.getSettings();this.initEvents(),this.onSettingsChanged(i),this.initSetEditMode(),this.fetchLog(i),this.setLists(i),setTimeout(function(){if(window.tinymce){var e=window.tinymce.get("disclaimer"),i=window.tinymce.get("explainer");e&&i&&(e.setContent(t.wheelCtrl.model.disclaimer),i.setContent(t.wheelCtrl.model.explainer)),t.setTinyMCE(t.wheelCtrl.model,!1)}},3e3),jQuery('[name="mb-wof-lite-settings[mailchimp_api]"]').on("change input",function(){window.canSaveData=!0,jQuery(".mb-wof-key-error").remove(),/^[a-f0-9]{32}-us\d+$/i.test(jQuery(this).val())||(window.canSaveData=!1,jQuery('<div class="mb-wof-key-error" style="color:red;padding-top:5px;">Invalid API key. Can not save data.</div>').insertAfter(jQuery(this)))})}return t.prototype.setLists=function(t){var i=this;t.mailchimp_api&&!this.fetchedMCLists&&e.Api.Mail.getMailChimpLists().then(function(e){i.fetchedMCLists=!0,i.providers.push({id:"mailchimp",title:"MailChimp"}),i.lists.push({listProvider:"mailchimp",lists:e}),i.drawListDropdowns()})},t.prototype.fetchLog=function(t){"true"==t.log&&e.Api.Log.getLog().then(function(e){jQuery("[name=wof-log]").val(e)})},t.prototype.initEvents=function(){var t=this;Core.Admin.Dispatcher.subscribe("wof-wheel:created",function(){t.wheelsListCtrl.getWheelsList()}),Core.Admin.Dispatcher.subscribe("settings:changed",function(e){t.onSettingsChanged(e)}),Core.Admin.Dispatcher.subscribe("settings:saved",function(e){t.setLists(e)}),jQuery('[name="mb-wof-settings[woo_coupons]"]').on("change",function(e){jQuery(e.currentTarget).is(":checked")?(jQuery(".wof-wc-title").show(),jQuery(".wof-value-title").hide()):(jQuery(".wof-wc-title").hide(),jQuery(".wof-value-title").show()),jQuery("[name=wof-slice-type]").trigger("change")}),jQuery("select[name=list]").on("change",function(e){t.wheelCtrl.model.list=jQuery(e.currentTarget).val()}),jQuery("select[name=list_provider]").on("change",function(e){t.wheelCtrl.model.list_provider=jQuery(e.currentTarget).val(),t.wheelCtrl.model.list=null,t.drawListDropdowns()}),jQuery(".btn-clear-log").on("click",function(t){t.preventDefault(),e.Api.Log.clearLog(),jQuery("[name=wof-log]").val("")})},t.prototype.onSettingsChanged=function(e){void 0===e&&(e=null),e=e||Core.Admin.Helpers.Context.getSettings(),"true"==e.log?jQuery(".wof-log-wrapper").closest("tr").show():jQuery(".wof-log-wrapper").closest("tr").hide(),e.mailchimp_api?(jQuery(".error-mail-lists").hide(),jQuery(".wof-step-1").show()):(jQuery(".error-mail-lists").show(),jQuery(".wof-step-1").hide())},t.prototype.drawListDropdowns=function(){if(!this.wheelCtrl.model.list_provider&&this.providers.length>0&&(this.wheelCtrl.model.list_provider=this.providers[0].id),!this.wheelCtrl.model.list&&this.providers.length>0){var t=e.helpers.Collections.findBy(this.lists,"listProvider",this.wheelCtrl.model.list_provider);null!=t&&t.lists.length&&(this.wheelCtrl.model.list=t.lists[0].id)}if(this.wheelCtrl.model.list_provider){var i=jQuery("select[name=list_provider]").empty();this.providers.forEach(function(e){jQuery("<option />",{val:e.id,text:e.title}).appendTo(i)}),i.val(this.wheelCtrl.model.list_provider)}if(this.wheelCtrl.model.list){var r=jQuery("select[name=list]").empty(),t=e.helpers.Collections.findBy(this.lists,"listProvider",this.wheelCtrl.model.list_provider);t.lists.forEach(function(e){jQuery("<option />",{val:e.id,text:e.title}).appendTo(r)}),r.val(this.wheelCtrl.model.list)}},t.prototype.initSetEditMode=function(){var e=this;Core.Admin.Dispatcher.subscribe("wof-wheel:edit",function(t){e.wheelCtrl.setEditMode(),e.wheelCtrl.resetStepTracker(t),Core.Admin.Dispatcher.publish("tab:activate","options-addwheel"),e.drawListDropdowns(),e.formBuilderForLists.setFields(e.wheelCtrl.model.fields),e.formBuilderForLists.drawTableRows(),jQuery(".color-picker").each(function(e,i){var r=jQuery(i),n=""+t[r.attr("name")];r.closest(".wp-picker-container").find(".wp-picker-clear").trigger("click"),r.wpColorPicker("color",n)}),e.setTinyMCE(t),Core.Admin.Main.initChoicePickers(),e.gdprCtrl.initGdprSettingOptions(e.wheelCtrl.model.fields,e.wheelCtrl.model.optin_if_checked),Core.Admin.Main.loading()})},t.prototype.setTinyMCE=function(e,t){void 0===t&&(t=!0);var i=this.getTinyMCEEditor("explainer");i&&(t&&i.setContent(e.explainer?e.explainer:""),i.off("change",this.explainerOn),this.explainerOn=function(){e.explainer=i.getContent()},i.on("change",this.explainerOn));var r=this.getTinyMCEEditor("disclaimer");r&&(t&&r.setContent(e.disclaimer?e.disclaimer:""),r.off("change",this.disclaimerOn),this.disclaimerOn=function(){e.disclaimer=r.getContent()},r.on("change",this.disclaimerOn))},t.prototype.getTinyMCEEditor=function(e){if(void 0===window.tinymce)return null;for(var t=0;t<window.tinymce.editors.length;t++){var i=window.tinymce.editors[t];if(i.id===e)return i}return null},t}();e.Main=t}(WOFAdmin||(WOFAdmin={})),jQuery(document).ready(function(){new WOFAdmin.Main,window.waitForFinalEvent=function(){}});
    1212var WOFAdmin;!function(n){!function(n){var e=function(){function n(){}return n.getLog=function(){return jQuery.getJSON(Core.Admin.Helpers.Context.getAdminAjaxUrl(),{action:n.get_log}).then(function(n){return n})},n.clearLog=function(){return jQuery.getJSON(Core.Admin.Helpers.Context.getAdminAjaxUrl(),{action:n.clear_log})},n.get_log="mb-wof-lite-get-log",n.clear_log="mb-wof-lite-clear-log",n}();n.Log=e}(n.Api||(n.Api={}))}(WOFAdmin||(WOFAdmin={}));
    1313var WOFAdmin;!function(i){!function(i){var t=function(){function i(){}return i.getMailchimpFields=function(t){return jQuery.getJSON(Core.Admin.Helpers.Context.getAdminAjaxUrl(),{action:i.get_mailchimp_fields,id:t}).then(function(i){return i})},i.getMailChimpLists=function(){return jQuery.getJSON(Core.Admin.Helpers.Context.getAdminAjaxUrl(),{action:i.get_mailchimp_lists_action}).then(function(i){return i})},i.get_mailchimp_lists_action="mb-wof-lite-get-mailchimp-lists",i.get_mailchimp_fields="mb-wof-lite-get-mailchimp-fields",i}();i.Mail=t}(i.Api||(i.Api={}))}(WOFAdmin||(WOFAdmin={}));
     
    1717var WOFAdmin;!function(n){!function(n){var r=function(){function n(){}return n.capitalizeWords=function(n){return n.replace(/\w\S*/g,function(n){return n.charAt(0).toUpperCase()+n.substr(1).toLowerCase()})},n}();n.Strings=r}(n.helpers||(n.helpers={}))}(WOFAdmin||(WOFAdmin={}));
    1818var WOFAdmin;!function(e){!function(e){var n=function(){function e(){}return e.toTheme=function(e){switch(e){case"blue":return"Standard Blue";case"deep-purple":return"Deep Purple"}return e},e.toSliceType=function(e){switch(e){case"0":return"No prize";case"1":return"Coupon code";case"2":return"Link"}},e}();e.Wheels=n}(e.helpers||(e.helpers={}))}(WOFAdmin||(WOFAdmin={}));
    19 var WOFAdmin;!function(n){!function(n){var i=function(){function n(){this.required=!1,this.type="text"}return n}();n.Field=i}(n.Models||(n.Models={}))}(WOFAdmin||(WOFAdmin={}));
    20 var WOFAdmin;!function(n){!function(n){var i=function(){function n(){}return n}();n.Slice=i}(n.Models||(n.Models={}))}(WOFAdmin||(WOFAdmin={}));
    21 var WOFAdmin;!function(n){!function(n){var i=function(){function n(){}return n}();n.Statistics=i}(n.Models||(n.Models={}))}(WOFAdmin||(WOFAdmin={}));
    22 var WOFAdmin;!function(e){!function(e){var i=function(){function e(){this.theme="vintage",this.slices=[],this.active="1",this.winning_chance=70,this.plays=0,this.bgpattern="hearts",this.title="Get your chance to <em>win a price</em>!",this.explainer="Enter your email address and spin the wheel. This is your chance to win amazing discounts!",this.disclaimer="Our in-house rules:<ul><li>One game per user</li><li>Cheaters will be disqualified.</li></ul>",this.email_placeholder="Your email",this.button_text="Try your luck",this.button_done="I'm done playing",this.close_text="I don't feel lucky",this.losing_title="Uh oh! Looks like you lost",this.losing_text="We're sorry, the wheel of fortune has let you down. Better luck next time!",this.winning_title="Hurray! You've hit {x}. Lucky you!",this.winning_text_coupon="Nicely done! You can use the coupon code below to claim your prize:",this.winning_text_link="Nicely done! here's the link to your free product:",this.button_again="Try again",this.games_left_text="You have {x} spins left",this.user_inclusion="0",this.appeartype="delay",this.appeardelay=5,this.appearscroll=60,this.occurance="delay",this.occurancedelay=14,this.hide_mobile=!0,this.fields=[]}return e}();e.Wheel=i}(e.Models||(e.Models={}))}(WOFAdmin||(WOFAdmin={}));
    2319"use strict";!function(e){"function"==typeof define&&define.amd?define(e):window.DataBind=e()}(function(){function e(e){return e&&window.jQuery&&e instanceof window.jQuery}function t(t){return e(t)?t[0]:t}function n(e,t){if(e){var n=void 0!==t;if(["checkbox","radio"].indexOf(e.type)>=0)return n&&(e.checked=!!t),e.checked;if(["text","hidden","textarea","select-one","email","url","week","time","search","tel","range","number","month","datetime-local","date","color","password"].indexOf(e.type)>=0){if(n){e.value=t;var o=document.createEvent("HTMLEvents");o.initEvent("change",!0,!1),e.dispatchEvent(o)}return e.value}if(["select-multiple"].indexOf(e.type)>=0){n&&(r(t)||(t=[t]));for(var i,a=[],c=e&&e.options,f=0,u=c.length;f<u;f++)i=c[f],n&&(t.indexOf(i.value)>-1?i.selected=!0:i.selected=!1),i.selected&&a.push(i.value||i.text);return a}return n&&(e.innerText=t),e.innerText}}function r(e){return"[object Array]"===Object.prototype.toString.call(e)}function o(e){return["checkbox","radio","select-one","select-multiple","password"].indexOf(e.type)>=0?"change":["text","hidden","textarea","email","url","week","time","search","tel","range","number","month","datetime-local","date","color"].indexOf(e.type)>=0?"input":void 0}function i(e){return e.hashkey||(e.hashkey=Date.now()+Math.floor(1e5*Math.random())),e.hashkey}function a(e,t){if(e&&t){var n=i(e);if(M[n]=M[n]||[],!(M[n].indexOf(t)>-1)){M[n].push(t);var r=o(e);e.addEventListener(r,t,!1)}}}function c(e,t){var n=i(e),r=M[n].indexOf(t);if(M[n]&&-1!==r){M[n].splice(r,1);var a=o(e);e.removeEventListener(a,t,!1)}}function f(e){var t=i(e),n=M[t];if(e&&n){var r,o=n.concat(),a=o.length;for(r=0;r<a;r++)c(e,o[r])}}function u(e,t){function n(){var e,t,n=!1;return t=o.exec(i[r]),t&&t.length&&(e=i[r].split("[")[0],a=a[e][+t[1]],n=!0),n}var r,o=new RegExp(/.*\[(\d+)\]/),i=t.split("."),a=e;for(r=0;r<i.length-1;r++)n()||(a=a[i[r]]);return n(),a}function l(e,t,n){var r=t.split("."),o=u(e,t);return void 0!==n&&(o[r[r.length-1]]=n),o[r[r.length-1]]}function d(e,t,r){a(e,function(e,t,n,r,o,i,a,c){return function(e){var f=o(this),u=i(this),l=r(t,n);r(t,n,f),a(c,this,{key:u,oldValue:l,newValue:f})}}(0,t,r,l,n,v,j,_))}function s(e){f(e)}function h(e,t,r){var o=function(e,t,n,r,o,i,a){return function(t,n,c,f){var t=i(e);r(e,c),o(a,e,{key:t,oldValue:f,newValue:c})}}(e,0,0,n,j,v,S);k.watch(t,r,o)}function p(e,t){var n,r=e.watchers[t];for(n=0;n<r.length;n++)k.unwatch(e,t,r[n])}function v(e){if(e)return e.getAttribute(L)}function y(e){return e=e||{},e={dom:void 0===e.dom||e.dom,model:void 0===e.model||e.model,children:void 0===e.children||e.children}}function m(e,t){if(!e||!t)return{};var n=v(e);if(!n)return{};var r=u(t,n),o=n.split(".");return o=o[o.length-1],{key:n,deepKey:o,deepModel:r,keyExists:!!r}}function g(e,t,r){if(!e||!t)return!1;var o=m(e,t);return!!o.keyExists&&(n(e,l(t,o.key)),r.dom&&d(e,o.deepModel,o.deepKey),r.model&&h(e,o.deepModel,o.deepKey),!0)}function w(e,t,n){if(e&&t){var r=m(e,t);r.keyExists&&(n.dom&&s(e),n.model&&p(r.deepModel,r.deepKey))}}function b(e,t){var n,r,o=[e];if(t.children)for(n=e.getElementsByTagName("*"),r=0;r<n.length;r++)o.push(n[r]);return o}function j(e,t,n){var r=document.createEvent("Events");r.initEvent(e,!0,!0),r.data=n,t.dispatchEvent(r)}function x(e,t,n,r){function o(e,o){u.push(o),r.dom&&e.addEventListener(n,o,!1),r.model&&e.addEventListener(t,o,!1)}function i(e,t){var n=u.indexOf(t);-1!==n&&(u.splice(n,1),r.dom&&e.removeEventListener(_,t,!1),r.model&&e.removeEventListener(S,t,!1))}function a(e){var t,n=u.concat();for(t=0;t<n.length;t++)i(e,n[t])}function c(t){var n;for(n=0;n<e.length;n++)o(e[n],t)}function f(t){var n,r=i;for(void 0===t&&(r=a),n=0;n<e.length;n++)r(e[n],t)}var u=[];return{watch:c,unwatch:f}}function O(e,n,r){if(e&&n){var o=t(e);if(o!==e)return arguments[0]=o,O.apply(this,arguments);r=y(r);var i,a=b(e,r),c=[];for(i=0;i<a.length;i++)g(a[i],n,{dom:r.dom,model:r.model})&&c.push(a[i]);var f=new x(c,S,_,r);return e.watchable=f,f}}function E(e,n,r){if(e&&n){var o=t(e);if(o!==e)return arguments[0]=o,E.apply(this,arguments);r=y(r);var i,a=b(e,r);for(i=0;i<a.length;i++)w(a[i],n,{dom:r.dom,model:r.model});e.watchable.unwatch()}}var k=function(){var e={noMore:!1},t=[],n=function(e){var t={};return e&&"[object Function]"==t.toString.call(e)},r=function(e){return e%1==0},o=function(e){return"[object Array]"===Object.prototype.toString.call(e)},i=function(e,t){var n=[],r=[];if("string"!=typeof e&&"string"!=typeof t&&!o(e)&&!o(t)){for(var i in e)t[i]||n.push(i);for(var a in t)e[a]||r.push(a)}return{added:n,removed:r}},a=function(e){if(null==e||"object"!=typeof e)return e;var t=e.constructor();for(var n in e)t[n]=e[n];return t},c=function(e,t,n,r){try{Object.defineProperty(e,t,{get:n,set:r,enumerable:!0,configurable:!0})}catch(o){try{Object.prototype.__defineGetter__.call(e,t,n),Object.prototype.__defineSetter__.call(e,t,r)}catch(e){throw"watchJS error: browser not supported :/"}}},f=function(e,t,n){try{Object.defineProperty(e,t,{enumerable:!1,configurable:!0,writable:!1,value:n})}catch(r){e[t]=n}},u=function(){n(arguments[1])?l.apply(this,arguments):o(arguments[1])?d.apply(this,arguments):s.apply(this,arguments)},l=function(e,t,n,r){if("string"!=typeof e&&(e instanceof Object||o(e))){var i=[];if(o(e))for(var a=0;a<e.length;a++)i.push(a);else for(var c in e)i.push(c);d(e,i,t,n,r)}},d=function(e,t,n,r,i){if("string"!=typeof e&&(e instanceof Object||o(e)))for(var a in t)s(e,t[a],n,r,i)},s=function(e,t,r,i,a){"string"!=typeof e&&(e instanceof Object||o(e))&&(n(e[t])||(null!=e[t]&&(void 0===i||i>0)&&(void 0!==i&&i--,l(e[t],r,i)),y(e,t,r),a&&O(e,t,r,i)))},h=function(){n(arguments[1])?p.apply(this,arguments):o(arguments[1])?v.apply(this,arguments):j.apply(this,arguments)},p=function(e,t){if(!(e instanceof String)&&(e instanceof Object||o(e))){var n=[];if(o(e))for(var r=0;r<e.length;r++)n.push(r);else for(var i in e)n.push(i);v(e,n,t)}},v=function(e,t,n){for(var r in t)j(e,t[r],n)},y=function(t,n,r){var o=t[n];b(t,n),t.watchers||f(t,"watchers",{}),t.watchers[n]||(t.watchers[n]=[]);for(var i in t.watchers[n])if(t.watchers[n][i]===r)return;t.watchers[n].push(r),c(t,n,function(){return o},function(i){var a=o;o=i,t[n]&&l(t[n],r),b(t,n),e.noMore||JSON.stringify(a)!==JSON.stringify(i)&&(m(t,n,"set",i,a),e.noMore=!1)})},m=function(e,t,n,o,i){for(var a in e.watchers[t])r(a)&&e.watchers[t][a].call(e,t,n,o,i)},g=["pop","push","reverse","shift","sort","slice","unshift"],w=function(e,t,n,r){f(e[t],r,function(){var o=n.apply(e[t],arguments);return s(e,e[t]),"slice"!==r&&m(e,t,r,arguments),o})},b=function(e,t){if(e[t]&&!(e[t]instanceof String)&&o(e[t]))for(var n,r=g.length;r--;)n=g[r],w(e,t,e[t][n],n)},j=function(e,t,n){for(var r in e.watchers[t]){e.watchers[t][r]==n&&e.watchers[t].splice(r,1)}E(e,t,n)},x=function(){for(var e in t){var n=t[e],r=i(n.obj[n.prop],n.actual);if(r.added.length||r.removed.length){if(r.added.length)for(var o in n.obj.watchers[n.prop])d(n.obj[n.prop],r.added,n.obj.watchers[n.prop][o],n.level-1,!0);m(n.obj,n.prop,"differentattr",r,n.actual)}n.actual=a(n.obj[n.prop])}},O=function(e,n,r,o){t.push({obj:e,prop:n,actual:a(e[n]),watcher:r,level:o})},E=function(e,n,r){for(var o in t){var i=t[o];i.obj==e&&i.prop==n&&i.watcher==r&&t.splice(o,1)}};return setInterval(x,50),e.watch=u,e.unwatch=h,e.callWatchers=m,e}(),M={},S="databind-model-change",_="databind-dom-change",L="data-key";return{bind:O,unbind:E}});
    2420!function(){"use strict";function e(n,t,r){return("string"==typeof t?t:t.toString()).replace(n.define||a,function(e,t,o,a){return 0===t.indexOf("def.")&&(t=t.substring(4)),t in r||(":"===o?(n.defineParams&&a.replace(n.defineParams,function(e,n,o){r[t]={arg:n,text:o}}),t in r||(r[t]=a)):new Function("def","def['"+t+"']="+a)(r)),""}).replace(n.use||a,function(t,o){n.useParams&&(o=o.replace(n.useParams,function(e,n,t,o){if(r[t]&&r[t].arg&&o){var a=(t+":"+o).replace(/'|\\/g,"_");return r.__exp=r.__exp||{},r.__exp[a]=r[t].text.replace(new RegExp("(^|[^\\w$])"+r[t].arg+"([^\\w$])","g"),"$1"+o+"$2"),n+"def.__exp['"+a+"']"}}));var a=new Function("def","return "+o)(r);return a?e(n,a,r):a})}function n(e){return e.replace(/\\('|\\)/g,"$1").replace(/[\r\t\n]/g," ")}var t,r={engine:"doT",version:"1.1.1",templateSettings:{evaluate:/\{\{([\s\S]+?(\}?)+)\}\}/g,interpolate:/\{\{=([\s\S]+?)\}\}/g,encode:/\{\{!([\s\S]+?)\}\}/g,use:/\{\{#([\s\S]+?)\}\}/g,useParams:/(^|[^\w$])def(?:\.|\[[\'\"])([\w$\.]+)(?:[\'\"]\])?\s*\:\s*([\w$\.]+|\"[^\"]+\"|\'[^\']+\'|\{[^\}]+\})/g,define:/\{\{##\s*([\w\.$]+)\s*(\:|=)([\s\S]+?)#\}\}/g,defineParams:/^\s*([\w$]+):([\s\S]+)/,conditional:/\{\{\?(\?)?\s*([\s\S]*?)\s*\}\}/g,iterate:/\{\{~\s*(?:\}\}|([\s\S]+?)\s*\:\s*([\w$]+)\s*(?:\:\s*([\w$]+))?\s*\}\})/g,varname:"it",strip:!0,append:!0,selfcontained:!1,doNotSkipEncoded:!1},template:void 0,compile:void 0,log:!0};r.encodeHTMLSource=function(e){var n={"&":"&#38;","<":"&#60;",">":"&#62;",'"':"&#34;","'":"&#39;","/":"&#47;"},t=e?/[&<>"'\/]/g:/&(?!#?\w+;)|<|>|"|'|\//g;return function(e){return e?e.toString().replace(t,function(e){return n[e]||e}):""}},t=function(){return this||(0,eval)("this")}(),"undefined"!=typeof module&&module.exports?module.exports=r:"function"==typeof define&&define.amd?define(function(){return r}):t.doT=r;var o={append:{start:"'+(",end:")+'",startencode:"'+encodeHTML("},split:{start:"';out+=(",end:");out+='",startencode:"';out+=encodeHTML("}},a=/$^/;r.template=function(c,i,u){i=i||r.templateSettings;var d,s,p=i.append?o.append:o.split,l=0,f=i.use||i.define?e(i,c,u||{}):c;f=("var out='"+(i.strip?f.replace(/(^|\r|\n)\t* +| +\t*(\r|\n|$)/g," ").replace(/\r|\n|\t|\/\*[\s\S]*?\*\//g,""):f).replace(/'|\\/g,"\\$&").replace(i.interpolate||a,function(e,t){return p.start+n(t)+p.end}).replace(i.encode||a,function(e,t){return d=!0,p.startencode+n(t)+p.end}).replace(i.conditional||a,function(e,t,r){return t?r?"';}else if("+n(r)+"){out+='":"';}else{out+='":r?"';if("+n(r)+"){out+='":"';}out+='"}).replace(i.iterate||a,function(e,t,r,o){return t?(l+=1,s=o||"i"+l,t=n(t),"';var arr"+l+"="+t+";if(arr"+l+"){var "+r+","+s+"=-1,l"+l+"=arr"+l+".length-1;while("+s+"<l"+l+"){"+r+"=arr"+l+"["+s+"+=1];out+='"):"';} } out+='"}).replace(i.evaluate||a,function(e,t){return"';"+n(t)+"out+='"})+"';return out;").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/(\s|;|\}|^|\{)out\+='';/g,"$1").replace(/\+''/g,""),d&&(i.selfcontained||!t||t._encodeHTML||(t._encodeHTML=r.encodeHTMLSource(i.doNotSkipEncoded)),f="var encodeHTML = typeof _encodeHTML !== 'undefined' ? _encodeHTML : ("+r.encodeHTMLSource.toString()+"("+(i.doNotSkipEncoded||"")+"));"+f);try{return new Function(i.varname,f)}catch(e){throw"undefined"!=typeof console&&console.log("Could not create a template function: "+f),e}},r.compile=function(e,n){return r.template(e,null,n)}}();
     
    2622var WOFAdmin;!function(e){!function(n){var i=function(){function n(){this.$gdprSettingsWrapper=jQuery("[name=gdpr_settings]"),this.$checkboxesContainer=jQuery(".wof-checkboxes-list"),this.$noCheckboxesBubble=jQuery(".wof-gdpr-options-no-checkbox"),this.$hiddenInput=this.$gdprSettingsWrapper.find("input[type=hidden]"),this.initEvents()}return n.prototype.addOptionToGdprSettingUI=function(e,n){void 0===n&&(n=!1),this.$checkboxesContainer.append(jQuery('<div style="padding-top:7px;"><input name="wof-gdpr-option[]" '+(n?'checked="checked"':"")+' data-field-id="'+e.id+'" type="checkbox" id="gdpr-option-'+e.id+'" /> <label for="gdpr-option-'+e.id+'">'+e.placeholder+"</label></div>"))},n.prototype.initGdprSettingOptions=function(n,i){var t=this;i=i?i.split(","):[],this.$checkboxesContainer.empty();var o=e.helpers.Collections.findAllBy(n,"type","consent_checkbox");o.length?this.$noCheckboxesBubble.hide():this.$noCheckboxesBubble.show(),o.forEach(function(e,n){var o=i.indexOf(e.id)>-1;"consent_checkbox"===e.type&&t.addOptionToGdprSettingUI(e,o)}),this.$hiddenInput.val(i),this.$hiddenInput[0].dispatchEvent(new Event("input"))},n.prototype.initEvents=function(){var e=this;Core.Admin.Dispatcher.subscribe("field:removed",function(n){jQuery("input[type=checkbox]#gdpr-option-"+n.id).closest("div").remove();var i=e.$hiddenInput.val().split(","),t=i.indexOf(n.id);t>-1&&i.splice(t,1),e.$hiddenInput.val(i.join(","))}),Core.Admin.Dispatcher.subscribe("field:added",function(n){e.addOptionToGdprSettingUI(n,!1)}),jQuery(".wof-checkboxes-list").on("change","input[type=checkbox]",function(n){var i=[];jQuery("input[name='wof-gdpr-option[]']:checked").each(function(e,n){i.push(jQuery(n).data("field-id"))}),e.$hiddenInput.val(i.join(",")),e.$hiddenInput[0].dispatchEvent(new Event("input"))})},n}();n.Gdpr=i}(e.Controllers||(e.Controllers={}))}(WOFAdmin||(WOFAdmin={}));
    2723var WOFAdmin;!function(e){!function(t){var i=function(){function t(){this.getWheelsList(),this.initEditWheel(),this.initDeleteWheel(),this.initDuplicateWheel(),this.initToggleActivation()}return t.prototype.initToggleActivation=function(){jQuery(".wof-wheels-list").on("click",".wof-toggle-active",function(t){var i=jQuery(t.currentTarget);e.Api.Wheels.toggleActivation(i.data("wheel"),i.is(":checked")?1:0)})},t.prototype.getWheelsList=function(){var t=this;e.Api.Wheels.getWheels().then(function(e){if(t.wheels=e,0===t.wheels.length)jQuery(".wof-no-results").show();else{jQuery(".wof-no-results").hide();var i=window.doT.template(jQuery("#tpl-wof-wheels-list").html());jQuery(".wof-wheels-list").html(i({wheels:e}))}})},t.prototype.initDuplicateWheel=function(){var t=!1;jQuery(".wof-wheels-list").on("click",".wof-duplicate-wheel",function(i){if(i.preventDefault(),!t){t=!0;var l=jQuery(i.currentTarget);l.css("opacity",.5),e.Api.Wheels.getWheel(l.data("wheel")).then(function(i){i.id=null,e.Api.Wheels.addWheel(i).then(function(){Core.Admin.Dispatcher.publish("wof-wheel:created"),t=!1,l.css("opacity",1)})})}})},t.prototype.initEditWheel=function(){jQuery(".wof-wheels-list").on("click",".wof-edit-wheel",function(t){t.preventDefault(),Core.Admin.Main.loading();var i=jQuery(t.currentTarget);e.Api.Wheels.getWheel(i.data("wheel")).then(function(e){Core.Admin.Dispatcher.publish("wof-wheel:edit",e)})})},t.prototype.initDeleteWheel=function(){jQuery(".wof-wheels-list").on("click",".wof-delete-wheel",function(t){if(t.preventDefault(),confirm("Are you sure you want to delete this wheel?")){var i=jQuery(t.currentTarget);e.Api.Wheels.deleteWheel(i.data("wheel")).then(function(){i.closest(".image-tile").hide("fast")})}})},t}();t.WheelsListCtrl=i}(e.Controllers||(e.Controllers={}))}(WOFAdmin||(WOFAdmin={}));
     24var WOFAdmin;!function(n){!function(n){var i=function(){function n(){this.required=!1,this.type="text"}return n}();n.Field=i}(n.Models||(n.Models={}))}(WOFAdmin||(WOFAdmin={}));
     25var WOFAdmin;!function(n){!function(n){var i=function(){function n(){}return n}();n.Slice=i}(n.Models||(n.Models={}))}(WOFAdmin||(WOFAdmin={}));
     26var WOFAdmin;!function(n){!function(n){var i=function(){function n(){}return n}();n.Statistics=i}(n.Models||(n.Models={}))}(WOFAdmin||(WOFAdmin={}));
     27var WOFAdmin;!function(e){!function(e){var i=function(){function e(){this.theme="vintage",this.slices=[],this.active="1",this.winning_chance=70,this.plays=0,this.bgpattern="hearts",this.title="Get your chance to <em>win a price</em>!",this.explainer="Enter your email address and spin the wheel. This is your chance to win amazing discounts!",this.disclaimer="Our in-house rules:<ul><li>One game per user</li><li>Cheaters will be disqualified.</li></ul>",this.email_placeholder="Your email",this.button_text="Try your luck",this.button_done="I'm done playing",this.close_text="I don't feel lucky",this.losing_title="Uh oh! Looks like you lost",this.losing_text="We're sorry, the wheel of fortune has let you down. Better luck next time!",this.winning_title="Hurray! You've hit {x}. Lucky you!",this.winning_text_coupon="Nicely done! You can use the coupon code below to claim your prize:",this.winning_text_link="Nicely done! here's the link to your free product:",this.button_again="Try again",this.games_left_text="You have {x} spins left",this.user_inclusion="0",this.appeartype="delay",this.appeardelay=5,this.appearscroll=60,this.occurance="delay",this.occurancedelay=14,this.hide_mobile=!0,this.fields=[]}return e}();e.Wheel=i}(e.Models||(e.Models={}))}(WOFAdmin||(WOFAdmin={}));
  • wp-optin-wheel/trunk/admin/views/add_wheel.php

    r3165654 r3380469  
    33    <ul class="step-tracker steps-5">
    44        <li class="step current">
    5             <span></span><h2><?php _e('Theme', $slug); ?></h2>
     5            <span></span><h2><?php esc_html_e('Theme', 'wp-optin-wheel' ); ?></h2>
    66        </li>
    77        <li class="step">
    8             <span></span><h2><?php _e('Chances', $slug); ?></h2>
     8            <span></span><h2><?php esc_html_e('Chances', 'wp-optin-wheel' ); ?></h2>
    99        </li>
    1010        <li class="step">
    11             <span></span><h2><?php _e('Slices', $slug); ?></h2>
     11            <span></span><h2><?php esc_html_e('Slices', 'wp-optin-wheel' ); ?></h2>
    1212        </li>
    1313        <li class="step">
    14             <span></span><h2><?php _e('Form builder', $slug); ?></h2>
     14            <span></span><h2><?php esc_html_e('Form builder', 'wp-optin-wheel' ); ?></h2>
    1515        </li>
    1616        <li class="step">
    17             <span></span><h2><?php _e('Settings', $slug); ?></h2>
     17            <span></span><h2><?php esc_html_e('Settings', 'wp-optin-wheel' ); ?></h2>
    1818        </li>
    1919    </ul>
     
    2121        <div data-step="1" class="t-c p-t-5">
    2222            <div class="wof-warn error-mail-lists">
    23                 <?php _e('Before you can create wheels, please enter your MailChimp API key in the "email integration" tab.', $slug); ?><br/>
    24                 <?php _e('Don\'t want to use MailChimp? Consider upgrading to the Pro version.', $slug); ?>
     23                <?php esc_html_e('Before you can create wheels, please enter your MailChimp API key in the "email integration" tab.', 'wp-optin-wheel' ); ?><br/>
     24                <?php esc_html_e('Don\'t want to use MailChimp? Consider upgrading to the Pro version.', 'wp-optin-wheel' ); ?>
    2525            </div>
    2626            <div class="wof-step-1" style="display: none;">
     
    4040                    ?>
    4141                    <div class="pro-option-teaser">
    42                         <div style="padding-bottom: 15px;text-align: center;"><b>Build your own unlimited themes</b> or enjoy pre-built themes (including <b>seasonal</b> themes like "Christmas") in premium.</div>
     42                        <div style="padding-bottom: 15px;text-align: center;"><?php echo wp_kses_post( __( '<b>Build your own theme in Pro </b> and give each slice any color your like. You can also pick from more pre-built themes (including <b>seasonal</b> themes like "Christmas").', 'wp-optin-wheel' ) ) ?></div>
    4343                        <div class="wof-theme">
    4444                            <img src="<?php echo esc_attr($data['base_url']).'/admin/img/wheel-black-and-white.png' ?>" />
     
    5353                </div>
    5454                <div class="m-t-5 t-c">
    55                     <button class="mabel-btn-next-step mabel-btn"><?php _e('Next', $slug); ?></button>
    56                     <button class="btn-save-wheel mabel-btn btn-save-when-editing" style="display: none;"><?php _e('Save', $slug); ?></button>
     55                    <button class="mabel-btn-next-step mabel-btn"><?php esc_html_e( 'Next', 'wp-optin-wheel' ); ?></button>
     56                    <button class="btn-save-wheel mabel-btn btn-save-when-editing" style="display: none;"><?php esc_html_e( 'Save', 'wp-optin-wheel' ); ?></button>
    5757                </div>
    5858            </div>
     
    7474
    7575            <div class="p-t-5 t-c">
    76                 <button class="mabel-btn-prev-step mabel-btn mabel-secondary"><?php _e('Back', $slug); ?></button>
    77                 <button class="mabel-btn-next-step mabel-btn"><?php _e('Next', $slug); ?></button>
    78                 <button class="btn-save-wheel mabel-btn btn-save-when-editing" style="display: none;"><?php _e('Save', $slug); ?></button>
     76                <button class="mabel-btn-prev-step mabel-btn mabel-secondary"><?php esc_html_e('Back', 'wp-optin-wheel' ); ?></button>
     77                <button class="mabel-btn-next-step mabel-btn"><?php esc_html_e('Next', 'wp-optin-wheel' ); ?></button>
     78                <button class="btn-save-wheel mabel-btn btn-save-when-editing" style="display: none;"><?php esc_html_e( 'Save', 'wp-optin-wheel' ); ?></button>
    7979            </div>
    8080        </div>
    8181
    8282        <div data-step="3" class="skip-save p-t-5" style="display: none;">
    83             <p><?php _e('A wheel has 12 slices. Below you can define each slice in detail.', $slug); ?></p>
     83            <p><?php esc_html_e('A wheel has 12 slices. Below you can define each slice in detail.', 'wp-optin-wheel' ); ?></p>
     84            <div class="pro-option-teaser" style="margin-top:15px">
     85                <p><?php echo wp_kses_post( __( 'With our Pro version, you can <strong>freely define how many slices</strong> your wheel should have. You can also <strong>limit prizes per slice</strong>!', 'wp-optin-wheel' ) ); ?></p>
     86            </div>
    8487            <table class="form-table wof-slice-wrapper m-t-5">
    8588                <thead>
    8689                    <th style="width:45px;"></th>
    87                     <th><?php _e('Type', $slug) ?></th>
    88                     <th><?php _e('Text', $slug) ?></th>
     90                    <th><?php esc_html_e('Type', 'wp-optin-wheel' ) ?></th>
     91                    <th><?php esc_html_e('Text', 'wp-optin-wheel' ) ?></th>
    8992                    <th>
    90                         <span class="wof-value-title"><?php _e('Value', $slug) ?></span>
    91                         <span class="wof-wc-title" style="display: none;"><?php _e('Discount', $slug) ?></span>
     93                        <span class="wof-value-title"><?php esc_html_e('Value', 'wp-optin-wheel' ) ?></span>
     94                        <span class="wof-wc-title" style="display: none;"><?php esc_html_e('Discount', 'wp-optin-wheel' ) ?></span>
    9295                    </th>
    93                     <th style="width:135px;"><?php _e('Chance', $slug) ?></th>
     96                    <th style="width:135px;"><?php esc_html_e('Chance', 'wp-optin-wheel' ) ?></th>
    9497                    <th style="width:100px;">&nbsp;</th>
    9598                </thead>
     
    97100            </table>
    98101            <div class="wof-total">
    99                 <?php _e('Chance total', $slug); ?>: <span class="wof-total-percentage"></span> %</th>
     102                <?php esc_html_e('Chance total', 'wp-optin-wheel' ); ?>: <span class="wof-total-percentage"></span> %</th>
    100103            </div>
    101104            <p class="msg-bad msg-incorrect-percentage" style="display: none;">
    102                 <?php _e("The total sum of chance should be 100. Please double check and adjust accordingly.", $slug) ?>
     105                <?php esc_html_e("The total sum of chance should be 100. Please double check and adjust accordingly.", 'wp-optin-wheel' ) ?>
    103106            </p>
    104107            <div class="p-t-5 t-c">
    105                 <button class="mabel-btn-prev-step mabel-btn mabel-secondary"><?php _e('Back', $slug); ?></button>
    106                 <button class="mabel-btn mabel-btn-next-step "><?php _e('Next', $slug); ?></button>
    107                 <button class="btn-save-wheel mabel-btn btn-save-when-editing" style="display: none;"><?php _e('Save', $slug); ?></button>
     108                <button class="mabel-btn-prev-step mabel-btn mabel-secondary"><?php esc_html_e('Back', 'wp-optin-wheel' ); ?></button>
     109                <button class="mabel-btn mabel-btn-next-step "><?php esc_html_e('Next', 'wp-optin-wheel' ); ?></button>
     110                <button class="btn-save-wheel mabel-btn btn-save-when-editing" style="display: none;"><?php esc_html_e('Save', 'wp-optin-wheel' ); ?></button>
    108111            </div>
    109112        </div>
     
    112115            <div class="form-builder-for-lists">
    113116                <div class="wof-info-bubble pro-option-teaser">
    114                     <?php _e('Build your opt-in form here. This is what the user needs to fill out before playing or seeing their prize.<br/>The premium version allows to add more <strong>fields and field types</strong>.', $slug); ?>
     117                    <?php echo wp_kses_post( __( 'Build your opt-in form here. This is what the user needs to fill out before playing or seeing their prize.<br/>The Pro version allows to add more <strong>fields and field types</strong>.', 'wp-optin-wheel' ) ); ?>
    115118                </div>
    116119                <?php
     
    119122            </div>
    120123            <div class="p-t-5 t-c">
    121                 <button class="mabel-btn-prev-step mabel-btn mabel-secondary"><?php _e('Back', $slug); ?></button>
    122                 <button class="mabel-btn-next-step mabel-btn"><?php _e('Next', $slug); ?></button>
    123                 <button class="btn-save-wheel mabel-btn btn-save-when-editing" style="display: none;"><?php _e('Save', $slug); ?></button>
     124                <button class="mabel-btn-prev-step mabel-btn mabel-secondary"><?php esc_html_e('Back', 'wp-optin-wheel' ); ?></button>
     125                <button class="mabel-btn-next-step mabel-btn"><?php esc_html_e('Next', 'wp-optin-wheel' ); ?></button>
     126                <button class="btn-save-wheel mabel-btn btn-save-when-editing" style="display: none;"><?php esc_html_e('Save', 'wp-optin-wheel' ); ?></button>
    124127            </div>
    125128        </div>
     
    140143
    141144            <div class="p-t-5 t-c">
    142                 <button class="mabel-btn-prev-step mabel-btn mabel-secondary"><?php _e('Back', $slug); ?></button>
    143                 <button class="btn-save-wheel mabel-btn"><?php _e('Save', $slug); ?></button>
     145                <button class="mabel-btn-prev-step mabel-btn mabel-secondary"><?php esc_html_e('Back', 'wp-optin-wheel' ); ?></button>
     146                <button class="btn-save-wheel mabel-btn"><?php esc_html_e('Save', 'wp-optin-wheel' ); ?></button>
    144147            </div>
    145148        </div>
    146149
    147150        <div class="t-c p-t-5" data-final-step style="display: none;">
    148                 <b><?php _e("All done! Your wheel of fortune is now live.", $slug); ?></b>
     151                <b><?php _e("All done! Your wheel of fortune is now live.", 'wp-optin-wheel' ); ?></b>
    149152            <div class="p-t-5 t-c">
    150                 <button class="btn-start-over mabel-btn"><?php _e('Add new wheel', $slug); ?></button>
     153                <button class="btn-start-over mabel-btn"><?php esc_html_e('Add new wheel', 'wp-optin-wheel' ); ?></button>
    151154            </div>
    152155        </div>
     
    161164        <td>
    162165            <select name="wof-slice-type">
    163                 <option {{? value.type == 0}}selected="selected"{{?}} value="0"><?php _e('No Prize', $slug) ?></option>
    164                 <option {{? value.type == 1}}selected="selected"{{?}} value="1"><?php _e('Coupon Code', $slug) ?></option>
    165                 <option {{? value.type == 2}}selected="selected"{{?}} value="2"><?php _e('Link', $slug) ?></option>
    166                 <option disabled><?php _e('WooCommerce - generated coupon (Pro)', $slug) ?></option>
    167                 <option disabled><?php _e('WooCommerce - Free product (Pro)', $slug) ?></option>
    168                 <option disabled><?php _e('WooCommerce - Free shipping (Pro)', $slug) ?></option>
    169                 <option disabled><?php _e('Redirect to link (Pro)', $slug) ?></option>
    170                 <option disabled><?php _e('Custom text or HTML (Pro)', $slug) ?></option>
     166                <option {{? value.type == 0}}selected="selected"{{?}} value="0"><?php esc_html_e('No Prize', 'wp-optin-wheel' ) ?></option>
     167                <option {{? value.type == 1}}selected="selected"{{?}} value="1"><?php esc_html_e('Coupon Code', 'wp-optin-wheel' ) ?></option>
     168                <option {{? value.type == 2}}selected="selected"{{?}} value="2"><?php esc_html_e('Link', 'wp-optin-wheel' ) ?></option>
     169                <option disabled><?php esc_html_e('WooCommerce - generated coupon (Pro)', 'wp-optin-wheel' ) ?></option>
     170                <option disabled><?php esc_html_e('WooCommerce - Free product (Pro)', 'wp-optin-wheel' ) ?></option>
     171                <option disabled><?php esc_html_e('WooCommerce - Free shipping (Pro)', 'wp-optin-wheel' ) ?></option>
     172                <option disabled><?php esc_html_e('Redirect to link (Pro)', 'wp-optin-wheel' ) ?></option>
     173                <option disabled><?php esc_html_e('Custom text or HTML (Pro)', 'wp-optin-wheel' ) ?></option>
    171174            </select>
    172175        </td>
     
    185188        </td>
    186189        <td>
    187             <a style="display: none;" class="btn-wc-coupon-settings" data-slice="{{=index+1}}" href="#"><?php _e('More settings', $slug); ?></a>
     190            <a style="display: none;" class="btn-wc-coupon-settings" data-slice="{{=index+1}}" href="#"><?php esc_html_e('More settings', 'wp-optin-wheel' ); ?></a>
    188191        </td>
    189192    </tr>
  • wp-optin-wheel/trunk/admin/views/all_wheels.php

    r3165654 r3380469  
    11<div class="wof-nonce" data-nonce="<?php echo esc_attr(wp_create_nonce('wof_data_nonce')) ?>"></div>
    22<div class="wof-all-wheels-wrapper">
    3     <span class="wof-no-results" style="display:inline-block;padding-bottom: 20px;"><?php _e("You didn't create any wheels yet.", \MABEL_WOF_LITE\Core\Common\Managers\Config_Manager::$slug); ?></span>
     3    <span class="wof-no-results" style="display:inline-block;padding-bottom: 20px;"><?php esc_html_e("You didn't create any wheels yet.", 'wp-optin-wheel' ); ?></span>
    44
    55    <div class="wof-wheels-list"></div>
    66
    77    <div class="pro-option-teaser">
    8         <b>Need statistics?</b> Views & optin statistics are available in the premium version.
     8        <?php echo wp_kses_post( __( '<b>Need statistics?</b> Views & optin statistics are available in the Pro version.', 'wp-optin-wheel' ) ) ?>
    99    </div>
    1010</div>
     
    2525        <div class="tile-footer">
    2626            <div>
    27                 <?php _e('Active', \MABEL_WOF_LITE\Core\Common\Managers\Config_Manager::$slug) ?> <input type="checkbox" name="active" {{! (value.active == 1) ? ' checked="checked" ' : '' }} class="skip-save wof-toggle-active" data-wheel="{{=value.id}}" />
     27                <?php esc_html_e( 'Active', 'wp-optin-wheel' ) ?> <input type="checkbox" name="active" {{! (value.active == 1) ? ' checked="checked" ' : '' }} class="skip-save wof-toggle-active" data-wheel="{{=value.id}}" />
    2828            </div>
    2929            <ul>
  • wp-optin-wheel/trunk/admin/views/sidebar-main.php

    r2801374 r3380469  
    66            <li>Full integration with WooCommerce</li>
    77            <li>Create your own themes</li>
    8             <li>Add other fields to the form</li>
     8            <li>Form builder: add more fields to the opt-in form</li>
    99            <li>Limit prizes</li>
    1010            <li>Add/remove slices</li>
  • wp-optin-wheel/trunk/class-wheel-of-fortune.php

    r3272834 r3380469  
    142142                    $item_id = "wp-optin-wheel-lite-log-".$email;
    143143                    $group_id = 'wp-optin-wheel-lite';
    144                     $group_label = __( 'Optin Wheel Plugin Data' );
     144                    $group_label = __( 'Optin Wheel Plugin Data', 'wp-optin-wheel' );
    145145                    $data = [ [
    146                         'name' => __('Logs for user', Config_Manager::$slug),
     146                        'name' => __('Logs for user', 'wp-optin-wheel' ),
    147147                        'value' => join('<br/>',$matches)
    148148                    ] ];
  • wp-optin-wheel/trunk/code/controllers/class-admin-controller.php

    r3165654 r3380469  
    5252
    5353        public function get_mailchimp_fields() {
     54
     55                        if( ! current_user_can( $this->capability ) || !isset( $_REQUEST['wof_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['wof_nonce'] ) ), 'wof_data_nonce' ) ) {
     56                wp_send_json_error();
     57            }
     58
     59            if ( ! empty( $_GET['id'] ) ) {
     60                wp_send_json( MailChimp_Service::get_fields_from_list( sanitize_text_field( sanitize_text_field( wp_unslash( $_GET['id'] ) ) ) ) );
     61            }
     62
     63            wp_send_json_error();
     64
     65                    }
     66
     67        public function clear_log() {
     68            if( ! current_user_can( $this->capability ) || !isset( $_REQUEST['wof_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['wof_nonce'] ) ), 'wof_data_nonce' ) ) {
     69                wp_send_json_error();
     70            }
     71            Log_Service::clear();
     72            wp_die();
     73        }
     74
     75        public function get_logs(){
     76            if( ! current_user_can( $this->capability ) || !isset( $_REQUEST['wof_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['wof_nonce'] ) ), 'wof_data_nonce' ) ) {
     77                wp_send_json_error();
     78            }
     79            wp_send_json(Log_Service::get_log());
     80        }
     81
     82        public function get_mailchimp_lists() {
     83            if( ! current_user_can( $this->capability ) || !isset( $_REQUEST['wof_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['wof_nonce'] ) ), 'wof_data_nonce' ) ) {
     84                wp_send_json_error();
     85            }
     86
     87            wp_send_json(MailChimp_Service::get_email_lists());
     88        }
     89
     90        public function toggle_wheel_activation()
     91        {
     92            if( ! current_user_can( $this->capability ) || !isset( $_REQUEST['wof_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['wof_nonce'] ) ), 'wof_data_nonce' ) ) {
     93                wp_send_json_error();
     94            }
     95
     96            if ( isset( $_REQUEST['id'] ) && ! empty( $_REQUEST['id'] ) && isset( $_REQUEST['toggle'] ) && ! empty( $_REQUEST['toggle'] ) ) {
     97                Wheel_service::toggle_activation( sanitize_text_field( wp_unslash( $_REQUEST['id'] ) ), sanitize_text_field( wp_unslash( $_REQUEST['toggle'] ) ) );
     98            }
     99
     100                        wp_die();
     101
     102                    }
     103
     104        public function delete_wheel()
     105        {
     106            if( ! current_user_can( $this->capability ) || !isset( $_REQUEST['wof_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['wof_nonce'] ) ), 'wof_data_nonce' ) ) {
     107                wp_send_json_error();
     108            }
     109
     110            if ( isset( $_REQUEST['id'] ) && ! empty( $_REQUEST['id'] ) ){
     111                Wheel_service::delete_wheel( sanitize_text_field( wp_unslash( $_REQUEST['id'] ) ) );
     112            }
     113
     114            wp_die();
     115        }
     116
     117        public function get_wheel()
     118        {
     119            if( ! current_user_can( $this->capability ) || !isset( $_REQUEST['wof_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['wof_nonce'] ) ), 'wof_data_nonce' ) ) {
     120                wp_send_json_error();
     121            }
     122
     123            if( empty( $_GET['id'] ) ) wp_die();
     124
     125            $notification = Wheel_service::get_wheel( sanitize_text_field( wp_unslash( $_GET['id'] ) ) );
     126
     127                        wp_send_json( $notification );
     128
     129                    }
     130
     131        public function get_wheels()
     132        {
     133            if( ! current_user_can( $this->capability ) || !isset( $_REQUEST['wof_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['wof_nonce'] ) ), 'wof_data_nonce' ) ) {
     134                wp_send_json_error();
     135            }
     136
     137            $notifications = Wheel_service::get_all_wheels();
     138            wp_send_json( $notifications );
     139        }
     140
     141        public function update_wheel()
     142        {
     143            if( ! current_user_can( $this->capability ) || !isset( $_REQUEST['wof_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['wof_nonce'] ) ), 'wof_data_nonce' ) ) {
     144                wp_send_json_error();
     145            }
     146
     147            if(!isset($_POST['options']) || !isset($_POST['id']))
     148                wp_send_json_error();
     149
     150            $decoded = json_decode( stripslashes( $_POST['options'] ) );
     151
     152            if($decoded === null)
     153                wp_send_json_error(json_last_error_msg());
     154
     155            $validated_decoded = $this->sanitize_options( $decoded );
     156
     157            Wheel_service::edit_wheel( sanitize_text_field( wp_unslash( $_POST['id'] ) ),addslashes( json_encode( $validated_decoded ) ) );
     158
     159            wp_send_json_success();
     160        }
     161
     162        public function add_wheel()
     163        {
    54164            if(!current_user_can($this->capability) || !isset($_REQUEST['wof_nonce']) || !wp_verify_nonce($_REQUEST['wof_nonce'],'wof_data_nonce')) {
    55165                wp_send_json_error();
    56166            }
    57             wp_send_json(MailChimp_Service::get_fields_from_list(sanitize_text_field($_GET['id'])));
    58         }
    59 
    60         public function clear_log() {
    61             if(!current_user_can($this->capability) || !isset($_REQUEST['wof_nonce']) || !wp_verify_nonce($_REQUEST['wof_nonce'],'wof_data_nonce')) {
     167
     168            if( empty( $_POST['options'] ) )
    62169                wp_send_json_error();
    63             }
    64             Log_Service::clear();
    65             wp_die();
    66         }
    67 
    68         public function get_logs(){
    69             if(!current_user_can($this->capability) || !isset($_REQUEST['wof_nonce']) || !wp_verify_nonce($_REQUEST['wof_nonce'],'wof_data_nonce')) {
    70                 wp_send_json_error();
    71             }
    72             wp_send_json(Log_Service::get_log());
    73         }
    74 
    75         public function get_mailchimp_lists() {
    76             if(!current_user_can($this->capability) || !isset($_REQUEST['wof_nonce']) || !wp_verify_nonce($_REQUEST['wof_nonce'],'wof_data_nonce')) {
    77                 wp_send_json_error();
    78             }
    79 
    80             wp_send_json(MailChimp_Service::get_email_lists());
    81         }
    82 
    83         public function toggle_wheel_activation()
    84         {
    85             if(!current_user_can($this->capability) || !isset($_REQUEST['wof_nonce']) || !wp_verify_nonce($_REQUEST['wof_nonce'],'wof_data_nonce')) {
    86                 wp_send_json_error();
    87             }
    88 
    89             Wheel_service::toggle_activation(sanitize_text_field($_REQUEST['id']), sanitize_text_field($_REQUEST['toggle']));
    90             wp_die();
    91         }
    92 
    93         public function delete_wheel()
    94         {
    95             if(!current_user_can($this->capability) || !isset($_REQUEST['wof_nonce']) || !wp_verify_nonce($_REQUEST['wof_nonce'],'wof_data_nonce')) {
    96                 wp_send_json_error();
    97             }
    98 
    99             Wheel_service::delete_wheel(sanitize_text_field($_REQUEST['id']));
    100             wp_die();
    101         }
    102 
    103         public function get_wheel()
    104         {
    105             if(!current_user_can($this->capability) || !isset($_REQUEST['wof_nonce']) || !wp_verify_nonce($_REQUEST['wof_nonce'],'wof_data_nonce')) {
    106                 wp_send_json_error();
    107             }
    108 
    109             if(!isset($_GET['id'])) wp_die();
    110 
    111             $notification = Wheel_service::get_wheel(sanitize_text_field($_GET['id']));
    112             wp_send_json($notification);
    113         }
    114 
    115         public function get_wheels()
    116         {
    117             if(!current_user_can($this->capability) || !isset($_REQUEST['wof_nonce']) || !wp_verify_nonce($_REQUEST['wof_nonce'],'wof_data_nonce')) {
    118                 wp_send_json_error();
    119             }
    120 
    121             $notifications = Wheel_service::get_all_wheels();
    122             wp_send_json($notifications);
    123         }
    124 
    125         public function update_wheel()
    126         {
    127             if(!current_user_can($this->capability) || !isset($_REQUEST['wof_nonce']) || !wp_verify_nonce($_REQUEST['wof_nonce'],'wof_data_nonce')) {
    128                 wp_send_json_error();
    129             }
    130 
    131             if(!isset($_POST['options']) || !isset($_POST['id']))
    132                 wp_send_json_error();
    133 
    134             $decoded = json_decode(stripslashes($_POST['options']));
    135 
    136             if($decoded === null)
    137                 wp_send_json_error(json_last_error_msg());
    138 
    139             $validated_decoded = $this->sanitize_options($decoded);
    140 
    141             Wheel_service::edit_wheel(sanitize_text_field($_POST['id']),addslashes(json_encode($validated_decoded)));
    142 
    143             wp_send_json_success();
    144         }
    145 
    146         public function add_wheel()
    147         {
    148             if(!current_user_can($this->capability) || !isset($_REQUEST['wof_nonce']) || !wp_verify_nonce($_REQUEST['wof_nonce'],'wof_data_nonce')) {
    149                 wp_send_json_error();
    150             }
    151 
    152             if(!isset($_POST['options']))
    153                 wp_send_json_error();
    154 
    155             $decoded = json_decode(stripslashes($_POST['options']));
    156 
    157             if($decoded === null)
    158                 wp_send_json_error(json_last_error_msg());
    159 
    160             $validated_decoded = $this->sanitize_options($decoded);
    161 
    162             $id = Wheel_service::add_wheel(addslashes(json_encode($validated_decoded)));
    163             wp_die($id);
     170
     171            $decoded = json_decode( stripslashes( $_POST['options'] ) );
     172
     173            if( $decoded === null )
     174                wp_send_json_error( json_last_error_msg() );
     175
     176            $validated_decoded = $this->sanitize_options( $decoded );
     177
     178            $id = Wheel_service::add_wheel( addslashes( json_encode( $validated_decoded ) ) );
     179            wp_die( esc_html( $id ) );
    164180        }
    165181
     
    169185            add_action(Config_Manager::$slug . '-render-sidebar', [$this,'render_main_sidebar']);
    170186
    171             $this->options_manager->add_section('settings', __('General settings',$this->slug), 'admin-settings', true);
    172             $this->options_manager->add_section('apis', __('Email Integration', $this->slug), 'email-alt');
    173             $this->options_manager->add_section('addwheel', __('Add Wheel',$this->slug), 'plus');
    174             $this->options_manager->add_section('wheels', __('Wheels',$this->slug), 'dashboard');
     187            $this->options_manager->add_section('settings', __('General settings', 'wp-optin-wheel' ), 'admin-settings', true);
     188            $this->options_manager->add_section('apis', __('Email Integration', 'wp-optin-wheel' ), 'email-alt');
     189            $this->options_manager->add_section('addwheel', __('Add Wheel', 'wp-optin-wheel' ), 'plus');
     190            $this->options_manager->add_section('wheels', __('Wheels', 'wp-optin-wheel' ), 'dashboard');
    175191
    176192            $this->options_manager->add_option('settings', new Checkbox_Option(
    177193                'log',
    178                 __('Use log file', $this->slug),
    179                 __('Log all opt-ins and play-results.',$this->slug),
     194                __('Use log file', 'wp-optin-wheel' ),
     195                __('Log all opt-ins and play-results.', 'wp-optin-wheel' ),
    180196                Settings_Manager::get_setting('log')
    181197            ));
    182198            $this->options_manager->add_option('settings', new Pro_option(
    183                 'Woocommerce coupon integration',
    184                 'This is a premium feature which enables <b>fully automated WooCommerce</b> integration. The integration comes with extra coupon settings such as coupon duration and validity settings.'
    185             ));
     199                __( 'Woocommerce coupon integration', 'wp-optin-wheel' ),
     200                __( 'This is a Pro feature, which enables a <b>fully automated WooCommerce</b> integration. The integration allows wheels to automatically create single-use coupon codes for winners. The integration comes with extra coupon settings such as coupon duration and product/cart validity settings.', 'wp-optin-wheel' )
     201                ));
    186202
    187203
     
    193209            $this->options_manager->add_option('apis', new Text_Option(
    194210                'mailchimp_api',
    195                 __('MailChimp API Key', $this->slug),
     211                __('MailChimp API Key', 'wp-optin-wheel' ),
    196212                Settings_Manager::get_setting('mailchimp_api'),
    197213                null,
    198                 __('If you want to use Mailchimp for email optin, enter your API Key here.', $this->slug)
     214                __('If you want to use Mailchimp for email optin, enter your API Key here.', 'wp-optin-wheel' )
    199215            ));
    200216
    201             $this->options_manager->add_option('apis', new Pro_option('Other integrations','<strong>Don\'t want to use MailChimp? The premium version also integrates with:</strong> <ul><li>Your own WordPress database</li><li>Zapier</li><li>Drip</li><li>Mailchimp</li><li>ActiveCampaign</li><li>Campaign Monitor</li><li>GetResponse</li><li>MailerLite</li><li>Klaviyo</li><li>Mailster</li><li>SendInBlue</li><li>Newsletter2Go</li><li>ConvertKit</li><li>Remarkety</li></ul>You can integrate with anything else via webhooks.'));
     217            $this->options_manager->add_option(
     218                'apis',
     219                new Pro_option(
     220                    __( 'Other integrations', 'wp-optin-wheel' ),
     221                    __( '<strong>Don\'t want to use MailChimp? The Pro version also integrates with:</strong> <ul><li>Your own WordPress database</li><li>Automation tools such as Zapier, IFTTT, N8N, Make, ...</li><li>Drip</li><li>Mailchimp</li><li>ActiveCampaign</li><li>Campaign Monitor</li><li>GetResponse</li><li>MailerLite</li><li>Klaviyo</li><li>Mailster</li><li>MailPoet</li><li>Brevo</li><li>ConvertKit</li><li>Remarkety</li></ul><p>You can also integrate with anything that supports webhooks.</p>', 'wp-optin-wheel' )
     222                )
     223            );
    202224
    203225            $this->options_manager->add_option('addwheel',
     
    279301
    280302            $themes = [
    281                 'vintage' => 'Vintage',
    282                 'deep-purple' => 'Deep Purple',
    283                 'yellow' => 'Yellow',
    284                 'red' => 'Red',
    285                 'orange' => 'Orange',
    286                 'purple' => 'Purple',
    287                 'green' => 'Green',
     303                'vintage'       => __( 'Vintage', 'wp-optin-wheel' ),
     304                'deep-purple'   => __( 'Deep Purple', 'wp-optin-wheel' ),
     305                'yellow'        => __( 'Yellow' , 'wp-optin-wheel' ),
     306                'red'           => __( 'Red', 'wp-optin-wheel' ),
     307                'orange'        => __( 'Orange', 'wp-optin-wheel' ),
     308                'purple'        => __( 'Purple', 'wp-optin-wheel' ),
     309                'green'         => __( 'Green', 'wp-optin-wheel' ),
    288310            ];
    289311
    290312            $slices = [ [
    291                     'label' => __('5% Discount', $this->slug),
     313                    'label' => __('5% Discount', 'wp-optin-wheel' ),
    292314                    'value' => '5OFF',
    293315                    'chance' => 30,
    294316                    'type' => 1
    295317                ], [
    296                     'label' => __('No prize', $this->slug),
    297                     'type' => 0
    298                 ], [
    299                     'label' => __('Next time', $this->slug),
    300                     'type' => 0
    301                 ], [
    302                     'label' => __('Almost!', $this->slug),
    303                     'type' => 0
    304                 ], [
    305                     'label' => __('10% Discount', $this->slug),
     318                    'label' => __('No prize', 'wp-optin-wheel' ),
     319                    'type' => 0
     320                ], [
     321                    'label' => __('Next time', 'wp-optin-wheel' ),
     322                    'type' => 0
     323                ], [
     324                    'label' => __('Almost!', 'wp-optin-wheel' ),
     325                    'type' => 0
     326                ], [
     327                    'label' => __('10% Discount', 'wp-optin-wheel' ),
    306328                    'value' => '10OFF',
    307329                    'chance' => 30,
    308330                    'type' => 1
    309331                ], [
    310                     'label' => __('Free Ebook', $this->slug),
     332                    'label' => __('Free Ebook', 'wp-optin-wheel' ),
    311333                    'value' => 'https://google.com/',
    312334                    'chance' => 30,
    313335                    'type' => 2
    314336                ], [
    315                     'label' => __('No Prize', $this->slug),
    316                     'type' => 0
    317                 ], [
    318                     'label' => __('No luck today', $this->slug),
    319                     'type' => 0
    320                 ], [
    321                     'label' => __('Almost!', $this->slug),
    322                     'type' => 0
    323                 ], [
    324                     'label' => __('50% Discount', $this->slug),
     337                    'label' => __('No Prize', 'wp-optin-wheel' ),
     338                    'type' => 0
     339                ], [
     340                    'label' => __('No luck today', 'wp-optin-wheel' ),
     341                    'type' => 0
     342                ], [
     343                    'label' => __('Almost!', 'wp-optin-wheel' ),
     344                    'type' => 0
     345                ], [
     346                    'label' => __('50% Discount', 'wp-optin-wheel' ),
    325347                    'value' => '50OFF',
    326348                    'chance' => 10,
    327349                    'type' => 1
    328350                ], [
    329                     'label' => __('No prize', $this->slug),
    330                     'type' => 0
    331                 ], [
    332                     'label' => __('Unlucky', $this->slug),
     351                    'label' => __('No prize', 'wp-optin-wheel' ),
     352                    'type' => 0
     353                ], [
     354                    'label' => __('Unlucky', 'wp-optin-wheel' ),
    333355                    'type' => 0
    334356                ],
    335357            ];
    336358
    337             $content_settings = new Container_Option(null, __('Content settings',$this->slug));
     359            $content_settings = new Container_Option( null, __('Content settings', 'wp-optin-wheel' ) );
    338360
    339361            $content_settings->options = [
     
    341363                    new Text_Option(
    342364                        'title',
    343                         __('Title', $this->slug),
     365                        __('Title', 'wp-optin-wheel' ),
    344366                        null,
    345                         __('Get your chance to <em>win a price</em>!', $this->slug),
    346                         __('Use <em></em> to emphasise text (it will have a different color).', $this->slug)
     367                        __('Get your chance to <em>win a price</em>!', 'wp-optin-wheel' ),
     368                        __('Use <em></em> to emphasise text (it will have a different color).', 'wp-optin-wheel' )
    347369                    )
    348370                ),
     
    350372                    new Editor_Option(
    351373                        'explainer',
    352                         __('Explainer text', $this->slug),
     374                        __('Explainer text', 'wp-optin-wheel' ),
    353375                        null,
    354376                        [
     
    359381                            'quicktags' => false
    360382                        ],
    361                         __('A short paragraph explaining how it works.', $this->slug)
     383                        __('A short paragraph explaining how it works.', 'wp-optin-wheel' )
    362384                    )
    363385                ),
     
    365387                    new Editor_Option(
    366388                        'disclaimer',
    367                         __('Disclaimer text', $this->slug),
     389                        __('Disclaimer text', 'wp-optin-wheel' ),
    368390                        null,
    369391                        [
     
    376398                            'quicktags' => false
    377399                        ],
    378                         __('Add a short paragraph explaining the rules & regulations.', $this->slug)
     400                        __('Add a short paragraph explaining the rules & regulations.', 'wp-optin-wheel' )
    379401                    )
    380402                ),
    381                 $this->add_data_attribute_for_data_bind(new Text_Option(
     403                $this->add_data_attribute_for_data_bind( new Text_Option(
    382404                    'button_text',
    383                     __('Spin-button text', $this->slug),
    384                     null,
    385                     __('Try your luck', $this->slug),
    386                     __('This text will appear on the button the visitor has to click to spin the wheel.')
    387                 )),
    388                 $this->add_data_attribute_for_data_bind(new Text_Option(
     405                    __('Spin-button text', 'wp-optin-wheel' ),
     406                    null,
     407                    __('Try your luck', 'wp-optin-wheel' ),
     408                    __('This text will appear on the button the visitor has to click to spin the wheel.', 'wp-optin-wheel' )
     409                )),
     410                $this->add_data_attribute_for_data_bind( new Text_Option(
    389411                    'close_text',
    390                     __('Close popup text', $this->slug),
    391                     null,
    392                     __("I don't feel lucky", $this->slug),
    393                     __('This link will close the popup. It appears on the lower right side of the popup.')
     412                    __('Close popup text', 'wp-optin-wheel' ),
     413                    null,
     414                    __("I don't feel lucky", 'wp-optin-wheel' ),
     415                    __( 'This link will close the popup. It appears on the lower right side of the popup.', 'wp-optin-wheel' )
    394416                )),
    395417                $this->add_data_attribute_for_data_bind(new Text_Option(
    396418                    'losing_title',
    397                     __('Losing title', $this->slug),
    398                     null,
    399                     __("Uh oh! Looks like you lost", $this->slug),
    400                     __('This title will appear after a player hits a losing segment.')
     419                    __( 'Losing title', 'wp-optin-wheel' ),
     420                    null,
     421                    __( "Uh oh! Looks like you lost", 'wp-optin-wheel' ),
     422                    __( 'This title will appear after a player hits a losing segment.', 'wp-optin-wheel' )
    401423                )),
    402424                $this->add_data_attribute_for_data_bind(new Text_Option(
    403425                    'losing_text',
    404                     __("Losing text", $this->slug),
    405                     null,
    406                     __("We're sorry, the wheel of fortune has let you down. Better luck next time!", $this->slug),
    407                     __('This text will appear below the losing title after a player hits a losing segment.')
     426                    __( "Losing text", 'wp-optin-wheel' ),
     427                    null,
     428                    __( "We're sorry, the wheel of fortune has let you down. Better luck next time!", 'wp-optin-wheel' ),
     429                    __( 'This text will appear below the losing title after a player hits a losing segment.', 'wp-optin-wheel' )
    408430                )),
    409431                $this->add_data_attribute_for_data_bind(new Text_Option(
    410432                    'winning_title',
    411                     __('Winning title', $this->slug),
    412                     null,
    413                     __("Hurray! You've hit {x}. Lucky you!", $this->slug),
    414                     __("This title will appear after a player hits a winning segment. Use {x} to denote the segment's label.")
     433                    __('Winning title', 'wp-optin-wheel' ),
     434                    null,
     435                    __("Hurray! You've hit {x}. Lucky you!", 'wp-optin-wheel' ),
     436                    __("This title will appear after a player hits a winning segment. Use {x} to denote the segment's label.", 'wp-optin-wheel' )
    415437                )),
    416438                $this->add_data_attribute_for_data_bind(new Text_Option(
    417439                    'winning_text_coupon',
    418                     __("Winning text for coupons", $this->slug),
    419                     null,
    420                     __("Nicely done! You can use the coupon code below to claim your prize:", $this->slug),
    421                     __('This text will appear below the winning title after a player hits a winning coupon-segment.')
     440                    __("Winning text for coupons", 'wp-optin-wheel' ),
     441                    null,
     442                    __("Nicely done! You can use the coupon code below to claim your prize:", 'wp-optin-wheel' ),
     443                    __('This text will appear below the winning title after a player hits a winning coupon-segment.', 'wp-optin-wheel' )
    422444                )),
    423445                $this->add_data_attribute_for_data_bind(new Text_Option(
    424446                    'winning_text_link',
    425                     __("Winning text for links", $this->slug),
    426                     null,
    427                     __("Nicely done! here's the link to your free product:", $this->slug),
    428                     __('This text will appear below the winning title after a player hits a winning link-segment.',$this->slug)
     447                    __("Winning text for links", 'wp-optin-wheel' ),
     448                    null,
     449                    __("Nicely done! here's the link to your free product:", 'wp-optin-wheel' ),
     450                    __('This text will appear below the winning title after a player hits a winning link-segment.', 'wp-optin-wheel' )
    429451                )),
    430452                $this->add_data_attribute_for_data_bind(new Text_Option(
    431453                    'button_done',
    432                     __("'Done' button text", $this->slug),
    433                     null,
    434                     __("I'm done playing", $this->slug),
    435                     __('When the player has done playing, this button will appear to allow to close the popup.', $this->slug)
     454                    __("'Done' button text", 'wp-optin-wheel' ),
     455                    null,
     456                    __("I'm done playing", 'wp-optin-wheel' ),
     457                    __('When the player has done playing, this button will appear to allow to close the popup.', 'wp-optin-wheel' )
    436458                ))
    437459            ];
    438460
    439             $design_settings = new Container_Option(null, __('Design settings',$this->slug));
     461            $design_settings = new Container_Option(null, __( 'Design settings', 'wp-optin-wheel' ) );
    440462            $design_settings->options = [
    441                 $this->add_data_attribute_for_data_bind(new Dropdown_Option('bgpattern','Background pattern', [
     463                $this->add_data_attribute_for_data_bind(new Dropdown_Option('bgpattern',__( 'Background pattern', 'wp-optin-wheel' ), [
    442464                    'none' => 'No pattern',
    443465                    'hearts' => 'Hearts'
    444                 ], 'hearts', 'More options in Pro.')),
    445                 new Pro_option('Advanced design settings (colors, logo, custom background, confetti, audio, ...)','This is a pro feature. You can define each slice\'s color, add a logo, custom background, and more to make your wheel pop!.')
    446             ];
    447 
    448             $behavior_settings = new Container_Option(null, __('Behavior setting', $this->slug));
     466                ], 'hearts', __( 'More options in Pro.' , 'wp-optin-wheel' ) ) ),
     467                new Pro_option( __( 'Advanced design settings (colors, logo, custom background, confetti, audio, ...)', 'wp-optin-wheel' ),__( 'This is a pro feature. You can define each slice\'s color, add a logo, custom background, and more.','wp-optin-wheel' ) ),
     468                new Pro_option( __( 'Full-screen popup', 'wp-optin-wheel' ),__( 'This is a pro feature.','wp-optin-wheel' ) ),
     469                new Pro_option( __( 'Embed the wheel on a post or page (no popup)', 'wp-optin-wheel' ),__( 'This is a pro feature.','wp-optin-wheel' ) )
     470            ];
     471
     472            $behavior_settings = new Container_Option(null, __( 'Behavior setting', 'wp-optin-wheel' ) );
    449473
    450474            $behavior_settings->options = [
    451475                new Pro_option(
    452                     __('Hide on mobile', $this->slug),
    453                     __('This is a Pro feature.', $this->slug)
     476                    __('Hide on mobile', 'wp-optin-wheel' ),
     477                    __('This is a Pro feature.', 'wp-optin-wheel' )
    454478                ),
    455479                new Pro_option(
    456                     __('Logged in/logged out', $this->slug),
    457                     __('This is a Pro feature where you can decide to show the wheel to all users, or only logged in/logged out users.', $this->slug)
     480                    __('Logged in/logged out', 'wp-optin-wheel' ),
     481                    __('This is a Pro feature.', 'wp-optin-wheel' )
    458482                ),
    459483                new Pro_option(
    460                     __('Show on these pages', $this->slug),
    461                     __('This is a Pro feature in which you can decide on which pages or custom post types to show/hide the wheel.', $this->slug)
     484                    __('Show on these pages only', 'wp-optin-wheel' ),
     485                    __('This is a Pro feature.', 'wp-optin-wheel' )
    462486                )
    463487            ];
    464488
    465             array_push($behavior_settings->options,$this->add_data_attribute_for_data_bind(
     489            $behavior_settings->options[] = $this->add_data_attribute_for_data_bind(
    466490                new Dropdown_Option(
    467491                    'appeartype',
    468                     __('Show wheel',$this->slug), [
    469                         'immediately' => 'Immediately',
    470                         'delay' => 'After a delay',
     492                    __( 'Show wheel', 'wp-optin-wheel' ), [
     493                        'immediately' => __( 'Immediately', 'wp-optin-wheel' ),
     494                        'delay' => __( 'After a delay', 'wp-optin-wheel' )
    471495                    ],
    472496                    null,
    473                     __('More options in Pro, such as by clicking a widget or button, on a timer, ...', $this->slug)
    474             )));
    475             array_push($behavior_settings->options,$this->add_data_attribute_for_data_bind(new Number_Option(
     497                    __('More options in Pro, such as by clicking a widget or button, on a timer, ...', 'wp-optin-wheel' )
     498            ));
     499            $behavior_settings->options[] = $this->add_data_attribute_for_data_bind( new Number_Option(
    476500                'appeardelay',
    477                 __('Appearance delay',$this->slug),
     501                __( 'Appearance delay', 'wp-optin-wheel' ),
    478502                5,
    479503                null,null,
    480504                [ new Option_Dependency('appeartype','delay') ],
    481                 __('Show popup after', $this->slug),
    482                 __('seconds', $this->slug)
    483             )));
    484 
    485             array_push($behavior_settings->options,$this->add_data_attribute_for_data_bind(new Number_Option(
     505                __( 'Show popup after', 'wp-optin-wheel' ),
     506                __( 'seconds', 'wp-optin-wheel' )
     507            ));
     508
     509            $behavior_settings->options[] = $this->add_data_attribute_for_data_bind(new Number_Option(
    486510                'occurancedelay',
    487                 __('Occurance delay',$this->slug),
     511                __('Occurance delay', 'wp-optin-wheel' ),
    488512                5,
    489513                null,null,
    490514                [ new Option_Dependency('occurance','delay') ],
    491                 __('Show popup again after', $this->slug),
    492                 __('days', $this->slug)
    493             )));
    494 
    495                       array_push($behavior_settings->options,$this->add_data_attribute_for_data_bind(new Pro_option(
    496               __('Spinning Speed', $this->slug),
    497               __('This is a Pro feature.', $this->slug)
    498           )));
    499 
    500             array_push($behavior_settings->options,$this->add_data_attribute_for_data_bind(new Pro_option(
    501                 __('Spinning Time', $this->slug),
    502                 __('This is a Pro feature.', $this->slug)
    503             )));
    504 
    505                         $list_settings = new Container_Option(null, __('List settings',$this->slug));
     515                __( 'Show popup again after', 'wp-optin-wheel' ),
     516                __( 'days', 'wp-optin-wheel' )
     517            ));
     518
     519                      $behavior_settings->options[] = $this->add_data_attribute_for_data_bind(new Pro_option(
     520              __( 'Spinning Speed', 'wp-optin-wheel' ),
     521              __( 'This is a Pro feature.', 'wp-optin-wheel' )
     522          ));
     523
     524          $behavior_settings->options[] = $this->add_data_attribute_for_data_bind(new Pro_option(
     525                __( 'Spinning Time', 'wp-optin-wheel' ),
     526                __( 'This is a Pro feature.', 'wp-optin-wheel' )
     527            ));
     528
     529                        $list_settings = new Container_Option( null, __('List settings', 'wp-optin-wheel' ) );
    506530
    507531            $list_settings->options = [
    508532                new Dropdown_Option(
    509533                    'list_provider',
    510                     __('List provider', $this->slug),
     534                    __('List provider', 'wp-optin-wheel' ),
    511535                    [],
    512536                    null,
    513                     __('What email list software are you using?', $this->slug)
     537                    __('What email list software are you using?', 'wp-optin-wheel' )
    514538                ),
    515539                new Dropdown_Option(
    516540                    'list',
    517                     __('Email list', $this->slug),
     541                    __('Email list', 'wp-optin-wheel' ),
    518542                    [],
    519543                    null,
    520                     __('To which email list should your visitors opt in?', $this->slug)
     544                    __('To which email list should your visitors opt in?', 'wp-optin-wheel' )
    521545                ),
    522                 new Pro_option('Form fields builder','This is a pro feature in which you can add more fields, rather than only an email field.'),
    523                new Pro_option(
     546
     547                                new Pro_option( __( 'Form fields builder', 'wp-optin-wheel' ), __( 'This is a pro feature.', 'wp-optin-wheel' ) ),
     548
     549                              new Pro_option(
    524550                    __('Validate email domains.', $this->slug),
    525                     __('This is a Pro feature where you email addresses will be validated against an up-to-date list of fake emails .', $this->slug)
     551                    __('This is a Pro feature where you email addresses will be validated against an up-to-date list of fake email domains.', $this->slug)
    526552                ),
    527553                new Pro_option(
     
    537563            $form_builder_for_lists_settings =  new Custom_Option(null,'form-builder-lists');
    538564
    539             $gdpr_settings = new Container_Option(null, __('GDPR', $this->slug));
     565            $gdpr_settings = new Container_Option( null, __('GDPR', 'wp-optin-wheel' ) );
    540566            $gdpr_settings->name = 'gdpr_settings';
    541             $gdpr_custom_setting = new Custom_Option('Send data to email list','gdpr-settings');
     567            $gdpr_custom_setting = new Custom_Option( __( 'Send data to email list', 'wp-optin-wheel' ),'gdpr-settings');
    542568            $gdpr_settings->options = [ $gdpr_custom_setting ];
    543569
     
    545571                $this->add_data_attribute_for_data_bind(new Number_Option(
    546572                    'winning_chance',
    547                     __('Winning chance',$this->slug),
     573                    __('Winning chance', 'wp-optin-wheel' ),
    548574                    75,null,
    549                     __("What's the chance your visitor will win something? If you want your visitor to always win (recommended), set this to 100%.", $this->slug),
     575                    __("What's the chance your visitor will win something? If you want your visitor to always win (recommended), set this to 100%.", 'wp-optin-wheel' ),
    550576                    null,' ',
    551577                    ' % '
    552578                )),
    553                 new Pro_option('Replays','Replays is a premium feature. You can set how many times a visitor can retry if they lose.')
     579                new Pro_option(__( 'Replays', 'wp-optin-wheel' ), __( 'Replays is a Pro feature. You can set how many times a visitor can retry if they lose.', 'wp-optin-wheel' ) )
    554580            ];
    555581
  • wp-optin-wheel/trunk/code/controllers/class-public-controller.php

    r3165654 r3380469  
    4848        }
    4949
    50         public function play($wheel) {
    51             if(!isset($_POST['nonce']) || !isset($_POST['id']) || !isset($_POST['action']) ||
    52                !isset($_POST['seq']) || !isset($_POST['pseq']) )
    53                 wp_send_json_error(__('Not allowed.',Config_Manager::$slug));
     50        public function play( $wheel ) {
     51            if( empty( $_POST['nonce'] ) || empty( $_POST['id'] ) || empty( $_POST['action'] ) ||
     52               empty( $_POST['seq'] ) || empty( $_POST['pseq'] ) )
     53                wp_send_json_error( __('Not allowed.', 'wp-optin-wheel' ) );
    5454
    55             if(empty($wheel))
    56                 $wheel = Wheel_service::get_wheel($_POST['id']);
     55            if( empty( $wheel ) )
     56                $wheel = Wheel_service::get_wheel( $_POST['id'] );
    5757
    58             $current_play = Wheel_service::validate_sequence($wheel, $_POST['seq'], $_POST['pseq']);
     58            $current_play = Wheel_service::validate_sequence( $wheel, sanitize_text_field( wp_unslash( $_POST['seq'] ) ),  sanitize_text_field( wp_unslash( $_POST['pseq'] ) ) );
    5959
    6060            if(!is_int($current_play))
    61                 wp_send_json_error(__('Not allowed.',Config_Manager::$slug));
     61                wp_send_json_error( __('Not allowed.', 'wp-optin-wheel' ) );
    6262
    63             $segment = Wheel_service::calculate_segment_hit($wheel);
     63            $segment = Wheel_service::calculate_segment_hit( $wheel );
    6464
    6565            $winning = $segment->type != 0;
     
    8989            if(!isset($_POST['nonce']) || !isset($_POST['id']) || !isset($_POST['mail']) ||
    9090                !isset($_POST['seq']) || !isset($_POST['pseq']) )
    91                 wp_send_json_error(__('Not allowed.',Config_Manager::$slug));
     91                wp_send_json_error( __('Not allowed.', 'wp-optin-wheel' ) );
    9292
    9393            $email = sanitize_email($_POST['mail']);
    9494            if (!filter_var($email, FILTER_VALIDATE_EMAIL))
    95                 wp_send_json_error(__('Badly formatted email.', Config_Manager::$slug));
     95                wp_send_json_error( __( 'Badly formatted email.', 'wp-optin-wheel' ) );
    9696
    97             $wheel = Wheel_service::get_wheel($_POST['id']);
     97            $wheel = Wheel_service::get_wheel( sanitize_text_field( wp_unslash( $_POST['id'] ) ) );
    9898
    9999            if(Log_Service::is_in_log($email,$wheel->id)){
    100                 wp_send_json_error(__("Email already used", Config_Manager::$slug));
     100                wp_send_json_error( __("Email already used", 'wp-optin-wheel' ) );
    101101            }
    102102
     
    161161        private function get_segment_title(Wheel_Model $wheel, $segment) {
    162162            if($segment->type == 0)
    163                 return $wheel->has_setting('losing_title') ? $wheel->losing_title : __('Uh oh!', Config_Manager::$slug);
     163                return $wheel->has_setting('losing_title') ? $wheel->losing_title : __( 'Uh oh!', 'wp-optin-wheel' );
    164164
    165165            return str_replace(
    166166                '{x}',
    167167                '<em>'.$segment->label.'</em>',
    168                 $wheel->has_setting('winning_title')? $wheel->winning_title : __('Hurray!', Config_Manager::$slug)
     168                $wheel->has_setting('winning_title')? $wheel->winning_title : __( 'Hurray!', 'wp-optin-wheel' )
    169169            );
    170170        }
  • wp-optin-wheel/trunk/code/models/class-wheel-model.php

    r2797123 r3380469  
    9696        }
    9797
    98         public function get_background(){
    99             $url = Config_Manager::$url . 'public/img/';
    100             switch($this->bgpattern){
     98        public function get_background() {
     99
     100                        $url = Config_Manager::$url . 'public/img/';
     101
     102                        switch( $this->bgpattern ) {
    101103                case 'hearts':
    102                     return 'background-image:url(\''.$url.'bg-hearts.png\');opacity:.085;background-size:11%;';
     104                    return 'background-image:url(\'' . esc_url( $url ) . 'bg-hearts.png\');opacity:.085;background-size:11%;';
    103105                default: return '';
    104106            }
    105         }
     107
     108                    }
    106109
    107110    }
  • wp-optin-wheel/trunk/code/services/class-helper-service.php

    r2797123 r3380469  
    2121        }
    2222
    23         public static function get_visitor_ip() {
    24 
    25             foreach ( [ 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR' ] as $key) {
    26                 if (array_key_exists($key, $_SERVER) === true) {
    27                     foreach (explode(',', $_SERVER[$key]) as $ip) {
    28                         if (filter_var($ip, FILTER_VALIDATE_IP) !== false) {
    29                             return $ip;
    30                         }
    31                     }
    32                 }
    33             }
    34 
    35             return null;
    36         }
    37 
    38         public static function hex_to_rgba( $hex, $alpha = 1 ) {
    39             $hex = str_replace( '#', '', $hex );
    40             $length = strlen( $hex );
    41             $rgb['r'] = hexdec( $length == 6 ? substr( $hex, 0, 2 ) : ( $length == 3 ? str_repeat( substr( $hex, 0, 1 ), 2 ) : 0 ) );
    42             $rgb['g'] = hexdec( $length == 6 ? substr( $hex, 2, 2 ) : ( $length == 3 ? str_repeat( substr( $hex, 1, 1 ), 2 ) : 0 ) );
    43             $rgb['b'] = hexdec( $length == 6 ? substr( $hex, 4, 2 ) : ( $length == 3 ? str_repeat( substr( $hex, 2, 1 ), 2 ) : 0 ) );
    44             if($alpha){
    45                 $rgb['a'] = $alpha;
    46             }
    47             return printf('rgba(%s,%s,%s,%s)',$rgb['r'],$rgb['g'],$rgb['b'],$alpha);
    48         }
    49     }
     23            }
    5024
    5125}
  • wp-optin-wheel/trunk/code/services/class-mailchimp-service.php

    r2797123 r3380469  
    2929            $response = self::request('lists/'.$list_id.'/members/'.md5(strtolower($email)),$data);
    3030
    31             if(isset($response->status) && $response->status == 400)
    32                 return $response->detail;
     31            if( empty( $response ) ) {
     32                return __( 'Something went wrong contacting MailChimp.', 'wp-optin-wheel' );
     33            }
     34
     35                        if( isset( $response->status ) && $response->status == 400 ) {
     36                return $response->detail;
     37            }
    3338
    3439            return true;
    35         }
     40
     41                    }
    3642
    3743        public static function get_email_lists() {
  • wp-optin-wheel/trunk/code/services/class-wheel-service.php

    r2895301 r3380469  
    5252        }
    5353
    54         public static function calculate_segment_hit(Wheel_Model $wheel) {
    55             $will_win = mt_rand(0,100) <= $wheel->winning_chance;
     54        public static function calculate_segment_hit( Wheel_Model $wheel ) {
     55
     56                        $will_win = wp_rand(0,100) <= $wheel->winning_chance;
    5657
    5758            if(!$will_win){
     
    6768                });
    6869
    69                 $rand = mt_rand(0, 100);
     70                $rand = wp_rand(0, 100);
    7071
    7172                $cumul = 0;
  • wp-optin-wheel/trunk/code/views/wheel.php

    r3165654 r3380469  
    11<?php
    22    /** @var \MABEL_WOF_LITE\Code\Models\Wheel_Model $model */
    3     use MABEL_WOF_LITE\Core\Common\Managers\Config_Manager;
    43    use MABEL_WOF_LITE\Code\Services\Wheel_service;
    54
     
    87<style>
    98    <?php if($model->bgpattern != 'none'){ ?>
    10         .wof-wheel[data-id="<?php echo $model->id ?>"]:after{<?php echo $model->get_background() ?>}
     9        .wof-wheel[data-id="<?php echo esc_attr( $model->id ) ?>"]:after{<?php echo $model->get_background() ?>}
    1110    <?php } ?>
    1211</style>
     
    2120        <div class="wof-close-wrapper">
    2221            <a class="wof-close wof-fgcolor" href="#">
    23                 <?php echo $model->has_setting('close_text') ? $model->close_text : __('Close', Config_Manager::$slug) ?>
     22                <?php echo esc_html( $model->has_setting('close_text') ? $model->close_text : __( 'Close', 'wp-optin-wheel' ) ) ?>
    2423            </a>
    2524        </div>
     
    2928                <div class="wof-left-inner">
    3029                    <div class="wof-pointer">
    31                         <svg width="100%" height="100%" viewBox="0 0 273 147"><g><path <?php echo $model->has_setting('pointer_color') ? 'fill="'.$model->pointer_color.'"' : 'class="wof-pointer-color"'; ?> d="M196.3 0h10.5l1 .25c10.06 1.9 19.63 5.06 28.1 10.93 11.28 7.55 19.66 18.43 25.12 30.78 1.9 6.4 4.06 12.23 4 19.04-.1 5.3.3 10.7-.34 15.97-2.18 14.1-9.08 27.46-19.38 37.33-10.03 10-23.32 16.4-37.33 18.4-4.95.54-10 .3-14.97.3-6.4-.02-13.06-2.82-19.2-4.68-54.98-17.5-109.95-35.08-164.96-52.5C4.7 74.7 2.14 73.33 0 69.5v-6.26c1.47-1.93 2.94-3.95 5.34-4.77C64.47 39.78 123.84 20.77 183 2c4.3-1.15 8.9-1.2 13.3-2z"/><path opacity=".25" d="M261.02 41.96c6.74 9.2 10.54 20.04 11.98 31.3V88c-1.9 14.78-8.25 28.63-18.78 39.24-11 11.34-25.83 18.16-41.52 19.78h-12.65c-3.8-.6-7.57-1.4-11.22-2.63C132.4 126.43 76 108.37 19.55 90.5c-3.4-1.22-8.1-1.62-10.12-4.94-2.2-3.14-1.5-6.3-.6-9.73 55.02 17.4 110 35 164.97 52.5 6.14 1.85 12.8 4.65 19.2 4.66 4.97 0 10.02.24 14.97-.3 14-2 27.3-8.4 37.33-18.4 10.3-9.87 17.2-23.24 19.38-37.33.63-5.27.23-10.66.34-15.97.06-6.8-2.1-12.64-4-19.04v.01z"/><ellipse stroke="null" ry="25" rx="25" cy="65" cx="199.124" stroke-opacity="null" stroke-width="null" fill="#fff"/></g></svg>
     30                        <svg width="100%" height="100%" viewBox="0 0 273 147"><g><path <?php echo $model->has_setting('pointer_color') ? ( 'fill="' . esc_attr( $model->pointer_color ) . '"' ) : 'class="wof-pointer-color"'; ?> d="M196.3 0h10.5l1 .25c10.06 1.9 19.63 5.06 28.1 10.93 11.28 7.55 19.66 18.43 25.12 30.78 1.9 6.4 4.06 12.23 4 19.04-.1 5.3.3 10.7-.34 15.97-2.18 14.1-9.08 27.46-19.38 37.33-10.03 10-23.32 16.4-37.33 18.4-4.95.54-10 .3-14.97.3-6.4-.02-13.06-2.82-19.2-4.68-54.98-17.5-109.95-35.08-164.96-52.5C4.7 74.7 2.14 73.33 0 69.5v-6.26c1.47-1.93 2.94-3.95 5.34-4.77C64.47 39.78 123.84 20.77 183 2c4.3-1.15 8.9-1.2 13.3-2z"/><path opacity=".25" d="M261.02 41.96c6.74 9.2 10.54 20.04 11.98 31.3V88c-1.9 14.78-8.25 28.63-18.78 39.24-11 11.34-25.83 18.16-41.52 19.78h-12.65c-3.8-.6-7.57-1.4-11.22-2.63C132.4 126.43 76 108.37 19.55 90.5c-3.4-1.22-8.1-1.62-10.12-4.94-2.2-3.14-1.5-6.3-.6-9.73 55.02 17.4 110 35 164.97 52.5 6.14 1.85 12.8 4.65 19.2 4.66 4.97 0 10.02.24 14.97-.3 14-2 27.3-8.4 37.33-18.4 10.3-9.87 17.2-23.24 19.38-37.33.63-5.27.23-10.66.34-15.97.06-6.8-2.1-12.64-4-19.04v.01z"/><ellipse stroke="null" ry="25" rx="25" cy="65" cx="199.124" stroke-opacity="null" stroke-width="null" fill="#fff"/></g></svg>
    3231                    </div>
    3332                    <div class="shadow-inner"></div>
     
    3837                        <?php $start_degrees = 0; $ctr= 1; ?>
    3938                        <?php foreach($model->slices as $slice) { ?>
    40                             <div class="wof-slice" data-slice="<?php echo esc_attr($ctr) ?>" style="transform:rotate(<?php echo esc_attr($start_degrees) ?>deg) translate(0px, -50%)"><?php echo wp_strip_all_tags($slice->label); ?></div>
     39                            <div class="wof-slice" data-slice="<?php echo esc_attr($ctr) ?>" style="transform:rotate(<?php echo esc_attr($start_degrees) ?>deg) translate(0px, -50%)"><?php echo esc_html( $slice->label ); ?></div>
    4140                            <?php $start_degrees += 30; $ctr++; ?>
    4241                        <?php } ?>
     
    4746                <div class="wof-right-inner">
    4847                    <div class="wof-title wof-fgcolor">
    49                         <?php echo wp_kses_post($model->title) ?>
     48                        <?php echo wp_kses_post( $model->title ) ?>
    5049                    </div>
    5150                    <?php if($model->has_setting('explainer')){ ?>
    5251                        <div class="wof-explainer wof-fgcolor">
    53                             <?php echo wp_kses_post($model->explainer) ?>
     52                            <?php echo wp_kses_post( $model->explainer ) ?>
    5453                        </div>
    5554                    <?php } ?>
    5655                    <div class="wof-form-wrapper">
    5756                        <div class="wof-error" style="display: none;"></div>
    58                         <input type="email" data-wof-required="email" class="wof-email" name="wof-email" placeholder="<?php echo esc_attr($model->setting_or_default('email_placeholder', __('Your email',Config_Manager::$slug))) ?>" />
     57                        <input type="email" data-wof-required="email" class="wof-email" name="wof-email" placeholder="<?php echo esc_attr($model->setting_or_default('email_placeholder', __( 'Your email', 'wp-optin-wheel' ) ) ) ?>" />
    5958                        <div class="wof-form-fields"></div>
    6059                        <button class="wof-btn-submit wof-color-2" type="submit">
    61                             <span><?php echo esc_html($model->setting_or_default('button_text',__('Try your luck',Config_Manager::$slug))) ?></span>
     60                            <span><?php echo esc_html( $model->setting_or_default( 'button_text', __('Try your luck', 'wp-optin-wheel') ) ) ?></span>
    6261                            <div class="wof-loader" style="display: none;">
    6362                                <div class="b1"></div>
     
    7069                    <?php if($model->has_setting('disclaimer')) { ?>
    7170                        <div class="wof-disclaimer wof-fgcolor">
    72                             <?php echo wp_kses_post($model->disclaimer) ?>
     71                            <?php echo wp_kses_post( $model->disclaimer ) ?>
    7372                        </div>
    7473                    <?php } ?>
  • wp-optin-wheel/trunk/code/views/wheels.php

    r3165654 r3380469  
    55<div class="wof-overlay" style="display: none;"></div>
    66
    7 <div class="wof-wheels" data-wof-nonce="<?php echo wp_create_nonce('wof-nonce') ?>">
     7<div class="wof-wheels" data-wof-nonce="<?php echo esc_attr( wp_create_nonce('wof-nonce') ) ?>">
    88    <?php
    99        foreach($model->wheels as $wheel) {
     10            // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    1011            echo \MABEL_WOF_LITE\Core\Common\Html::view('wheel', $wheel);
    1112        }
  • wp-optin-wheel/trunk/core/common/class-admin.php

    r3272834 r3380469  
    66    use MABEL_WOF_LITE\Core\Common\Managers\Options_Manager;
    77    use MABEL_WOF_LITE\Core\Models\Start_VM;
    8 
    9 
     8   
    109    abstract class Admin extends Presentation_Base
    1110    {
     
    4645
    4746            foreach( $notices as $notice ) {
    48                 echo '<div class="notice is-dismissible notice-'.$notice['class'].'"><p>'.$notice['message'].'</p></div>';
     47                echo '<div class="notice is-dismissible notice-' . esc_attr( $notice['class'] ) . '"><p>' . esc_html( $notice['message'] ) . '</p></div>';
    4948            }
    5049
     
    5655        {
    5756            $my_links = [
    58                 '<a href="' . admin_url( 'options-general.php?page=' .Config_Manager::$slug ) . '">' .__('Settings' , Config_Manager::$slug). '</a>',
     57                '<a href="' . admin_url( 'options-general.php?page=' .Config_Manager::$slug ) . '">' .__('Settings' , 'wp-optin-wheel' ). '</a>',
    5958            ];
    6059            return array_merge( $links, $my_links );
     
    9695            ob_start();
    9796            include Config_Manager::$dir . 'core/views/start.php';
     97            // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    9898            echo ob_get_clean();
    9999        }
  • wp-optin-wheel/trunk/core/common/class-html.php

    r2797123 r3380469  
    3333            ob_start();
    3434            include Config_Manager::$dir . $view . '.php';
     35            // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    3536            echo ob_get_clean();
    3637        }
  • wp-optin-wheel/trunk/core/common/class-loader.php

    r3144245 r3380469  
    8282            foreach ( $this->filters as $hook ) {
    8383                if(! method_exists($hook['component'],$hook['callback'])){
    84                     throw new \Exception("Can't add filter. Method ". $hook['callback'] . " doesn't exist.");
     84                    throw new \Exception("Can't add filter. Method doesn't exist.");
    8585                }
    8686                add_filter( $hook['hook'], ($hook['component'] === null? $hook['callback'] : [ $hook['component'], $hook['callback'] ]), $hook['priority'], $hook['accepted_args'] );
     
    8989            foreach ( $this->actions as $hook ) {
    9090                if(! method_exists($hook['component'],$hook['callback'])){
    91                     throw new \Exception("Can't add action. Method ". $hook['callback'] . "doesn't exist.");
     91                    throw new \Exception("Can't add action. Method doesn't exist.");
    9292                }
    9393                add_action( $hook['hook'], ($hook['component'] === null? $hook['callback'] : [ $hook['component'], $hook['callback'] ]), $hook['priority'], $hook['accepted_args'] );
  • wp-optin-wheel/trunk/core/common/class-widget.php

    r2797123 r3380469  
    3535            $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
    3636
    37             echo $args['before_widget'];
     37            echo wp_kses_post( $args['before_widget'] );
     38           
    3839            if ( $title ) {
    39                 echo $args['before_title'] . $title . $args['after_title'];
     40                echo wp_kses_post( $args['before_title'] . $title . $args['after_title'] );
    4041            }
    4142
     
    4344
    4445            foreach($instance as $k => $v) {
    45                 array_push($argument_list, $k . '="' .$v . '"' );
     46                $argument_list[] = $k . '="' . $v . '"';
    4647            }
    4748
    4849            echo do_shortcode('[' . $this->shortcode . ' ' .join(' ', $argument_list) . ']');
    4950
    50             echo $args['after_widget'];
     51            echo wp_kses_post( $args['after_widget'] );
    5152        }
    5253
     
    5556        {
    5657            if($this->warning){
    57                 echo $this->warning;
     58                echo esc_html( $this->warning );
    5859            }else{
    5960
     
    7172                include Config_Manager::$dir . 'core/views/widget_form.php';
    7273
     74                // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    7375                echo ob_get_clean();
    7476            }
  • wp-optin-wheel/trunk/core/common/managers/class-settings-manager.php

    r2797123 r3380469  
    9292                return null;
    9393
    94             if(isset(self::$defaults[$key]))
    95                 return __(self::$defaults[$key], Config_Manager::$slug);
     94            if( isset( self::$defaults[ $key ] ) )
     95                return __( self::$defaults[$key], 'wp-optin-wheel' );
    9696
    9797            return null;
  • wp-optin-wheel/trunk/core/models/class-option.php

    r2797123 r3380469  
    4444        public function get_extra_data_attributes(){
    4545            return join(' ', Enumerable::from($this->data_attributes)->select(function($v,$k){
    46                 return 'data-'.$k.'="'.$v.'"';
     46                return 'data-'.$k.'="'. esc_attr( $v ).'"';
    4747            })->toArray());
    4848        }
  • wp-optin-wheel/trunk/core/views/fields/autocomplete.php

    r3165654 r3380469  
    22    /** @var \MABEL_WOF_LITE\Core\Models\Autocomplete_Option $option */
    33?>
    4 <div class="mabel-autocomplete-wrapper <?php echo $option->name === null ? $option->id : $option->name; ?>" data-action="<?php echo esc_attr($option->ajax_action) ?>">
     4<div class="mabel-autocomplete-wrapper <?php echo esc_attr( $option->name === null ? $option->id : $option->name ) ?>" data-action="<?php echo esc_attr( $option->ajax_action ) ?>">
    55    <input type="hidden"
    6            name="<?php echo $option->name === null ? $option->id : $option->name; ?>"
    7            value="<?php echo $option->value; ?>"
     6           name="<?php echo esc_attr( $option->name === null ? $option->id : $option->name ) ?>"
     7           value="<?php echo esc_attr( $option->value ) ?>"
    88        <?php echo $option->get_extra_data_attributes(); ?>
    99    />
     
    2020<?php
    2121if(isset($option->extra_info))
    22     echo '<div class="p-t-1 extra-info">' . $option->extra_info .'</div>';
     22    echo '<div class="p-t-1 extra-info">' . wp_kses_post( $option->extra_info ) .'</div>';
    2323?>
  • wp-optin-wheel/trunk/core/views/fields/checkbox.php

    r2797123 r3380469  
    66
    77?>
    8 <input type="hidden" name="<?php echo $option->name === null ? $option->id : $option->name; ?>" value="false" class="skip-dependency" />
     8<input type="hidden" name="<?php echo esc_attr( $option->name === null ? $option->id : $option->name ) ?>" value="false" class="skip-dependency" />
    99<input
    1010    class="mabel-form-element"
    1111    type="checkbox"
    12     name="<?php echo $option->name === null ? $option->id : $option->name; ?>"
     12    name="<?php echo esc_attr( $option->name === null ? $option->id : $option->name ) ?>"
    1313    value="true"
    1414    <?php if(in_array($option->value, ['true','1',true], true)) echo ' checked '; ?>
     
    1818/>
    1919
    20 <label for="ckb-<?php echo $option->id ?>">
     20<label for="ckb-<?php echo esc_attr( $option->id ) ?>">
    2121    <?php echo esc_html($option->label); ?>
    2222</label>
     
    2424<?php
    2525if(isset($option->extra_info))
    26     echo '<div class="p-t-1 extra-info">' . $option->extra_info .'</div>';
     26    echo '<div class="p-t-1 extra-info">' . wp_kses_post( $option->extra_info ) .'</div>';
    2727?>
  • wp-optin-wheel/trunk/core/views/fields/choice-picker.php

    r3165654 r3380469  
    44$id = $option->name === null ? $option->id : $option->name;
    55?>
    6 <div class="mabel-mc-wrapper" data-id="<?php echo $id; ?>">
     6<div class="mabel-mc-wrapper" data-id="<?php echo esc_attr( $id ) ?>">
    77
    88    <input
    99        type="hidden"
    10         name="<?php echo $id; ?>"
    11         value="<?php echo $option->values_to_key_list(); ?>"
     10        name="<?php echo esc_attr( $id ) ?>"
     11        value="<?php echo esc_attr( $option->values_to_key_list() ) ?>"
    1212        class="mabel-formm-element"
    1313        <?php echo $option->get_extra_data_attributes(); ?>
     
    1616    <div class="mabel-mc-chosen">
    1717        <em class="infotext" style="<?php if(!empty($option->value)) echo 'display:none'; ?>">
    18             <?php _e("Choose from the items below", \MABEL_WOF_LITE\Core\Common\Managers\Config_Manager::$slug); ?>
     18            <?php _e("Choose from the items below", 'wp-optin-wheel' ); ?>
    1919        </em>
    2020
     
    2525        <?php
    2626            foreach($option->possible_values as $title => $options){
    27                 echo '<span class="mabel-mc-title">'.$title.'</span>';
     27                echo '<span class="mabel-mc-title">' . wp_kses_post( $title ) . '</span>';
    2828                foreach($options as $key => $value) {
    29                     echo '<span class="mabel-mc-option" data-id="'.$key.'">'.(empty($value) ? 'n/a' : $value).'</span>';
     29                    echo '<span class="mabel-mc-option" data-id="' . esc_attr( $key ) . '">' . ( empty($value) ? 'n/a' : wp_kses_post( $value) ) . '</span>';
    3030                }
    3131            }
     
    3636<?php
    3737if(isset($option->extra_info))
    38     echo '<div class="p-t-1 extra-info">' . esc_html($option->extra_info) .'</div>';
     38    echo '<div class="p-t-1 extra-info">' . wp_kses_post( $option->extra_info ) .'</div>';
    3939?>
  • wp-optin-wheel/trunk/core/views/fields/colorpicker.php

    r3144245 r3380469  
    55<input
    66    type="text"
    7     name="<?php echo $option->name === null ? $option->id : $option->name; ?>"
    8     value="<?php if( ! empty( $option->value ) ) echo htmlspecialchars($option->value);?>"
    9     <?php echo !empty($option->dependency) ? 'data-dependency="' . htmlspecialchars(json_encode($option->dependency,ENT_QUOTES)) . '"':''; ?>
     7    name="<?php echo esc_attr( $option->name === null ? $option->id : $option->name ) ?>"
     8    value="<?php if( ! empty( $option->value ) ) echo esc_attr( $option->value ) ?>"
     9    <?php echo ! empty( $option->dependency ) ? 'data-dependency="' . htmlspecialchars(json_encode($option->dependency,ENT_QUOTES)) . '"':''; ?>
    1010    class="color-picker mabel-form-element"
    1111/>
     
    1313<?php
    1414    if(isset($option->extra_info))
    15         echo '<div class="p-t-1 extra-info">' . esc_html($option->extra_info) .'</div>';
     15        echo '<div class="p-t-1 extra-info">' . wp_kses_post( $option->extra_info ) .'</div>';
    1616?>
  • wp-optin-wheel/trunk/core/views/fields/container-option.php

    r2797123 r3380469  
    55<div
    66    class="mabel-accordion mabel-form-element"
    7     name="<?php echo $option->name === null ? $option->id : $option->name; ?>"
     7    name="<?php echo esc_attr( $option->name === null ? $option->id : $option->name ) ?>"
    88    <?php echo !empty($option->dependency) ? 'data-dependency="' . htmlspecialchars(json_encode($option->dependency,ENT_QUOTES)) . '"':''; ?>
    99>
    10     <button class="mabel-accordion-btn"><?php echo $option->button_text; ?></button>
     10    <button class="mabel-accordion-btn"><?php echo esc_html( $option->button_text ) ?></button>
    1111    <div style="display: none;">
    1212        <table class="form-table">
     
    1616                    echo '<tr>';
    1717                    if(!empty($o->title))
    18                         echo '<th scope="row">'.$o->title.'</th>';
     18                        echo '<th scope="row">' . wp_kses_post( $o->title ) . '</th>';
    1919                    echo '<td '.(empty($o->title) ? 'colspan="2"' : '').'>';
    20                         Html::option($o);
     20                        Html::option( $o );
    2121                    echo '</td>';
    2222                }
  • wp-optin-wheel/trunk/core/views/fields/datepicker.php

    r3165654 r3380469  
    55<input
    66    type="text"
    7     name="<?php echo $option->name === null ? $option->id : $option->name; ?>"
    8     value="<?php if( ! empty( $option->value ) ) echo htmlspecialchars($option->value);?>"
     7    name="<?php echo esc_attr( $option->name === null ? $option->id : $option->name ) ?>"
     8    value="<?php if( ! empty( $option->value ) ) echo esc_attr($option->value);?>"
    99    <?php echo !empty($option->dependency) ? 'data-dependency="' . htmlspecialchars(json_encode($option->dependency,ENT_QUOTES)) . '"':''; ?>
    1010    class="widefat mabel-date-picker mabel-form-element"
    1111    <?php echo $option->get_extra_data_attributes(); ?>
    12     data-options="<?php echo esc_attr(json_encode($option->options)) ?>"
     12    data-options="<?php echo esc_attr( json_encode($option->options ) ) ?>"
    1313/>
    1414
    1515<?php
    1616if(isset($option->extra_info))
    17     echo '<div class="p-t-1 extra-info">' . esc_html($option->extra_info) .'</div>';
     17    echo '<div class="p-t-1 extra-info">' . esc_html( $option->extra_info ) .'</div>';
    1818?>
  • wp-optin-wheel/trunk/core/views/fields/dropdown.php

    r2797123 r3380469  
    88
    99if(isset($option->pre_text)) {
    10     echo '<span>' . esc_html($option->pre_text) . '</span>';
     10    echo '<span>' . esc_html( $option->pre_text ) . '</span>';
    1111    $has_pre_text = true;
    1212}
     
    1616    class="widefat mabel-form-element"
    1717    <?php echo $has_pre_text ? 'style="padding:0 10px;width:auto;"' : ''; ?>
    18     name="<?php echo $option->name === null ? $option->id : $option->name; ?>"
    19     <?php echo !empty($option->dependency) ? 'data-dependency="' . htmlspecialchars(json_encode($option->dependency,ENT_QUOTES)) . '"':''; ?>
     18    name="<?php echo esc_attr( $option->name === null ? $option->id : $option->name ) ?>"
     19    <?php echo ! empty($option->dependency) ? 'data-dependency="' . htmlspecialchars(json_encode($option->dependency,ENT_QUOTES)) . '"':''; ?>
    2020    <?php echo $option->get_extra_data_attributes(); ?>
    2121>
     
    2323        foreach($option->options as $key=>$value){
    2424            $selected = $key == $option->value;
    25             echo '<option ' . ($selected?'selected':'') .' value="'.$key.'">'.$value.'</option>';
     25            echo '<option ' . ($selected?'selected':'') .' value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</option>';
    2626        }
    2727    ?>
     
    3030<?php
    3131if(isset($option->post_text))
    32     echo '<span>' . $option->post_text . '</span>';
     32    echo '<span>' . esc_html( $option->post_text ) . '</span>';
    3333?>
    3434
     
    3636
    3737if(isset($option->extra_info))
    38     echo '<div class="p-t-1 extra-info">' . $option->extra_info . '</div>';
     38    echo '<div class="p-t-1 extra-info">' . esc_html( $option->extra_info ) . '</div>';
  • wp-optin-wheel/trunk/core/views/fields/help.php

    r2797123 r3380469  
    55?>
    66<div class="p-t-1">
    7     <div style="display: none;" id="help-<?php echo $help->id; ?>">
     7    <div style="display: none;" id="help-<?php echo esc_attr( $help->id ); ?>">
    88        <div style="padding:20px;">
    9             <?php include Config_Manager::$dir . 'admin/views/' .$help->template; ?>
     9            <?php include Config_Manager::$dir . 'admin/views/' . $help->template; ?>
    1010        </div>
    1111    </div>
    12     <a title="<?php echo $help->title; ?>" href="#TB_inline?width=600&height=550&inlineId=help-<?php echo $help->id; ?>" class="primary thickbox">
    13         <?php echo $help->link_title == null ?
    14             __('More info', Config_Manager::$slug) :
    15             __($help->link_title, Config_Manager::$slug);
     12    <a title="<?php echo esc_attr( $help->title ); ?>" href="#TB_inline?width=600&height=550&inlineId=help-<?php echo esc_attr( $help->id ); ?>" class="primary thickbox">
     13        <?php echo esc_html( $help->link_title == null ?
     14                __( 'More info', 'wp-optin-wheel' ) :
     15                $help->link_title
     16            )
    1617        ?>
    1718    </a>
  • wp-optin-wheel/trunk/core/views/fields/hidden.php

    r2797123 r3380469  
    33?>
    44
    5 <input class="mabel-formm-element" type="hidden" name="<?php echo $option->name === null ? $option->id : $option->name; ?>" value="<?php echo $option->value; ?>" <?php echo $option->get_extra_data_attributes(); ?> />
     5<input class="mabel-formm-element" type="hidden" name="<?php echo esc_attr( $option->name === null ? $option->id : $option->name ) ?>" value="<?php echo esc_attr( $option->value ) ?>" <?php echo $option->get_extra_data_attributes(); ?> />
  • wp-optin-wheel/trunk/core/views/fields/number.php

    r3144245 r3380469  
    1717    style="<?php echo $has_pre_text? 'width:100px;' : ''; ?>"
    1818    type="number"
    19     name="<?php echo $option->name === null ? $option->id : $option->name; ?>"
     19    name="<?php echo esc_attr( $option->name === null ? $option->id : $option->name ) ?>"
    2020    value="<?php if( ! empty( $option->value ) ) echo htmlspecialchars($option->value);?>"
    2121    <?php echo !empty($option->dependency) ? 'data-dependency="' . htmlspecialchars(json_encode($option->dependency,ENT_QUOTES)) . '"':''; ?>
  • wp-optin-wheel/trunk/core/views/fields/pro-option.php

    r3165654 r3380469  
    44
    55<div class="pro-option-teaser">
    6     <?php echo $option->value? $option->value : __("This option is available in the premium version.", \MABEL_WOF_LITE\Core\Common\Managers\Config_Manager::$slug); ?>
     6    <?php echo $option->value ? wp_kses_post( $option->value ) : esc_html( 'This option is available in the Pro version.', 'wp-optin-wheel' ); ?>
    77</div>
  • wp-optin-wheel/trunk/core/views/fields/rangeslider.php

    r2797123 r3380469  
    77    style="opacity: 0;"
    88    class="mabel-formm-element"
    9     name="<?php echo $option->name === null ? $option->id : $option->name; ?>"
     9    name="<?php echo esc_attr( $option->name === null ? $option->id : $option->name ) ?>"
    1010    type="range"
    11     min="<?php echo $option->min; ?>"
    12     max="<?php echo $option->max; ?>"
    13     step="<?php echo $option->step; ?>"
    14     value="<?php echo $option->value; ?>"
     11    min="<?php echo esc_attr( $option->min ) ?>"
     12    max="<?php echo esc_attr( $option->max ) ?>"
     13    step="<?php echo esc_attr( $option->step ) ?>"
     14    value="<?php echo esc_attr( $option->value ) ?>"
    1515    <?php echo $option->get_extra_data_attributes(); ?>
    1616/>
     
    1818<?php
    1919    if(isset($option->extra_info))
    20         echo '<div class="p-t-1 extra-info">' . esc_html($option->extra_info) .'</div>';
     20        echo '<div class="p-t-1 extra-info">' . esc_html( $option->extra_info ) .'</div>';
    2121?>
    2222
  • wp-optin-wheel/trunk/core/views/fields/textbox.php

    r3144245 r3380469  
    1313        class="widefat mabel-form-element"
    1414        type="text"
    15         name="<?php echo $option->name === null ? $option->id : $option->name; ?>"
    16         value="<?php if( ! empty( $option->value ) ) echo htmlspecialchars($option->value);?>"
    17         placeholder="<?php echo $option->placeholder; ?>"
     15        name="<?php echo esc_attr( $option->name === null ? $option->id : $option->name ) ?>"
     16        value="<?php if( ! empty( $option->value ) ) echo esc_attr($option->value) ?>"
     17        placeholder="<?php echo esc_attr( $option->placeholder ) ?>"
    1818        <?php echo !empty($option->dependency) ? 'data-dependency="' . htmlspecialchars(json_encode($option->dependency,ENT_QUOTES)) . '"':''; ?>
    1919        <?php echo $option->get_extra_data_attributes(); ?>
     
    2222    <textarea
    2323        class="widefat mabel-form-element"
    24         name="<?php echo $option->name === null ? $option->id : $option->name; ?>"
    25         placeholder="<?php echo $option->placeholder; ?>"
    26         <?php echo !empty($option->dependency) ? 'data-dependency="' . htmlspecialchars(json_encode($option->dependency,ENT_QUOTES)) . '"':''; ?>
     24        name="<?php echo esc_attr( $option->name === null ? $option->id : $option->name ) ?>"
     25        placeholder="<?php echo esc_attr( $option->placeholder ) ?>"
     26        <?php echo ! empty($option->dependency) ? 'data-dependency="' . htmlspecialchars(json_encode($option->dependency,ENT_QUOTES)) . '"':''; ?>
    2727        <?php echo $option->get_extra_data_attributes(); ?>
    2828    ><?php if( ! empty( $option->value ) ) echo htmlspecialchars($option->value);?></textarea>
  • wp-optin-wheel/trunk/core/views/start.php

    r2797123 r3380469  
    1919                                '<a data-tab="options-'.$section->id.'" href="#" class="mabel-nav-tab'.($section->active === true? '  mabel-nav-tab-active':'').'">
    2020                                        <i class="dashicons dashicons-'.$section->icon.'"></i>
    21                                         <span>'.__($section->title, $model->slug).'</span>
     21                                        <span>' . esc_html( $section->title ) . '</span>
    2222                                    </a>';
    2323                        }
    24                         do_action($model->slug . '-add-tabs');
     24                        do_action( $model->slug . '-add-tabs' );
    2525                    ?>
    2626                </h2>
    27                 <form action="options.php" id="<?php echo $model->slug; ?>-form" method="POST">
     27                <form action="options.php" id="<?php echo esc_attr( $model->slug ); ?>-form" method="POST">
    2828                    <?php
    2929                    settings_fields( $model->slug );
    3030                    foreach($model->sections as $section)
    3131                    {
    32                         echo '<div class="mabel-tab tab-options-'.$section->id.'" '.($section->active === true? '':'style="display:none;"').'>';
     32                        echo '<div class="mabel-tab tab-options-' . esc_attr( $section->id ) . '" '.($section->active === true? '':'style="display:none;"').'>';
    3333                        if($section->has_options())
    3434                        {
     
    3838                                echo '<tr>';
    3939                                if(!empty($o->title))
    40                                     echo '<th scope="row">'.$o->title.'</th>';
     40                                    echo '<th scope="row">' . esc_html( $o->title ) . '</th>';
    4141                                echo '<td>';
    4242                                Html::option($o);
     
    4949
    5050                        echo '<div class="p-t-2">
    51                                         <span class="all-settings-saved"><i class="icon-check icon-15"></i> '.__('All settings saved', $model->slug). '</span>
    52                                         <span style="display:none;" class="saving-settings">Saving settings...</span>
     51                                        <span class="all-settings-saved"><i class="icon-check icon-15"></i> ' . esc_html( 'All settings saved', 'wp-optin-wheel' ) . '</span>
     52                                        <span style="display:none;" class="saving-settings">' . esc_html( 'Saving settings...', 'wp-optin-wheel' ) . '</span>
    5353                                 </div>';
    5454                        echo '</div>';
     
    7575                foreach($model->sections as $section)
    7676                {
    77                     echo '<div style="display: none;" class="mabel-sidebar sidebar-' .$section->id. '" data-sidebar-for="options-' .$section->id. '">';
    78                     do_action($model->slug . '-render-sidebar-'.$section->id);
     77                    echo '<div style="display: none;" class="mabel-sidebar sidebar-' . esc_attr( $section->id ) . '" data-sidebar-for="options-' .esc_attr( $section->id ) . '">';
     78                    do_action( $model->slug . '-render-sidebar-' . $section->id );
    7979                    echo '</div>';
    8080                }
     
    8686
    8787<?php
    88 do_action($model->slug . '-add-content');
     88do_action( $model->slug . '-add-content' );
    8989?>
    9090<div
    9191    data-context
    92     data-settings-key="<?php echo $model->settings_key ?>"
    93     data-slug="<?php echo $model->slug ?>"
    94     data-admin-ajax-url="<?php echo admin_url('admin-ajax.php'); ?>">
     92    data-settings-key="<?php echo esc_attr( $model->settings_key ) ?>"
     93    data-slug="<?php echo esc_attr( $model->slug ) ?>"
     94    data-admin-ajax-url="<?php echo esc_attr( admin_url('admin-ajax.php') ); ?>">
    9595</div>
  • wp-optin-wheel/trunk/core/views/widget_form.php

    r2797123 r3380469  
    1111            /** @var \MABEL_WOF_LITE\Core\Models\Option $option */
    1212            echo '<p>';
    13                 echo '<label>' .$option->title. '</label>';
     13                echo '<label>' . wp_kses_post( $option->title ) . '</label>';
    1414                echo '<div>';
    1515                    $option_manager->display_field( ['option' => $option] );
  • wp-optin-wheel/trunk/readme.txt

    r3272834 r3380469  
    55Tested up to: 6.8
    66Requires PHP: 5.6
    7 Stable tag: 1.4.8
     7Stable tag: 1.5
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8989== Changelog ==
    9090
     91= 1.5 =
     92 * Improvement: improved code for translations.
     93 * Improvement: improved error handling when MailChimp sends back an error.
     94 * Improvement: escape all output.
     95 * Improvement: sanitize all values coming from user input.
     96 * Fix: fixed an issue with the default disclaimer and explainer text not showing in the backend when creating a wheel.
     97 
    9198= 1.4.8 =
    9299 * Improvement: validate MailChimp API key before saving (both frontend and backend).
  • wp-optin-wheel/trunk/wp-optin-wheel.php

    r3272834 r3380469  
    44 * Plugin URI: https://studiowombat.com/plugin/wheel-of-fortune/?utm_source=woffree&utm_medium=plugin&utm_campaign=plugins
    55 * Description: Gamified optin popup to grow your email list, with exit-intent. Woocommerce compatible.
    6  * Version: 1.4.8
     6 * Version: 1.5
    77 * Author: StudioWombat
    88 * Author URI: https://studiowombat.com/?utm_source=woffree&utm_medium=plugin&utm_campaign=plugins
     
    4747        plugin_basename( __FILE__ ),
    4848        'WP Optin Wheel',
    49         '1.4.8',
     49        '1.5',
    5050        'mb-wof-lite-settings'
    5151    );
Note: See TracChangeset for help on using the changeset viewer.