Version Description
Metform 1.3.0-beta1 is a major update. We have reconstructed the widgets with react and huge optimization for future proof. If you faced any issue please contact our support team from here https://help.wpmet.com/
Download this release
Release Info
Developer | ataurr |
Plugin | Metform Elementor Contact Form Builder – Flexible and Design-Friendly Contact Form builder plugin for WordPress |
Version | 1.3.6 |
Comparing to | |
See all releases |
Code changes from version 1.3.5 to 1.3.6
- metform.php +1 -1
- plugin.php +22 -1
- public/assets/js/admin-script.js +1 -1
- readme.txt +5 -2
- xs_migration/DataMigration.php +0 -482
- xs_migration/Migration.php +0 -307
- xs_migration/MigrationContract.php +0 -11
metform.php
CHANGED
@@ -5,7 +5,7 @@ defined( 'ABSPATH' ) || exit;
|
|
5 |
* Plugin Name: MetForm
|
6 |
* Plugin URI: http://products.wpmet.com/metform/
|
7 |
* Description: Most flexible and design friendly form builder for Elementor
|
8 |
-
* Version: 1.3.
|
9 |
* Author: Wpmet
|
10 |
* Author URI: https://wpmet.com
|
11 |
* Text Domain: metform
|
5 |
* Plugin Name: MetForm
|
6 |
* Plugin URI: http://products.wpmet.com/metform/
|
7 |
* Description: Most flexible and design friendly form builder for Elementor
|
8 |
+
* Version: 1.3.6
|
9 |
* Author: Wpmet
|
10 |
* Author URI: https://wpmet.com
|
11 |
* Text Domain: metform
|
plugin.php
CHANGED
@@ -16,7 +16,7 @@ final class Plugin{
|
|
16 |
}
|
17 |
|
18 |
public function version(){
|
19 |
-
return '1.3.
|
20 |
}
|
21 |
|
22 |
public function package_type(){
|
@@ -298,6 +298,9 @@ final class Plugin{
|
|
298 |
$btn['label'] = esc_html__('MetForm Pro', 'metform');
|
299 |
$btn['url'] = esc_url( 'https://products.wpmet.com/metform/');
|
300 |
|
|
|
|
|
|
|
301 |
Utils\Notice::push(
|
302 |
[
|
303 |
'id' => 'unsupported-metform-pro-version',
|
@@ -309,6 +312,24 @@ final class Plugin{
|
|
309 |
);
|
310 |
}
|
311 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
public function failed_elementor_version(){
|
313 |
|
314 |
$btn['label'] = esc_html__('Update Elementor', 'metform');
|
16 |
}
|
17 |
|
18 |
public function version(){
|
19 |
+
return '1.3.6';
|
20 |
}
|
21 |
|
22 |
public function package_type(){
|
298 |
$btn['label'] = esc_html__('MetForm Pro', 'metform');
|
299 |
$btn['url'] = esc_url( 'https://products.wpmet.com/metform/');
|
300 |
|
301 |
+
if(!$this->should_show_pro_banner())
|
302 |
+
return;
|
303 |
+
|
304 |
Utils\Notice::push(
|
305 |
[
|
306 |
'id' => 'unsupported-metform-pro-version',
|
312 |
);
|
313 |
}
|
314 |
|
315 |
+
/**
|
316 |
+
* Check the admin screen and show the pro banner if eligible
|
317 |
+
*/
|
318 |
+
public function should_show_pro_banner() {
|
319 |
+
$current_screen = (get_current_screen())->base;
|
320 |
+
$current_post_type = ( get_current_screen())->post_type;
|
321 |
+
$eligible_post_type = ['metform-form','metform-entry'];
|
322 |
+
$eligible_screens = ['plugins','dashboard','metform_page_metform-menu-settings','themes'];
|
323 |
+
|
324 |
+
if(in_array($current_post_type,$eligible_post_type))
|
325 |
+
return true;
|
326 |
+
|
327 |
+
if(in_array($current_screen,$eligible_screens))
|
328 |
+
return true;
|
329 |
+
|
330 |
+
return false;
|
331 |
+
}
|
332 |
+
|
333 |
public function failed_elementor_version(){
|
334 |
|
335 |
$btn['label'] = esc_html__('Update Elementor', 'metform');
|
public/assets/js/admin-script.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(e){"use strict";e(".metfrom-btn-refresh-get-response-list").click(function(){var t=e(this);t.addClass("mf-setting-spin");var i,a=e("#metform_form_modal"),o=e("#metform-form-modalinput-settings").attr("data-nonce"),s=e(".get-response-campaign-list");i=a.find("form").attr("data-mf-id"),e.ajax({url:window.metform_api.resturl+"metform/v1/entries/store_get_response_list/"+i,type:"get",headers:{"X-WP-Nonce":o},dataType:"json",success:function(e){s.empty(),e.forEach(e=>{s.append('<option value="'+e.campaignId+'">'+e.description+"</option>")}),t.removeClass("mf-setting-spin")},error:function(e){t.removeClass("mf-setting-spin")}})}),e(".metfrom-btn-refresh-mailchimp-list").click(function(){var t=e(this);t.addClass("mf-setting-spin");var i,a=e("#metform_form_modal"),o=e("#metform-form-modalinput-settings").attr("data-nonce"),s=e(".mailchimp_list");i=a.find("form").attr("data-mf-id"),e.ajax({url:window.metform_api.resturl+"metform/v1/entries/store_mailchimp_list/"+i,type:"get",headers:{"X-WP-Nonce":o},dataType:"json",success:function(e){try{s.empty(),e.lists.forEach(e=>{s.append("<option value="+e.id+">"+e.name+"</option>")})}catch(e){}t.removeClass("mf-setting-spin")},error:function(e){t.removeClass("mf-setting-spin")}})}),e(".metfrom-btn-refresh-hubsopt-list").click(function(){var t=e(this);t.addClass("mf-setting-spin");var i,a=e("#metform_form_modal"),o=e("#metform-form-modalinput-settings").attr("data-nonce"),s=e(".hubspot_forms");i=a.find("form").attr("data-mf-id"),e.ajax({url:window.metform_api.resturl+"metform/v1/forms/hubspot_forms/"+i,type:"get",headers:{"X-WP-Nonce":o},dataType:"json",success:function(e){try{s.empty(),s.append('<option value="select">Select a form</option>'),e.forEach(e=>{s.append("<option value="+e.portalId+" guid="+e.guid+">"+e.name+"</option>")})}catch(e){}t.removeClass("mf-setting-spin")},error:function(e){t.removeClass("mf-setting-spin")}})}),e(".hubspot_forms").on("change",function(){var t=e("option:selected",this).attr("guid"),i=e("option:selected",this).val();e(".mf_hubspot_form_guid").val(t),e(".mf_hubspot_form_portalId").val(i);var a,o=e("#metform_form_modal"),s=e("#metform-form-modalinput-settings").attr("data-nonce");a=o.find("form").attr("data-mf-id"),e("#mf-hubsopt-fileds").html("Please wait....");var r="";e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get_fields_data/"+a,type:"get",headers:{"X-WP-Nonce":s},dataType:"json",success:function(i){r=i,e.ajax({url:window.metform_api.resturl+"metform/v1/forms/hubspot_form_fields/"+a,type:"post",headers:{"X-WP-Nonce":s},dataType:"json",data:{guid:t},success:function(t){var i="",a="";Object.keys(r).map(function(e){return[r[e]]}).map(e=>{a+="<option value="+e[0].mf_input_name+">"+e[0].mf_input_label+"</option>"});t.forEach(e=>{i+="<tr><td>"+e.label+"</td><td><select name=mf_hubspot_form_field_name_"+e.name+' class="attr-form-control">'+a+"</select></td></tr>"}),e("#mf-hubsopt-fileds").html('<table width="100%">'+i+"</table>")},error:function(t){e("#mf-hubsopt-fileds").html("Sorry ! Something went wrong")}})},error:function(t){e("#mf-hubsopt-fileds").html("Sorry ! Something went wrong")}})}),e(".row-actions .edit a, .page-title-action, .metform-form-edit-btn, body.post-type-metform-form a.row-title").on("click",function(t){t.preventDefault();var i=0,a=e("#metform_form_modal"),o=e(this).parents(".column-title"),s=e("body").attr("data-metform-template-key");if(a.addClass("loading"),a.modal("show"),o.length>0){i=e(this).attr("data-metform-form-id"),"undefined"!==s&&(i=s),i=void 0!==i?i:o.find(".hidden").attr("id").split("_")[1];var r=e("#metform-form-modalinput-settings").attr("data-nonce");e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get/"+i,type:"get",headers:{"X-WP-Nonce":r},dataType:"json",success:function(e){u(e),a.removeClass("loading")}})}else{u({form_title:e(".mf-form-modalinput-title").attr("data-default-value"),admin_email_body:"",admin_email_from:"",admin_email_reply_to:"",admin_email_subject:"",capture_user_browser_data:"",enable_admin_notification:"",limit_total_entries_status:"",limit_total_entries:"0",redirect_to:"",success_url:"",failed_cancel_url:"",require_login:"",store_entries:"1",entry_title:"",success_message:e(".mf-form-modalinput-success_message").attr("data-default-value"),user_email_body:"",user_email_from:"",user_email_reply_to:"",user_email_subject:"",input_names:"Example: [mf-inputname]"}),a.removeClass("loading")}e(".mf-register").length&&e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get_fields_data/"+i,type:"get",headers:{"X-WP-Nonce":r},dataType:"json",success:function(t){var a=t,o="";e.ajax({url:window.metform_api.resturl+"xs/register/settings/"+i,type:"get",headers:{"X-WP-Nonce":r},dataType:"json",success:function(t){Object.keys(a).map(function(e){return[a[e]]}).map(e=>{o+="<option value="+e[0].mf_input_name+">"+e[0].mf_input_label+"</option>"});var i='<div class="mf-input-group mf-input-group-inline">'+('<label class="attr-input-label">User Name</label><div class="mf-inputs"><select class="attr-form-control" id="mf_auth_reg_user_name" name="mf_auth_reg_user_name">'+o+"</select></div>")+'</div><div class="mf-input-group mf-input-group-inline">'+('<label class="attr-input-label">User Email</label><div class="mf-inputs"><select class="attr-form-control" id="mf_auth_reg_user_email" name="mf_auth_reg_user_email">'+o+"</select></div>")+'</div><div class="mf-input-group mf-input-group-inline"><label class="attr-input-label">Role</label><div class="mf-inputs"><select class="attr-form-control" id="mf_auth_reg_role" name="mf_auth_reg_role"><option value="administrator">Administrator</option><option value="editor">Editor</option><option value="author">Author</option><option value="contributor">Contributor</option><option selected="selected" value="subscriber">Subscriber</option></select></div></div>';e(".mf_register_form_fields").html(i),0!=t&&(e('#mf_auth_reg_user_name option[value="'+t.mf_auth_reg_user_name+'"]').prop("selected",!0),e('#mf_auth_reg_user_email option[value="'+t.mf_auth_reg_user_email+'"]').prop("selected",!0),e('#mf_auth_reg_role option[value="'+t.mf_auth_reg_role+'"]').prop("selected",!0))},error:function(e){}})},error:function(e){}}),e(".mf-login").length&&e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get_fields_data/"+i,type:"get",headers:{"X-WP-Nonce":r},dataType:"json",success:function(t){var a=t,o="";e.ajax({url:window.metform_api.resturl+"xs/login/settings/"+i,type:"get",headers:{"X-WP-Nonce":r},dataType:"json",success:function(t){Object.keys(a).map(function(e){return[a[e]]}).map(e=>{o+="<option value="+e[0].mf_input_name+">"+e[0].mf_input_label+"</option>"});var i='<div class="mf-input-group mf-input-group-inline">'+('<label class="attr-input-label">User Name</label><div class="mf-inputs"><select class="attr-form-control" id="mf_auth_login_user_name" name="mf_auth_login_user_name">'+o+"</select></div>")+'</div><div class="mf-input-group mf-input-group-inline">'+('<label class="attr-input-label">User Password</label><div class="mf-inputs"><select class="attr-form-control" id="mf_auth_login_user_password" name="mf_auth_login_user_password">'+o+"</select></div>")+"</div>";e(".mf_login_form_fields").html(i),0!=t&&(e('#mf_auth_login_user_name option[value="'+t.mf_auth_login_user_name+'"]').prop("selected",!0),e('#mf_auth_login_user_password option[value="'+t.mf_auth_login_user_password+'"]').prop("selected",!0))},error:function(e){}})},error:function(e){}}),function(t){var i=e("#metform-form-modalinput-settings").attr("data-nonce"),a=e(".get-response-campaign-list");e.ajax({url:window.metform_api.resturl+"metform/v1/entries/get_response_list/"+t,type:"get",headers:{"X-WP-Nonce":i},dataType:"json",success:function(e){a.empty(),e.length&&e.forEach(e=>{a.append("<option value="+e.campaignId+">"+e.description+"</option>")})},error:function(e){}})}(i),function(t){var i=e(".metfrom-btn-refresh-hubsopt-list");i.addClass("mf-setting-spin");var a=e("#metform-form-modalinput-settings").attr("data-nonce"),o=e(".hubspot_forms"),s=t;e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get_hubspot_forms/"+s,type:"get",headers:{"X-WP-Nonce":a},dataType:"json",success:function(e){try{o.empty(),o.append('<option value="select">Select a form</option>'),e.forEach(e=>{o.append("<option value="+e.portalId+" guid="+e.guid+">"+e.name+"</option>")})}catch(e){}i.removeClass("mf-setting-spin")},error:function(e){i.removeClass("mf-setting-spin")}})}(i),function(t){e("#metform_form_modal");var i,a=e("#metform-form-modalinput-settings").attr("data-nonce"),o=e(".mailchimp_list");i=t,e.ajax({url:window.metform_api.resturl+"metform/v1/entries/get_mailchimp_list/"+i,type:"get",headers:{"X-WP-Nonce":a},dataType:"json",success:function(e){try{o.empty(),e.lists.forEach(e=>{o.append("<option value="+e.id+">"+e.name+"</option>")})}catch(e){}},error:function(e){}})}(i),a.find("form").attr("data-mf-id",i),a.find(".get-response-campaign-list").attr("get-response-list-id",i)}),e(".metform-form-save-btn-editor").on("click",function(){e(".metform-form-save-btn-editor").attr("disabled",!0);var t=e("#metform-form-modalinput-settings");t.attr("data-open-editor","1"),t.trigger("submit")}),e("#metform-form-modalinput-settings").on("submit",function(t){t.preventDefault();var i=e("#metform-form-modal"),a=e(this);i.addClass("loading"),e(".metform-form-save-btn-editor").attr("disabled",!0),e(".metform-form-save-btn").attr("disabled",!0);var o=e(this).serialize(),s=e(this).attr("data-mf-id"),r=e(this).attr("data-open-editor"),n=e(this).attr("data-editor-url"),m=e(this).attr("data-nonce");e.ajax({url:window.metform_api.resturl+"metform/v1/forms/update/"+s,type:"post",data:o,headers:{"X-WP-Nonce":m},dataType:"json",success:function(t){e("#message").css("display","block"),1==t.saved?(e("#post-"+t.data.id).find(".row-title").html(t.data.title),e("#message").removeClass("attr-alert-warning").addClass("attr-alert-success").html(t.status)):e("#message").removeClass("attr-alert-success").addClass("attr-alert-warning").html(t.status),setTimeout(function(){e("#message").css("display","none"),a.find(".attr-close").trigger("click")},1e3),i.removeClass("loading"),"1"==r&&1==t.saved?setTimeout(function(){window.location.href=n+"?post="+t.data.id+"&action=elementor"},1e3):"0"!=s?(e(".metform-form-save-btn-editor").removeAttr("disabled"),e(".metform-form-save-btn").removeAttr("disabled")):"0"==s&&setTimeout(function(){location.reload()},1e3)}})});var t=e(".mf-entry-title"),i=e(".mf-form-user-confirmation"),a=e(".mf-form-admin-notification"),o=e(".mf-input-rest-api-group"),s=e(".mf-mailchimp"),r=e(".mf-get_response"),n=e(".mf-zapier"),m=e(".mf-slack"),l=e(".mf-paypal"),f=e(".mf-stripe"),c=e(".mf-ckit"),d=e(".mf-aweber"),p=e(".mf-mail-poet");function _(t,i=null){var a=e("#metform-form-modalinput-settings").attr("data-nonce");e('.mf-mailster-list-id option[value="'+t+'"]').prop("selected",!0),e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get_fields_data/"+i,type:"get",headers:{"X-WP-Nonce":a},dataType:"json",success:function(a){console.log(a);var o=a,s="";Object.keys(o).map(function(e){return[o[e]]}).map(e=>{s+="<option value="+e[0].mf_input_name+">"+e[0].mf_input_label+"</option>"}),function(t,i,a){var o=e("#metform-form-modalinput-settings").attr("data-nonce");e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get_mailster_form/"+t,type:"get",headers:{"X-WP-Nonce":o},dataType:"json",success:function(t){var o="";for(const[e,a]of Object.entries(t))if("fields"==e)for(const[e,t]of Object.entries(a))o+='<div class="mf-input-group mf-input-group-inline"><label class="attr-input-label">'+t.name+'</label><div class="mf-inputs"><select class="attr-form-control" id="mailster_field_'+e+'" name="mailster_field_'+e+'">'+i+"</select></div></div>";e(".mf-mailster-settings-section").html(o),function(t,i){var a=window.mf_mailster_list_id;if(e(".mf-mailster-list-id").val()==a){var o=e("#metform-form-modalinput-settings").attr("data-nonce");e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get_mailster_form_data/"+i,type:"get",headers:{"X-WP-Nonce":o},dataType:"json",success:function(t){for(const[i,a]of Object.entries(t))for(const[t,i]of Object.entries(a))console.log(t+" = "+i),e("#"+t+' option[value="'+i+'"]').prop("selected",!0)},error:function(e){console.log("Can not get mailster forms fields")}})}}(0,a)},error:function(e){console.log("Can not get mailster forms fields")}})}(t,s,i)},error:function(e){}})}function u(r){if(t.hide(),i.hide(),a.hide(),o.hide(),s.hide(),n.hide(),m.hide(),l.hide(),f.hide(),c.hide(),d.hide(),p.hide(),""!=r.form_title){e(".mf-form-modalinput-title").val(r.form_title),e(".mf-form-modalinput-success_message").val(r.success_message),e(".mf-entry-title-input").val(void 0!==r.entry_title&&""!=r.entry_title?r.entry_title:void 0===r.entry_title||""==r.entry_title?"Entry # [mf_id]":""),e(".mf-form-modalinput-redirect_to").val(r.redirect_to),e(".mf-form-modalinput-success_url").val(r.success_url),e(".mf-form-modalinput-failed_cancel_url").val(r.failed_cancel_url),e(".mf-form-modalinput-limit_total_entries").val(r.limit_total_entries);var u=e(".mf-form-modalinput-store_entries");"1"==r.store_entries?(u.attr("checked",!0),t.show()):(u.removeAttr("checked"),t.hide());var h=e(".mf-form-modalinput-hide_form_after_submission");"1"==r.hide_form_after_submission?h.attr("checked",!0):h.removeAttr("checked");var v=e(".mf-form-modalinput-require_login");"1"==r.require_login?v.attr("checked",!0):v.removeAttr("checked");var g=e(".mf-form-modalinput-limit_status");"1"==r.limit_total_entries_status?g.attr("checked",!0):g.removeAttr("checked");var b=e(".mf-form-modalinput-count_views");"1"==r.count_views?b.attr("checked",!0):b.removeAttr("checked");var k=e(".mf-form-modalinput-multiple_submission");"1"==r.multiple_submission?k.attr("checked",!0):k.removeAttr("checked");var w=e(".mf-form-modalinput-enable_recaptcha");"1"==r.enable_recaptcha?w.attr("checked",!0):w.removeAttr("checked");var y=e(".mf-form-modalinput-capture_user_browser_data");"1"==r.capture_user_browser_data?(y.attr("checked",!0),e("#multiple_submission").removeClass("hide_input"),e("#multiple_submission").addClass("show_input")):y.removeAttr("checked"),e(".mf-form-user-email-subject").val(r.user_email_subject),e(".mf-form-user-email-from").val(r.user_email_from),e(".mf-form-user-reply-to").val(r.user_email_reply_to),e(".mf-form-user-email-body").val(r.user_email_body);var j=e(".mf-form-user-enable");"1"==r.enable_user_notification?(j.attr("checked",!0),i.show()):(j.removeAttr("checked"),i.hide());var x=e(".mf-form-user-submission-copy");"1"==r.user_email_attach_submission_copy?x.attr("checked",!0):x.removeAttr("checked"),e(".mf-form-admin-email-subject").val(r.admin_email_subject),e(".mf-form-admin-email-from").val(r.admin_email_from),e(".mf-form-admin-email-to").val(r.admin_email_to),e(".mf-form-admin-reply-to").val(r.admin_email_reply_to),e(".mf-form-admin-email-body").val(r.admin_email_body);var C=e(".mf-form-admin-enable");"1"==r.enable_admin_notification?(C.attr("checked",!0),a.show()):(C.removeAttr("checked"),a.hide());var A=e(".mf-form-admin-submission-copy");"1"==r.admin_email_attach_submission_copy?A.attr("checked",!0):A.removeAttr("checked");var T=e(".mf-form-modalinput-rest_api");"1"==r.mf_rest_api?(T.attr("checked",!0),e(".mf-rest-api").show()):(T.removeAttr("checked"),e(".mf-rest-api").hide());var P=e(".mf-form-modalinput-mail_chimp");"1"==r.mf_mail_chimp?(P.attr("checked",!0),s.show()):(P.removeAttr("checked"),s.hide());let o=e(".mf-form-modalinput-ckit"),_=e(".mf-form-modalinput-mail_aweber"),F=e(".mf-form-modalinput-mail_poet");if("1"==r.mf_convert_kit?(o.attr("checked",!0),c.show()):(o.removeAttr("checked"),c.hide()),"1"==r.mf_mail_aweber?(_.attr("checked",!0),d.show()):(_.removeAttr("checked"),d.hide()),"1"==r.mf_mail_poet?(F.attr("checked",!0),p.show()):(F.removeAttr("checked"),p.hide()),r.ckit_opt){let t=e("select.mf-ckit-list-id").first(),i=r.mf_ckit_list_id||"";t.html(),r.ckit_opt.forEach(function(e){t.append('<option value="'+e.id+'">'+e.name+"</option>")}),t.val(i)}if(r.aweber_opt){let t=e("select.mf-aweber-list-id").first(),i=r.mf_aweber_list_id||"";t.html();for(let e in r.aweber_opt)t.append('<option value="'+r.aweber_opt[e].id+'">'+r.aweber_opt[e].name+"</option>");t.val(i)}if(r.mp_opt){let t=e("select.mf-mail-poet-list-id").first(),i=r.mf_mail_poet_list_id||"";t.html();for(let e in r.mp_opt)t.append('<option value="'+r.mp_opt[e].id+'">'+r.mp_opt[e].name+"</option>");t.val(i)}var z=e(".mf-form-modalinput-active_campaign");"1"==r.mf_active_campaign?z.attr("checked",!0):z.removeAttr("checked");var N=e(".mf-form-modalinput-get_response");"1"==r.mf_get_response?(N.attr("checked",!0),e(".mf-get_response").show()):(N.removeAttr("checked"),e(".mf-get_response").hide());var W=e(".mf-hubsopt");"1"==r.mf_hubspot?W.attr("checked",!0):W.removeAttr("checked");var X=e(".mf-hubspot-forms"),O=e(".hubspot_forms_section");"1"==r.mf_hubspot_forms?(X.attr("checked",!0),O.show()):(X.removeAttr("checked"),O.hide()),e(".mf_hubspot_form_portalId").val(r.mf_hubspot_form_portalId),e(".mf_hubspot_form_guid").val(r.mf_hubspot_form_guid);var S=e(".mf-zoho");"1"==r.mf_zoho?S.attr("checked",!0):S.removeAttr("checked");var E=e(".mf-form-modalinput-mailster"),D=e(".mf-mailster-settings-section");"1"==r.mf_mailster?(E.attr("checked",!0),D.show(),e(".mf-mailster-forms").show()):(E.removeAttr("checked"),D.hide(),e(".mf-mailster-forms").hide());var I=e(".mf-register");1==r.mf_registration?(I.attr("checked",!0),e(".mf_register_form_fields").show()):(I.removeAttr("checked"),e(".mf_register_form_fields").hide());var U=e(".mf-login");1==r.mf_login?(U.attr("checked",!0),e(".mf_login_form_fields").show()):(e(".mf_login_form_fields").hide(),U.removeAttr("checked"));var q=e(".mf-form-modalinput-zapier");"1"==r.mf_zapier?(q.attr("checked",!0),n.show()):(q.removeAttr("checked",!0),n.hide());var R=e(".mf-form-modalinput-slack");"1"==r.mf_slack?(R.attr("checked",!0),m.show()):(R.removeAttr("checked",!0),m.hide());var Q=e(".mf-form-modalinput-paypal");"1"==r.mf_paypal?(Q.attr("checked",!0),l.show()):(Q.removeAttr("checked",!0),l.hide());var G=e(".mf-form-modalinput-stripe");"1"==r.mf_stripe?(G.attr("checked",!0),f.show()):(G.removeAttr("checked",!0),f.hide());G=e(".mf-form-modalinput-stripe");"1"==r.mf_stripe?(G.attr("checked",!0),f.show()):(G.removeAttr("checked",!0),f.hide());var K=e(".mf-form-modalinput-paypal_sandbox");"1"==r.mf_paypal_sandbox?K.attr("checked",!0):K.removeAttr("checked",!0);var L=e(".mf-form-modalinput-stripe_sandbox");"1"==r.mf_stripe_sandbox?L.attr("checked",!0):L.removeAttr("checked",!0);var B=r.mf_rest_api_method&&r.mf_rest_api_method.length?r.mf_rest_api_method:"POST";e('.mf-rest-api-method option[value="'+B+'"]').prop("selected",!0),e(".mf-rest-api-url").val(r.mf_rest_api_url),e(".mf-mailchimp-api-key").val(r.mf_mailchimp_api_key),e(".mf-mailchimp-list-id").val(r.mf_mailchimp_list_id),""==r.mf_mailchimp_list_id&&e(".mf-mailchimp-list-id").val(e(".mailchimp_list").find(":selected").val()),0!=r.mf_mailchimp_list_id&&e('.mailchimp_list option[value="'+r.mf_get_response_list_id+'"]').prop("selected",!0),e(".mf-get_response-list-id").val(r.mf_get_response_list_id),0!=r.mf_get_response_list_id&&e('.get-response-campaign-list option[value="'+r.mf_get_response_list_id+'"]').prop("selected",!0),e(".mf-zapier-web-hook").val(r.mf_zapier_webhook),e(".mf-slack-web-hook").val(r.mf_slack_webhook),e(".mf-paypal-email").val(r.mf_paypal_email),e(".mf-paypal-token").val(r.mf_paypal_token),e(".mf-stripe-image-url").val(r.mf_stripe_image_url),e(".mf-stripe-live-publishiable-key").val(r.mf_stripe_live_publishiable_key),e(".mf-stripe-live-secret-key").val(r.mf_stripe_live_secret_key),e(".mf-stripe-test-publishiable-key").val(r.mf_stripe_test_publishiable_key),e(".mf-stripe-test-secret-key").val(r.mf_stripe_test_secret_key),e(".mf-recaptcha-site-key").val(r.mf_recaptcha_site_key),e(".mf-recaptcha-secret-key").val(r.mf_recaptcha_secret_key),e("input.mf-form-modalinput-limit_status, .mf-form-modalinput-rest_api").trigger("change")}(window.mf_mailster_list_id=r.mf_mailster_list_id,e('.mf-mailster-list-id option[value="'+r.mf_mailster_list_id+'"]').prop("selected",!0),e(".mf-form-modalinput-mailster").length)&&_(e(".mf-mailster-list-id").find(":selected").val(),e("#metform_form_modal").find("form").attr("data-mf-id"))}e("input.mf-form-modalinput-store_entries").on("change",function(){e(this).is(":checked")?t.show():e(this).is(":not(:checked)")&&t.hide()}),e("input.mf-form-modalinput-limit_status").on("change",function(){e(this).is(":checked")?e("#limit_status").find("input").removeAttr("disabled"):e(this).is(":not(:checked)")&&e("#limit_status").find("input").attr("disabled","disabled")}),e("input.mf-form-user-enable").on("change",function(){e(this).is(":checked")?i.show():e(this).is(":not(:checked)")&&i.hide()}),e("input.mf-form-admin-enable").on("change",function(){e(this).is(":checked")?a.show():e(this).is(":not(:checked)")&&a.hide()}),e("input.mf-form-modalinput-rest_api").on("change",function(){e(this).is(":checked")?o.show():e(this).is(":not(:checked)")&&o.hide()}),e("input.mf-form-modalinput-mail_chimp").on("change",function(){e(this).is(":checked")?s.show():e(this).is(":not(:checked)")&&s.hide()}),e(".mf-form-modalinput-get_response").on("change",function(){e(this).is(":checked")?r.show():r.hide()}),e("input.mf-form-modalinput-mail_aweber").on("change",function(){e(this).is(":checked")?d.show():e(this).is(":not(:checked)")&&d.hide()}),e("input.mf-form-modalinput-mail_poet").on("change",function(){e(this).is(":checked")?p.show():e(this).is(":not(:checked)")&&p.hide()}),e("input.mf-form-modalinput-ckit").on("change",function(){e(this).is(":checked")?c.show():e(this).is(":not(:checked)")&&c.hide()}),e("input.mf-form-modalinput-zapier").on("change",function(){e(this).is(":checked")?n.show():e(this).is(":not(:checked)")&&n.hide()}),e("input.mf-form-modalinput-slack").on("change",function(){e(this).is(":checked")?m.show():e(this).is(":not(:checked)")&&m.hide()}),e("input.mf-form-modalinput-paypal").on("change",function(){e(this).is(":checked")?l.show():e(this).is(":not(:checked)")&&l.hide()}),e("input.mf-form-modalinput-stripe").on("change",function(){e(this).is(":checked")?stripe.show():e(this).is(":not(:checked)")&&stripe.hide()}),e("input.mf-form-modalinput-stripe_sandbox").on("change",function(){e(this).is(":checked")?e(".mf_stripe_sandbox").show():e(this).is(":not(:checked)")&&e(".mf_stripe_sandbox").hide()}),e(".mf-hubspot-forms").on("change",function(){e(this).is(":checked")?e(".hubspot_forms_section").show():e(".hubspot_forms_section").hide()}),e(".mf-register").on("change",function(){e(this).is(":checked")?e(".mf_register_form_fields").show():e(".mf_register_form_fields").hide()}),e(".mf-login").on("change",function(){e(this).is(":checked")?e(".mf_login_form_fields").show():e(".mf_login_form_fields").hide()}),e(".mf-form-modalinput-mailster").on("change",function(){e(this).is(":checked")?(e(".mf-mailster-settings-section").show(),e(".mf-mailster-forms").show()):(e(".mf-mailster-settings-section").hide(),e(".mf-mailster-forms").hide())}),e(".mf-mailster-list-id").on("change",function(){var t=e(this).val(),i=e("#metform-form-modalinput-settings").attr("data-mf-id");console.log(window.mf_mailster_list_id),console.log(_(t,i))}),e(".get-response-campaign-list").on("change",function(){e(".mf-get_response-list-id ").val(e(this).val())}),e("input.mf-form-modalinput-capture_user_browser_data").click(function(){e(this).is(":checked")?(e("#multiple_submission").removeClass("hide_input"),e("#multiple_submission").addClass("show_input")):e(this).is(":not(:checked)")&&(e("#multiple_submission").removeClass("show_input"),e("#multiple_submission").addClass("hide_input"))}),e(".mf-settings-tab .mf-setting-nav-link").on("click",function(t){if(!e(this).hasClass("mf-setting-nav-hidden")){t.preventDefault();var i=e(this).attr("href");window.location.hash=i,e(this).parent().addClass("nav-tab-active").siblings().removeClass("nav-tab-active"),e(i).addClass("active").siblings().removeClass("active")}}),e(".mf-setting-nav-link").on("click",function(t){e(this).hasClass("mf-setting-nav-hidden")?t.preventDefault():(e(this).parents(".nav-tab-wrapper").find("a").removeClass("top").removeClass("bottom"),e(this).parents("li").prev().find("a").addClass("top"),e(this).parents("li").next().find("a").addClass("bottom"))});var h=e(".mf-settings-tab .mf-setting-nav-link").eq(1).attr("href");if(window.location.hash&&(h=window.location.hash),e('.mf-settings-tab .mf-setting-nav-link[href="'+h+'"]').trigger("click"),e(window).on("resize.mfSettings",function(){e(".mf-setting-sidebar").css("width",e(".mf-setting-sidebar-column").width())}).trigger("resize.mfSettings"),e(".mf-setting-header").length>0){var v=e(".mf-setting-header").offset().top;e(window).scroll(function(){var t=e(".mf-setting-header");e(window).scrollTop()>=v?t.addClass("fixed").css({width:jQuery(".metform-admin-container").width()}):t.removeClass("fixed").css({width:"auto"})})}e(".mf-admin-single-accordion").on("click",".mf-admin-single-accordion--heading",function(){e(this).next().slideToggle().parent().toggleClass("active").siblings().removeClass("active").find(".mf-admin-single-accordion--body").slideUp()}),e(".mf-admin-single-accordion:first-child .mf-admin-single-accordion--heading").trigger("click"),e(".mf-recaptcha-version").on("change",function(){var t=e(this).val();e("#mf-"+t).fadeIn().siblings().hide()}),e(".mf-recaptcha-version").trigger("change"),e(".mf-form-modalinput-stripe_sandbox").on("change",function(){var t=e(this).parents(".attr-form-group").eq(0).next(".mf-form-modalinput-stripe_sandbox_keys");e(this).is(":checked")?t.fadeIn():t.fadeOut()}),e(".mf-form-modalinput-stripe_sandbox").trigger("change"),e(document).on("click","#met_pro_aweber_authorize",function(t){t.preventDefault();let i=e(this).closest("p.description");i.html("<span>Wait....</span>");var a=metform_api.admin_url+"admin-ajax.php",o={action:"get_aweber_authorization_url",api_key:e("#mf_aweber_dev_api_key").val(),api_sec:e("#mf_aweber_dev_api_sec").val()};e.ajax({url:a,method:"POST",data:o,dataType:"json",success:function(e){if(!0===e.success){let t='<a class=" button mf-setting-btn-link" href="'+e.data.url+'">Authorize The App </a>';i.html(t)}else if(e.data){let t=e.data;i.html('<span style="background-color: red; padding: 1px 5px;">'+t.msg+"</span>")}},error:function(e){i.html('<span style="color: red"> ajax error occurred, please check your internet connection..</span>')},complete:function(){}})}),e(document).on("click","#met_pro_aweber_propmpt_re_auth",function(t){t.preventDefault(),e("#mf_aweber_dev_api_key").val("").prop("disabled",!1),e("#mf_aweber_dev_api_sec").val("").prop("disabled",!1),e(this).closest("p.description").html('<a class="button mf-setting-btn-link" id="met_pro_aweber_re_authorize"> Get Re - Authorization URL </a>')}),e(document).on("click","#met_pro_aweber_re_authorize",function(t){t.preventDefault();let i=e(this).closest("p.description");i.html("<span>Wait....</span>");let a=e("#mf_aweber_dev_api_key").val();if(!a||a.length<1)return i.html('<span style="color: red">API Key can not be empty..</span>'),!1;var o=metform_api.admin_url+"admin-ajax.php",s={action:"get_aweber_re_authorization_url",api_key:a,api_sec:e("#mf_aweber_dev_api_sec").val()};e.ajax({url:o,method:"POST",data:s,dataType:"json",success:function(e){if(!0===e.success){let t=e.data;if("ok"==t.result){let e='<a class="mf-setting-btn-link" href="'+t.url+'">Authorize The App </a>';i.html(e)}else i.html("<span>"+t.msg+"</span>")}else if(e.data){let t=e.data;i.html('<span style="background-color: red; padding: 1px 5px;">'+t.msg+"</span>")}},error:function(e){i.html('<span style="color: red"> ajax error occurred, please check your internet connection..</span>')},complete:function(){}})}),e(document).on("click","#met_form_aweber_get_list",function(t){t.preventDefault();let i=e(this),a=e("#mf_aweber_info"),o=metform_api.admin_url+"admin-ajax.php";e.ajax({url:o,method:"POST",data:{action:"get_list_lists"},dataType:"json",success:function(e){if(!0===e.success){let t=e.data,o=i.closest("div.mf-aweber").find("select");if(o.html(""),t.lists)for(let e in t.lists)o.append('<option value="'+t.lists[e].id+'">'+t.lists[e].name+"</option>");a.html("")}else if(e.data){let t=e.data;a.html('<span style="background-color: red; padding: 1px 5px;">'+t.msg+"</span>")}},error:function(e){a.html('<span style="color: red"> ajax error occurred, please check your internet connection..</span>')},complete:function(){}})}),e(document).on("click","#met_form_mail_poet_get_list",function(t){t.preventDefault();let i=e(this),a=e("#mf_mail_poet_info"),o=metform_api.admin_url+"admin-ajax.php";e.ajax({url:o,method:"POST",data:{action:"mail_poet_get_email_list_lists"},dataType:"json",success:function(e){if(!0===e.success){let t=e.data,o=i.closest("div.mf-mail-poet").find("select");if(o.html(""),t.lists)for(let e in t.lists)o.append('<option value="'+t.lists[e].id+'">'+t.lists[e].name+"</option>");a.html("")}else if(e.data){let t=e.data;a.html('<span style="background-color: red; padding: 1px 5px;">'+t.msg+"</span>")}},error:function(e){a.html('<span style="color: red"> ajax error occurred, please check your internet connection..</span>')},complete:function(){}})}),e(document).on("click","#met_form_ckit_get_list",function(t){t.preventDefault();var i=metform_api.admin_url+"admin-ajax.php";let a=e(this);e.ajax({url:i,method:"POST",data:{action:"get_form_lists"},dataType:"json",success:function(e){if(!0===e.success){let t=e.data,i=a.closest("div.mf-ckit").find("select");i.html(""),t.forms&&t.forms.forEach(function(e){i.append('<option value="'+e.id+'">'+e.name+"</option>")})}else alert("Error occurred when trying to check for aweber authorization.")},error:function(e){},complete:function(){}})})});
|
1 |
+
jQuery(document).ready(function(e){"use strict";e(".metfrom-btn-refresh-get-response-list").click(function(){var t=e(this);t.addClass("mf-setting-spin");var i,a=e("#metform_form_modal"),o=e("#metform-form-modalinput-settings").attr("data-nonce"),s=e(".get-response-campaign-list");i=a.find("form").attr("data-mf-id"),e.ajax({url:window.metform_api.resturl+"metform/v1/entries/store_get_response_list/"+i,type:"get",headers:{"X-WP-Nonce":o},dataType:"json",success:function(e){s.empty(),e.forEach(e=>{s.append('<option value="'+e.campaignId+'">'+e.description+"</option>")}),t.removeClass("mf-setting-spin")},error:function(e){t.removeClass("mf-setting-spin")}})}),e(".metfrom-btn-refresh-mailchimp-list").click(function(){var t=e(this);t.addClass("mf-setting-spin");var i,a=e("#metform_form_modal"),o=e("#metform-form-modalinput-settings").attr("data-nonce"),s=e(".mailchimp_list");i=a.find("form").attr("data-mf-id"),e.ajax({url:window.metform_api.resturl+"metform/v1/entries/store_mailchimp_list/"+i,type:"get",headers:{"X-WP-Nonce":o},dataType:"json",success:function(e){try{s.empty(),e.lists.forEach(e=>{s.append("<option value="+e.id+">"+e.name+"</option>")})}catch(e){}t.removeClass("mf-setting-spin")},error:function(e){t.removeClass("mf-setting-spin")}})}),e(".metfrom-btn-refresh-hubsopt-list").click(function(){var t=e(this);t.addClass("mf-setting-spin");var i,a=e("#metform_form_modal"),o=e("#metform-form-modalinput-settings").attr("data-nonce"),s=e(".hubspot_forms");i=a.find("form").attr("data-mf-id"),e.ajax({url:window.metform_api.resturl+"metform/v1/forms/hubspot_forms/"+i,type:"get",headers:{"X-WP-Nonce":o},dataType:"json",success:function(e){try{s.empty(),s.append('<option value="select">Select a form</option>'),e.forEach(e=>{s.append("<option value="+e.portalId+" guid="+e.guid+">"+e.name+"</option>")})}catch(e){}t.removeClass("mf-setting-spin")},error:function(e){t.removeClass("mf-setting-spin")}})}),e(".hubspot_forms").on("change",function(){var t=e("option:selected",this).attr("guid"),i=e("option:selected",this).val();e(".mf_hubspot_form_guid").val(t),e(".mf_hubspot_form_portalId").val(i);var a,o=e("#metform_form_modal"),s=e("#metform-form-modalinput-settings").attr("data-nonce");a=o.find("form").attr("data-mf-id"),e("#mf-hubsopt-fileds").html("Please wait....");var r="";e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get_fields_data/"+a,type:"get",headers:{"X-WP-Nonce":s},dataType:"json",success:function(i){r=i,e.ajax({url:window.metform_api.resturl+"metform/v1/forms/hubspot_form_fields/"+a,type:"post",headers:{"X-WP-Nonce":s},dataType:"json",data:{guid:t},success:function(t){var i="",a="";Object.keys(r).map(function(e){return[r[e]]}).map(e=>{a+="<option value="+e[0].mf_input_name+">"+e[0].mf_input_label+"</option>"});t.forEach(e=>{i+="<tr><td>"+e.label+"</td><td><select name=mf_hubspot_form_field_name_"+e.name+' class="attr-form-control">'+a+"</select></td></tr>"}),e("#mf-hubsopt-fileds").html('<table width="100%">'+i+"</table>")},error:function(t){e("#mf-hubsopt-fileds").html("Sorry ! Something went wrong")}})},error:function(t){e("#mf-hubsopt-fileds").html("Sorry ! Something went wrong")}})}),e(".row-actions .edit a, .page-title-action, .metform-form-edit-btn, body.post-type-metform-form a.row-title").on("click",function(t){t.preventDefault();var i=0,a=e("#metform_form_modal"),o=e(this).parents(".column-title"),s=e("body").attr("data-metform-template-key");if(a.addClass("loading"),a.modal("show"),o.length>0){i=e(this).attr("data-metform-form-id"),"undefined"!==s&&(i=s),i=void 0!==i?i:o.find(".hidden").attr("id").split("_")[1];var r=e("#metform-form-modalinput-settings").attr("data-nonce");e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get/"+i,type:"get",headers:{"X-WP-Nonce":r},dataType:"json",success:function(e){u(e),a.removeClass("loading")}})}else{u({form_title:e(".mf-form-modalinput-title").attr("data-default-value"),admin_email_body:"",admin_email_from:"",admin_email_reply_to:"",admin_email_subject:"",capture_user_browser_data:"",enable_admin_notification:"",limit_total_entries_status:"",limit_total_entries:"0",redirect_to:"",success_url:"",failed_cancel_url:"",require_login:"",store_entries:"1",entry_title:"",success_message:e(".mf-form-modalinput-success_message").attr("data-default-value"),user_email_body:"",user_email_from:"",user_email_reply_to:"",user_email_subject:"",input_names:"Example: [mf-inputname]"}),a.removeClass("loading")}e(".mf-register").length&&e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get_fields_data/"+i,type:"get",headers:{"X-WP-Nonce":r},dataType:"json",success:function(t){var a=t,o="";e.ajax({url:window.metform_api.resturl+"xs/register/settings/"+i,type:"get",headers:{"X-WP-Nonce":r},dataType:"json",success:function(t){Object.keys(a).map(function(e){return[a[e]]}).map(e=>{o+="<option value="+e[0].mf_input_name+">"+e[0].mf_input_label+"</option>"});var i='<div class="mf-input-group mf-input-group-inline">'+('<label class="attr-input-label">User Name</label><div class="mf-inputs"><select class="attr-form-control" id="mf_auth_reg_user_name" name="mf_auth_reg_user_name">'+o+"</select></div>")+'</div><div class="mf-input-group mf-input-group-inline">'+('<label class="attr-input-label">User Email</label><div class="mf-inputs"><select class="attr-form-control" id="mf_auth_reg_user_email" name="mf_auth_reg_user_email">'+o+"</select></div>")+'</div><div class="mf-input-group mf-input-group-inline"><label class="attr-input-label">Role</label><div class="mf-inputs"><select class="attr-form-control" id="mf_auth_reg_role" name="mf_auth_reg_role"><option value="administrator">Administrator</option><option value="editor">Editor</option><option value="author">Author</option><option value="contributor">Contributor</option><option selected="selected" value="subscriber">Subscriber</option></select></div></div>';e(".mf_register_form_fields").html(i),0!=t&&(e('#mf_auth_reg_user_name option[value="'+t.mf_auth_reg_user_name+'"]').prop("selected",!0),e('#mf_auth_reg_user_email option[value="'+t.mf_auth_reg_user_email+'"]').prop("selected",!0),e('#mf_auth_reg_role option[value="'+t.mf_auth_reg_role+'"]').prop("selected",!0))},error:function(e){}})},error:function(e){}}),e(".mf-login").length&&e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get_fields_data/"+i,type:"get",headers:{"X-WP-Nonce":r},dataType:"json",success:function(t){var a=t,o="";e.ajax({url:window.metform_api.resturl+"xs/login/settings/"+i,type:"get",headers:{"X-WP-Nonce":r},dataType:"json",success:function(t){Object.keys(a).map(function(e){return[a[e]]}).map(e=>{o+="<option value="+e[0].mf_input_name+">"+e[0].mf_input_label+"</option>"});var i='<div class="mf-input-group mf-input-group-inline">'+('<label class="attr-input-label">User Name</label><div class="mf-inputs"><select class="attr-form-control" id="mf_auth_login_user_name" name="mf_auth_login_user_name">'+o+"</select></div>")+'</div><div class="mf-input-group mf-input-group-inline">'+('<label class="attr-input-label">User Password</label><div class="mf-inputs"><select class="attr-form-control" id="mf_auth_login_user_password" name="mf_auth_login_user_password">'+o+"</select></div>")+"</div>";e(".mf_login_form_fields").html(i),0!=t&&(e('#mf_auth_login_user_name option[value="'+t.mf_auth_login_user_name+'"]').prop("selected",!0),e('#mf_auth_login_user_password option[value="'+t.mf_auth_login_user_password+'"]').prop("selected",!0))},error:function(e){}})},error:function(e){}}),function(t){var i=e("#metform-form-modalinput-settings").attr("data-nonce"),a=e(".get-response-campaign-list");e.ajax({url:window.metform_api.resturl+"metform/v1/entries/get_response_list/"+t,type:"get",headers:{"X-WP-Nonce":i},dataType:"json",success:function(e){a.empty(),e.length&&e.forEach(e=>{a.append("<option value="+e.campaignId+">"+e.description+"</option>")})},error:function(e){}})}(i),function(t){var i=e(".metfrom-btn-refresh-hubsopt-list");i.addClass("mf-setting-spin");var a=e("#metform-form-modalinput-settings").attr("data-nonce"),o=e(".hubspot_forms"),s=t;e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get_hubspot_forms/"+s,type:"get",headers:{"X-WP-Nonce":a},dataType:"json",success:function(e){try{o.empty(),o.append('<option value="select">Select a form</option>'),e.forEach(e=>{o.append("<option value="+e.portalId+" guid="+e.guid+">"+e.name+"</option>")})}catch(e){}i.removeClass("mf-setting-spin")},error:function(e){i.removeClass("mf-setting-spin")}})}(i),function(t){e("#metform_form_modal");var i,a=e("#metform-form-modalinput-settings").attr("data-nonce"),o=e(".mailchimp_list");i=t,e.ajax({url:window.metform_api.resturl+"metform/v1/entries/get_mailchimp_list/"+i,type:"get",headers:{"X-WP-Nonce":a},dataType:"json",success:function(e){try{o.empty(),e.lists.forEach(e=>{o.append("<option value="+e.id+">"+e.name+"</option>")})}catch(e){}},error:function(e){}})}(i),a.find("form").attr("data-mf-id",i),a.find(".get-response-campaign-list").attr("get-response-list-id",i)}),e(".metform-form-save-btn-editor").on("click",function(){e(".metform-form-save-btn-editor").attr("disabled",!0);var t=e("#metform-form-modalinput-settings");t.attr("data-open-editor","1"),t.trigger("submit")}),e("#metform-form-modalinput-settings").on("submit",function(t){t.preventDefault();var i=e("#metform-form-modal"),a=e(this);i.addClass("loading"),e(".metform-form-save-btn-editor").attr("disabled",!0),e(".metform-form-save-btn").attr("disabled",!0);var o=e(this).serialize(),s=e(this).attr("data-mf-id"),r=e(this).attr("data-open-editor"),n=e(this).attr("data-editor-url"),m=e(this).attr("data-nonce");e.ajax({url:window.metform_api.resturl+"metform/v1/forms/update/"+s,type:"post",data:o,headers:{"X-WP-Nonce":m},dataType:"json",success:function(t){e("#message").css("display","block"),1==t.saved?(e("#post-"+t.data.id).find(".row-title").html(t.data.title),e("#message").removeClass("attr-alert-warning").addClass("attr-alert-success").html(t.status)):e("#message").removeClass("attr-alert-success").addClass("attr-alert-warning").html(t.status),setTimeout(function(){e("#message").css("display","none"),a.find(".attr-close").trigger("click")},1e3),i.removeClass("loading"),"1"==r&&1==t.saved?setTimeout(function(){window.location.href=n+"?post="+t.data.id+"&action=elementor"},1e3):"0"!=s?(e(".metform-form-save-btn-editor").removeAttr("disabled"),e(".metform-form-save-btn").removeAttr("disabled")):"0"==s&&setTimeout(function(){location.reload()},1e3)}})});var t=e(".mf-entry-title"),i=e(".mf-form-user-confirmation"),a=e(".mf-form-admin-notification"),o=e(".mf-input-rest-api-group"),s=e(".mf-mailchimp"),r=e(".mf-get_response"),n=e(".mf-zapier"),m=e(".mf-slack"),l=e(".mf-paypal"),f=e(".mf-stripe"),c=e(".mf-ckit"),d=e(".mf-aweber"),p=e(".mf-mail-poet");function _(t,i=null){var a=e("#metform-form-modalinput-settings").attr("data-nonce");e('.mf-mailster-list-id option[value="'+t+'"]').prop("selected",!0),e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get_fields_data/"+i,type:"get",headers:{"X-WP-Nonce":a},dataType:"json",success:function(a){console.log(a);var o=a,s="";Object.keys(o).map(function(e){return[o[e]]}).map(e=>{s+="<option value="+e[0].mf_input_name+">"+e[0].mf_input_label+"</option>"}),function(t,i,a){var o=e("#metform-form-modalinput-settings").attr("data-nonce");e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get_mailster_form/"+t,type:"get",headers:{"X-WP-Nonce":o},dataType:"json",success:function(t){var o="";for(const[e,a]of Object.entries(t))if("fields"==e)for(const[e,t]of Object.entries(a))o+='<div class="mf-input-group mf-input-group-inline"><label class="attr-input-label">'+t.name+'</label><div class="mf-inputs"><select class="attr-form-control" id="mailster_field_'+e+'" name="mailster_field_'+e+'">'+i+"</select></div></div>";e(".mf-mailster-settings-section").html(o),function(t,i){var a=window.mf_mailster_list_id;if(e(".mf-mailster-list-id").val()==a){var o=e("#metform-form-modalinput-settings").attr("data-nonce");e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get_mailster_form_data/"+i,type:"get",headers:{"X-WP-Nonce":o},dataType:"json",success:function(t){for(const[i,a]of Object.entries(t))for(const[t,i]of Object.entries(a))console.log(t+" = "+i),e("#"+t+' option[value="'+i+'"]').prop("selected",!0)},error:function(e){console.log("Can not get mailster forms fields")}})}}(0,a)},error:function(e){console.log("Can not get mailster forms fields")}})}(t,s,i)},error:function(e){}})}function u(r){if(t.hide(),i.hide(),a.hide(),o.hide(),s.hide(),n.hide(),m.hide(),l.hide(),f.hide(),c.hide(),d.hide(),p.hide(),""!=r.form_title){e(".mf-form-modalinput-title").val(r.form_title),e(".mf-form-modalinput-success_message").val(r.success_message),e(".mf-entry-title-input").val(void 0!==r.entry_title&&""!=r.entry_title?r.entry_title:void 0===r.entry_title||""==r.entry_title?"Entry # [mf_id]":""),e(".mf-form-modalinput-redirect_to").val(r.redirect_to),e(".mf-form-modalinput-success_url").val(r.success_url),e(".mf-form-modalinput-failed_cancel_url").val(r.failed_cancel_url),e(".mf-form-modalinput-limit_total_entries").val(r.limit_total_entries);var u=e(".mf-form-modalinput-store_entries");"1"==r.store_entries?(u.attr("checked",!0),t.show()):(u.removeAttr("checked"),t.hide());var h=e(".mf-form-modalinput-hide_form_after_submission");"1"==r.hide_form_after_submission?h.attr("checked",!0):h.removeAttr("checked");var v=e(".mf-form-modalinput-require_login");"1"==r.require_login?v.attr("checked",!0):v.removeAttr("checked");var g=e(".mf-form-modalinput-limit_status");"1"==r.limit_total_entries_status?g.attr("checked",!0):g.removeAttr("checked");var b=e(".mf-form-modalinput-count_views");"1"==r.count_views?b.attr("checked",!0):b.removeAttr("checked");var k=e(".mf-form-modalinput-multiple_submission");"1"==r.multiple_submission?k.attr("checked",!0):k.removeAttr("checked");var w=e(".mf-form-modalinput-enable_recaptcha");"1"==r.enable_recaptcha?w.attr("checked",!0):w.removeAttr("checked");var y=e(".mf-form-modalinput-capture_user_browser_data");"1"==r.capture_user_browser_data?(y.attr("checked",!0),e("#multiple_submission").removeClass("hide_input"),e("#multiple_submission").addClass("show_input")):y.removeAttr("checked"),e(".mf-form-user-email-subject").val(r.user_email_subject),e(".mf-form-user-email-from").val(r.user_email_from),e(".mf-form-user-reply-to").val(r.user_email_reply_to),e(".mf-form-user-email-body").val(r.user_email_body);var j=e(".mf-form-user-enable");"1"==r.enable_user_notification?(j.attr("checked",!0),i.show()):(j.removeAttr("checked"),i.hide());var x=e(".mf-form-user-submission-copy");"1"==r.user_email_attach_submission_copy?x.attr("checked",!0):x.removeAttr("checked"),e(".mf-form-admin-email-subject").val(r.admin_email_subject),e(".mf-form-admin-email-from").val(r.admin_email_from),e(".mf-form-admin-email-to").val(r.admin_email_to),e(".mf-form-admin-reply-to").val(r.admin_email_reply_to),e(".mf-form-admin-email-body").val(r.admin_email_body);var C=e(".mf-form-admin-enable");"1"==r.enable_admin_notification?(C.attr("checked",!0),a.show()):(C.removeAttr("checked"),a.hide());var A=e(".mf-form-admin-submission-copy");"1"==r.admin_email_attach_submission_copy?A.attr("checked",!0):A.removeAttr("checked");var T=e(".mf-form-modalinput-rest_api");"1"==r.mf_rest_api?(T.attr("checked",!0),e(".mf-rest-api").show()):(T.removeAttr("checked"),e(".mf-rest-api").hide());var P=e(".mf-form-modalinput-mail_chimp");"1"==r.mf_mail_chimp?(P.attr("checked",!0),s.show()):(P.removeAttr("checked"),s.hide());let o=e(".mf-form-modalinput-ckit"),_=e(".mf-form-modalinput-mail_aweber"),F=e(".mf-form-modalinput-mail_poet");if("1"==r.mf_convert_kit?(o.attr("checked",!0),c.show()):(o.removeAttr("checked"),c.hide()),"1"==r.mf_mail_aweber?(_.attr("checked",!0),d.show()):(_.removeAttr("checked"),d.hide()),"1"==r.mf_mail_poet?(F.attr("checked",!0),p.show()):(F.removeAttr("checked"),p.hide()),r.ckit_opt){let t=e("select.mf-ckit-list-id").first(),i=r.mf_ckit_list_id||"";t.html(),r.ckit_opt.forEach(function(e){t.append('<option value="'+e.id+'">'+e.name+"</option>")}),t.val(i)}if(r.aweber_opt){let t=e("select.mf-aweber-list-id").first(),i=r.mf_aweber_list_id||"";t.html();for(let e in r.aweber_opt)t.append('<option value="'+r.aweber_opt[e].id+'">'+r.aweber_opt[e].name+"</option>");t.val(i)}if(r.mp_opt){let t=e("select.mf-mail-poet-list-id").first(),i=r.mf_mail_poet_list_id||"";t.html();for(let e in r.mp_opt)t.append('<option value="'+r.mp_opt[e].id+'">'+r.mp_opt[e].name+"</option>");t.val(i)}var z=e(".mf-form-modalinput-active_campaign");"1"==r.mf_active_campaign?z.attr("checked",!0):z.removeAttr("checked");var N=e(".mf-form-modalinput-get_response");"1"==r.mf_get_response?(N.attr("checked",!0),e(".mf-get_response").show()):(N.removeAttr("checked"),e(".mf-get_response").hide());var W=e(".mf-hubsopt");"1"==r.mf_hubspot?W.attr("checked",!0):W.removeAttr("checked");var X=e(".mf-hubspot-forms"),O=e(".hubspot_forms_section");"1"==r.mf_hubspot_forms?(X.attr("checked",!0),O.show()):(X.removeAttr("checked"),O.hide()),e(".mf_hubspot_form_portalId").val(r.mf_hubspot_form_portalId),e(".mf_hubspot_form_guid").val(r.mf_hubspot_form_guid);var S=e(".mf-zoho");"1"==r.mf_zoho?S.attr("checked",!0):S.removeAttr("checked");var E=e(".mf-form-modalinput-mailster"),D=e(".mf-mailster-settings-section");"1"==r.mf_mailster?(E.attr("checked",!0),D.show(),e(".mf-mailster-forms").show()):(E.removeAttr("checked"),D.hide(),e(".mf-mailster-forms").hide());var I=e(".mf-register");1==r.mf_registration?(I.attr("checked",!0),e(".mf_register_form_fields").show()):(I.removeAttr("checked"),e(".mf_register_form_fields").hide());var U=e(".mf-login");1==r.mf_login?(U.attr("checked",!0),e(".mf_login_form_fields").show()):(e(".mf_login_form_fields").hide(),U.removeAttr("checked"));var q=e(".mf-form-modalinput-zapier");"1"==r.mf_zapier?(q.attr("checked",!0),n.show()):(q.removeAttr("checked",!0),n.hide());var R=e(".mf-form-modalinput-slack");"1"==r.mf_slack?(R.attr("checked",!0),m.show()):(R.removeAttr("checked",!0),m.hide());var Q=e(".mf-form-modalinput-paypal");"1"==r.mf_paypal?(Q.attr("checked",!0),l.show()):(Q.removeAttr("checked",!0),l.hide());var G=e(".mf-form-modalinput-stripe");"1"==r.mf_stripe?(G.attr("checked",!0),f.show()):(G.removeAttr("checked",!0),f.hide());G=e(".mf-form-modalinput-stripe");"1"==r.mf_stripe?(G.attr("checked",!0),f.show()):(G.removeAttr("checked",!0),f.hide());var K=e(".mf-form-modalinput-paypal_sandbox");"1"==r.mf_paypal_sandbox?K.attr("checked",!0):K.removeAttr("checked",!0);var L=e(".mf-form-modalinput-stripe_sandbox");"1"==r.mf_stripe_sandbox?L.attr("checked",!0):L.removeAttr("checked",!0);var B=r.mf_rest_api_method&&r.mf_rest_api_method.length?r.mf_rest_api_method:"POST";e('.mf-rest-api-method option[value="'+B+'"]').prop("selected",!0),e(".mf-rest-api-url").val(r.mf_rest_api_url),e(".mf-mailchimp-api-key").val(r.mf_mailchimp_api_key),e(".mf-mailchimp-list-id").val(r.mf_mailchimp_list_id),""==r.mf_mailchimp_list_id&&e(".mf-mailchimp-list-id").val(e(".mailchimp_list").find(":selected").val()),0!=r.mf_mailchimp_list_id&&e('.mailchimp_list option[value="'+r.mf_get_response_list_id+'"]').prop("selected",!0),e(".mf-get_response-list-id").val(r.mf_get_response_list_id),0!=r.mf_get_response_list_id&&e('.get-response-campaign-list option[value="'+r.mf_get_response_list_id+'"]').prop("selected",!0),e(".mf-zapier-web-hook").val(r.mf_zapier_webhook),e(".mf-slack-web-hook").val(r.mf_slack_webhook),e(".mf-paypal-email").val(r.mf_paypal_email),e(".mf-paypal-token").val(r.mf_paypal_token),e(".mf-stripe-image-url").val(r.mf_stripe_image_url),e(".mf-stripe-live-publishiable-key").val(r.mf_stripe_live_publishiable_key),e(".mf-stripe-live-secret-key").val(r.mf_stripe_live_secret_key),e(".mf-stripe-test-publishiable-key").val(r.mf_stripe_test_publishiable_key),e(".mf-stripe-test-secret-key").val(r.mf_stripe_test_secret_key),e(".mf-recaptcha-site-key").val(r.mf_recaptcha_site_key),e(".mf-recaptcha-secret-key").val(r.mf_recaptcha_secret_key),e("input.mf-form-modalinput-limit_status, .mf-form-modalinput-rest_api").trigger("change")}(window.mf_mailster_list_id=r.mf_mailster_list_id,e('.mf-mailster-list-id option[value="'+r.mf_mailster_list_id+'"]').prop("selected",!0),e(".mf-form-modalinput-mailster").length)&&_(e(".mf-mailster-list-id").find(":selected").val(),e("#metform_form_modal").find("form").attr("data-mf-id"))}e("input.mf-form-modalinput-store_entries").on("change",function(){e(this).is(":checked")?t.show():e(this).is(":not(:checked)")&&t.hide()}),e("input.mf-form-modalinput-limit_status").on("change",function(){e(this).is(":checked")?e("#limit_status").find("input").removeAttr("disabled"):e(this).is(":not(:checked)")&&e("#limit_status").find("input").attr("disabled","disabled")}),e("input.mf-form-user-enable").on("change",function(){e(this).is(":checked")?i.show():e(this).is(":not(:checked)")&&i.hide()}),e("input.mf-form-admin-enable").on("change",function(){e(this).is(":checked")?a.show():e(this).is(":not(:checked)")&&a.hide()}),e("input.mf-form-modalinput-rest_api").on("change",function(){e(this).is(":checked")?o.show():e(this).is(":not(:checked)")&&o.hide()}),e("input.mf-form-modalinput-mail_chimp").on("change",function(){e(this).is(":checked")?s.show():e(this).is(":not(:checked)")&&s.hide()}),e(".mf-form-modalinput-get_response").on("change",function(){e(this).is(":checked")?r.show():r.hide()}),e("input.mf-form-modalinput-mail_aweber").on("change",function(){e(this).is(":checked")?d.show():e(this).is(":not(:checked)")&&d.hide()}),e("input.mf-form-modalinput-mail_poet").on("change",function(){e(this).is(":checked")?p.show():e(this).is(":not(:checked)")&&p.hide()}),e("input.mf-form-modalinput-ckit").on("change",function(){e(this).is(":checked")?c.show():e(this).is(":not(:checked)")&&c.hide()}),e("input.mf-form-modalinput-zapier").on("change",function(){e(this).is(":checked")?n.show():e(this).is(":not(:checked)")&&n.hide()}),e("input.mf-form-modalinput-slack").on("change",function(){e(this).is(":checked")?m.show():e(this).is(":not(:checked)")&&m.hide()}),e("input.mf-form-modalinput-paypal").on("change",function(){e(this).is(":checked")?l.show():e(this).is(":not(:checked)")&&l.hide()}),e("input.mf-form-modalinput-stripe").on("change",function(){e(this).is(":checked")?stripe.show():e(this).is(":not(:checked)")&&stripe.hide()}),e("input.mf-form-modalinput-stripe_sandbox").on("change",function(){e(this).is(":checked")?e(".mf_stripe_sandbox").show():e(this).is(":not(:checked)")&&e(".mf_stripe_sandbox").hide()}),e(".mf-hubspot-forms").on("change",function(){e(this).is(":checked")?e(".hubspot_forms_section").show():e(".hubspot_forms_section").hide()}),e(".mf-register").on("change",function(){e(this).is(":checked")?e(".mf_register_form_fields").show():e(".mf_register_form_fields").hide()}),e(".mf-login").on("change",function(){e(this).is(":checked")?e(".mf_login_form_fields").show():e(".mf_login_form_fields").hide()}),e(".mf-form-to-post").on("change",function(){e(this).is(":checked")?e(".mf-form-to-post-fields").show():e(".mf-form-to-post-fields").hide()}),e(".mf-form-modalinput-mailster").on("change",function(){e(this).is(":checked")?(e(".mf-mailster-settings-section").show(),e(".mf-mailster-forms").show()):(e(".mf-mailster-settings-section").hide(),e(".mf-mailster-forms").hide())}),e(".mf-mailster-list-id").on("change",function(){var t=e(this).val(),i=e("#metform-form-modalinput-settings").attr("data-mf-id");console.log(window.mf_mailster_list_id),console.log(_(t,i))}),e(".get-response-campaign-list").on("change",function(){e(".mf-get_response-list-id ").val(e(this).val())}),e("input.mf-form-modalinput-capture_user_browser_data").click(function(){e(this).is(":checked")?(e("#multiple_submission").removeClass("hide_input"),e("#multiple_submission").addClass("show_input")):e(this).is(":not(:checked)")&&(e("#multiple_submission").removeClass("show_input"),e("#multiple_submission").addClass("hide_input"))}),e(".mf-settings-tab .mf-setting-nav-link").on("click",function(t){if(!e(this).hasClass("mf-setting-nav-hidden")){t.preventDefault();var i=e(this).attr("href");window.location.hash=i,e(this).parent().addClass("nav-tab-active").siblings().removeClass("nav-tab-active"),e(i).addClass("active").siblings().removeClass("active")}}),e(".mf-setting-nav-link").on("click",function(t){e(this).hasClass("mf-setting-nav-hidden")?t.preventDefault():(e(this).parents(".nav-tab-wrapper").find("a").removeClass("top").removeClass("bottom"),e(this).parents("li").prev().find("a").addClass("top"),e(this).parents("li").next().find("a").addClass("bottom"))});var h=e(".mf-settings-tab .mf-setting-nav-link").eq(1).attr("href");if(window.location.hash&&(h=window.location.hash),e('.mf-settings-tab .mf-setting-nav-link[href="'+h+'"]').trigger("click"),e(window).on("resize.mfSettings",function(){e(".mf-setting-sidebar").css("width",e(".mf-setting-sidebar-column").width())}).trigger("resize.mfSettings"),e(".mf-setting-header").length>0){var v=e(".mf-setting-header").offset().top;e(window).scroll(function(){var t=e(".mf-setting-header");e(window).scrollTop()>=v?t.addClass("fixed").css({width:jQuery(".metform-admin-container").width()}):t.removeClass("fixed").css({width:"auto"})})}e(".mf-admin-single-accordion").on("click",".mf-admin-single-accordion--heading",function(){e(this).next().slideToggle().parent().toggleClass("active").siblings().removeClass("active").find(".mf-admin-single-accordion--body").slideUp()}),e(".mf-admin-single-accordion:first-child .mf-admin-single-accordion--heading").trigger("click"),e(".mf-recaptcha-version").on("change",function(){var t=e(this).val();e("#mf-"+t).fadeIn().siblings().hide()}),e(".mf-recaptcha-version").trigger("change"),e(".mf-form-modalinput-stripe_sandbox").on("change",function(){var t=e(this).parents(".attr-form-group").eq(0).next(".mf-form-modalinput-stripe_sandbox_keys");e(this).is(":checked")?t.fadeIn():t.fadeOut()}),e(".mf-form-modalinput-stripe_sandbox").trigger("change"),e(document).on("click","#met_pro_aweber_authorize",function(t){t.preventDefault();let i=e(this).closest("p.description");i.html("<span>Wait....</span>");var a=metform_api.admin_url+"admin-ajax.php",o={action:"get_aweber_authorization_url",api_key:e("#mf_aweber_dev_api_key").val(),api_sec:e("#mf_aweber_dev_api_sec").val()};e.ajax({url:a,method:"POST",data:o,dataType:"json",success:function(e){if(!0===e.success){let t='<a class=" button mf-setting-btn-link" href="'+e.data.url+'">Authorize The App </a>';i.html(t)}else if(e.data){let t=e.data;i.html('<span style="background-color: red; padding: 1px 5px;">'+t.msg+"</span>")}},error:function(e){i.html('<span style="color: red"> ajax error occurred, please check your internet connection..</span>')},complete:function(){}})}),e(document).on("click","#met_pro_aweber_propmpt_re_auth",function(t){t.preventDefault(),e("#mf_aweber_dev_api_key").val("").prop("disabled",!1),e("#mf_aweber_dev_api_sec").val("").prop("disabled",!1),e(this).closest("p.description").html('<a class="button mf-setting-btn-link" id="met_pro_aweber_re_authorize"> Get Re - Authorization URL </a>')}),e(document).on("click","#met_pro_aweber_re_authorize",function(t){t.preventDefault();let i=e(this).closest("p.description");i.html("<span>Wait....</span>");let a=e("#mf_aweber_dev_api_key").val();if(!a||a.length<1)return i.html('<span style="color: red">API Key can not be empty..</span>'),!1;var o=metform_api.admin_url+"admin-ajax.php",s={action:"get_aweber_re_authorization_url",api_key:a,api_sec:e("#mf_aweber_dev_api_sec").val()};e.ajax({url:o,method:"POST",data:s,dataType:"json",success:function(e){if(!0===e.success){let t=e.data;if("ok"==t.result){let e='<a class="mf-setting-btn-link" href="'+t.url+'">Authorize The App </a>';i.html(e)}else i.html("<span>"+t.msg+"</span>")}else if(e.data){let t=e.data;i.html('<span style="background-color: red; padding: 1px 5px;">'+t.msg+"</span>")}},error:function(e){i.html('<span style="color: red"> ajax error occurred, please check your internet connection..</span>')},complete:function(){}})}),e(document).on("click","#met_form_aweber_get_list",function(t){t.preventDefault();let i=e(this),a=e("#mf_aweber_info"),o=metform_api.admin_url+"admin-ajax.php";e.ajax({url:o,method:"POST",data:{action:"get_list_lists"},dataType:"json",success:function(e){if(!0===e.success){let t=e.data,o=i.closest("div.mf-aweber").find("select");if(o.html(""),t.lists)for(let e in t.lists)o.append('<option value="'+t.lists[e].id+'">'+t.lists[e].name+"</option>");a.html("")}else if(e.data){let t=e.data;a.html('<span style="background-color: red; padding: 1px 5px;">'+t.msg+"</span>")}},error:function(e){a.html('<span style="color: red"> ajax error occurred, please check your internet connection..</span>')},complete:function(){}})}),e(document).on("click","#met_form_mail_poet_get_list",function(t){t.preventDefault();let i=e(this),a=e("#mf_mail_poet_info"),o=metform_api.admin_url+"admin-ajax.php";e.ajax({url:o,method:"POST",data:{action:"mail_poet_get_email_list_lists"},dataType:"json",success:function(e){if(!0===e.success){let t=e.data,o=i.closest("div.mf-mail-poet").find("select");if(o.html(""),t.lists)for(let e in t.lists)o.append('<option value="'+t.lists[e].id+'">'+t.lists[e].name+"</option>");a.html("")}else if(e.data){let t=e.data;a.html('<span style="background-color: red; padding: 1px 5px;">'+t.msg+"</span>")}},error:function(e){a.html('<span style="color: red"> ajax error occurred, please check your internet connection..</span>')},complete:function(){}})}),e(document).on("click","#met_form_ckit_get_list",function(t){t.preventDefault();var i=metform_api.admin_url+"admin-ajax.php";let a=e(this);e.ajax({url:i,method:"POST",data:{action:"get_form_lists"},dataType:"json",success:function(e){if(!0===e.success){let t=e.data,i=a.closest("div.mf-ckit").find("select");i.html(""),t.forms&&t.forms.forEach(function(e){i.append('<option value="'+e.id+'">'+e.name+"</option>")})}else alert("Error occurred when trying to check for aweber authorization.")},error:function(e){},complete:function(){}})})});
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: ataurr, wpmet, emrnco, prappo_p, atiqsu, easin55474
|
3 |
Tags: Form builder, Elementor form builder, contact form, custom form, forms, drag & drop form builder
|
4 |
Requires at least: 4.8
|
5 |
-
Tested up to: 5.5
|
6 |
-
Stable tag: 1.3.
|
7 |
Requires PHP: 7.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -221,6 +221,9 @@ Connect with Gmail, Slack, Mailchimp, and many more.
|
|
221 |
|
222 |
|
223 |
== Changelog ==
|
|
|
|
|
|
|
224 |
Version 1.3.5
|
225 |
Fix: Rating notice issues
|
226 |
Added: CSS optimization.
|
2 |
Contributors: ataurr, wpmet, emrnco, prappo_p, atiqsu, easin55474
|
3 |
Tags: Form builder, Elementor form builder, contact form, custom form, forms, drag & drop form builder
|
4 |
Requires at least: 4.8
|
5 |
+
Tested up to: 5.5.1
|
6 |
+
Stable tag: 1.3.6
|
7 |
Requires PHP: 7.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
221 |
|
222 |
|
223 |
== Changelog ==
|
224 |
+
Version 1.3.6
|
225 |
+
Fix: Banner issues
|
226 |
+
|
227 |
Version 1.3.5
|
228 |
Fix: Rating notice issues
|
229 |
Added: CSS optimization.
|
xs_migration/DataMigration.php
DELETED
@@ -1,482 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace MetForm\XsMigration;
|
4 |
-
|
5 |
-
|
6 |
-
abstract class DataMigration implements MigrationContract {
|
7 |
-
|
8 |
-
|
9 |
-
const STATUS_DONE = 'done';
|
10 |
-
const STATUS_QUEUED = 'queued';
|
11 |
-
const STATUS_RUNNING = 'running';
|
12 |
-
|
13 |
-
const STATUS_FINISHED = 'finished';
|
14 |
-
const STATUS_INITIATED = 'initiated';
|
15 |
-
|
16 |
-
const STATUS_METHOD_PAUSED = 'paused';
|
17 |
-
const STATUS_METHOD_EXECUTED = 'executed';
|
18 |
-
const STATUS_METHOD_EXECUTING = 'executing';
|
19 |
-
|
20 |
-
/**
|
21 |
-
* @param $txtDomain
|
22 |
-
* @param $versionFrom
|
23 |
-
* @param $versionTo
|
24 |
-
*
|
25 |
-
* @return mixed
|
26 |
-
*/
|
27 |
-
public function input($txtDomain, $versionFrom, $versionTo) {
|
28 |
-
|
29 |
-
#$versionFrom = '1.1.9';
|
30 |
-
#$versionTo = '1.2.0';
|
31 |
-
$optionKey = 'data_migration_'.$txtDomain.'_log';
|
32 |
-
|
33 |
-
$from = str_replace('.', '_', trim($versionFrom));
|
34 |
-
$to = str_replace('.', '_', trim($versionTo));
|
35 |
-
|
36 |
-
$frm = $this->makeFullVersionKey($from);
|
37 |
-
$trm = $this->makeFullVersionKey($to);
|
38 |
-
|
39 |
-
$log = [];
|
40 |
-
$verCache = [];
|
41 |
-
$exPKey = $frm.'_'.$trm;
|
42 |
-
|
43 |
-
$verCache['o_from'] = $versionFrom;
|
44 |
-
$verCache['u_from'] = $from;
|
45 |
-
$verCache['p_from'] = $frm;
|
46 |
-
$verCache['o_to'] = $versionTo;
|
47 |
-
$verCache['u_to'] = $to;
|
48 |
-
$verCache['p_to'] = $trm;
|
49 |
-
|
50 |
-
$existingOption = get_option($optionKey);
|
51 |
-
|
52 |
-
if(!$existingOption) {
|
53 |
-
|
54 |
-
$existingOption = [];
|
55 |
-
$existingOption['status'] = self::STATUS_INITIATED;
|
56 |
-
$existingOption['plan_key'] = $exPKey;
|
57 |
-
|
58 |
-
$cStack = $this->getCallStacks([], $frm, $trm);
|
59 |
-
|
60 |
-
$existingOption['map'] = $cStack['map'];
|
61 |
-
|
62 |
-
$existingOption['execution_plan'][$exPKey]['status'] = self::STATUS_RUNNING;
|
63 |
-
$existingOption['execution_plan'][$exPKey]['stack'] = $cStack['stack'];
|
64 |
-
$existingOption['execution_plan'][$exPKey]['available'] = $cStack['func'];
|
65 |
-
$existingOption['execution_plan'][$exPKey]['executing'] = '';
|
66 |
-
$existingOption['execution_plan'][$exPKey]['executed'] = [];
|
67 |
-
$existingOption['execution_plan'][$exPKey]['failed'] = [];
|
68 |
-
$existingOption['execution_plan'][$exPKey]['progress'] = [];
|
69 |
-
$existingOption['execution_plan'][$exPKey]['log'] = [];
|
70 |
-
$existingOption['execution_plan'][$exPKey]['version'] = $verCache;
|
71 |
-
|
72 |
-
$existingOption['plan_log'][$exPKey] = 'Execution plan '.$exPKey. ' initiated at '.date('Y-m-d H:i:s'). ' .' . PHP_EOL;
|
73 |
-
|
74 |
-
$log[] = 'Conversion initiated for version '. $versionFrom .' to '. $versionTo. ' at '.date('Y-m-d H:i:s').'.';
|
75 |
-
$log[] = 'Execution plan prepared.';
|
76 |
-
$log[] = 'Execution plan saved into database.';
|
77 |
-
|
78 |
-
|
79 |
-
if(empty($existingOption['execution_plan'][$exPKey]['stack'])) {
|
80 |
-
|
81 |
-
$log[] = '- No Conversion method found for '. $versionFrom .' to '. $versionTo .'';
|
82 |
-
$log[] = '-- exiting....';
|
83 |
-
$log[] = 'Execution plan executed at '.date('Y-m-d H:i:s').'.';
|
84 |
-
$log[] = '----------------------------------------------------------';
|
85 |
-
|
86 |
-
|
87 |
-
$existingOption['execution_plan'][$exPKey]['status'] = self::STATUS_FINISHED;
|
88 |
-
$existingOption['execution_plan'][$exPKey]['log'] = $log;
|
89 |
-
$existingOption['plan_log'][$exPKey] .= 'Execution plan '.$exPKey. ' finished at '.date('Y-m-d H:i:s'). ' .' . PHP_EOL;
|
90 |
-
$existingOption['status'] = self::STATUS_FINISHED;
|
91 |
-
|
92 |
-
//update_option($optionKey, $existingOption);
|
93 |
-
|
94 |
-
return [
|
95 |
-
'status' => 'success',
|
96 |
-
'log' => $log,
|
97 |
-
];
|
98 |
-
}
|
99 |
-
|
100 |
-
$curExecMethod = array_shift($existingOption['execution_plan'][$exPKey]['stack']);
|
101 |
-
|
102 |
-
$existingOption['execution_plan'][$exPKey]['executing'] = $curExecMethod;
|
103 |
-
$existingOption['execution_plan'][$exPKey]['progress'][$curExecMethod] = [
|
104 |
-
'status' => self::STATUS_QUEUED,
|
105 |
-
'check_list' => [],
|
106 |
-
];
|
107 |
-
|
108 |
-
|
109 |
-
$log[] = 'Execution plan '.$exPKey.' has started at '.date('Y-m-d H:i:s').'.';
|
110 |
-
$log[] = '- Conversion method '. $curExecMethod . ' entered into queue at '.date('Y-m-d H:i:s').'.';
|
111 |
-
$log[] = '-- Method '.$curExecMethod.' is executing....';
|
112 |
-
|
113 |
-
|
114 |
-
$existingOption['execution_plan'][$exPKey]['log'] = $log;
|
115 |
-
$existingOption['execution_plan'][$exPKey]['log'][] = '-- ....';
|
116 |
-
$existingOption['execution_plan'][$exPKey]['progress'][$curExecMethod]['status'] = self::STATUS_METHOD_EXECUTING;
|
117 |
-
|
118 |
-
//update_option($optionKey, $existingOption);
|
119 |
-
|
120 |
-
return $this->$curExecMethod($optionKey, $exPKey, $existingOption);
|
121 |
-
//return $existingOption;
|
122 |
-
}
|
123 |
-
|
124 |
-
#We have reached this point,
|
125 |
-
#this means we do not have previously saved progress into database
|
126 |
-
#Now we are checking the status of the execution plan....
|
127 |
-
|
128 |
-
if($existingOption['status'] === self::STATUS_INITIATED) {
|
129 |
-
|
130 |
-
#this is the initiated plan key, it must be defined by the programmer when status is set to initiated.
|
131 |
-
$planKey = $existingOption['plan_key'];
|
132 |
-
$planStat = $existingOption['execution_plan'][$planKey]['status'];
|
133 |
-
$log = $existingOption['execution_plan'][$planKey]['log'];
|
134 |
-
|
135 |
-
if($planStat === self::STATUS_DONE) {
|
136 |
-
|
137 |
-
#the execution plan has been executed but some how the status of the migration status is not finished
|
138 |
-
#If a plan is done then migration status must be finished............................................
|
139 |
-
#So we will do nothing but change the migration status finished......................................
|
140 |
-
#though this should never happened...................................................................
|
141 |
-
|
142 |
-
$existingOption['status'] = self::STATUS_FINISHED;
|
143 |
-
|
144 |
-
$log[] = '-- ! Migration status is initiated but execution plan ' .$planKey. ' is finished. This is a potential bug, we are finishing the execution plan at '.date('Y-m-d H:i:s');
|
145 |
-
$log[] = '------------------------------------------------------------------------------';
|
146 |
-
|
147 |
-
$existingOption['execution_plan'][$planKey]['log'] = $log;
|
148 |
-
|
149 |
-
//update_option($optionKey, $existingOption);
|
150 |
-
|
151 |
-
return [
|
152 |
-
'status' => 'success',
|
153 |
-
'log' => $log,
|
154 |
-
];
|
155 |
-
}
|
156 |
-
|
157 |
-
#Execution plan is not finished................
|
158 |
-
#We will execute all the methods from stack....
|
159 |
-
$mtdKey = $existingOption['execution_plan'][$planKey]['executing'];
|
160 |
-
$mtdStat = $existingOption['execution_plan'][$planKey]['progress'][$mtdKey]['status'];
|
161 |
-
|
162 |
-
if($mtdStat == self::STATUS_QUEUED || $mtdStat == self::STATUS_METHOD_PAUSED) {
|
163 |
-
|
164 |
-
$existingOption['execution_plan'][$planKey]['progress'][$mtdKey] = [
|
165 |
-
'status' => self::STATUS_METHOD_EXECUTING,
|
166 |
-
];
|
167 |
-
|
168 |
-
//update_option($optionKey, $existingOption);
|
169 |
-
|
170 |
-
return $this->$mtdKey($optionKey, $planKey, $existingOption);
|
171 |
-
}
|
172 |
-
|
173 |
-
if($mtdStat == self::STATUS_METHOD_EXECUTING) {
|
174 |
-
|
175 |
-
#Someone initiated the method execution, so in this interval we will do nothing.
|
176 |
-
return $log;
|
177 |
-
}
|
178 |
-
|
179 |
-
if($mtdStat == self::STATUS_METHOD_EXECUTED) {
|
180 |
-
|
181 |
-
#the method we were executing and it was finished, now we will enter new method in execution queue.
|
182 |
-
#this method will enter into executed stack...................................................
|
183 |
-
|
184 |
-
$existingOption['execution_plan'][$planKey]['executed'][] = $mtdKey;
|
185 |
-
$existingOption['execution_plan'][$planKey]['executing'] = '';
|
186 |
-
|
187 |
-
if(empty($existingOption['execution_plan'][$planKey]['stack'])) {
|
188 |
-
|
189 |
-
#All the method from call stack has been executed
|
190 |
-
#Now we will finish the plan and the migration...
|
191 |
-
|
192 |
-
$existingOption['status'] = self::STATUS_FINISHED;
|
193 |
-
$existingOption['execution_plan'][$planKey]['status'] = self::STATUS_DONE;
|
194 |
-
//$existingOption['execution_plan'][$planKey]['version'] = $verCache;
|
195 |
-
$existingOption['plan_key'] = '';
|
196 |
-
|
197 |
-
|
198 |
-
$log[] = 'Conversion method '.$mtdKey.' has finished all its conversion and check list.';
|
199 |
-
$log[] = 'Calling stack is finished.';
|
200 |
-
$log[] = 'Execution plan executed and data conversion from '.$verCache['o_from']. ' to '.$verCache['o_to'].' at '.date('Y-m-d H:i:s').'.';
|
201 |
-
$log[] = '...................................................................................';
|
202 |
-
|
203 |
-
$existingOption['execution_plan'][$planKey]['log'] = $log;
|
204 |
-
|
205 |
-
//update_option($optionKey, $existingOption);
|
206 |
-
|
207 |
-
return [
|
208 |
-
'status' => 'success',
|
209 |
-
'log' => $log,
|
210 |
-
];
|
211 |
-
}
|
212 |
-
|
213 |
-
#Call stack is not finished,
|
214 |
-
#So we will queued the next method from stack
|
215 |
-
|
216 |
-
$nx = array_pop($existingOption['execution_plan'][$planKey]['stack']);
|
217 |
-
|
218 |
-
$existingOption['execution_plan'][$planKey]['executing'] = $nx;
|
219 |
-
|
220 |
-
$existingOption['execution_plan'][$planKey]['progress'][$nx] = [
|
221 |
-
'status' => self::STATUS_METHOD_EXECUTING,
|
222 |
-
'check_list' => [],
|
223 |
-
];
|
224 |
-
|
225 |
-
$log[] = '- Conversion method '. $nx . ' entered into queue at '.date('Y-m-d H:i:s').'.';
|
226 |
-
$log[] = '-- Method '. $nx. ' is executing...';
|
227 |
-
|
228 |
-
$existingOption['execution_plan'][$planKey]['log'] = $log;
|
229 |
-
$existingOption['execution_plan'][$planKey]['log'][] = '-- ....';
|
230 |
-
|
231 |
-
//update_option($optionKey, $existingOption);
|
232 |
-
|
233 |
-
return $this->$nx($optionKey, $planKey, $existingOption);
|
234 |
-
}
|
235 |
-
|
236 |
-
return [
|
237 |
-
'status' => 'error',
|
238 |
-
'log' => [
|
239 |
-
'Execution mtdStat error, method undefined.'
|
240 |
-
],
|
241 |
-
];
|
242 |
-
}
|
243 |
-
|
244 |
-
if($existingOption['status'] === self::STATUS_FINISHED) {
|
245 |
-
|
246 |
-
#In scenario could happen like someone initiated plan 001003003_001003004
|
247 |
-
#and now they want to migrate/initiate plan 001003004_001003005..........
|
248 |
-
#........................................................................
|
249 |
-
|
250 |
-
if(empty($existingOption['execution_plan'][$exPKey])) {
|
251 |
-
|
252 |
-
$existingOption['status'] = self::STATUS_INITIATED;
|
253 |
-
$existingOption['plan_key'] = $exPKey;
|
254 |
-
|
255 |
-
$cStack = $this->getCallStacks([], $frm, $trm);
|
256 |
-
|
257 |
-
$existingOption['map'] = $cStack['map'];
|
258 |
-
|
259 |
-
$existingOption['execution_plan'][$exPKey]['status'] = self::STATUS_RUNNING;
|
260 |
-
$existingOption['execution_plan'][$exPKey]['stack'] = $cStack['stack'];
|
261 |
-
$existingOption['execution_plan'][$exPKey]['available'] = $cStack['func'];
|
262 |
-
$existingOption['execution_plan'][$exPKey]['executing'] = '';
|
263 |
-
$existingOption['execution_plan'][$exPKey]['executed'] = [];
|
264 |
-
$existingOption['execution_plan'][$exPKey]['failed'] = [];
|
265 |
-
$existingOption['execution_plan'][$exPKey]['progress'] = [];
|
266 |
-
$existingOption['execution_plan'][$exPKey]['log'] = [];
|
267 |
-
$existingOption['execution_plan'][$exPKey]['version'] = $verCache;
|
268 |
-
|
269 |
-
$existingOption['plan_log'][$exPKey] = 'Execution plan '.$exPKey. ' initiated at '.date('Y-m-d H:i:s'). ' .' . PHP_EOL;
|
270 |
-
|
271 |
-
$log[] = 'Conversion initiated for version '. $versionFrom .' to '. $versionTo. ' at '.date('Y-m-d H:i:s').'.';
|
272 |
-
$log[] = 'Execution plan prepared.';
|
273 |
-
$log[] = 'Execution plan saved into database.';
|
274 |
-
|
275 |
-
|
276 |
-
if(empty($existingOption['execution_plan'][$exPKey]['stack'])) {
|
277 |
-
|
278 |
-
$log[] = '- No Conversion method found for '. $versionFrom .' to '. $versionTo .'';
|
279 |
-
$log[] = '-- exiting the execution plan....';
|
280 |
-
$log[] = 'Calling stack is finished.';
|
281 |
-
$log[] = 'Execution plan executed and data conversion from '.$versionFrom. ' to '.$versionTo.' at '.date('Y-m-d H:i:s').'.';
|
282 |
-
$log[] = '...................................................................................';
|
283 |
-
|
284 |
-
$existingOption['execution_plan'][$exPKey]['status'] = self::STATUS_FINISHED;
|
285 |
-
$existingOption['execution_plan'][$exPKey]['log'] = $log;
|
286 |
-
$existingOption['plan_log'][$exPKey] .= 'Execution plan '.$exPKey. ' finished at '.date('Y-m-d H:i:s'). ' .' . PHP_EOL;
|
287 |
-
$existingOption['status'] = self::STATUS_FINISHED;
|
288 |
-
|
289 |
-
//update_option($optionKey, $existingOption);
|
290 |
-
|
291 |
-
return [
|
292 |
-
'status' => 'success',
|
293 |
-
'log' => $log,
|
294 |
-
];
|
295 |
-
}
|
296 |
-
|
297 |
-
$curExecMethod = array_shift($existingOption['execution_plan'][$exPKey]['stack']);
|
298 |
-
|
299 |
-
$existingOption['execution_plan'][$exPKey]['executing'] = $curExecMethod;
|
300 |
-
$existingOption['execution_plan'][$exPKey]['progress'][$curExecMethod] = [
|
301 |
-
'status' => self::STATUS_QUEUED,
|
302 |
-
'check_list' => [],
|
303 |
-
];
|
304 |
-
|
305 |
-
|
306 |
-
$log[] = 'Execution plan '.$exPKey.' has started at '.date('Y-m-d H:i:s').'.';
|
307 |
-
$log[] = '- Conversion method '. $curExecMethod . ' entered into queue at '.date('Y-m-d H:i:s').'.';
|
308 |
-
$log[] = '-- Method '.$curExecMethod.' is executing....';
|
309 |
-
|
310 |
-
$existingOption['execution_plan'][$exPKey]['log'] = $log;
|
311 |
-
$existingOption['execution_plan'][$exPKey]['log'][] = '-- ....';
|
312 |
-
$existingOption['execution_plan'][$exPKey]['progress'][$curExecMethod]['status'] = self::STATUS_METHOD_EXECUTING;
|
313 |
-
|
314 |
-
//update_option($optionKey, $existingOption);
|
315 |
-
|
316 |
-
return $this->$curExecMethod($optionKey, $exPKey, $existingOption);
|
317 |
-
//return $existingOption;
|
318 |
-
}
|
319 |
-
|
320 |
-
|
321 |
-
#This is the scenario where migration status is finished
|
322 |
-
#and there are also configuration with execution plan
|
323 |
-
#.......................................................
|
324 |
-
|
325 |
-
#Now execution plan could be finished
|
326 |
-
#that means user already migrated version $from to $to [e.g 1.3.4 to 1.3.5]
|
327 |
-
#and they again trying to migrate same version to version
|
328 |
-
#..........................................................................
|
329 |
-
if($existingOption['execution_plan'][$exPKey]['status'] === self::STATUS_DONE) {
|
330 |
-
|
331 |
-
return [
|
332 |
-
'status' => 'success',
|
333 |
-
'log' => $existingOption['execution_plan'][$exPKey]['log'],
|
334 |
-
];
|
335 |
-
}
|
336 |
-
|
337 |
-
#In no scenario this should happened, only when there is a mistake from programmer or corrupt data.
|
338 |
-
|
339 |
-
return [
|
340 |
-
'status' => 'error',
|
341 |
-
'log' => [
|
342 |
-
'Could not act on given request. Logical flow detected.'
|
343 |
-
],
|
344 |
-
];
|
345 |
-
}
|
346 |
-
|
347 |
-
|
348 |
-
return [
|
349 |
-
'status' => 'error',
|
350 |
-
'log' => [
|
351 |
-
'Exiting...data is corrupted.'
|
352 |
-
],
|
353 |
-
];
|
354 |
-
}
|
355 |
-
|
356 |
-
|
357 |
-
/**
|
358 |
-
*
|
359 |
-
* @param array $data
|
360 |
-
*/
|
361 |
-
public function output(array $data) {
|
362 |
-
|
363 |
-
if(!empty($data['option'])) {
|
364 |
-
|
365 |
-
foreach($data['option'] as $opKey => $opVal) {
|
366 |
-
|
367 |
-
update_option($opKey, $opVal);
|
368 |
-
}
|
369 |
-
}
|
370 |
-
}
|
371 |
-
|
372 |
-
|
373 |
-
/**
|
374 |
-
*
|
375 |
-
* @param $versionMap
|
376 |
-
* @param $frm
|
377 |
-
* @param $trm
|
378 |
-
*
|
379 |
-
* @return array
|
380 |
-
*/
|
381 |
-
private function getCallStacks($versionMap, $frm, $trm) {
|
382 |
-
|
383 |
-
$callStack = [];
|
384 |
-
$conversionMethods = [];
|
385 |
-
$methods = get_class_methods($this);
|
386 |
-
|
387 |
-
foreach($methods as $method) {
|
388 |
-
|
389 |
-
if(substr($method, 0, 13) === 'convert_from_') {
|
390 |
-
|
391 |
-
$conversionMethods[] = $method;
|
392 |
-
|
393 |
-
$tmp = str_replace('convert_from_', '', $method);
|
394 |
-
$tmp = explode('_to_', $tmp);
|
395 |
-
|
396 |
-
$vl = $this->makeFullVersionKey($tmp[0]);
|
397 |
-
$vh = $this->makeFullVersionKey($tmp[1]);
|
398 |
-
|
399 |
-
$versionMap[$vl] = $tmp[0];
|
400 |
-
$versionMap[$vh] = $tmp[1];
|
401 |
-
}
|
402 |
-
}
|
403 |
-
|
404 |
-
|
405 |
-
ksort($versionMap);
|
406 |
-
|
407 |
-
foreach($versionMap as $k => $v) {
|
408 |
-
|
409 |
-
if($k >= $frm && $k < $trm) {
|
410 |
-
|
411 |
-
$fnc = '';
|
412 |
-
|
413 |
-
foreach($conversionMethods as $conversionMethod) {
|
414 |
-
|
415 |
-
if(strpos($conversionMethod, 'convert_from_'.$v) !== false) {
|
416 |
-
|
417 |
-
$fnc = $conversionMethod;
|
418 |
-
|
419 |
-
break;
|
420 |
-
}
|
421 |
-
}
|
422 |
-
|
423 |
-
if(!empty($fnc)) {
|
424 |
-
$callStack[] = $fnc;
|
425 |
-
}
|
426 |
-
}
|
427 |
-
}
|
428 |
-
|
429 |
-
return [
|
430 |
-
'map' => $versionMap,
|
431 |
-
'func' => $conversionMethods,
|
432 |
-
'stack' => $callStack,
|
433 |
-
];
|
434 |
-
}
|
435 |
-
|
436 |
-
/**
|
437 |
-
*
|
438 |
-
* @param $string
|
439 |
-
*
|
440 |
-
* @return string
|
441 |
-
*/
|
442 |
-
public function makeFullVersionKey($string) {
|
443 |
-
|
444 |
-
$fr = explode('_', $string);
|
445 |
-
|
446 |
-
$frm = array_map(function($item){
|
447 |
-
return str_pad($item, 3, '0', STR_PAD_LEFT);
|
448 |
-
}, $fr);
|
449 |
-
|
450 |
-
return implode('', $frm);
|
451 |
-
}
|
452 |
-
|
453 |
-
|
454 |
-
public static function ddd() {
|
455 |
-
|
456 |
-
$args = func_get_args();
|
457 |
-
|
458 |
-
if(empty($args)) die('No argument passed........');
|
459 |
-
|
460 |
-
foreach($args as $arg) {
|
461 |
-
|
462 |
-
echo '<pre>';
|
463 |
-
|
464 |
-
if(is_array($arg)) {
|
465 |
-
|
466 |
-
print_r($arg);
|
467 |
-
|
468 |
-
} elseif(is_object($arg)) {
|
469 |
-
|
470 |
-
var_dump($arg);
|
471 |
-
|
472 |
-
} else {
|
473 |
-
|
474 |
-
var_dump($arg);
|
475 |
-
}
|
476 |
-
}
|
477 |
-
|
478 |
-
echo '</pre>';
|
479 |
-
|
480 |
-
die('Exiting....all arguments are dumped!');
|
481 |
-
}
|
482 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xs_migration/Migration.php
DELETED
@@ -1,307 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace MetForm\XsMigration;
|
4 |
-
|
5 |
-
|
6 |
-
class Migration extends DataMigration {
|
7 |
-
|
8 |
-
|
9 |
-
/**
|
10 |
-
*
|
11 |
-
* @param $wpOptionKey
|
12 |
-
* @param $executionPlanKey
|
13 |
-
* @param $existingOption
|
14 |
-
*
|
15 |
-
* @return array
|
16 |
-
*/
|
17 |
-
public function convert_from_1_1_4_to_1_1_5($wpOptionKey, $executionPlanKey, $existingOption) {
|
18 |
-
|
19 |
-
$log = $existingOption['execution_plan'][$executionPlanKey]['log'];
|
20 |
-
|
21 |
-
return [
|
22 |
-
'status' => 'success',
|
23 |
-
'log' => $log,
|
24 |
-
];
|
25 |
-
}
|
26 |
-
|
27 |
-
|
28 |
-
/**
|
29 |
-
*
|
30 |
-
* @param $wpOptionKey
|
31 |
-
* @param $executionPlanKey
|
32 |
-
* @param $existingOption
|
33 |
-
*
|
34 |
-
* @return array
|
35 |
-
*/
|
36 |
-
public function convert_from_1_1_5_to_1_1_6($wpOptionKey, $executionPlanKey, $existingOption) {
|
37 |
-
|
38 |
-
$log = $existingOption['execution_plan'][$executionPlanKey]['log'];
|
39 |
-
|
40 |
-
return [
|
41 |
-
'status' => 'success',
|
42 |
-
'log' => $log,
|
43 |
-
];
|
44 |
-
}
|
45 |
-
|
46 |
-
|
47 |
-
/**
|
48 |
-
*
|
49 |
-
* @param $wpOptionKey
|
50 |
-
* @param $executionPlanKey
|
51 |
-
* @param $existingOption
|
52 |
-
*
|
53 |
-
* @return array
|
54 |
-
*/
|
55 |
-
public function convert_from_1_1_6_to_1_1_7($wpOptionKey, $executionPlanKey, $existingOption) {
|
56 |
-
|
57 |
-
$log = $existingOption['execution_plan'][$executionPlanKey]['log'];
|
58 |
-
|
59 |
-
return [
|
60 |
-
'status' => 'success',
|
61 |
-
'log' => $log,
|
62 |
-
];
|
63 |
-
}
|
64 |
-
|
65 |
-
|
66 |
-
/**
|
67 |
-
*
|
68 |
-
* @param $wpOptionKey
|
69 |
-
* @param $executionPlanKey
|
70 |
-
* @param $existingOption
|
71 |
-
*
|
72 |
-
* @return array
|
73 |
-
*/
|
74 |
-
public function convert_from_1_1_7_to_1_1_8($wpOptionKey, $executionPlanKey, $existingOption) {
|
75 |
-
|
76 |
-
$log = $existingOption['execution_plan'][$executionPlanKey]['log'];
|
77 |
-
|
78 |
-
return [
|
79 |
-
'status' => 'success',
|
80 |
-
'log' => $log,
|
81 |
-
];
|
82 |
-
}
|
83 |
-
|
84 |
-
|
85 |
-
/**
|
86 |
-
*
|
87 |
-
* @param $wpOptionKey
|
88 |
-
* @param $executionPlanKey
|
89 |
-
* @param $existingOption
|
90 |
-
*
|
91 |
-
* @return array
|
92 |
-
*/
|
93 |
-
public function convert_from_1_1_8_to_1_1_9($wpOptionKey, $executionPlanKey, $existingOption) {
|
94 |
-
|
95 |
-
$log = $existingOption['execution_plan'][$executionPlanKey]['log'];
|
96 |
-
|
97 |
-
return [
|
98 |
-
'status' => 'success',
|
99 |
-
'log' => $log,
|
100 |
-
];
|
101 |
-
}
|
102 |
-
|
103 |
-
|
104 |
-
/**
|
105 |
-
*
|
106 |
-
* @param $wpOptionKey
|
107 |
-
* @param $executionPlanKey
|
108 |
-
* @param $existingOption
|
109 |
-
*
|
110 |
-
* @return array
|
111 |
-
*/
|
112 |
-
public function convert_from_1_1_9_to_1_2_0($wpOptionKey, $executionPlanKey, $existingOption) {
|
113 |
-
|
114 |
-
$log = $existingOption['execution_plan'][$executionPlanKey]['log'];
|
115 |
-
|
116 |
-
return [
|
117 |
-
'status' => 'success',
|
118 |
-
'log' => $log,
|
119 |
-
];
|
120 |
-
}
|
121 |
-
|
122 |
-
|
123 |
-
/**
|
124 |
-
*
|
125 |
-
* @param $wpOptionKey
|
126 |
-
* @param $executionPlanKey
|
127 |
-
* @param $existingOption
|
128 |
-
*
|
129 |
-
* @return array
|
130 |
-
*/
|
131 |
-
public function convert_from_1_2_0_to_1_2_1($wpOptionKey, $executionPlanKey, $existingOption) {
|
132 |
-
|
133 |
-
$log = $existingOption['execution_plan'][$executionPlanKey]['log'];
|
134 |
-
|
135 |
-
|
136 |
-
$checkList = $existingOption['execution_plan'][$executionPlanKey]['progress'][__FUNCTION__]['check_list'];
|
137 |
-
$weightLifted = 0; #this value will be the programmers intuition, our goal is to not to give work more than 10 seconds
|
138 |
-
|
139 |
-
if(empty($checkList)) {
|
140 |
-
|
141 |
-
$checkList['option_updated'] = false;
|
142 |
-
$checkList['form_data_processed'] = false;
|
143 |
-
|
144 |
-
$existingOption['execution_plan'][$executionPlanKey]['progress'][__FUNCTION__]['check_list'] = $checkList;
|
145 |
-
}
|
146 |
-
|
147 |
-
|
148 |
-
if($checkList['option_updated'] === false) {
|
149 |
-
|
150 |
-
$opt = $this->prepareOption_1_2_0_to_1_2_1();
|
151 |
-
|
152 |
-
if(!empty($opt)) {
|
153 |
-
|
154 |
-
foreach($opt as $opKey => $opVal) {
|
155 |
-
|
156 |
-
//update_option($opKey, $opVal);
|
157 |
-
}
|
158 |
-
}
|
159 |
-
|
160 |
-
$weightLifted += 30; # AR: feeling it may take 3 seconds to return the result so putting 3*10 = 30;
|
161 |
-
|
162 |
-
$checkList['option_updated'] = true;
|
163 |
-
|
164 |
-
$existingOption['execution_plan'][$executionPlanKey]['progress'][__FUNCTION__]['check_list'] = $checkList;
|
165 |
-
}
|
166 |
-
|
167 |
-
|
168 |
-
global $wpdb;
|
169 |
-
|
170 |
-
$postTypes = 'metform-form';
|
171 |
-
|
172 |
-
|
173 |
-
return [
|
174 |
-
'status' => 'success',
|
175 |
-
'log' => $log,
|
176 |
-
];
|
177 |
-
}
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
private function prepareOption_1_2_0_to_1_2_1() {
|
184 |
-
|
185 |
-
global $wpdb;
|
186 |
-
|
187 |
-
$postTypes = 'metform-form';
|
188 |
-
|
189 |
-
#read all forms and acquire the settings
|
190 |
-
$postIds = get_posts(
|
191 |
-
array(
|
192 |
-
'post_type' => $postTypes,
|
193 |
-
'numberposts' => -1, // get all posts.
|
194 |
-
'fields' => 'ids', // Only get post IDs
|
195 |
-
)
|
196 |
-
);
|
197 |
-
|
198 |
-
#Retrieving post meta...................
|
199 |
-
$qry = 'SELECT * FROM `'.$wpdb->postmeta.'` WHERE `meta_key`="metform_form__form_setting" AND `post_id` IN ('.implode(',', $postIds).') ;';
|
200 |
-
|
201 |
-
$rows = $wpdb->get_results($qry, ARRAY_A);
|
202 |
-
|
203 |
-
$newStructureOptions = [
|
204 |
-
'metform_option__settings' => [
|
205 |
-
'mf_recaptcha_version' => '',
|
206 |
-
'mf_recaptcha_site_key' => '',
|
207 |
-
'mf_recaptcha_secret_key' => '',
|
208 |
-
'mf_recaptcha_site_key_v3' => '',
|
209 |
-
'mf_recaptcha_secret_key_v3' => '',
|
210 |
-
'mf_mailchimp_api_key' => '',
|
211 |
-
],
|
212 |
-
];
|
213 |
-
|
214 |
-
foreach($rows as $row) {
|
215 |
-
|
216 |
-
if(!empty($row['mf_recaptcha_site_key'])) {
|
217 |
-
|
218 |
-
$newStructureOptions['metform_option__settings']['mf_recaptcha_site_key'] = $row['mf_recaptcha_site_key'];
|
219 |
-
$newStructureOptions['metform_option__settings']['mf_recaptcha_secret_key'] = $row['mf_recaptcha_secret_key'];
|
220 |
-
$newStructureOptions['metform_option__settings']['mf_recaptcha_version'] = 'recaptcha-v2';
|
221 |
-
}
|
222 |
-
|
223 |
-
if(!empty($row['mf_mailchimp_api_key'])) {
|
224 |
-
|
225 |
-
$newStructureOptions['metform_option__settings']['mf_mailchimp_api_key'] = $row['mf_mailchimp_api_key'];
|
226 |
-
}
|
227 |
-
}
|
228 |
-
|
229 |
-
|
230 |
-
return [
|
231 |
-
'option' => $newStructureOptions,
|
232 |
-
];
|
233 |
-
|
234 |
-
}
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
/**
|
253 |
-
*
|
254 |
-
* @return array
|
255 |
-
*/
|
256 |
-
public function convert_1_1_9_to_1_2_0() {
|
257 |
-
|
258 |
-
global $wpdb;
|
259 |
-
|
260 |
-
$postTypes = 'metform-form';
|
261 |
-
|
262 |
-
#read all forms and acquire the settings
|
263 |
-
$postIds = get_posts(
|
264 |
-
array(
|
265 |
-
'post_type' => $postTypes,
|
266 |
-
'numberposts' => -1, // get all posts.
|
267 |
-
'fields' => 'ids', // Only get post IDs
|
268 |
-
)
|
269 |
-
);
|
270 |
-
|
271 |
-
#Retrieving post meta...................
|
272 |
-
$qry = 'SELECT * FROM `'.$wpdb->postmeta.'` WHERE `meta_key`="metform_form__form_setting" AND `post_id` IN ('.implode(',', $postIds).') ;';
|
273 |
-
|
274 |
-
$rows = $wpdb->get_results($qry, ARRAY_A);
|
275 |
-
|
276 |
-
$newStructureOptions = [
|
277 |
-
'metform_option__settings' => [
|
278 |
-
'mf_recaptcha_version' => '',
|
279 |
-
'mf_recaptcha_site_key' => '',
|
280 |
-
'mf_recaptcha_secret_key' => '',
|
281 |
-
'mf_recaptcha_site_key_v3' => '',
|
282 |
-
'mf_recaptcha_secret_key_v3' => '',
|
283 |
-
'mf_mailchimp_api_key' => '',
|
284 |
-
],
|
285 |
-
];
|
286 |
-
|
287 |
-
foreach($rows as $row) {
|
288 |
-
|
289 |
-
if(!empty($row['mf_recaptcha_site_key'])) {
|
290 |
-
|
291 |
-
$newStructureOptions['metform_option__settings']['mf_recaptcha_site_key'] = $row['mf_recaptcha_site_key'];
|
292 |
-
$newStructureOptions['metform_option__settings']['mf_recaptcha_secret_key'] = $row['mf_recaptcha_secret_key'];
|
293 |
-
$newStructureOptions['metform_option__settings']['mf_recaptcha_version'] = 'recaptcha-v2';
|
294 |
-
}
|
295 |
-
|
296 |
-
if(!empty($row['mf_mailchimp_api_key'])) {
|
297 |
-
|
298 |
-
$newStructureOptions['metform_option__settings']['mf_mailchimp_api_key'] = $row['mf_mailchimp_api_key'];
|
299 |
-
}
|
300 |
-
}
|
301 |
-
|
302 |
-
|
303 |
-
return [
|
304 |
-
'option' => $newStructureOptions,
|
305 |
-
];
|
306 |
-
}
|
307 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xs_migration/MigrationContract.php
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace MetForm\XsMigration;
|
4 |
-
|
5 |
-
|
6 |
-
interface MigrationContract {
|
7 |
-
|
8 |
-
public function input($txtDomain, $versionFrom, $versionTo);
|
9 |
-
|
10 |
-
public function output(array $data);
|
11 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|