Version Description
- 04-11-2022 =
- Improvement: Security issue
- Improvement: Mailchimp API Key Validation on save
- Fix: Enable and Disable Elements not working
Download this release
Release Info
Developer | fauzanjegstudio |
Plugin | Jeg Elementor Kit |
Version | 2.5.7 |
Comparing to | |
See all releases |
Code changes from version 2.5.6 to 2.5.7
- assets/js/dashboard/dashboard-container.js +1 -1
- assets/js/dashboard/dashboard.js +1 -1
- class/ajax/class-ajax.php +85 -29
- class/dashboard/class-dashboard.php +5 -3
- class/dashboard/template/class-template-dashboard-abstract.php +6 -6
- class/elements/views/class-mailchimp-view.php +24 -8
- helper.php +8 -26
- jeg-elementor-kit.php +2 -2
- languages/jeg-elementor-kit.pot +27 -23
- readme.txt +6 -1
- templates/dashboard/dashboard-elements.php +1 -1
assets/js/dashboard/dashboard-container.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t,e){"use strict";e.SingleSegment=e.noWrapSegment.extend({populateFields:function(){var t=this.prepareField(this.params.fields);this.setupField(this.id,t)},prepareField:function(t){var i=0,n=[];return _.each(t,function(o,a){var s=e.cloneObject(t[a]);n[a]=this.prepareFieldData(s,o,i++)}.bind(this)),e.helper.prioritySort(n)},prepareFieldData:function(t){var e=this.params.container;return t.container=this,t.fieldName=e.id+"["+t.fieldName+"]",t},listenFieldChange:function(t,e){this.params.container.listenSegmentChange(this.id,t,e)}}),e.MultiSegment=e.SingleSegment.extend({segmentType:"multi",segmentContentParent:".jkit-condition-content",ready:function(){this.activateSegment()},prepareFieldData:function(t){var e=this.params.index,i=this.params.container;return t.container=this,t.fieldName=i.id+"["+e+"]["+t.fieldName+"]",t},getParentContainer:function(){return this.params.container.container.find(".jkit-condition-wrapper")},attachEvent:function(){this.element.find(".jkit-condition-header").on("click",this.activateSegment.bind(this)),this.element.find(".tab-delete").on("click",this.removeSegment.bind(this))},activateSegment:function(){this.params.parentInstance.activateSegment(this.id)},toogleSegment:function(){setTimeout(function(){this.element.toggleClass("show").find(".jkit-condition-content").slideToggle("fast")}.bind(this),200)},closeSegment:function(){this.element.find(".jkit-condition-content").slideUp("fast")},removeSegment:function(t){t.stopPropagation(),this.element.remove(),this.params.parentInstance.removeSegment(this.id,this.params.index),void 0!==this.params.container.option.parent.saveValue&&this.params.container.option.parent.saveValue()}}),e.segmentConstructor.single=e.SingleSegment,e.segmentConstructor.multi=e.MultiSegment,e.SingleContainer=e.BaseContainer.extend({setContainerHolder:function(){this.containerHolder=this.option.parent.containerHolder},prepareSegmentData:function(t){return t.parent=this.id,t.container=this,t.fields=this.option.fields,t},populateSegments:function(){var t={[this.option.id]:{id:this.option.id,name:this.option.id,type:this.option.type}};t=this.prepareSegment(t),this.setupSegment(this.id,t)},prepareSegment:function(t){return _.each(t,function(i,n){var o=e.cloneObject(t[n]);t[n]=this.prepareSegmentData(o,i)}.bind(this)),e.helper.prioritySort(t)},getValues:function(){var t={};return this.segments(this.option.id).fields.each((function(e){t[e.id]=e.value.get()})),t},listenSegmentChange:function(t,e,i){void 0!==this.option.parent.listenContainerChange&&this.option.parent.listenContainerChange(t,e,i)}}),e.ConditionContainer=e.SingleContainer.extend({initialize:function(t,i,n){this.id=t,this.element=i,this.option=n,this.segments=new e.Values({defaultConstructor:e.Segment}),this.embeed(),this.setContainerHolder(),this.loadContainer()},populateSegments:function(){for(var t in this.option.fields){var e=this.createSegmentParam(t);e=this.prepareSegment(e),this.setupSegment(this.id,e)}},getValues:function(){var t=[];return this.segments.each((function(e){var i={};e.fields.each((function(t){i[t.id]=t.value.get()})),t.push(i)})),t},triggerFinish:function(){this.segments.each(function(t){this.segments(t.id).triggerLoaded()}.bind(this)),this.checkEmptySegment()},prepareSegmentData:function(t,e){return t.parent=this.id,t.container=this,t.parentInstance=this,void 0===this.option.fields?t.fields=this.option.default:t.fields=this.option.fields[e.index],t},activateSegment:function(t){this.segments.each((function(e){t===e.id&&e.toogleSegment()}))},removeSegment:function(t,e){this.segments.remove(t),this.checkEmptySegment()},checkEmptySegment:function(){this.getAllSegments().length?this.hideEmptyCondition():this.renderEmptySegment()},renderEmptySegment:function(){this.element.find(".jkit-condition-empty").show()},hideEmptyCondition:function(){this.element.find(".jkit-condition-empty").hide()},getAllSegments:function(){var t=[];return this.segments.each((function(e){t.push(e.id)})),t},attachEvent:function(){this.container.find(".jkit-condition-add button").on("click",this.buttonAddClicked.bind(this))},buttonAddClicked:function(){this.createMultiSegment(),void 0!==this.option.parent.saveValue&&this.option.parent.saveValue(),this.checkEmptySegment()},createMultiSegment:function(){var t=this.getNextSegmentIndex(),e=this.createSegmentParam(t),i=e.segment.id;(e=this.prepareSegment(e))[0].fields=this.option.default,this.setupSegment(this.id,e),this.segments(i).triggerLoaded(),this.segments(i).activateSegment()},getNextSegmentIndex:function(){var t=0,e=!1;return this.segments.each((function(i){t=i.params.index,e=!0})),e||0!==t?++t:t},createSegmentParam:function(t){var i=e.segmentName(this.option.id,t);return t=parseInt(t),{segment:{id:i,name:this.option.title+" "+(t+1),type:this.option.type,index:t}}},embeed:function(){this.container=t(this.renderContainer()),this.element.append(this.container)},renderContainer:function(){var t=wp.template("jkit-condition-container");return t?t({lang:JKitTemplateConfig.lang}):"<div></div>"}}),e.JKitOptionBuilder=e.Class.extend({initialize:function(t,i,n){this.id=t,this.options=e.cloneObject(i),this.$wrapper=n,this.createContainer()},createContainer:function(){this.containerHolder=new e.Values({defaultConstructor:e.BaseContainer}),_.each(this.options,function(t){t.parent=this,"single"===t.type?this.containerHolder.add(t.id,new e.SingleContainer(t.id,this.$wrapper,t)):this.containerHolder.add(t.id,new e.ConditionContainer(t.id,this.$wrapper,t))}.bind(this))},triggerFinish:function(){this.containerHolder.trigger(this.id,this)}}),e.JKitOptionWrapperBuilder=e.JKitOptionBuilder.extend({initialize:function(t,i,n,o){this.id=t,this.options=e.cloneObject(i),this.$wrapper=n,this.setting=o,this.timeout=null,this.loaded=!1,this.embeed(),this.attachEvent(),Notiflix.Notify.init({position:"right-top",zindex:999999,showOnlyTheLastOne:!0,success:{notiflixIconColor:"#fff"}})},attachEvent:function(){this.$container.find(".jkit-container-header").on("click",this.headerClicked.bind(this)),this.$container.find(".jkit-header-action .tab-delete").on("click",this.deleteClicked.bind(this)),this.$container.find(".jkit-header-action .tab-edit").on("click",this.editClicked.bind(this)),this.$container.find(".jkit-header-action .tab-clone").on("click",this.cloneClicked.bind(this))},editClicked:function(t){t.stopPropagation()},cloneClicked:function(e){e.stopPropagation(),t(e.currentTarget).find("i").attr("class","
|
1 |
+
!function(t,e){"use strict";e.SingleSegment=e.noWrapSegment.extend({populateFields:function(){var t=this.prepareField(this.params.fields);this.setupField(this.id,t)},prepareField:function(t){var i=0,n=[];return _.each(t,function(o,a){var s=e.cloneObject(t[a]);n[a]=this.prepareFieldData(s,o,i++)}.bind(this)),e.helper.prioritySort(n)},prepareFieldData:function(t){var e=this.params.container;return t.container=this,t.fieldName=e.id+"["+t.fieldName+"]",t},listenFieldChange:function(t,e){this.params.container.listenSegmentChange(this.id,t,e)}}),e.MultiSegment=e.SingleSegment.extend({segmentType:"multi",segmentContentParent:".jkit-condition-content",ready:function(){this.activateSegment()},prepareFieldData:function(t){var e=this.params.index,i=this.params.container;return t.container=this,t.fieldName=i.id+"["+e+"]["+t.fieldName+"]",t},getParentContainer:function(){return this.params.container.container.find(".jkit-condition-wrapper")},attachEvent:function(){this.element.find(".jkit-condition-header").on("click",this.activateSegment.bind(this)),this.element.find(".tab-delete").on("click",this.removeSegment.bind(this))},activateSegment:function(){this.params.parentInstance.activateSegment(this.id)},toogleSegment:function(){setTimeout(function(){this.element.toggleClass("show").find(".jkit-condition-content").slideToggle("fast")}.bind(this),200)},closeSegment:function(){this.element.find(".jkit-condition-content").slideUp("fast")},removeSegment:function(t){t.stopPropagation(),this.element.remove(),this.params.parentInstance.removeSegment(this.id,this.params.index),void 0!==this.params.container.option.parent.saveValue&&this.params.container.option.parent.saveValue()}}),e.segmentConstructor.single=e.SingleSegment,e.segmentConstructor.multi=e.MultiSegment,e.SingleContainer=e.BaseContainer.extend({setContainerHolder:function(){this.containerHolder=this.option.parent.containerHolder},prepareSegmentData:function(t){return t.parent=this.id,t.container=this,t.fields=this.option.fields,t},populateSegments:function(){var t={[this.option.id]:{id:this.option.id,name:this.option.id,type:this.option.type}};t=this.prepareSegment(t),this.setupSegment(this.id,t)},prepareSegment:function(t){return _.each(t,function(i,n){var o=e.cloneObject(t[n]);t[n]=this.prepareSegmentData(o,i)}.bind(this)),e.helper.prioritySort(t)},getValues:function(){var t={};return this.segments(this.option.id).fields.each((function(e){t[e.id]=e.value.get()})),t},listenSegmentChange:function(t,e,i){void 0!==this.option.parent.listenContainerChange&&this.option.parent.listenContainerChange(t,e,i)}}),e.ConditionContainer=e.SingleContainer.extend({initialize:function(t,i,n){this.id=t,this.element=i,this.option=n,this.segments=new e.Values({defaultConstructor:e.Segment}),this.embeed(),this.setContainerHolder(),this.loadContainer()},populateSegments:function(){for(var t in this.option.fields){var e=this.createSegmentParam(t);e=this.prepareSegment(e),this.setupSegment(this.id,e)}},getValues:function(){var t=[];return this.segments.each((function(e){var i={};e.fields.each((function(t){i[t.id]=t.value.get()})),t.push(i)})),t},triggerFinish:function(){this.segments.each(function(t){this.segments(t.id).triggerLoaded()}.bind(this)),this.checkEmptySegment()},prepareSegmentData:function(t,e){return t.parent=this.id,t.container=this,t.parentInstance=this,void 0===this.option.fields?t.fields=this.option.default:t.fields=this.option.fields[e.index],t},activateSegment:function(t){this.segments.each((function(e){t===e.id&&e.toogleSegment()}))},removeSegment:function(t,e){this.segments.remove(t),this.checkEmptySegment()},checkEmptySegment:function(){this.getAllSegments().length?this.hideEmptyCondition():this.renderEmptySegment()},renderEmptySegment:function(){this.element.find(".jkit-condition-empty").show()},hideEmptyCondition:function(){this.element.find(".jkit-condition-empty").hide()},getAllSegments:function(){var t=[];return this.segments.each((function(e){t.push(e.id)})),t},attachEvent:function(){this.container.find(".jkit-condition-add button").on("click",this.buttonAddClicked.bind(this))},buttonAddClicked:function(){this.createMultiSegment(),void 0!==this.option.parent.saveValue&&this.option.parent.saveValue(),this.checkEmptySegment()},createMultiSegment:function(){var t=this.getNextSegmentIndex(),e=this.createSegmentParam(t),i=e.segment.id;(e=this.prepareSegment(e))[0].fields=this.option.default,this.setupSegment(this.id,e),this.segments(i).triggerLoaded(),this.segments(i).activateSegment()},getNextSegmentIndex:function(){var t=0,e=!1;return this.segments.each((function(i){t=i.params.index,e=!0})),e||0!==t?++t:t},createSegmentParam:function(t){var i=e.segmentName(this.option.id,t);return t=parseInt(t),{segment:{id:i,name:this.option.title+" "+(t+1),type:this.option.type,index:t}}},embeed:function(){this.container=t(this.renderContainer()),this.element.append(this.container)},renderContainer:function(){var t=wp.template("jkit-condition-container");return t?t({lang:JKitTemplateConfig.lang}):"<div></div>"}}),e.JKitOptionBuilder=e.Class.extend({initialize:function(t,i,n){this.id=t,this.options=e.cloneObject(i),this.$wrapper=n,this.createContainer()},createContainer:function(){this.containerHolder=new e.Values({defaultConstructor:e.BaseContainer}),_.each(this.options,function(t){t.parent=this,"single"===t.type?this.containerHolder.add(t.id,new e.SingleContainer(t.id,this.$wrapper,t)):this.containerHolder.add(t.id,new e.ConditionContainer(t.id,this.$wrapper,t))}.bind(this))},triggerFinish:function(){this.containerHolder.trigger(this.id,this)}}),e.JKitOptionWrapperBuilder=e.JKitOptionBuilder.extend({initialize:function(t,i,n,o){this.id=t,this.options=e.cloneObject(i),this.$wrapper=n,this.setting=o,this.timeout=null,this.loaded=!1,this.embeed(),this.attachEvent(),Notiflix.Notify.init({position:"right-top",zindex:999999,showOnlyTheLastOne:!0,success:{notiflixIconColor:"#fff"}})},attachEvent:function(){this.$container.find(".jkit-container-header").on("click",this.headerClicked.bind(this)),this.$container.find(".jkit-header-action .tab-delete").on("click",this.deleteClicked.bind(this)),this.$container.find(".jkit-header-action .tab-edit").on("click",this.editClicked.bind(this)),this.$container.find(".jkit-header-action .tab-clone").on("click",this.cloneClicked.bind(this))},editClicked:function(t){t.stopPropagation()},cloneClicked:function(e){e.stopPropagation(),t(e.currentTarget).find("i").attr("class","fas fa-circle-notch fa-spin"),wp.ajax.send("jkit_clone_element",{data:{id:this.id,nonce:JKitTemplateConfig.nonce,type:JKitTemplateConfig.type,page:JKitTemplateConfig.page}}).done(function(t){window.ampdashboard.reRenderWrapper(t)}.bind(this))},deleteClicked:function(i){i.stopPropagation(),confirm(JKitTemplateConfig.lang.deleteelement)&&(t(i.currentTarget).find("i").attr("class","fas fa-circle-notch fa-spin"),wp.ajax.send("jkit_delete_element",{data:{id:this.id,nonce:JKitTemplateConfig.nonce}}).done(function(){this.$container.remove(),e.builderholder.remove(this.id),e.refreshPriority()}.bind(this)))},headerClicked:function(){this.loaded||(this.requestDetail(),this.loaded=!0),this.$container.siblings().each((function(){t(this).removeClass("show").find(".jkit-container-body").slideUp("fast")})),this.$container.toggleClass("show").find(".jkit-container-body").slideToggle("fast")},requestDetail:function(){wp.ajax.send("jkit_detail_element",{data:{id:this.id,nonce:JKitTemplateConfig.nonce,page:JKitTemplateConfig.page}}).done(function(t){this.$container.find(".jkit-container-body").html(""),this.createContainer(t),this.triggerFinish()}.bind(this))},embeed:function(){this.$container=t(this.renderContainer()),this.$wrapper.append(this.$container)},renderContainer:function(){var t=wp.template("jkit-element-container");return t?t({id:this.id,title:this.setting.title,url:this.setting.url,lang:JKitTemplateConfig.lang}):t},createContainer:function(t){this.containerHolder=new e.Values({defaultConstructor:e.BaseContainer});var i=this.$container.find(".jkit-container-body");_.each(this.options,function(n){n.parent=this,n.fields=t[n.id],"single"===n.type?this.containerHolder.add(n.id,new e.SingleContainer(n.id,i,n)):this.containerHolder.add(n.id,new e.ConditionContainer(n.id,i,n))}.bind(this))},listenContainerChange:function(t,e,i){"option"===t&&"title"===e&&this.$container.find(".jkit-container-header h3 span").text(i),this.saveValue()},getValues:function(){var t={};return this.containerHolder.each((function(e){t[e.id]=e.getValues()})),t},saveValue:function(){clearTimeout(this.timeout),this.timeout=setTimeout(function(){wp.ajax.send("jkit_update_element",{data:{id:this.id,data:this.getValues(),nonce:JKitTemplateConfig.nonce}}).done((function(){Notiflix.Notify.success(JKitTemplateConfig.success)}))}.bind(this),500)}})}(jQuery,wp.customize);
|
assets/js/dashboard/dashboard.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(
|
1 |
+
!function(a){"use strict";window.jkitdashboard=window.jkitdashboard||{},window.jkitdashboard={init:function(n){var t=this;t.xhr=null,t.container=void 0===n?a("body"):n,Notiflix.Notify.init({position:"right-top",zindex:999999,showOnlyTheLastOne:!0,success:{notiflixIconColor:"#fff"}}),t.button_save=t.container.find(".jkit-dashboard-body-wrap .jkit-form-submit>button"),t.form_handler(),t.elements(),t.admin_menu()},admin_menu:function(){this.container.find(".jkit-support-menu a, .jkit-review-menu a").attr("target","_blank")},form_handler:function(){var n=this,t="undefined"!=typeof jkit_custom_dashboard_form_id&&jkit_custom_dashboard_form_id.name?"#"+jkit_custom_dashboard_form_id.name:"#jkit-user-data-form, #jkit-settings-form, #jkit-notfound-form",e=n.container.find(t);e.find(".jkit-form-content").on("click",(function(n){n.preventDefault();var t=a(this).parents(".jkit-form-tab ");t.hasClass("collapse")?t.removeClass("collapse"):t.addClass("collapse")})),e.on("submit",(function(t){t.preventDefault();var e=a(this).attr("id"),i={},s="",o="",d="",r=/\[([^\]]+)\]/;"jkit-user-data-form"===e?s="save_user_data":"jkit-settings-form"===e?s="save_settings":"jkit-notfound-form"===e?s="save_notfound":"undefined"!=typeof jkit_custom_dashboard_form_id&&jkit_custom_dashboard_form_id.name===e&&(s="save_"+jkit_custom_dashboard_form_id.name),a(this).find("input, select").each((function(n){o=r.exec(a(this).attr("name")),d=a(this).val(),i[o[1]]=d})),n.button_save.addClass("saving"),n.button_save.find("i").removeClass("fa-save").addClass("fa-spinner fa-spin"),a.ajax({type:"POST",url:"undefined"!=typeof jkit_custom_ajax_url?jkit_custom_ajax_url:jkit_ajax_url,data:{form_data:i,action:s,nonce:jkit_nonce},dataType:"json",encode:!0}).done((function(a){Notiflix.Notify.success(a.message),n.button_save.removeClass("saving"),n.button_save.find("i").removeClass("fa-spinner fa-spin").addClass("fa-save")})).fail((function(){Notiflix.Notify.failure(jkit_dashboard_localize.save_failed),n.button_save.removeClass("saving"),n.button_save.find("i").removeClass("fa-spinner fa-spin").addClass("fa-save")}))}))},elements:function(){var n=this,t=n.container.find(".element-checkbox-option .switch"),e=n.container.find(".jkit-button.enable-all"),i=n.container.find(".jkit-button.disable-all"),s=n.container.find("#jkit-elements-enable-form");t.on("click",(function(n){n.preventDefault();var t=a(this).prev("input");t.is(":checked")?t.prop("checked",!1):t.prop("checked",!0)})),e.on("click",(function(a){a.preventDefault(),t.prev("input").prop("checked",!0)})),i.on("click",(function(a){a.preventDefault(),t.prev("input").prop("checked",!1)})),s.on("submit",(function(e){e.preventDefault();var i={};n.button_save.addClass("saving"),n.button_save.find("i").removeClass("fa-save").addClass("fa-spinner fa-spin"),t.each((function(n,t){var e=a(t).prev("input"),s=e.data("element-key");i[s]=e.is(":checked")})),a.ajax({type:"POST",url:jkit_ajax_url,data:{form_data:i,action:"save_elements_enable",nonce:jkit_nonce},dataType:"json",encode:!0}).done((function(a){Notiflix.Notify.success(a.message),n.button_save.removeClass("saving"),n.button_save.find("i").removeClass("fa-spinner fa-spin").addClass("fa-save")})).fail((function(){Notiflix.Notify.failure(jkit_dashboard_localize.save_failed),n.button_save.removeClass("saving"),n.button_save.find("i").removeClass("fa-spinner fa-spin").addClass("fa-save")}))}))}},a(document).on("ready",(function(){window.jkitdashboard.init()}))}(jQuery);
|
class/ajax/class-ajax.php
CHANGED
@@ -68,19 +68,23 @@ class Ajax {
|
|
68 |
* Setup Hooks
|
69 |
*/
|
70 |
private function setup_hook() {
|
71 |
-
add_action( 'parse_request', array( $this, '
|
72 |
add_filter( 'query_vars', array( $this, 'ajax_query_vars' ) );
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
add_action( 'wp_ajax_jkit_update_sequence', array( $this, 'update_sequence' ) );
|
77 |
-
add_action( 'wp_ajax_jkit_clone_element', array( $this, 'clone_element' ) );
|
78 |
-
add_action( 'wp_ajax_jkit_detail_element', array( $this, 'detail_element' ) );
|
79 |
-
add_action( 'wp_ajax_jkit_update_element', array( $this, 'update_element' ) );
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
|
86 |
/**
|
@@ -101,7 +105,7 @@ class Ajax {
|
|
101 |
*
|
102 |
* @param WP $wp Current WordPress environment instance (passed by reference).
|
103 |
*/
|
104 |
-
public function
|
105 |
if ( array_key_exists( $this->endpoint, $wp->query_vars ) ) {
|
106 |
add_filter( 'wp_doing_ajax', array( $this, 'is_doing_ajax' ) );
|
107 |
|
@@ -113,7 +117,22 @@ class Ajax {
|
|
113 |
$this->element_ajax( $element_name );
|
114 |
}
|
115 |
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
if ( 'save_user_data' === $action ) {
|
118 |
// @codingStandardsIgnoreStart sanitize value using jeg_sanitize_array
|
119 |
$this->save_user_data( jeg_sanitize_array( wp_unslash( $_POST['form_data'] ) ) );
|
@@ -225,13 +244,50 @@ class Ajax {
|
|
225 |
* @param array $data User data.
|
226 |
*/
|
227 |
public function save_user_data( $data ) {
|
228 |
-
$
|
229 |
-
|
230 |
-
'
|
231 |
-
|
232 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
|
234 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
}
|
236 |
|
237 |
/**
|
@@ -260,7 +316,7 @@ class Ajax {
|
|
260 |
* Find Taxonomy
|
261 |
*/
|
262 |
public function find_taxonomy() {
|
263 |
-
if ( $this->is_nonce_valid() ) {
|
264 |
$result = array();
|
265 |
$query = sanitize_text_field( wp_unslash( $_POST['query'] ) );
|
266 |
$slug = isset( $_POST['slug'] ) ? sanitize_text_field( wp_unslash( $_POST['slug'] ) ) : '';
|
@@ -301,7 +357,7 @@ class Ajax {
|
|
301 |
* Find all post type
|
302 |
*/
|
303 |
public function find_posts() {
|
304 |
-
if ( $this->is_nonce_valid() ) {
|
305 |
$query = sanitize_text_field( wp_unslash( $_REQUEST['query'] ) );
|
306 |
|
307 |
add_filter(
|
@@ -353,7 +409,7 @@ class Ajax {
|
|
353 |
* Find Author
|
354 |
*/
|
355 |
public function find_author() {
|
356 |
-
if ( $this->is_nonce_valid() ) {
|
357 |
$values = '';
|
358 |
|
359 |
if ( isset( $_POST['value'] ) && $_POST['value'] ) {
|
@@ -370,15 +426,15 @@ class Ajax {
|
|
370 |
*
|
371 |
* @return bool
|
372 |
*/
|
373 |
-
public function is_nonce_valid() {
|
374 |
-
return isset( $_POST['action'], $_POST['nonce'] ) && wp_verify_nonce( sanitize_key( $_POST['nonce'] ), jkit_get_nonce_identifier() );
|
375 |
}
|
376 |
|
377 |
/**
|
378 |
* Clone
|
379 |
*/
|
380 |
public function clone_element() {
|
381 |
-
if ( $this->is_nonce_valid() ) {
|
382 |
$data = jeg_sanitize_array( $_POST );
|
383 |
$post_id = $this->duplicate_element( $data['id'] );
|
384 |
|
@@ -443,7 +499,7 @@ class Ajax {
|
|
443 |
* Create Element
|
444 |
*/
|
445 |
public function create_element() {
|
446 |
-
if ( $this->is_nonce_valid() ) {
|
447 |
$post_type = sanitize_key( $_POST['type'] );
|
448 |
$published = jkit_get_element_data( $post_type )['publish'];
|
449 |
$keys = jkit_extract_ids( $published );
|
@@ -485,7 +541,7 @@ class Ajax {
|
|
485 |
* Detail Element
|
486 |
*/
|
487 |
public function detail_element() {
|
488 |
-
if ( $this->is_nonce_valid() ) {
|
489 |
$data = jeg_sanitize_array( $_POST );
|
490 |
$result = $this->get_fields( $data['id'], $data['page'] );
|
491 |
wp_send_json_success( $result );
|
@@ -552,7 +608,7 @@ class Ajax {
|
|
552 |
* Update Element
|
553 |
*/
|
554 |
public function update_element() {
|
555 |
-
if ( $this->is_nonce_valid() ) {
|
556 |
$data = jeg_sanitize_array( $_POST )['data'];
|
557 |
$condition = isset( $data['condition'] ) ? $data['condition'] : '';
|
558 |
$post_id = sanitize_post_field( 'post_id', $_POST['id'], $_POST['id'] );
|
@@ -573,7 +629,7 @@ class Ajax {
|
|
573 |
* Delete Element
|
574 |
*/
|
575 |
public function delete_element() {
|
576 |
-
if ( $this->is_nonce_valid() ) {
|
577 |
$data = jeg_sanitize_array( $_POST );
|
578 |
wp_delete_post( $data['id'], true );
|
579 |
wp_send_json_success( $data );
|
@@ -585,7 +641,7 @@ class Ajax {
|
|
585 |
* Update Sequence
|
586 |
*/
|
587 |
public function update_sequence() {
|
588 |
-
if ( $this->is_nonce_valid() ) {
|
589 |
$data = jeg_sanitize_array( $_POST );
|
590 |
|
591 |
if ( isset( $data['publish'] ) && count( $data['publish'] ) ) {
|
68 |
* Setup Hooks
|
69 |
*/
|
70 |
private function setup_hook() {
|
71 |
+
add_action( 'parse_request', array( $this, 'element_ajax_parse_request' ) );
|
72 |
add_filter( 'query_vars', array( $this, 'ajax_query_vars' ) );
|
73 |
|
74 |
+
if ( current_user_can( 'edit_theme_options' ) ) {
|
75 |
+
add_action( 'parse_request', array( $this, 'admin_ajax_parse_request' ) );
|
|
|
|
|
|
|
|
|
76 |
|
77 |
+
add_action( 'wp_ajax_jkit_create_element', array( $this, 'create_element' ) );
|
78 |
+
add_action( 'wp_ajax_jkit_delete_element', array( $this, 'delete_element' ) );
|
79 |
+
add_action( 'wp_ajax_jkit_update_sequence', array( $this, 'update_sequence' ) );
|
80 |
+
add_action( 'wp_ajax_jkit_clone_element', array( $this, 'clone_element' ) );
|
81 |
+
add_action( 'wp_ajax_jkit_detail_element', array( $this, 'detail_element' ) );
|
82 |
+
add_action( 'wp_ajax_jkit_update_element', array( $this, 'update_element' ) );
|
83 |
+
|
84 |
+
add_action( 'wp_ajax_jkit_find_taxonomy', array( $this, 'find_taxonomy' ) );
|
85 |
+
add_action( 'wp_ajax_jkit_find_author', array( $this, 'find_author' ) );
|
86 |
+
add_action( 'wp_ajax_jkit_find_posts_object', array( $this, 'find_posts' ) );
|
87 |
+
}
|
88 |
}
|
89 |
|
90 |
/**
|
105 |
*
|
106 |
* @param WP $wp Current WordPress environment instance (passed by reference).
|
107 |
*/
|
108 |
+
public function element_ajax_parse_request( $wp ) {
|
109 |
if ( array_key_exists( $this->endpoint, $wp->query_vars ) ) {
|
110 |
add_filter( 'wp_doing_ajax', array( $this, 'is_doing_ajax' ) );
|
111 |
|
117 |
$this->element_ajax( $element_name );
|
118 |
}
|
119 |
|
120 |
+
do_action( 'jkit_elements_ajax_' . $action );
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Parse ajax request handler
|
126 |
+
*
|
127 |
+
* @param WP $wp Current WordPress environment instance (passed by reference).
|
128 |
+
*/
|
129 |
+
public function admin_ajax_parse_request( $wp ) {
|
130 |
+
if ( array_key_exists( $this->endpoint, $wp->query_vars ) ) {
|
131 |
+
add_filter( 'wp_doing_ajax', array( $this, 'is_doing_ajax' ) );
|
132 |
+
|
133 |
+
$action = $wp->query_vars['action'];
|
134 |
+
|
135 |
+
if ( isset( $_POST['form_data'], $_POST['nonce'] ) && wp_verify_nonce( sanitize_key( $_POST['nonce'] ), jkit_get_nonce_identifier( 'dashboard' ) ) ) {
|
136 |
if ( 'save_user_data' === $action ) {
|
137 |
// @codingStandardsIgnoreStart sanitize value using jeg_sanitize_array
|
138 |
$this->save_user_data( jeg_sanitize_array( wp_unslash( $_POST['form_data'] ) ) );
|
244 |
* @param array $data User data.
|
245 |
*/
|
246 |
public function save_user_data( $data ) {
|
247 |
+
if ( isset( $data['mailchimp_api_key'] ) ) {
|
248 |
+
$save = array(
|
249 |
+
'mailchimp' => array(
|
250 |
+
'api_key' => $data['mailchimp_api_key'],
|
251 |
+
),
|
252 |
+
);
|
253 |
+
|
254 |
+
$split = explode( '-', $data['mailchimp_api_key'] );
|
255 |
+
|
256 |
+
if ( ! isset( $split[1] ) || empty( $split[1] ) || preg_match( '/^.*\..+$/', $split[1] ) ) {
|
257 |
+
wp_send_json(
|
258 |
+
array(
|
259 |
+
'message' => esc_html__( 'API Key is Invalid.', 'jeg-elementor-kit' ),
|
260 |
+
),
|
261 |
+
400
|
262 |
+
);
|
263 |
+
}
|
264 |
|
265 |
+
$dc = $split[1];
|
266 |
+
|
267 |
+
$response = wp_remote_request(
|
268 |
+
'https://' . $dc . '.api.mailchimp.com/3.0/?fields=account_id',
|
269 |
+
array(
|
270 |
+
'method' => 'GET',
|
271 |
+
'headers' =>
|
272 |
+
array(
|
273 |
+
'Authorization' => sprintf( 'Basic %s', base64_encode( 'mc4wp:' . $data['mailchimp_api_key'] ) ),
|
274 |
+
),
|
275 |
+
'timeout' => 30,
|
276 |
+
)
|
277 |
+
);
|
278 |
+
$mc_response = json_decode( wp_remote_retrieve_body( $response ) );
|
279 |
+
|
280 |
+
if ( is_object( $mc_response ) && property_exists( $mc_response, 'account_id' ) ) {
|
281 |
+
update_option( 'jkit_user_data', $save );
|
282 |
+
} else {
|
283 |
+
wp_send_json(
|
284 |
+
array(
|
285 |
+
'message' => $mc_response->detail,
|
286 |
+
),
|
287 |
+
$mc_response->status ? $mc_response->status : 400
|
288 |
+
);
|
289 |
+
}
|
290 |
+
}
|
291 |
}
|
292 |
|
293 |
/**
|
316 |
* Find Taxonomy
|
317 |
*/
|
318 |
public function find_taxonomy() {
|
319 |
+
if ( $this->is_nonce_valid( 'dashboard' ) ) {
|
320 |
$result = array();
|
321 |
$query = sanitize_text_field( wp_unslash( $_POST['query'] ) );
|
322 |
$slug = isset( $_POST['slug'] ) ? sanitize_text_field( wp_unslash( $_POST['slug'] ) ) : '';
|
357 |
* Find all post type
|
358 |
*/
|
359 |
public function find_posts() {
|
360 |
+
if ( $this->is_nonce_valid( 'dashboard' ) ) {
|
361 |
$query = sanitize_text_field( wp_unslash( $_REQUEST['query'] ) );
|
362 |
|
363 |
add_filter(
|
409 |
* Find Author
|
410 |
*/
|
411 |
public function find_author() {
|
412 |
+
if ( $this->is_nonce_valid( 'dashboard' ) ) {
|
413 |
$values = '';
|
414 |
|
415 |
if ( isset( $_POST['value'] ) && $_POST['value'] ) {
|
426 |
*
|
427 |
* @return bool
|
428 |
*/
|
429 |
+
public function is_nonce_valid( $slug = '' ) {
|
430 |
+
return isset( $_POST['action'], $_POST['nonce'] ) && wp_verify_nonce( sanitize_key( $_POST['nonce'] ), jkit_get_nonce_identifier( $slug ) );
|
431 |
}
|
432 |
|
433 |
/**
|
434 |
* Clone
|
435 |
*/
|
436 |
public function clone_element() {
|
437 |
+
if ( $this->is_nonce_valid( 'dashboard' ) ) {
|
438 |
$data = jeg_sanitize_array( $_POST );
|
439 |
$post_id = $this->duplicate_element( $data['id'] );
|
440 |
|
499 |
* Create Element
|
500 |
*/
|
501 |
public function create_element() {
|
502 |
+
if ( $this->is_nonce_valid( 'dashboard' ) ) {
|
503 |
$post_type = sanitize_key( $_POST['type'] );
|
504 |
$published = jkit_get_element_data( $post_type )['publish'];
|
505 |
$keys = jkit_extract_ids( $published );
|
541 |
* Detail Element
|
542 |
*/
|
543 |
public function detail_element() {
|
544 |
+
if ( $this->is_nonce_valid( 'dashboard' ) ) {
|
545 |
$data = jeg_sanitize_array( $_POST );
|
546 |
$result = $this->get_fields( $data['id'], $data['page'] );
|
547 |
wp_send_json_success( $result );
|
608 |
* Update Element
|
609 |
*/
|
610 |
public function update_element() {
|
611 |
+
if ( $this->is_nonce_valid( 'dashboard' ) ) {
|
612 |
$data = jeg_sanitize_array( $_POST )['data'];
|
613 |
$condition = isset( $data['condition'] ) ? $data['condition'] : '';
|
614 |
$post_id = sanitize_post_field( 'post_id', $_POST['id'], $_POST['id'] );
|
629 |
* Delete Element
|
630 |
*/
|
631 |
public function delete_element() {
|
632 |
+
if ( $this->is_nonce_valid( 'dashboard' ) ) {
|
633 |
$data = jeg_sanitize_array( $_POST );
|
634 |
wp_delete_post( $data['id'], true );
|
635 |
wp_send_json_success( $data );
|
641 |
* Update Sequence
|
642 |
*/
|
643 |
public function update_sequence() {
|
644 |
+
if ( $this->is_nonce_valid( 'dashboard' ) ) {
|
645 |
$data = jeg_sanitize_array( $_POST );
|
646 |
|
647 |
if ( isset( $data['publish'] ) && count( $data['publish'] ) ) {
|
class/dashboard/class-dashboard.php
CHANGED
@@ -108,8 +108,10 @@ class Dashboard {
|
|
108 |
* Module constructor.
|
109 |
*/
|
110 |
public function __construct() {
|
111 |
-
|
112 |
-
|
|
|
|
|
113 |
}
|
114 |
|
115 |
/**
|
@@ -488,7 +490,7 @@ class Dashboard {
|
|
488 |
if ( is_admin() ) {
|
489 |
$ajax_url = add_query_arg( array( $this->endpoint => 'jkit_user_data' ), esc_url( home_url( '/' ) ) );
|
490 |
|
491 |
-
return 'var jkit_ajax_url = "' . esc_url( $ajax_url ) . '", jkit_nonce = "' . jkit_create_global_nonce() . '";';
|
492 |
}
|
493 |
|
494 |
return null;
|
108 |
* Module constructor.
|
109 |
*/
|
110 |
public function __construct() {
|
111 |
+
if ( current_user_can( 'edit_theme_options' ) ) {
|
112 |
+
$this->setup_init();
|
113 |
+
$this->setup_hook();
|
114 |
+
}
|
115 |
}
|
116 |
|
117 |
/**
|
490 |
if ( is_admin() ) {
|
491 |
$ajax_url = add_query_arg( array( $this->endpoint => 'jkit_user_data' ), esc_url( home_url( '/' ) ) );
|
492 |
|
493 |
+
return 'var jkit_ajax_url = "' . esc_url( $ajax_url ) . '", jkit_nonce = "' . jkit_create_global_nonce( 'dashboard' ) . '";';
|
494 |
}
|
495 |
|
496 |
return null;
|
class/dashboard/template/class-template-dashboard-abstract.php
CHANGED
@@ -75,7 +75,7 @@ abstract class Template_Dashboard_Abstract {
|
|
75 |
'default' => $condition,
|
76 |
),
|
77 |
),
|
78 |
-
'nonce' => wp_create_nonce( jkit_get_nonce_identifier() ),
|
79 |
'ajax' => admin_url( 'admin-ajax.php' ),
|
80 |
'page' => $page,
|
81 |
'lang' => $this->language(),
|
@@ -183,7 +183,7 @@ abstract class Template_Dashboard_Abstract {
|
|
183 |
'title' => esc_html__( 'Archive Author', 'jeg-elementor-kit' ),
|
184 |
'description' => esc_html__( 'Write the author name to search.', 'jeg-elementor-kit' ),
|
185 |
'ajax' => 'jkit_find_author',
|
186 |
-
'nonce' => jkit_create_global_nonce(),
|
187 |
'options' => call_user_func(
|
188 |
function () use ( $value ) {
|
189 |
return static::get_user_options( $value );
|
@@ -210,7 +210,7 @@ abstract class Template_Dashboard_Abstract {
|
|
210 |
'title' => esc_html__( 'Archive Taxonomy', 'jeg-elementor-kit' ),
|
211 |
'description' => esc_html__( 'Write the terms name to search. Leave empty to select all terms.', 'jeg-elementor-kit' ),
|
212 |
'ajax' => 'jkit_find_taxonomy',
|
213 |
-
'nonce' => jkit_create_global_nonce(),
|
214 |
'options' => call_user_func(
|
215 |
function () use ( $value ) {
|
216 |
if ( isset( $value['archive_taxonomy'] ) && $value['archive_taxonomy'] ) {
|
@@ -281,7 +281,7 @@ abstract class Template_Dashboard_Abstract {
|
|
281 |
'title' => esc_html__( 'Include Post / Page', 'jeg-elementor-kit' ),
|
282 |
'description' => esc_html__( 'Write post or page name to search.', 'jeg-elementor-kit' ),
|
283 |
'ajax' => 'jkit_find_posts_object',
|
284 |
-
'nonce' => jkit_create_global_nonce(),
|
285 |
'options' => call_user_func(
|
286 |
function () use ( $value ) {
|
287 |
if ( isset( $value['singular_post'] ) && $value['singular_post'] ) {
|
@@ -310,7 +310,7 @@ abstract class Template_Dashboard_Abstract {
|
|
310 |
'title' => esc_html__( 'Terms Name', 'jeg-elementor-kit' ),
|
311 |
'description' => esc_html__( 'Write terms name (Ex: category name, tag name, etc) to search.', 'jeg-elementor-kit' ),
|
312 |
'ajax' => 'jkit_find_taxonomy',
|
313 |
-
'nonce' => jkit_create_global_nonce(),
|
314 |
'dependency' => array(
|
315 |
array(
|
316 |
'field' => 'location',
|
@@ -337,7 +337,7 @@ abstract class Template_Dashboard_Abstract {
|
|
337 |
'title' => esc_html__( 'Author Name', 'jeg-elementor-kit' ),
|
338 |
'description' => esc_html__( 'Write the author name to search.', 'jeg-elementor-kit' ),
|
339 |
'ajax' => 'jkit_find_author',
|
340 |
-
'nonce' => jkit_create_global_nonce(),
|
341 |
'options' => call_user_func(
|
342 |
function () use ( $value ) {
|
343 |
return static::get_user_options( $value );
|
75 |
'default' => $condition,
|
76 |
),
|
77 |
),
|
78 |
+
'nonce' => wp_create_nonce( jkit_get_nonce_identifier( 'dashboard' ) ),
|
79 |
'ajax' => admin_url( 'admin-ajax.php' ),
|
80 |
'page' => $page,
|
81 |
'lang' => $this->language(),
|
183 |
'title' => esc_html__( 'Archive Author', 'jeg-elementor-kit' ),
|
184 |
'description' => esc_html__( 'Write the author name to search.', 'jeg-elementor-kit' ),
|
185 |
'ajax' => 'jkit_find_author',
|
186 |
+
'nonce' => jkit_create_global_nonce( 'dashboard' ),
|
187 |
'options' => call_user_func(
|
188 |
function () use ( $value ) {
|
189 |
return static::get_user_options( $value );
|
210 |
'title' => esc_html__( 'Archive Taxonomy', 'jeg-elementor-kit' ),
|
211 |
'description' => esc_html__( 'Write the terms name to search. Leave empty to select all terms.', 'jeg-elementor-kit' ),
|
212 |
'ajax' => 'jkit_find_taxonomy',
|
213 |
+
'nonce' => jkit_create_global_nonce( 'dashboard' ),
|
214 |
'options' => call_user_func(
|
215 |
function () use ( $value ) {
|
216 |
if ( isset( $value['archive_taxonomy'] ) && $value['archive_taxonomy'] ) {
|
281 |
'title' => esc_html__( 'Include Post / Page', 'jeg-elementor-kit' ),
|
282 |
'description' => esc_html__( 'Write post or page name to search.', 'jeg-elementor-kit' ),
|
283 |
'ajax' => 'jkit_find_posts_object',
|
284 |
+
'nonce' => jkit_create_global_nonce( 'dashboard' ),
|
285 |
'options' => call_user_func(
|
286 |
function () use ( $value ) {
|
287 |
if ( isset( $value['singular_post'] ) && $value['singular_post'] ) {
|
310 |
'title' => esc_html__( 'Terms Name', 'jeg-elementor-kit' ),
|
311 |
'description' => esc_html__( 'Write terms name (Ex: category name, tag name, etc) to search.', 'jeg-elementor-kit' ),
|
312 |
'ajax' => 'jkit_find_taxonomy',
|
313 |
+
'nonce' => jkit_create_global_nonce( 'dashboard' ),
|
314 |
'dependency' => array(
|
315 |
array(
|
316 |
'field' => 'location',
|
337 |
'title' => esc_html__( 'Author Name', 'jeg-elementor-kit' ),
|
338 |
'description' => esc_html__( 'Write the author name to search.', 'jeg-elementor-kit' ),
|
339 |
'ajax' => 'jkit_find_author',
|
340 |
+
'nonce' => jkit_create_global_nonce( 'dashboard' ),
|
341 |
'options' => call_user_func(
|
342 |
function () use ( $value ) {
|
343 |
return static::get_user_options( $value );
|
class/elements/views/class-mailchimp-view.php
CHANGED
@@ -15,6 +15,24 @@ namespace Jeg\Elementor_Kit\Elements\Views;
|
|
15 |
* @package Jeg\Elementor_Kit\Elements\Views
|
16 |
*/
|
17 |
class Mailchimp_View extends View_Abstract {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
/**
|
19 |
* Build block content
|
20 |
*/
|
@@ -267,16 +285,14 @@ class Mailchimp_View extends View_Abstract {
|
|
267 |
* Ajax request handler
|
268 |
*/
|
269 |
public function ajax_request() {
|
270 |
-
$
|
|
|
271 |
// @codingStandardsIgnoreStart sanitize value using jeg_sanitize_array
|
272 |
$data = jeg_sanitize_array( $_REQUEST['data'] );
|
273 |
// @codingStandardsIgnoreEnd
|
274 |
-
$user_data = get_option( 'jkit_user_data' );
|
275 |
$check_admin = in_array( 'administrator', wp_get_current_user()->roles, true );
|
276 |
|
277 |
-
if (
|
278 |
-
$api_key = $user_data['mailchimp']['api_key'];
|
279 |
-
} else {
|
280 |
$error_message = esc_html__( 'Something went wrong', 'jeg-elementor-kit' );
|
281 |
|
282 |
if ( $check_admin ) {
|
@@ -293,9 +309,9 @@ class Mailchimp_View extends View_Abstract {
|
|
293 |
return;
|
294 |
}
|
295 |
|
296 |
-
$server = explode( '-', $
|
297 |
|
298 |
-
if ( ! isset( $server[1] ) || empty( $server[1] ) ) {
|
299 |
$error_message = esc_html__( 'Something went wrong', 'jeg-elementor-kit' );
|
300 |
|
301 |
if ( $check_admin ) {
|
@@ -331,7 +347,7 @@ class Mailchimp_View extends View_Abstract {
|
|
331 |
'data_format' => 'body',
|
332 |
'timeout' => 45,
|
333 |
'headers' => array(
|
334 |
-
'Authorization' => 'apikey ' . $
|
335 |
'Content-Type' => 'application/json; charset=utf-8',
|
336 |
),
|
337 |
'body' => wp_json_encode( $payload ),
|
15 |
* @package Jeg\Elementor_Kit\Elements\Views
|
16 |
*/
|
17 |
class Mailchimp_View extends View_Abstract {
|
18 |
+
/**
|
19 |
+
* Mailchimp API Key
|
20 |
+
*
|
21 |
+
* @var string $mailchimp_api_key
|
22 |
+
*/
|
23 |
+
private $mailchimp_api_key = '';
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Set Mailchimp API Key.
|
27 |
+
*/
|
28 |
+
private function set_mailchimp_api_key() {
|
29 |
+
$user_data = get_option( 'jkit_user_data', '' );
|
30 |
+
|
31 |
+
if ( is_array( $user_data ) && isset( $user_data['mailchimp']['api_key'] ) && ! empty( $user_data['mailchimp']['api_key'] ) ) {
|
32 |
+
$this->mailchimp_api_key = $user_data['mailchimp']['api_key'];
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
/**
|
37 |
* Build block content
|
38 |
*/
|
285 |
* Ajax request handler
|
286 |
*/
|
287 |
public function ajax_request() {
|
288 |
+
$this->set_mailchimp_api_key();
|
289 |
+
|
290 |
// @codingStandardsIgnoreStart sanitize value using jeg_sanitize_array
|
291 |
$data = jeg_sanitize_array( $_REQUEST['data'] );
|
292 |
// @codingStandardsIgnoreEnd
|
|
|
293 |
$check_admin = in_array( 'administrator', wp_get_current_user()->roles, true );
|
294 |
|
295 |
+
if ( empty( $this->mailchimp_api_key ) ) {
|
|
|
|
|
296 |
$error_message = esc_html__( 'Something went wrong', 'jeg-elementor-kit' );
|
297 |
|
298 |
if ( $check_admin ) {
|
309 |
return;
|
310 |
}
|
311 |
|
312 |
+
$server = explode( '-', $this->mailchimp_api_key );
|
313 |
|
314 |
+
if ( ! isset( $server[1] ) || empty( $server[1] ) || preg_match( '/^.*\..+$/', $server[1] ) ) {
|
315 |
$error_message = esc_html__( 'Something went wrong', 'jeg-elementor-kit' );
|
316 |
|
317 |
if ( $check_admin ) {
|
347 |
'data_format' => 'body',
|
348 |
'timeout' => 45,
|
349 |
'headers' => array(
|
350 |
+
'Authorization' => 'apikey ' . $this->mailchimp_api_key,
|
351 |
'Content-Type' => 'application/json; charset=utf-8',
|
352 |
),
|
353 |
'body' => wp_json_encode( $payload ),
|
helper.php
CHANGED
@@ -199,8 +199,12 @@ if ( ! function_exists( 'jkit_get_nonce_identifier' ) ) {
|
|
199 |
*
|
200 |
* @return string
|
201 |
*/
|
202 |
-
function jkit_get_nonce_identifier() {
|
203 |
-
|
|
|
|
|
|
|
|
|
204 |
}
|
205 |
}
|
206 |
|
@@ -210,8 +214,8 @@ if ( ! function_exists( 'jkit_create_global_nonce' ) ) {
|
|
210 |
*
|
211 |
* @return string
|
212 |
*/
|
213 |
-
function jkit_create_global_nonce() {
|
214 |
-
return wp_create_nonce( jkit_get_nonce_identifier() );
|
215 |
}
|
216 |
}
|
217 |
|
@@ -464,28 +468,6 @@ if ( ! function_exists( 'jkit_get_elementor_saved_template_option' ) ) {
|
|
464 |
}
|
465 |
}
|
466 |
|
467 |
-
if ( ! function_exists( 'jkit_get_nonce_identifier' ) ) {
|
468 |
-
/**
|
469 |
-
* Get nonce identifier
|
470 |
-
*
|
471 |
-
* @return string
|
472 |
-
*/
|
473 |
-
function jkit_get_nonce_identifier() {
|
474 |
-
return 'jkit-nonce';
|
475 |
-
}
|
476 |
-
}
|
477 |
-
|
478 |
-
if ( ! function_exists( 'jkit_create_global_nonce' ) ) {
|
479 |
-
/**
|
480 |
-
* Get nonce identifier
|
481 |
-
*
|
482 |
-
* @return string
|
483 |
-
*/
|
484 |
-
function jkit_create_global_nonce() {
|
485 |
-
return wp_create_nonce( jkit_get_nonce_identifier() );
|
486 |
-
}
|
487 |
-
}
|
488 |
-
|
489 |
if ( ! function_exists( 'jkit_get_responsive_breakpoints' ) ) {
|
490 |
/**
|
491 |
* Get Elementor responsive breakpoints
|
199 |
*
|
200 |
* @return string
|
201 |
*/
|
202 |
+
function jkit_get_nonce_identifier( $slug = '' ) {
|
203 |
+
if ( ! is_null( $slug ) ) {
|
204 |
+
$slug = '-' . $slug;
|
205 |
+
}
|
206 |
+
|
207 |
+
return 'jkit-nonce' . $slug;
|
208 |
}
|
209 |
}
|
210 |
|
214 |
*
|
215 |
* @return string
|
216 |
*/
|
217 |
+
function jkit_create_global_nonce( $slug = '' ) {
|
218 |
+
return wp_create_nonce( jkit_get_nonce_identifier( $slug ) );
|
219 |
}
|
220 |
}
|
221 |
|
468 |
}
|
469 |
}
|
470 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
471 |
if ( ! function_exists( 'jkit_get_responsive_breakpoints' ) ) {
|
472 |
/**
|
473 |
* Get Elementor responsive breakpoints
|
jeg-elementor-kit.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Jeg Elementor Kit
|
4 |
* Plugin URI: http://jegtheme.com/
|
5 |
* Description: Additional highly customizable widgets for Elementor page builder
|
6 |
-
* Version: 2.5.
|
7 |
* Author: Jegstudio
|
8 |
* Author URI: http://jegtheme.com
|
9 |
* License: GPLv3
|
@@ -25,7 +25,7 @@ add_action(
|
|
25 |
function() {
|
26 |
defined( 'JEG_ELEMENTOR_KIT' ) || define( 'JEG_ELEMENTOR_KIT', 'jeg-elementor-kit' );
|
27 |
defined( 'JEG_ELEMENTOR_KIT_NAME' ) || define( 'JEG_ELEMENTOR_KIT_NAME', 'Jeg Elementor Kit' );
|
28 |
-
defined( 'JEG_ELEMENTOR_KIT_VERSION' ) || define( 'JEG_ELEMENTOR_KIT_VERSION', '2.5.
|
29 |
defined( 'JEG_ELEMENTOR_KIT_URL' ) || define( 'JEG_ELEMENTOR_KIT_URL', plugins_url( JEG_ELEMENTOR_KIT ) );
|
30 |
defined( 'JEG_ELEMENTOR_KIT_FILE' ) || define( 'JEG_ELEMENTOR_KIT_FILE', __FILE__ );
|
31 |
defined( 'JEG_ELEMENTOR_KIT_BASE' ) || define( 'JEG_ELEMENTOR_KIT_BASE', plugin_basename( __FILE__ ) );
|
3 |
* Plugin Name: Jeg Elementor Kit
|
4 |
* Plugin URI: http://jegtheme.com/
|
5 |
* Description: Additional highly customizable widgets for Elementor page builder
|
6 |
+
* Version: 2.5.7
|
7 |
* Author: Jegstudio
|
8 |
* Author URI: http://jegtheme.com
|
9 |
* License: GPLv3
|
25 |
function() {
|
26 |
defined( 'JEG_ELEMENTOR_KIT' ) || define( 'JEG_ELEMENTOR_KIT', 'jeg-elementor-kit' );
|
27 |
defined( 'JEG_ELEMENTOR_KIT_NAME' ) || define( 'JEG_ELEMENTOR_KIT_NAME', 'Jeg Elementor Kit' );
|
28 |
+
defined( 'JEG_ELEMENTOR_KIT_VERSION' ) || define( 'JEG_ELEMENTOR_KIT_VERSION', '2.5.7' );
|
29 |
defined( 'JEG_ELEMENTOR_KIT_URL' ) || define( 'JEG_ELEMENTOR_KIT_URL', plugins_url( JEG_ELEMENTOR_KIT ) );
|
30 |
defined( 'JEG_ELEMENTOR_KIT_FILE' ) || define( 'JEG_ELEMENTOR_KIT_FILE', __FILE__ );
|
31 |
defined( 'JEG_ELEMENTOR_KIT_BASE' ) || define( 'JEG_ELEMENTOR_KIT_BASE', plugin_basename( __FILE__ ) );
|
languages/jeg-elementor-kit.pot
CHANGED
@@ -23,11 +23,11 @@ msgstr ""
|
|
23 |
msgid "%s ago"
|
24 |
msgstr ""
|
25 |
|
26 |
-
#: jeg-elementor-kit/helper.php:
|
27 |
msgid "Need Help?"
|
28 |
msgstr ""
|
29 |
|
30 |
-
#: jeg-elementor-kit/helper.php:
|
31 |
msgid "Rate Us"
|
32 |
msgstr ""
|
33 |
|
@@ -35,11 +35,15 @@ msgstr ""
|
|
35 |
msgid "It is recommended that you backup your site before updating the plugin so rollback is possible whenever needed."
|
36 |
msgstr ""
|
37 |
|
38 |
-
#: jeg-elementor-kit/class/ajax/class-ajax.php:
|
39 |
msgid "Success Save Data"
|
40 |
msgstr ""
|
41 |
|
42 |
-
#: jeg-elementor-kit/class/ajax/class-ajax.php:
|
|
|
|
|
|
|
|
|
43 |
msgid "Clone"
|
44 |
msgstr ""
|
45 |
|
@@ -47,67 +51,67 @@ msgstr ""
|
|
47 |
msgid "JKit - Icons"
|
48 |
msgstr ""
|
49 |
|
50 |
-
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:
|
51 |
msgid "Settings"
|
52 |
msgstr ""
|
53 |
|
54 |
-
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:
|
55 |
msgid "User Data"
|
56 |
msgstr ""
|
57 |
|
58 |
-
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:
|
59 |
msgid "Elements"
|
60 |
msgstr ""
|
61 |
|
62 |
-
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:
|
63 |
msgid "Templates"
|
64 |
msgstr ""
|
65 |
|
66 |
-
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:
|
67 |
msgid "Header"
|
68 |
msgstr ""
|
69 |
|
70 |
-
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:
|
71 |
msgid "Footer"
|
72 |
msgstr ""
|
73 |
|
74 |
-
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:
|
75 |
msgid "Not Found 404"
|
76 |
msgstr ""
|
77 |
|
78 |
-
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:
|
79 |
msgid "Jeg Elementor Kit"
|
80 |
msgstr ""
|
81 |
|
82 |
-
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:
|
83 |
msgid "Something went wrong"
|
84 |
msgstr ""
|
85 |
|
86 |
-
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:
|
87 |
msgid "Save Failed"
|
88 |
msgstr ""
|
89 |
|
90 |
-
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:
|
91 |
msgid "Delete"
|
92 |
msgstr ""
|
93 |
|
94 |
-
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:
|
95 |
msgid "Setup Condition"
|
96 |
msgstr ""
|
97 |
|
98 |
-
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:
|
99 |
msgid "Modify"
|
100 |
msgstr ""
|
101 |
|
102 |
-
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:
|
103 |
msgid "Hello <b>%1$s</b>, thank you for using <a href=\"%2$s\" target=\"_blank\">Jeg Elementor Kit</a> v%4$s. Please take a second to <a href=\"%3$s\" target=\"_blank\"> leave us a <span>★★★★★</span> rating</a>. We'd really appreciate your support!"
|
104 |
msgstr ""
|
105 |
|
106 |
-
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:
|
107 |
msgid "Our Website"
|
108 |
msgstr ""
|
109 |
|
110 |
-
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:
|
111 |
msgid "Support Forum"
|
112 |
msgstr ""
|
113 |
|
@@ -4835,15 +4839,15 @@ msgstr ""
|
|
4835 |
msgid "Your page will be redirected on frontend"
|
4836 |
msgstr ""
|
4837 |
|
4838 |
-
#: jeg-elementor-kit/class/elements/views/class-mailchimp-view.php:
|
4839 |
msgid "Please set API Key into dashboard user data."
|
4840 |
msgstr ""
|
4841 |
|
4842 |
-
#: jeg-elementor-kit/class/elements/views/class-mailchimp-view.php:
|
4843 |
msgid "Please make sure your API Key is correct in dashboard user data."
|
4844 |
msgstr ""
|
4845 |
|
4846 |
-
#: jeg-elementor-kit/class/elements/views/class-mailchimp-view.php:
|
4847 |
msgid "Something went wrong: "
|
4848 |
msgstr ""
|
4849 |
|
23 |
msgid "%s ago"
|
24 |
msgstr ""
|
25 |
|
26 |
+
#: jeg-elementor-kit/helper.php:859, jeg-elementor-kit/class/dashboard/class-dashboard.php:315, jeg-elementor-kit/class/dashboard/class-dashboard.php:316, jeg-elementor-kit/templates/banner/notice-banner.php:21
|
27 |
msgid "Need Help?"
|
28 |
msgstr ""
|
29 |
|
30 |
+
#: jeg-elementor-kit/helper.php:860, jeg-elementor-kit/class/dashboard/class-dashboard.php:325, jeg-elementor-kit/class/dashboard/class-dashboard.php:326
|
31 |
msgid "Rate Us"
|
32 |
msgstr ""
|
33 |
|
35 |
msgid "It is recommended that you backup your site before updating the plugin so rollback is possible whenever needed."
|
36 |
msgstr ""
|
37 |
|
38 |
+
#: jeg-elementor-kit/class/ajax/class-ajax.php:171, jeg-elementor-kit/class/ajax/class-ajax.php:162, jeg-elementor-kit/class/ajax/class-ajax.php:152, jeg-elementor-kit/class/ajax/class-ajax.php:142, jeg-elementor-kit/class/dashboard/template/class-template-dashboard-abstract.php:82
|
39 |
msgid "Success Save Data"
|
40 |
msgstr ""
|
41 |
|
42 |
+
#: jeg-elementor-kit/class/ajax/class-ajax.php:259
|
43 |
+
msgid "API Key is Invalid."
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: jeg-elementor-kit/class/ajax/class-ajax.php:478, jeg-elementor-kit/class/dashboard/class-dashboard.php:630, jeg-elementor-kit/class/dashboard/template/class-template-dashboard-abstract.php:497
|
47 |
msgid "Clone"
|
48 |
msgstr ""
|
49 |
|
51 |
msgid "JKit - Icons"
|
52 |
msgstr ""
|
53 |
|
54 |
+
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:248, jeg-elementor-kit/class/dashboard/class-dashboard.php:249
|
55 |
msgid "Settings"
|
56 |
msgstr ""
|
57 |
|
58 |
+
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:257, jeg-elementor-kit/class/dashboard/class-dashboard.php:258
|
59 |
msgid "User Data"
|
60 |
msgstr ""
|
61 |
|
62 |
+
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:266, jeg-elementor-kit/class/dashboard/class-dashboard.php:267
|
63 |
msgid "Elements"
|
64 |
msgstr ""
|
65 |
|
66 |
+
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:275, jeg-elementor-kit/class/dashboard/class-dashboard.php:276
|
67 |
msgid "Templates"
|
68 |
msgstr ""
|
69 |
|
70 |
+
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:285, jeg-elementor-kit/class/dashboard/class-dashboard.php:286
|
71 |
msgid "Header"
|
72 |
msgstr ""
|
73 |
|
74 |
+
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:295, jeg-elementor-kit/class/dashboard/class-dashboard.php:296
|
75 |
msgid "Footer"
|
76 |
msgstr ""
|
77 |
|
78 |
+
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:305, jeg-elementor-kit/class/dashboard/class-dashboard.php:306
|
79 |
msgid "Not Found 404"
|
80 |
msgstr ""
|
81 |
|
82 |
+
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:344, jeg-elementor-kit/class/dashboard/class-dashboard.php:345, jeg-elementor-kit/class/elements/options/class-accordion-option.php:57, jeg-elementor-kit/class/elements/options/class-animated-text-option.php:57, jeg-elementor-kit/class/elements/options/class-banner-option.php:57, jeg-elementor-kit/class/elements/options/class-button-option.php:57, jeg-elementor-kit/class/elements/options/class-category-list-option.php:71, jeg-elementor-kit/class/elements/options/class-client-logo-option.php:57, jeg-elementor-kit/class/elements/options/class-contact-form-7-option.php:57, jeg-elementor-kit/class/elements/options/class-countdown-option.php:57, jeg-elementor-kit/class/elements/options/class-dual-button-option.php:57, jeg-elementor-kit/class/elements/options/class-feature-list-option.php:57, jeg-elementor-kit/class/elements/options/class-fun-fact-option.php:57, jeg-elementor-kit/class/elements/options/class-gallery-option.php:57, jeg-elementor-kit/class/elements/options/class-heading-option.php:57, jeg-elementor-kit/class/elements/options/class-icon-box-option.php:57, jeg-elementor-kit/class/elements/options/class-image-box-option.php:57, jeg-elementor-kit/class/elements/options/class-mailchimp-option.php:57, jeg-elementor-kit/class/elements/options/class-nav-menu-option.php:57, jeg-elementor-kit/class/elements/options/class-off-canvas-option.php:57, jeg-elementor-kit/class/elements/options/class-option-abstract.php:92, jeg-elementor-kit/class/elements/options/class-pie-chart-option.php:57, jeg-elementor-kit/class/elements/options/class-portfolio-gallery-option.php:57, jeg-elementor-kit/class/elements/options/class-post-block-option.php:71, jeg-elementor-kit/class/elements/options/class-post-list-option.php:71, jeg-elementor-kit/class/elements/options/class-product-carousel-option.php:70, jeg-elementor-kit/class/elements/options/class-product-categories-option.php:70, jeg-elementor-kit/class/elements/options/class-product-grid-option.php:63, jeg-elementor-kit/class/elements/options/class-progress-bar-option.php:57, jeg-elementor-kit/class/elements/options/class-search-option.php:57, jeg-elementor-kit/class/elements/options/class-social-share-option.php:57, jeg-elementor-kit/class/elements/options/class-tabs-option.php:57, jeg-elementor-kit/class/elements/options/class-team-option.php:57, jeg-elementor-kit/class/elements/options/class-testimonials-option.php:57, jeg-elementor-kit/class/elements/options/class-video-button-option.php:57
|
83 |
msgid "Jeg Elementor Kit"
|
84 |
msgstr ""
|
85 |
|
86 |
+
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:522, jeg-elementor-kit/class/elements/views/class-mailchimp-view.php:47, jeg-elementor-kit/class/elements/views/class-mailchimp-view.php:296, jeg-elementor-kit/class/elements/views/class-mailchimp-view.php:315
|
87 |
msgid "Something went wrong"
|
88 |
msgstr ""
|
89 |
|
90 |
+
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:523
|
91 |
msgid "Save Failed"
|
92 |
msgstr ""
|
93 |
|
94 |
+
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:588, jeg-elementor-kit/class/dashboard/class-dashboard.php:627, jeg-elementor-kit/class/dashboard/template/class-template-dashboard-abstract.php:498
|
95 |
msgid "Delete"
|
96 |
msgstr ""
|
97 |
|
98 |
+
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:625
|
99 |
msgid "Setup Condition"
|
100 |
msgstr ""
|
101 |
|
102 |
+
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:633
|
103 |
msgid "Modify"
|
104 |
msgstr ""
|
105 |
|
106 |
+
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:668
|
107 |
msgid "Hello <b>%1$s</b>, thank you for using <a href=\"%2$s\" target=\"_blank\">Jeg Elementor Kit</a> v%4$s. Please take a second to <a href=\"%3$s\" target=\"_blank\"> leave us a <span>★★★★★</span> rating</a>. We'd really appreciate your support!"
|
108 |
msgstr ""
|
109 |
|
110 |
+
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:689
|
111 |
msgid "Our Website"
|
112 |
msgstr ""
|
113 |
|
114 |
+
#: jeg-elementor-kit/class/dashboard/class-dashboard.php:690
|
115 |
msgid "Support Forum"
|
116 |
msgstr ""
|
117 |
|
4839 |
msgid "Your page will be redirected on frontend"
|
4840 |
msgstr ""
|
4841 |
|
4842 |
+
#: jeg-elementor-kit/class/elements/views/class-mailchimp-view.php:299
|
4843 |
msgid "Please set API Key into dashboard user data."
|
4844 |
msgstr ""
|
4845 |
|
4846 |
+
#: jeg-elementor-kit/class/elements/views/class-mailchimp-view.php:318
|
4847 |
msgid "Please make sure your API Key is correct in dashboard user data."
|
4848 |
msgstr ""
|
4849 |
|
4850 |
+
#: jeg-elementor-kit/class/elements/views/class-mailchimp-view.php:361
|
4851 |
msgid "Something went wrong: "
|
4852 |
msgstr ""
|
4853 |
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: elementor, element, addon, widget, extension, blog, post, elementor addon,
|
|
4 |
Requires at least: 5.0
|
5 |
Tested up to: 6.1
|
6 |
Requires PHP: 7.0
|
7 |
-
Stable tag: 2.5.
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -91,6 +91,11 @@ https://elementor.com/help/requirements/ Also you can disable some widgets that
|
|
91 |
|
92 |
== Changelog ==
|
93 |
|
|
|
|
|
|
|
|
|
|
|
94 |
= 2.5.6 - 03-11-2022 =
|
95 |
* Fix: Custom Attributes in link html tag is not showing
|
96 |
* Fix: 404 Template not working
|
4 |
Requires at least: 5.0
|
5 |
Tested up to: 6.1
|
6 |
Requires PHP: 7.0
|
7 |
+
Stable tag: 2.5.7
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
91 |
|
92 |
== Changelog ==
|
93 |
|
94 |
+
= 2.5.7 - 04-11-2022 =
|
95 |
+
* Improvement: Security issue
|
96 |
+
* Improvement: Mailchimp API Key Validation on save
|
97 |
+
* Fix: Enable and Disable Elements not working
|
98 |
+
|
99 |
= 2.5.6 - 03-11-2022 =
|
100 |
* Fix: Custom Attributes in link html tag is not showing
|
101 |
* Fix: 404 Template not working
|
templates/dashboard/dashboard-elements.php
CHANGED
@@ -27,7 +27,7 @@ $elements = Jeg\Elementor_Kit\Elements\Element::instance()->list_elements();
|
|
27 |
foreach ( $elements as $element ) {
|
28 |
$item_key = 'jkit_' . strtolower( $element );
|
29 |
$item_name = str_replace( '_', ' ', $element );
|
30 |
-
$checked = ! isset( $config[ $item_key ] ) || $config[ $item_key ] ? 'checked' : '';
|
31 |
?>
|
32 |
<div class="element-checkbox-option">
|
33 |
<div class="element-info">
|
27 |
foreach ( $elements as $element ) {
|
28 |
$item_key = 'jkit_' . strtolower( $element );
|
29 |
$item_name = str_replace( '_', ' ', $element );
|
30 |
+
$checked = ! isset( $config[ $item_key ] ) || filter_var( $config[ $item_key ], FILTER_VALIDATE_BOOLEAN ) ? 'checked' : '';
|
31 |
?>
|
32 |
<div class="element-checkbox-option">
|
33 |
<div class="element-info">
|