Changeset 3380469
- Timestamp:
- 10/18/2025 10:37:05 AM (3 months ago)
- Location:
- wp-optin-wheel
- Files:
-
- 137 added
- 36 edited
-
tags/1.5 (added)
-
tags/1.5/.DS_Store (added)
-
tags/1.5/LICENSE.txt (added)
-
tags/1.5/admin (added)
-
tags/1.5/admin/css (added)
-
tags/1.5/admin/css/admin.min.css (added)
-
tags/1.5/admin/img (added)
-
tags/1.5/admin/img/wheel-alt-blue.png (added)
-
tags/1.5/admin/img/wheel-black-and-white.png (added)
-
tags/1.5/admin/img/wheel-blue.png (added)
-
tags/1.5/admin/img/wheel-deep-purple.png (added)
-
tags/1.5/admin/img/wheel-green.png (added)
-
tags/1.5/admin/img/wheel-orange.png (added)
-
tags/1.5/admin/img/wheel-purple.png (added)
-
tags/1.5/admin/img/wheel-red.png (added)
-
tags/1.5/admin/img/wheel-vintage.png (added)
-
tags/1.5/admin/img/wheel-yellow.png (added)
-
tags/1.5/admin/js (added)
-
tags/1.5/admin/js/admin.min.js (added)
-
tags/1.5/admin/views (added)
-
tags/1.5/admin/views/add_wheel.php (added)
-
tags/1.5/admin/views/all_wheels.php (added)
-
tags/1.5/admin/views/form-builder-lists.php (added)
-
tags/1.5/admin/views/gdpr-settings.php (added)
-
tags/1.5/admin/views/log.php (added)
-
tags/1.5/admin/views/privacy-policy-suggestions.php (added)
-
tags/1.5/admin/views/sidebar-main.php (added)
-
tags/1.5/class-wheel-of-fortune.php (added)
-
tags/1.5/code (added)
-
tags/1.5/code/controllers (added)
-
tags/1.5/code/controllers/class-admin-controller.php (added)
-
tags/1.5/code/controllers/class-public-controller.php (added)
-
tags/1.5/code/models (added)
-
tags/1.5/code/models/class-wheel-model.php (added)
-
tags/1.5/code/models/class-wheels-vm.php (added)
-
tags/1.5/code/services (added)
-
tags/1.5/code/services/class-helper-service.php (added)
-
tags/1.5/code/services/class-log-service.php (added)
-
tags/1.5/code/services/class-mailchimp-service.php (added)
-
tags/1.5/code/services/class-wheel-service.php (added)
-
tags/1.5/code/views (added)
-
tags/1.5/code/views/response-done.php (added)
-
tags/1.5/code/views/response-lost.php (added)
-
tags/1.5/code/views/wheel.php (added)
-
tags/1.5/code/views/wheels.php (added)
-
tags/1.5/core (added)
-
tags/1.5/core/assets (added)
-
tags/1.5/core/assets/img (added)
-
tags/1.5/core/assets/img/loader-black.svg (added)
-
tags/1.5/core/assets/img/loader.svg (added)
-
tags/1.5/core/common (added)
-
tags/1.5/core/common/class-admin.php (added)
-
tags/1.5/core/common/class-frontend.php (added)
-
tags/1.5/core/common/class-html.php (added)
-
tags/1.5/core/common/class-loader.php (added)
-
tags/1.5/core/common/class-presentation-base.php (added)
-
tags/1.5/core/common/class-registry.php (added)
-
tags/1.5/core/common/class-shortcode.php (added)
-
tags/1.5/core/common/class-widget.php (added)
-
tags/1.5/core/common/linq (added)
-
tags/1.5/core/common/linq/class-enumerable.php (added)
-
tags/1.5/core/common/managers (added)
-
tags/1.5/core/common/managers/class-abstract-options-manager.php (added)
-
tags/1.5/core/common/managers/class-config-manager.php (added)
-
tags/1.5/core/common/managers/class-language-manager.php (added)
-
tags/1.5/core/common/managers/class-options-manager.php (added)
-
tags/1.5/core/common/managers/class-settings-manager.php (added)
-
tags/1.5/core/common/managers/class-widget-options-manager.php (added)
-
tags/1.5/core/models (added)
-
tags/1.5/core/models/class-autocomplete-option.php (added)
-
tags/1.5/core/models/class-checkbox-option.php (added)
-
tags/1.5/core/models/class-choicepicker-option.php (added)
-
tags/1.5/core/models/class-colorpicker-option.php (added)
-
tags/1.5/core/models/class-container-option.php (added)
-
tags/1.5/core/models/class-custom-option.php (added)
-
tags/1.5/core/models/class-datepicker-option.php (added)
-
tags/1.5/core/models/class-dropdown-option.php (added)
-
tags/1.5/core/models/class-editor-option.php (added)
-
tags/1.5/core/models/class-help.php (added)
-
tags/1.5/core/models/class-hidden-option.php (added)
-
tags/1.5/core/models/class-inline-style.php (added)
-
tags/1.5/core/models/class-mediaselector-option.php (added)
-
tags/1.5/core/models/class-number-and-choice-option.php (added)
-
tags/1.5/core/models/class-number-option.php (added)
-
tags/1.5/core/models/class-option-dependency.php (added)
-
tags/1.5/core/models/class-option-section.php (added)
-
tags/1.5/core/models/class-option.php (added)
-
tags/1.5/core/models/class-pro-option.php (added)
-
tags/1.5/core/models/class-range-option.php (added)
-
tags/1.5/core/models/class-start-vm.php (added)
-
tags/1.5/core/models/class-text-option.php (added)
-
tags/1.5/core/views (added)
-
tags/1.5/core/views/fields (added)
-
tags/1.5/core/views/fields/autocomplete.php (added)
-
tags/1.5/core/views/fields/checkbox.php (added)
-
tags/1.5/core/views/fields/choice-picker.php (added)
-
tags/1.5/core/views/fields/colorpicker.php (added)
-
tags/1.5/core/views/fields/container-option.php (added)
-
tags/1.5/core/views/fields/datepicker.php (added)
-
tags/1.5/core/views/fields/dropdown.php (added)
-
tags/1.5/core/views/fields/editor.php (added)
-
tags/1.5/core/views/fields/help.php (added)
-
tags/1.5/core/views/fields/hidden.php (added)
-
tags/1.5/core/views/fields/media-selector.php (added)
-
tags/1.5/core/views/fields/number-and-choice.php (added)
-
tags/1.5/core/views/fields/number.php (added)
-
tags/1.5/core/views/fields/pro-option.php (added)
-
tags/1.5/core/views/fields/rangeslider.php (added)
-
tags/1.5/core/views/fields/textbox.php (added)
-
tags/1.5/core/views/start.php (added)
-
tags/1.5/core/views/widget_form.php (added)
-
tags/1.5/public (added)
-
tags/1.5/public/css (added)
-
tags/1.5/public/css/public.min.css (added)
-
tags/1.5/public/css/theme-deep-purple.css (added)
-
tags/1.5/public/css/theme-green.css (added)
-
tags/1.5/public/css/theme-orange.css (added)
-
tags/1.5/public/css/theme-purple.css (added)
-
tags/1.5/public/css/theme-red.css (added)
-
tags/1.5/public/css/theme-vintage.css (added)
-
tags/1.5/public/css/theme-yellow.css (added)
-
tags/1.5/public/img (added)
-
tags/1.5/public/img/bg-hearts.png (added)
-
tags/1.5/public/img/bg-waves-dark.png (added)
-
tags/1.5/public/img/bg-waves-light.png (added)
-
tags/1.5/public/img/wheel-deep-purple.png (added)
-
tags/1.5/public/img/wheel-green.png (added)
-
tags/1.5/public/img/wheel-orange.png (added)
-
tags/1.5/public/img/wheel-purple.png (added)
-
tags/1.5/public/img/wheel-red.png (added)
-
tags/1.5/public/img/wheel-vintage.png (added)
-
tags/1.5/public/img/wheel-yellow.png (added)
-
tags/1.5/public/js (added)
-
tags/1.5/public/js/public.min.js (added)
-
tags/1.5/readme.txt (added)
-
tags/1.5/uninstall.php (added)
-
tags/1.5/wp-optin-wheel.php (added)
-
trunk/admin/js/admin.min.js (modified) (3 diffs)
-
trunk/admin/views/add_wheel.php (modified) (11 diffs)
-
trunk/admin/views/all_wheels.php (modified) (2 diffs)
-
trunk/admin/views/sidebar-main.php (modified) (1 diff)
-
trunk/class-wheel-of-fortune.php (modified) (1 diff)
-
trunk/code/controllers/class-admin-controller.php (modified) (11 diffs)
-
trunk/code/controllers/class-public-controller.php (modified) (3 diffs)
-
trunk/code/models/class-wheel-model.php (modified) (1 diff)
-
trunk/code/services/class-helper-service.php (modified) (1 diff)
-
trunk/code/services/class-mailchimp-service.php (modified) (1 diff)
-
trunk/code/services/class-wheel-service.php (modified) (2 diffs)
-
trunk/code/views/wheel.php (modified) (7 diffs)
-
trunk/code/views/wheels.php (modified) (1 diff)
-
trunk/core/common/class-admin.php (modified) (4 diffs)
-
trunk/core/common/class-html.php (modified) (1 diff)
-
trunk/core/common/class-loader.php (modified) (2 diffs)
-
trunk/core/common/class-widget.php (modified) (4 diffs)
-
trunk/core/common/managers/class-settings-manager.php (modified) (1 diff)
-
trunk/core/models/class-option.php (modified) (1 diff)
-
trunk/core/views/fields/autocomplete.php (modified) (2 diffs)
-
trunk/core/views/fields/checkbox.php (modified) (3 diffs)
-
trunk/core/views/fields/choice-picker.php (modified) (4 diffs)
-
trunk/core/views/fields/colorpicker.php (modified) (2 diffs)
-
trunk/core/views/fields/container-option.php (modified) (2 diffs)
-
trunk/core/views/fields/datepicker.php (modified) (1 diff)
-
trunk/core/views/fields/dropdown.php (modified) (5 diffs)
-
trunk/core/views/fields/help.php (modified) (1 diff)
-
trunk/core/views/fields/hidden.php (modified) (1 diff)
-
trunk/core/views/fields/number.php (modified) (1 diff)
-
trunk/core/views/fields/pro-option.php (modified) (1 diff)
-
trunk/core/views/fields/rangeslider.php (modified) (2 diffs)
-
trunk/core/views/fields/textbox.php (modified) (2 diffs)
-
trunk/core/views/start.php (modified) (5 diffs)
-
trunk/core/views/widget_form.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/wp-optin-wheel.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-optin-wheel/trunk/admin/js/admin.min.js
r3272834 r3380469 9 9 var 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={})); 10 10 var 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(){}});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),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(){}}); 12 12 var 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={})); 13 13 var 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={})); … … 17 17 var 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={})); 18 18 var 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={}));23 19 "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}}); 24 20 !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={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},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)}}(); … … 26 22 var 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={})); 27 23 var 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={})); 24 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={})); 25 var WOFAdmin;!function(n){!function(n){var i=function(){function n(){}return n}();n.Slice=i}(n.Models||(n.Models={}))}(WOFAdmin||(WOFAdmin={})); 26 var WOFAdmin;!function(n){!function(n){var i=function(){function n(){}return n}();n.Statistics=i}(n.Models||(n.Models={}))}(WOFAdmin||(WOFAdmin={})); 27 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={})); -
wp-optin-wheel/trunk/admin/views/add_wheel.php
r3165654 r3380469 3 3 <ul class="step-tracker steps-5"> 4 4 <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> 6 6 </li> 7 7 <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> 9 9 </li> 10 10 <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> 12 12 </li> 13 13 <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> 15 15 </li> 16 16 <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> 18 18 </li> 19 19 </ul> … … 21 21 <div data-step="1" class="t-c p-t-5"> 22 22 <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' ); ?> 25 25 </div> 26 26 <div class="wof-step-1" style="display: none;"> … … 40 40 ?> 41 41 <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> 43 43 <div class="wof-theme"> 44 44 <img src="<?php echo esc_attr($data['base_url']).'/admin/img/wheel-black-and-white.png' ?>" /> … … 53 53 </div> 54 54 <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> 57 57 </div> 58 58 </div> … … 74 74 75 75 <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> 79 79 </div> 80 80 </div> 81 81 82 82 <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> 84 87 <table class="form-table wof-slice-wrapper m-t-5"> 85 88 <thead> 86 89 <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> 89 92 <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> 92 95 </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> 94 97 <th style="width:100px;"> </th> 95 98 </thead> … … 97 100 </table> 98 101 <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> 100 103 </div> 101 104 <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' ) ?> 103 106 </p> 104 107 <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> 108 111 </div> 109 112 </div> … … 112 115 <div class="form-builder-for-lists"> 113 116 <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' ) ); ?> 115 118 </div> 116 119 <?php … … 119 122 </div> 120 123 <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> 124 127 </div> 125 128 </div> … … 140 143 141 144 <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> 144 147 </div> 145 148 </div> 146 149 147 150 <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> 149 152 <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> 151 154 </div> 152 155 </div> … … 161 164 <td> 162 165 <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> 171 174 </select> 172 175 </td> … … 185 188 </td> 186 189 <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> 188 191 </td> 189 192 </tr> -
wp-optin-wheel/trunk/admin/views/all_wheels.php
r3165654 r3380469 1 1 <div class="wof-nonce" data-nonce="<?php echo esc_attr(wp_create_nonce('wof_data_nonce')) ?>"></div> 2 2 <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> 4 4 5 5 <div class="wof-wheels-list"></div> 6 6 7 7 <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' ) ) ?> 9 9 </div> 10 10 </div> … … 25 25 <div class="tile-footer"> 26 26 <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}}" /> 28 28 </div> 29 29 <ul> -
wp-optin-wheel/trunk/admin/views/sidebar-main.php
r2801374 r3380469 6 6 <li>Full integration with WooCommerce</li> 7 7 <li>Create your own themes</li> 8 <li> Add other fields to theform</li>8 <li>Form builder: add more fields to the opt-in form</li> 9 9 <li>Limit prizes</li> 10 10 <li>Add/remove slices</li> -
wp-optin-wheel/trunk/class-wheel-of-fortune.php
r3272834 r3380469 142 142 $item_id = "wp-optin-wheel-lite-log-".$email; 143 143 $group_id = 'wp-optin-wheel-lite'; 144 $group_label = __( 'Optin Wheel Plugin Data' );144 $group_label = __( 'Optin Wheel Plugin Data', 'wp-optin-wheel' ); 145 145 $data = [ [ 146 'name' => __('Logs for user', Config_Manager::$slug),146 'name' => __('Logs for user', 'wp-optin-wheel' ), 147 147 'value' => join('<br/>',$matches) 148 148 ] ]; -
wp-optin-wheel/trunk/code/controllers/class-admin-controller.php
r3165654 r3380469 52 52 53 53 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 { 54 164 if(!current_user_can($this->capability) || !isset($_REQUEST['wof_nonce']) || !wp_verify_nonce($_REQUEST['wof_nonce'],'wof_data_nonce')) { 55 165 wp_send_json_error(); 56 166 } 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'] ) ) 62 169 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 ) ); 164 180 } 165 181 … … 169 185 add_action(Config_Manager::$slug . '-render-sidebar', [$this,'render_main_sidebar']); 170 186 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'); 175 191 176 192 $this->options_manager->add_option('settings', new Checkbox_Option( 177 193 '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' ), 180 196 Settings_Manager::get_setting('log') 181 197 )); 182 198 $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 )); 186 202 187 203 … … 193 209 $this->options_manager->add_option('apis', new Text_Option( 194 210 'mailchimp_api', 195 __('MailChimp API Key', $this->slug),211 __('MailChimp API Key', 'wp-optin-wheel' ), 196 212 Settings_Manager::get_setting('mailchimp_api'), 197 213 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' ) 199 215 )); 200 216 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 ); 202 224 203 225 $this->options_manager->add_option('addwheel', … … 279 301 280 302 $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' ), 288 310 ]; 289 311 290 312 $slices = [ [ 291 'label' => __('5% Discount', $this->slug),313 'label' => __('5% Discount', 'wp-optin-wheel' ), 292 314 'value' => '5OFF', 293 315 'chance' => 30, 294 316 'type' => 1 295 317 ], [ 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' ), 306 328 'value' => '10OFF', 307 329 'chance' => 30, 308 330 'type' => 1 309 331 ], [ 310 'label' => __('Free Ebook', $this->slug),332 'label' => __('Free Ebook', 'wp-optin-wheel' ), 311 333 'value' => 'https://google.com/', 312 334 'chance' => 30, 313 335 'type' => 2 314 336 ], [ 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' ), 325 347 'value' => '50OFF', 326 348 'chance' => 10, 327 349 'type' => 1 328 350 ], [ 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' ), 333 355 'type' => 0 334 356 ], 335 357 ]; 336 358 337 $content_settings = new Container_Option( null, __('Content settings',$this->slug));359 $content_settings = new Container_Option( null, __('Content settings', 'wp-optin-wheel' ) ); 338 360 339 361 $content_settings->options = [ … … 341 363 new Text_Option( 342 364 'title', 343 __('Title', $this->slug),365 __('Title', 'wp-optin-wheel' ), 344 366 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' ) 347 369 ) 348 370 ), … … 350 372 new Editor_Option( 351 373 'explainer', 352 __('Explainer text', $this->slug),374 __('Explainer text', 'wp-optin-wheel' ), 353 375 null, 354 376 [ … … 359 381 'quicktags' => false 360 382 ], 361 __('A short paragraph explaining how it works.', $this->slug)383 __('A short paragraph explaining how it works.', 'wp-optin-wheel' ) 362 384 ) 363 385 ), … … 365 387 new Editor_Option( 366 388 'disclaimer', 367 __('Disclaimer text', $this->slug),389 __('Disclaimer text', 'wp-optin-wheel' ), 368 390 null, 369 391 [ … … 376 398 'quicktags' => false 377 399 ], 378 __('Add a short paragraph explaining the rules & regulations.', $this->slug)400 __('Add a short paragraph explaining the rules & regulations.', 'wp-optin-wheel' ) 379 401 ) 380 402 ), 381 $this->add_data_attribute_for_data_bind( new Text_Option(403 $this->add_data_attribute_for_data_bind( new Text_Option( 382 404 '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( 389 411 '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' ) 394 416 )), 395 417 $this->add_data_attribute_for_data_bind(new Text_Option( 396 418 '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' ) 401 423 )), 402 424 $this->add_data_attribute_for_data_bind(new Text_Option( 403 425 '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' ) 408 430 )), 409 431 $this->add_data_attribute_for_data_bind(new Text_Option( 410 432 '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' ) 415 437 )), 416 438 $this->add_data_attribute_for_data_bind(new Text_Option( 417 439 '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' ) 422 444 )), 423 445 $this->add_data_attribute_for_data_bind(new Text_Option( 424 446 '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' ) 429 451 )), 430 452 $this->add_data_attribute_for_data_bind(new Text_Option( 431 453 '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' ) 436 458 )) 437 459 ]; 438 460 439 $design_settings = new Container_Option(null, __( 'Design settings',$this->slug));461 $design_settings = new Container_Option(null, __( 'Design settings', 'wp-optin-wheel' ) ); 440 462 $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' ), [ 442 464 'none' => 'No pattern', 443 465 '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' ) ); 449 473 450 474 $behavior_settings->options = [ 451 475 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' ) 454 478 ), 455 479 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' ) 458 482 ), 459 483 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' ) 462 486 ) 463 487 ]; 464 488 465 array_push($behavior_settings->options,$this->add_data_attribute_for_data_bind(489 $behavior_settings->options[] = $this->add_data_attribute_for_data_bind( 466 490 new Dropdown_Option( 467 491 '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' ) 471 495 ], 472 496 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( 476 500 'appeardelay', 477 __( 'Appearance delay',$this->slug),501 __( 'Appearance delay', 'wp-optin-wheel' ), 478 502 5, 479 503 null,null, 480 504 [ 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( 486 510 'occurancedelay', 487 __('Occurance delay', $this->slug),511 __('Occurance delay', 'wp-optin-wheel' ), 488 512 5, 489 513 null,null, 490 514 [ 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' ) ); 506 530 507 531 $list_settings->options = [ 508 532 new Dropdown_Option( 509 533 'list_provider', 510 __('List provider', $this->slug),534 __('List provider', 'wp-optin-wheel' ), 511 535 [], 512 536 null, 513 __('What email list software are you using?', $this->slug)537 __('What email list software are you using?', 'wp-optin-wheel' ) 514 538 ), 515 539 new Dropdown_Option( 516 540 'list', 517 __('Email list', $this->slug),541 __('Email list', 'wp-optin-wheel' ), 518 542 [], 519 543 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' ) 521 545 ), 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( 524 550 __('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 email s.', $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) 526 552 ), 527 553 new Pro_option( … … 537 563 $form_builder_for_lists_settings = new Custom_Option(null,'form-builder-lists'); 538 564 539 $gdpr_settings = new Container_Option( null, __('GDPR', $this->slug));565 $gdpr_settings = new Container_Option( null, __('GDPR', 'wp-optin-wheel' ) ); 540 566 $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'); 542 568 $gdpr_settings->options = [ $gdpr_custom_setting ]; 543 569 … … 545 571 $this->add_data_attribute_for_data_bind(new Number_Option( 546 572 'winning_chance', 547 __('Winning chance', $this->slug),573 __('Winning chance', 'wp-optin-wheel' ), 548 574 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' ), 550 576 null,' ', 551 577 ' % ' 552 578 )), 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' ) ) 554 580 ]; 555 581 -
wp-optin-wheel/trunk/code/controllers/class-public-controller.php
r3165654 r3380469 48 48 } 49 49 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' ) ); 54 54 55 if( empty($wheel))56 $wheel = Wheel_service::get_wheel( $_POST['id']);55 if( empty( $wheel ) ) 56 $wheel = Wheel_service::get_wheel( $_POST['id'] ); 57 57 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'] ) ) ); 59 59 60 60 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' ) ); 62 62 63 $segment = Wheel_service::calculate_segment_hit( $wheel);63 $segment = Wheel_service::calculate_segment_hit( $wheel ); 64 64 65 65 $winning = $segment->type != 0; … … 89 89 if(!isset($_POST['nonce']) || !isset($_POST['id']) || !isset($_POST['mail']) || 90 90 !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' ) ); 92 92 93 93 $email = sanitize_email($_POST['mail']); 94 94 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' ) ); 96 96 97 $wheel = Wheel_service::get_wheel( $_POST['id']);97 $wheel = Wheel_service::get_wheel( sanitize_text_field( wp_unslash( $_POST['id'] ) ) ); 98 98 99 99 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' ) ); 101 101 } 102 102 … … 161 161 private function get_segment_title(Wheel_Model $wheel, $segment) { 162 162 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' ); 164 164 165 165 return str_replace( 166 166 '{x}', 167 167 '<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' ) 169 169 ); 170 170 } -
wp-optin-wheel/trunk/code/models/class-wheel-model.php
r2797123 r3380469 96 96 } 97 97 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 ) { 101 103 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%;'; 103 105 default: return ''; 104 106 } 105 } 107 108 } 106 109 107 110 } -
wp-optin-wheel/trunk/code/services/class-helper-service.php
r2797123 r3380469 21 21 } 22 22 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 } 50 24 51 25 } -
wp-optin-wheel/trunk/code/services/class-mailchimp-service.php
r2797123 r3380469 29 29 $response = self::request('lists/'.$list_id.'/members/'.md5(strtolower($email)),$data); 30 30 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 } 33 38 34 39 return true; 35 } 40 41 } 36 42 37 43 public static function get_email_lists() { -
wp-optin-wheel/trunk/code/services/class-wheel-service.php
r2895301 r3380469 52 52 } 53 53 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; 56 57 57 58 if(!$will_win){ … … 67 68 }); 68 69 69 $rand = mt_rand(0, 100);70 $rand = wp_rand(0, 100); 70 71 71 72 $cumul = 0; -
wp-optin-wheel/trunk/code/views/wheel.php
r3165654 r3380469 1 1 <?php 2 2 /** @var \MABEL_WOF_LITE\Code\Models\Wheel_Model $model */ 3 use MABEL_WOF_LITE\Core\Common\Managers\Config_Manager;4 3 use MABEL_WOF_LITE\Code\Services\Wheel_service; 5 4 … … 8 7 <style> 9 8 <?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() ?>} 11 10 <?php } ?> 12 11 </style> … … 21 20 <div class="wof-close-wrapper"> 22 21 <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' ) ) ?> 24 23 </a> 25 24 </div> … … 29 28 <div class="wof-left-inner"> 30 29 <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> 32 31 </div> 33 32 <div class="shadow-inner"></div> … … 38 37 <?php $start_degrees = 0; $ctr= 1; ?> 39 38 <?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> 41 40 <?php $start_degrees += 30; $ctr++; ?> 42 41 <?php } ?> … … 47 46 <div class="wof-right-inner"> 48 47 <div class="wof-title wof-fgcolor"> 49 <?php echo wp_kses_post( $model->title) ?>48 <?php echo wp_kses_post( $model->title ) ?> 50 49 </div> 51 50 <?php if($model->has_setting('explainer')){ ?> 52 51 <div class="wof-explainer wof-fgcolor"> 53 <?php echo wp_kses_post( $model->explainer) ?>52 <?php echo wp_kses_post( $model->explainer ) ?> 54 53 </div> 55 54 <?php } ?> 56 55 <div class="wof-form-wrapper"> 57 56 <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' ) ) ) ?>" /> 59 58 <div class="wof-form-fields"></div> 60 59 <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> 62 61 <div class="wof-loader" style="display: none;"> 63 62 <div class="b1"></div> … … 70 69 <?php if($model->has_setting('disclaimer')) { ?> 71 70 <div class="wof-disclaimer wof-fgcolor"> 72 <?php echo wp_kses_post( $model->disclaimer) ?>71 <?php echo wp_kses_post( $model->disclaimer ) ?> 73 72 </div> 74 73 <?php } ?> -
wp-optin-wheel/trunk/code/views/wheels.php
r3165654 r3380469 5 5 <div class="wof-overlay" style="display: none;"></div> 6 6 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') ) ?>"> 8 8 <?php 9 9 foreach($model->wheels as $wheel) { 10 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 10 11 echo \MABEL_WOF_LITE\Core\Common\Html::view('wheel', $wheel); 11 12 } -
wp-optin-wheel/trunk/core/common/class-admin.php
r3272834 r3380469 6 6 use MABEL_WOF_LITE\Core\Common\Managers\Options_Manager; 7 7 use MABEL_WOF_LITE\Core\Models\Start_VM; 8 9 8 10 9 abstract class Admin extends Presentation_Base 11 10 { … … 46 45 47 46 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>'; 49 48 } 50 49 … … 56 55 { 57 56 $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>', 59 58 ]; 60 59 return array_merge( $links, $my_links ); … … 96 95 ob_start(); 97 96 include Config_Manager::$dir . 'core/views/start.php'; 97 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 98 98 echo ob_get_clean(); 99 99 } -
wp-optin-wheel/trunk/core/common/class-html.php
r2797123 r3380469 33 33 ob_start(); 34 34 include Config_Manager::$dir . $view . '.php'; 35 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 35 36 echo ob_get_clean(); 36 37 } -
wp-optin-wheel/trunk/core/common/class-loader.php
r3144245 r3380469 82 82 foreach ( $this->filters as $hook ) { 83 83 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."); 85 85 } 86 86 add_filter( $hook['hook'], ($hook['component'] === null? $hook['callback'] : [ $hook['component'], $hook['callback'] ]), $hook['priority'], $hook['accepted_args'] ); … … 89 89 foreach ( $this->actions as $hook ) { 90 90 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."); 92 92 } 93 93 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 35 35 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); 36 36 37 echo $args['before_widget']; 37 echo wp_kses_post( $args['before_widget'] ); 38 38 39 if ( $title ) { 39 echo $args['before_title'] . $title . $args['after_title'];40 echo wp_kses_post( $args['before_title'] . $title . $args['after_title'] ); 40 41 } 41 42 … … 43 44 44 45 foreach($instance as $k => $v) { 45 array_push($argument_list, $k . '="' .$v . '"' );46 $argument_list[] = $k . '="' . $v . '"'; 46 47 } 47 48 48 49 echo do_shortcode('[' . $this->shortcode . ' ' .join(' ', $argument_list) . ']'); 49 50 50 echo $args['after_widget'];51 echo wp_kses_post( $args['after_widget'] ); 51 52 } 52 53 … … 55 56 { 56 57 if($this->warning){ 57 echo $this->warning;58 echo esc_html( $this->warning ); 58 59 }else{ 59 60 … … 71 72 include Config_Manager::$dir . 'core/views/widget_form.php'; 72 73 74 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 73 75 echo ob_get_clean(); 74 76 } -
wp-optin-wheel/trunk/core/common/managers/class-settings-manager.php
r2797123 r3380469 92 92 return null; 93 93 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' ); 96 96 97 97 return null; -
wp-optin-wheel/trunk/core/models/class-option.php
r2797123 r3380469 44 44 public function get_extra_data_attributes(){ 45 45 return join(' ', Enumerable::from($this->data_attributes)->select(function($v,$k){ 46 return 'data-'.$k.'="'. $v.'"';46 return 'data-'.$k.'="'. esc_attr( $v ).'"'; 47 47 })->toArray()); 48 48 } -
wp-optin-wheel/trunk/core/views/fields/autocomplete.php
r3165654 r3380469 2 2 /** @var \MABEL_WOF_LITE\Core\Models\Autocomplete_Option $option */ 3 3 ?> 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 ) ?>"> 5 5 <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 ) ?>" 8 8 <?php echo $option->get_extra_data_attributes(); ?> 9 9 /> … … 20 20 <?php 21 21 if(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>'; 23 23 ?> -
wp-optin-wheel/trunk/core/views/fields/checkbox.php
r2797123 r3380469 6 6 7 7 ?> 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" /> 9 9 <input 10 10 class="mabel-form-element" 11 11 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 ) ?>" 13 13 value="true" 14 14 <?php if(in_array($option->value, ['true','1',true], true)) echo ' checked '; ?> … … 18 18 /> 19 19 20 <label for="ckb-<?php echo $option->id?>">20 <label for="ckb-<?php echo esc_attr( $option->id ) ?>"> 21 21 <?php echo esc_html($option->label); ?> 22 22 </label> … … 24 24 <?php 25 25 if(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>'; 27 27 ?> -
wp-optin-wheel/trunk/core/views/fields/choice-picker.php
r3165654 r3380469 4 4 $id = $option->name === null ? $option->id : $option->name; 5 5 ?> 6 <div class="mabel-mc-wrapper" data-id="<?php echo $id;?>">6 <div class="mabel-mc-wrapper" data-id="<?php echo esc_attr( $id ) ?>"> 7 7 8 8 <input 9 9 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() ) ?>" 12 12 class="mabel-formm-element" 13 13 <?php echo $option->get_extra_data_attributes(); ?> … … 16 16 <div class="mabel-mc-chosen"> 17 17 <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' ); ?> 19 19 </em> 20 20 … … 25 25 <?php 26 26 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>'; 28 28 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>'; 30 30 } 31 31 } … … 36 36 <?php 37 37 if(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>'; 39 39 ?> -
wp-optin-wheel/trunk/core/views/fields/colorpicker.php
r3144245 r3380469 5 5 <input 6 6 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)) . '"':''; ?> 10 10 class="color-picker mabel-form-element" 11 11 /> … … 13 13 <?php 14 14 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>'; 16 16 ?> -
wp-optin-wheel/trunk/core/views/fields/container-option.php
r2797123 r3380469 5 5 <div 6 6 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 ) ?>" 8 8 <?php echo !empty($option->dependency) ? 'data-dependency="' . htmlspecialchars(json_encode($option->dependency,ENT_QUOTES)) . '"':''; ?> 9 9 > 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> 11 11 <div style="display: none;"> 12 12 <table class="form-table"> … … 16 16 echo '<tr>'; 17 17 if(!empty($o->title)) 18 echo '<th scope="row">' .$o->title.'</th>';18 echo '<th scope="row">' . wp_kses_post( $o->title ) . '</th>'; 19 19 echo '<td '.(empty($o->title) ? 'colspan="2"' : '').'>'; 20 Html::option( $o);20 Html::option( $o ); 21 21 echo '</td>'; 22 22 } -
wp-optin-wheel/trunk/core/views/fields/datepicker.php
r3165654 r3380469 5 5 <input 6 6 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);?>" 9 9 <?php echo !empty($option->dependency) ? 'data-dependency="' . htmlspecialchars(json_encode($option->dependency,ENT_QUOTES)) . '"':''; ?> 10 10 class="widefat mabel-date-picker mabel-form-element" 11 11 <?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 ) ) ?>" 13 13 /> 14 14 15 15 <?php 16 16 if(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>'; 18 18 ?> -
wp-optin-wheel/trunk/core/views/fields/dropdown.php
r2797123 r3380469 8 8 9 9 if(isset($option->pre_text)) { 10 echo '<span>' . esc_html( $option->pre_text) . '</span>';10 echo '<span>' . esc_html( $option->pre_text ) . '</span>'; 11 11 $has_pre_text = true; 12 12 } … … 16 16 class="widefat mabel-form-element" 17 17 <?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)) . '"':''; ?> 20 20 <?php echo $option->get_extra_data_attributes(); ?> 21 21 > … … 23 23 foreach($option->options as $key=>$value){ 24 24 $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>'; 26 26 } 27 27 ?> … … 30 30 <?php 31 31 if(isset($option->post_text)) 32 echo '<span>' . $option->post_text. '</span>';32 echo '<span>' . esc_html( $option->post_text ) . '</span>'; 33 33 ?> 34 34 … … 36 36 37 37 if(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 5 5 ?> 6 6 <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 ); ?>"> 8 8 <div style="padding:20px;"> 9 <?php include Config_Manager::$dir . 'admin/views/' . $help->template; ?>9 <?php include Config_Manager::$dir . 'admin/views/' . $help->template; ?> 10 10 </div> 11 11 </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 ) 16 17 ?> 17 18 </a> -
wp-optin-wheel/trunk/core/views/fields/hidden.php
r2797123 r3380469 3 3 ?> 4 4 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 17 17 style="<?php echo $has_pre_text? 'width:100px;' : ''; ?>" 18 18 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 ) ?>" 20 20 value="<?php if( ! empty( $option->value ) ) echo htmlspecialchars($option->value);?>" 21 21 <?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 4 4 5 5 <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' ); ?> 7 7 </div> -
wp-optin-wheel/trunk/core/views/fields/rangeslider.php
r2797123 r3380469 7 7 style="opacity: 0;" 8 8 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 ) ?>" 10 10 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 ) ?>" 15 15 <?php echo $option->get_extra_data_attributes(); ?> 16 16 /> … … 18 18 <?php 19 19 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>'; 21 21 ?> 22 22 -
wp-optin-wheel/trunk/core/views/fields/textbox.php
r3144245 r3380469 13 13 class="widefat mabel-form-element" 14 14 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 ) ?>" 18 18 <?php echo !empty($option->dependency) ? 'data-dependency="' . htmlspecialchars(json_encode($option->dependency,ENT_QUOTES)) . '"':''; ?> 19 19 <?php echo $option->get_extra_data_attributes(); ?> … … 22 22 <textarea 23 23 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)) . '"':''; ?> 27 27 <?php echo $option->get_extra_data_attributes(); ?> 28 28 ><?php if( ! empty( $option->value ) ) echo htmlspecialchars($option->value);?></textarea> -
wp-optin-wheel/trunk/core/views/start.php
r2797123 r3380469 19 19 '<a data-tab="options-'.$section->id.'" href="#" class="mabel-nav-tab'.($section->active === true? ' mabel-nav-tab-active':'').'"> 20 20 <i class="dashicons dashicons-'.$section->icon.'"></i> 21 <span>' .__($section->title, $model->slug).'</span>21 <span>' . esc_html( $section->title ) . '</span> 22 22 </a>'; 23 23 } 24 do_action( $model->slug . '-add-tabs');24 do_action( $model->slug . '-add-tabs' ); 25 25 ?> 26 26 </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"> 28 28 <?php 29 29 settings_fields( $model->slug ); 30 30 foreach($model->sections as $section) 31 31 { 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;"').'>'; 33 33 if($section->has_options()) 34 34 { … … 38 38 echo '<tr>'; 39 39 if(!empty($o->title)) 40 echo '<th scope="row">' .$o->title.'</th>';40 echo '<th scope="row">' . esc_html( $o->title ) . '</th>'; 41 41 echo '<td>'; 42 42 Html::option($o); … … 49 49 50 50 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> 53 53 </div>'; 54 54 echo '</div>'; … … 75 75 foreach($model->sections as $section) 76 76 { 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 ); 79 79 echo '</div>'; 80 80 } … … 86 86 87 87 <?php 88 do_action( $model->slug . '-add-content');88 do_action( $model->slug . '-add-content' ); 89 89 ?> 90 90 <div 91 91 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') ); ?>"> 95 95 </div> -
wp-optin-wheel/trunk/core/views/widget_form.php
r2797123 r3380469 11 11 /** @var \MABEL_WOF_LITE\Core\Models\Option $option */ 12 12 echo '<p>'; 13 echo '<label>' . $option->title. '</label>';13 echo '<label>' . wp_kses_post( $option->title ) . '</label>'; 14 14 echo '<div>'; 15 15 $option_manager->display_field( ['option' => $option] ); -
wp-optin-wheel/trunk/readme.txt
r3272834 r3380469 5 5 Tested up to: 6.8 6 6 Requires PHP: 5.6 7 Stable tag: 1. 4.87 Stable tag: 1.5 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 89 89 == Changelog == 90 90 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 91 98 = 1.4.8 = 92 99 * Improvement: validate MailChimp API key before saving (both frontend and backend). -
wp-optin-wheel/trunk/wp-optin-wheel.php
r3272834 r3380469 4 4 * Plugin URI: https://studiowombat.com/plugin/wheel-of-fortune/?utm_source=woffree&utm_medium=plugin&utm_campaign=plugins 5 5 * Description: Gamified optin popup to grow your email list, with exit-intent. Woocommerce compatible. 6 * Version: 1. 4.86 * Version: 1.5 7 7 * Author: StudioWombat 8 8 * Author URI: https://studiowombat.com/?utm_source=woffree&utm_medium=plugin&utm_campaign=plugins … … 47 47 plugin_basename( __FILE__ ), 48 48 'WP Optin Wheel', 49 '1. 4.8',49 '1.5', 50 50 'mb-wof-lite-settings' 51 51 );
Note: See TracChangeset
for help on using the changeset viewer.