Version Description
- 28-05-2018 =
- Fix - Google reCaptcha check with its own server.
- Fix - Switch to cloned field options after cloning.
- Fix - Hidden row design on last form field deletion.
- Fix - Failed draggable fields being hidden in form builder.
- Fix - Toggle and tooltip initialize if the field is new one.
Download this release
Release Info
Developer | wpeverest |
Plugin | Everest Forms – Easy Contact Form and Form Builder |
Version | 1.1.7 |
Comparing to | |
See all releases |
Code changes from version 1.1.6 to 1.1.7
- assets/js/admin/everest-panel-builder.js +78 -39
- assets/js/admin/everest-panel-builder.min.js +1 -1
- everest-forms.php +1 -1
- includes/class-everest-forms.php +1 -1
- includes/class-evf-form-task.php +21 -10
- languages/everest-forms.pot +13 -9
- readme.txt +8 -1
assets/js/admin/everest-panel-builder.js
CHANGED
@@ -422,12 +422,14 @@
|
|
422 |
newFieldCloned.find('.label-title .text').text(new_field_label);
|
423 |
field.closest( '.evf-admin-grid' ).find( '[data-field-id="' + old_key + '"]' ).after( newFieldCloned );
|
424 |
$(document).trigger('everest-form-cloned', [ new_key, field_type ]);
|
|
|
425 |
},
|
426 |
bindFieldDelete: function () {
|
427 |
$( 'body' ).on('click', '.everest-forms-preview .everest-forms-field .everest-forms-field-delete', function () {
|
428 |
var $field = $( this ).closest( '.everest-forms-field' );
|
429 |
var field_id = $field.attr('data-field-id');
|
430 |
var option_field = $( '#everest-forms-field-option-' + field_id );
|
|
|
431 |
|
432 |
if ( $field.hasClass( 'no-delete' ) ) {
|
433 |
$.alert({
|
@@ -462,6 +464,9 @@
|
|
462 |
$field.remove();
|
463 |
option_field.remove();
|
464 |
});
|
|
|
|
|
|
|
465 |
}
|
466 |
},
|
467 |
cancel: {
|
@@ -473,19 +478,39 @@
|
|
473 |
});
|
474 |
},
|
475 |
bindSaveOption: function () {
|
476 |
-
$( 'body' ).on('click', '.evf_save_form_action_button', function () {
|
477 |
var $this = $(this);
|
478 |
var form = $('form#everest-forms-builder-form');
|
479 |
var structure = EVFPanelBuilder.getStructure();
|
480 |
-
|
481 |
var form_data = form.serializeArray();
|
482 |
|
483 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
484 |
|
|
|
485 |
var data = {
|
486 |
action: 'everest_forms_save_form',
|
487 |
security: evf_data.evf_save_form,
|
488 |
-
form_data: JSON.stringify(new_form_data)
|
489 |
};
|
490 |
var $wrapper = $('#everest-forms-builder');
|
491 |
$.ajax({
|
@@ -687,22 +712,33 @@
|
|
687 |
$('.evf-admin-field-wrapper').removeClass('evf-hover');
|
688 |
}
|
689 |
});
|
690 |
-
|
|
|
691 |
connectToSortable: '.evf-admin-grid',
|
692 |
containment: '#everest-forms-builder',
|
693 |
helper: 'clone',
|
694 |
-
revert: 'invalid',
|
695 |
cancel: false,
|
696 |
-
|
697 |
-
|
|
|
|
|
|
|
|
|
698 |
},
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
706 |
}
|
707 |
}).disableSelection();
|
708 |
},
|
@@ -753,10 +789,10 @@
|
|
753 |
var field_type = field.attr('data-field-type');
|
754 |
field.css({
|
755 |
'width': '100%',
|
756 |
-
'left': '0'
|
757 |
});
|
758 |
|
759 |
-
field.append('<i class="spinner is-active" style="margin: 0;padding: 0;"></i>');
|
760 |
|
761 |
var data = {
|
762 |
action: 'everest_forms_new_field_' + field_type,
|
@@ -764,25 +800,26 @@
|
|
764 |
field_type: field_type,
|
765 |
form_id: evf_data.form_id
|
766 |
};
|
|
|
767 |
$.ajax({
|
768 |
url: evf_data.ajax_url,
|
769 |
data: data,
|
770 |
type: 'POST',
|
771 |
beforeSend: function () {
|
772 |
-
|
773 |
},
|
774 |
-
success: function
|
775 |
var field_preview = response.data.preview;
|
776 |
var field_options = response.data.options;
|
777 |
var form_field_id = response.data.form_field_id;
|
778 |
-
$('#everest-forms-field-id').val(form_field_id);
|
779 |
-
$('.everest-forms-field-options').find('.no-fields').hide();
|
780 |
-
$('.everest-forms-field-options').append(field_options);
|
781 |
-
field.after(field_preview);
|
782 |
field.remove();
|
783 |
EVFPanelBuilder.checkEmptyGrid();
|
784 |
-
|
785 |
-
|
786 |
}
|
787 |
});
|
788 |
},
|
@@ -851,19 +888,21 @@ jQuery( function ( $ ) {
|
|
851 |
});
|
852 |
|
853 |
// Fields Options - Open/close.
|
854 |
-
$(
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
|
|
863 |
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
|
|
869 |
});
|
422 |
newFieldCloned.find('.label-title .text').text(new_field_label);
|
423 |
field.closest( '.evf-admin-grid' ).find( '[data-field-id="' + old_key + '"]' ).after( newFieldCloned );
|
424 |
$(document).trigger('everest-form-cloned', [ new_key, field_type ]);
|
425 |
+
EVFPanelBuilder.switchToFieldOptionPanel(new_key);//switch to cloned field options
|
426 |
},
|
427 |
bindFieldDelete: function () {
|
428 |
$( 'body' ).on('click', '.everest-forms-preview .everest-forms-field .everest-forms-field-delete', function () {
|
429 |
var $field = $( this ).closest( '.everest-forms-field' );
|
430 |
var field_id = $field.attr('data-field-id');
|
431 |
var option_field = $( '#everest-forms-field-option-' + field_id );
|
432 |
+
var grid = $( this ).closest( '.evf-admin-grid' );
|
433 |
|
434 |
if ( $field.hasClass( 'no-delete' ) ) {
|
435 |
$.alert({
|
464 |
$field.remove();
|
465 |
option_field.remove();
|
466 |
});
|
467 |
+
if( grid.children().length === 1 ) {
|
468 |
+
grid.addClass( 'evf-empty-grid' );
|
469 |
+
}
|
470 |
}
|
471 |
},
|
472 |
cancel: {
|
478 |
});
|
479 |
},
|
480 |
bindSaveOption: function () {
|
481 |
+
$( 'body' ).on( 'click', '.evf_save_form_action_button', function () {
|
482 |
var $this = $(this);
|
483 |
var form = $('form#everest-forms-builder-form');
|
484 |
var structure = EVFPanelBuilder.getStructure();
|
|
|
485 |
var form_data = form.serializeArray();
|
486 |
|
487 |
+
/* db unwanted data erase start */
|
488 |
+
var rfields_ids = [];
|
489 |
+
$( '.everest-forms-field[data-field-id]' ).each( function() {
|
490 |
+
rfields_ids.push( $( this ).attr( 'data-field-id' ) );
|
491 |
+
});
|
492 |
+
|
493 |
+
var form_data_length = form_data.length;
|
494 |
+
while ( form_data_length-- ) {
|
495 |
+
if ( form_data[ form_data_length ].name.startsWith( 'form_fields' ) ) {
|
496 |
+
var idflag = false;
|
497 |
+
rfields_ids.forEach( function( element ) {
|
498 |
+
if ( form_data[ form_data_length ].name.startsWith( 'form_fields[' + element + ']' ) ) {
|
499 |
+
idflag = true;
|
500 |
+
}
|
501 |
+
});
|
502 |
+
if ( form_data_length > -1 && idflag === false ) {
|
503 |
+
form_data.splice( form_data_length, 1 );
|
504 |
+
}
|
505 |
+
}
|
506 |
+
}
|
507 |
+
/* fix end */
|
508 |
|
509 |
+
var new_form_data = form_data.concat(structure);
|
510 |
var data = {
|
511 |
action: 'everest_forms_save_form',
|
512 |
security: evf_data.evf_save_form,
|
513 |
+
form_data: JSON.stringify( new_form_data )
|
514 |
};
|
515 |
var $wrapper = $('#everest-forms-builder');
|
516 |
$.ajax({
|
712 |
$('.evf-admin-field-wrapper').removeClass('evf-hover');
|
713 |
}
|
714 |
});
|
715 |
+
|
716 |
+
$( '.evf-registered-buttons button.evf-registered-item' ).draggable({
|
717 |
connectToSortable: '.evf-admin-grid',
|
718 |
containment: '#everest-forms-builder',
|
719 |
helper: 'clone',
|
|
|
720 |
cancel: false,
|
721 |
+
scroll: false,
|
722 |
+
delay: 200,
|
723 |
+
opacity: 0.75,
|
724 |
+
start: function( event, ui ) {
|
725 |
+
$( '.evf-admin-grid' ).addClass( 'evf-hover' );
|
726 |
+
$( this ).data( 'uihelper', ui.helper );
|
727 |
},
|
728 |
+
revert: function( value ){
|
729 |
+
var uiHelper = ( this ).data( 'uihelper' );
|
730 |
+
uiHelper.data( 'dropped', value !== false );
|
731 |
+
if( value === false ) {
|
732 |
+
return true;
|
733 |
+
}
|
734 |
+
return false;
|
735 |
+
},
|
736 |
+
stop: function( event, ui ) {
|
737 |
+
if( ui.helper.data( 'dropped' ) === true ) {
|
738 |
+
$( '.evf-admin-grid' ).removeClass( 'evf-hover' );
|
739 |
+
var helper = ui.helper;
|
740 |
+
EVFPanelBuilder.fieldDrop( helper );
|
741 |
+
}
|
742 |
}
|
743 |
}).disableSelection();
|
744 |
},
|
789 |
var field_type = field.attr('data-field-type');
|
790 |
field.css({
|
791 |
'width': '100%',
|
792 |
+
'left': '0'
|
793 |
});
|
794 |
|
795 |
+
field.append( '<i class="spinner is-active" style="margin: 0;padding: 0;"></i>' );
|
796 |
|
797 |
var data = {
|
798 |
action: 'everest_forms_new_field_' + field_type,
|
800 |
field_type: field_type,
|
801 |
form_id: evf_data.form_id
|
802 |
};
|
803 |
+
|
804 |
$.ajax({
|
805 |
url: evf_data.ajax_url,
|
806 |
data: data,
|
807 |
type: 'POST',
|
808 |
beforeSend: function () {
|
809 |
+
$( document.body ).trigger( 'init_fields_toogle' );
|
810 |
},
|
811 |
+
success: function( response ) {
|
812 |
var field_preview = response.data.preview;
|
813 |
var field_options = response.data.options;
|
814 |
var form_field_id = response.data.form_field_id;
|
815 |
+
$( '#everest-forms-field-id' ).val( form_field_id );
|
816 |
+
$( '.everest-forms-field-options' ).find( '.no-fields' ).hide();
|
817 |
+
$( '.everest-forms-field-options' ).append( field_options );
|
818 |
+
field.after( field_preview );
|
819 |
field.remove();
|
820 |
EVFPanelBuilder.checkEmptyGrid();
|
821 |
+
$( document.body ).trigger( 'init_tooltips' );
|
822 |
+
$( document.body ).trigger( 'init_fields_toogle' );
|
823 |
}
|
824 |
});
|
825 |
},
|
888 |
});
|
889 |
|
890 |
// Fields Options - Open/close.
|
891 |
+
$( document.body ).on( 'init_fields_toogle', function() {
|
892 |
+
$( '.everest-forms-field-option' ).on( 'click', '.everest-forms-field-option-group > a', function( event ) {
|
893 |
+
event.preventDefault();
|
894 |
+
$( this ).parent( '.everest-forms-field-option-group' ).toggleClass( 'closed' ).toggleClass( 'open' );
|
895 |
+
});
|
896 |
+
$( '.everest-forms-field-option' ).on( 'click', '.everest-forms-field-option-group a', function( event ) {
|
897 |
+
// If the user clicks on some form input inside, the box should not be toggled.
|
898 |
+
if ( $( event.target ).filter( ':input, option, .sort' ).length ) {
|
899 |
+
return;
|
900 |
+
}
|
901 |
|
902 |
+
$( this ).next( '.everest-forms-field-option-group-inner' ).stop().slideToggle();
|
903 |
+
});
|
904 |
+
$( '.everest-forms-field-option-group.closed' ).each( function() {
|
905 |
+
$( this ).find( '.everest-forms-field-option-group-inner' ).hide();
|
906 |
+
});
|
907 |
+
} ).trigger( 'init_fields_toogle' );
|
908 |
});
|
assets/js/admin/everest-panel-builder.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(f,c){var s={init:function(){f(document).ready(s.ready),f(window).on("load",s.load),s.bindUI()},ready:function(){jconfirm.defaults={closeIcon:!0,backgroundDismiss:!0,escapeKey:!0,animationBounce:1,useBootstrap:!1,theme:"modern",boxWidth:"400px",columnClass:"evf-responsive-class"},f(document).trigger("everest_forms_ready")},load:function(){},bindUI:function(){s.bindDefaultTabs(),s.checkEmptyGrid(),s.bindFields(),s.bindFormPreview(),s.bindGridSwitcher(),s.bindFieldSettings(),s.bindFieldDelete(),s.bindCloneField(),s.bindSaveOption(),s.bindFieldOptionChange(),s.bindAddNewRow(),s.bindRemoveRow(),s.bindFormSettings(),s.choicesInit(),s.choicesUpdate(),"field-options"===c.tab&&f(".evf-panel-field-options-button").trigger("click")},choicesInit:function(){var e=f(".evf-choices-list");e.sortable({out:function(e,i){var t=f(e.target).attr("data-field-id");s.choiceChange(t)}});var i=e.closest(".everest-forms-field-option").attr("data-field-id");f("#everest-forms-field-"+i)},choicesUpdate:function(){f(".evf-choices-list");f("body").on("click",".evf-choices-list a.add",function(){var e=f(this).closest("li").clone();e.find('input[type="text"]').val("");var i=f(this).closest(".evf-choices-list"),t=i.attr("data-field-id"),n=i.find("li").length;n++,e.find('input[type="checkbox"],input[type="radio"]').prop("checked",!1),e.attr("data-key",n),e.find(".default").attr("name","form_fields["+t+"][choices]["+n+"][default]"),e.find(".label").attr("name","form_fields["+t+"][choices]["+n+"][label]"),e.find(".value").attr("name","form_fields["+t+"][choices]["+n+"][value]"),f(this).closest("li").after(e),s.choiceChange(t)}),f("body").on("click",".evf-choices-list a.remove",function(){var e=f(this).closest(".evf-choices-list"),i=e.attr("data-field-id");e.find("li").length<2?f.alert({title:!1,content:c.i18n_field_error_choice,icon:"dashicons dashicons-info",type:"blue",buttons:{ok:{text:c.i18n_ok,btnClass:"btn-confirm",keys:["enter"]}}}):(f(this).closest("li").remove(),s.choiceChange(i))});f("body").on("keyup paste click",".evf-choices-list input",function(){var e=f(this).closest(".evf-choices-list").attr("data-field-id");"radio"===f(this).attr("type").toLowerCase()&&f(this).is(":checked")&&(f(this).closest(".evf-choices-list").find('input[type="radio"]').prop("checked",!1),f(this).prop("checked",!0)),s.choiceChange(e)})},choiceChange:function(e){var i=f("#everest-forms-field-option-row-"+e+"-choices"),t=f("#everest-forms-field-"+e),n=t.find("ul.primary-input"),o=i.find("ul.evf-choices-list").attr("data-field-type");"select"===o&&(n=t.find("select.primary-input")),n.html(""),f.each(i.find("ul.evf-choices-list").find("li"),function(){var e=f(this).find(".default").attr("type"),i=f("<li/>").append('<input type="'+e+'" disabled="">');"select"===o&&(i=f("<option/>"),f(this).find(".default").is(":checked")&&i.attr("selected","selected")),i.append(f(this).find(".label").val()),f(this).find(".default").is(":checked")&&i.find("input").prop("checked",!0),n.append(i)})},bindFormSettings:function(){f("body").on("click",".evf-setting-panel",function(e){var i=f(this).attr("data-section");f(".evf-setting-panel").removeClass("active"),f(".evf-content-section").removeClass("active"),f(this).addClass("active"),f(".evf-content-"+i+"-settings").addClass("active"),e.preventDefault()}),f(".evf-setting-panel").eq(0).trigger("click")},removeRow:function(e){f.each(e.find(".everest-forms-field"),function(){var e=f(this),i=e.attr("data-field-id"),t=f("#everest-forms-field-option-"+i);e.remove(),t.remove()}),e.remove()},bindRemoveRow:function(){f("body").on("click",".evf-delete-row",function(){var e=f(this).closest(".evf-admin-row");f(".evf-admin-row").length<2?f.alert({title:c.i18n_row_locked,content:c.i18n_row_locked_msg,icon:"dashicons dashicons-info",type:"blue",buttons:{confirm:{text:c.i18n_close,btnClass:"btn-confirm",keys:["enter"]}}}):f.confirm({title:!1,content:c.i18n_delete_row_confirm,type:"red",closeIcon:!1,backgroundDismiss:!1,icon:"dashicons dashicons-warning",buttons:{confirm:{text:c.i18n_ok,btnClass:"btn-confirm",keys:["enter"],action:function(){s.removeRow(e)}},cancel:{text:c.i18n_cancel}}})})},bindAddNewRow:function(){f("body").on("click",".evf-add-row span",function(){var e=f(".evf-admin-row").eq(0).clone(),i=f(".evf-admin-row").length;e.find(".evf-admin-grid").html(""),e.attr("data-row-id",i+1),f(".evf-admin-field-wrapper").append(e),s.bindFields(),s.checkEmptyGrid()})},bindFieldOptionChange:function(){f("body").on("keyup paste click",'.everest-forms-field-option-row input[type="text"][name$="[label]"], .everest-forms-field-option-row textarea[name$="[description]"], .everest-forms-field-option-row input[type="checkbox"][name$="[required]"], .everest-forms-field-option-row input[type="checkbox"][name$="[label_hide]"], .everest-forms-field-option-row input[type="text"][name$="[placeholder]"]',function(){s.bindFormFieldChange(f(this))})},bindFormFieldChange:function(e){var i=e.closest(".everest-forms-field-option-row").attr("data-field-id"),t=f(".evf-admin-grid #everest-forms-field-"+i+".active"),n=e.attr("id");if("undefined"!==n&&n!==undefined)switch(n=n.replace("everest-forms-field-option-"+i+"-","")){case"label":t.find(".label-title .text").text(e.val());break;case"description":t.find(".description").html(e.val());break;case"required":e.is(":checked")?(t.find(".label-title .required").remove(),t.find(".label-title").append('<span class="required">*</span>')):t.find(".label-title .required").remove();break;case"label_hide":e.is(":checked")?t.find(".label-title").hide():t.find(".label-title").show();break;case"placeholder":t.find("input").attr("placeholder",e.val())}},bindCloneField:function(){f("body").on("click",".everest-forms-preview .everest-forms-field .everest-forms-field-duplicate",function(){var e=f(this).closest(".everest-forms-field");e.hasClass("no-duplicate")?f.alert({title:c.i18n_field_locked,content:c.i18n_field_locked_msg,icon:"dashicons dashicons-info",type:"blue",buttons:{confirm:{text:c.i18n_close,btnClass:"btn-confirm",keys:["enter"]}}}):f.confirm({title:!1,content:c.i18n_duplicate_field_confirm,type:"orange",closeIcon:!1,backgroundDismiss:!1,icon:"dashicons dashicons-warning",buttons:{confirm:{text:c.i18n_ok,btnClass:"btn-confirm",keys:["enter"],action:function(){s.cloneFieldAction(e)}},cancel:{text:c.i18n_cancel}}})})},cloneFieldAction:function(n){var o=n.attr("data-field-id"),e=c.form_id,i={action:"everest_forms_get_next_id",security:c.evf_get_next_id,form_id:e};f.ajax({url:c.ajax_url,data:i,type:"POST",beforeSend:function(){},success:function(e){if("boolean"==typeof e.success&&!0===e.success){var i=e.data.field_id,t=e.data.field_key;f("#everest-forms-field-id").val(i),s.render_node(n,o,t)}}})},render_node:function(e,o,r){var i=f(".everest-forms-field-options #everest-forms-field-option-"+o),t=e.attr("data-field-type"),n=i.html(),s=c.copy_of+f("#everest-forms-field-option-"+o+"-label").val(),a=e.clone(),d=new RegExp(o,"g");n=n.replace(d,r);var l=f('<div class="everest-forms-field-option everest-forms-field-option-'+t+'" id="everest-forms-field-option-'+r+'" data-field-id="'+r+'" />');l.append(n),f.each(i.find(":input"),function(){var e=f(this).attr("type"),i=f(this).attr("name").replace(d,r),t="";if("text"===e||"hidden"===e)t=f(this).val(),l.find('input[name="'+i+'"]').val(t),l.find('input[value="'+o+'"]').val(r);else if("checkbox"===e||"radio"===e)f(this).is(":checked")?l.find('input[name="'+i+'"]').prop("checked",!0).attr("checked","checked"):l.find('[name="'+i+'"]').prop("checked",!1).attr("checked",!1);else if(f(this).is("select")){if(f(this).find("option:selected").length){var n=f(this).find("option:selected").val();l.find('[name="'+i+'"]').find('[value="'+n+'"]').prop("selected",!0)}}else""!==f(this).val()&&l.find('[name="'+i+'"]').val(f(this).val())}),f(".everest-forms-field-options").append(l),f("#everest-forms-field-option-"+r+"-label").val(s),a.attr("class",e.attr("class")),a.attr("id","everest-forms-field-"+r),a.attr("data-field-id",r),a.attr("data-field-type",t),a.find(".label-title .text").text(s),e.closest(".evf-admin-grid").find('[data-field-id="'+o+'"]').after(a),f(document).trigger("everest-form-cloned",[r,t])},bindFieldDelete:function(){f("body").on("click",".everest-forms-preview .everest-forms-field .everest-forms-field-delete",function(){var e=f(this).closest(".everest-forms-field"),i=e.attr("data-field-id"),t=f("#everest-forms-field-option-"+i);e.hasClass("no-delete")?f.alert({title:c.i18n_field_locked,content:c.i18n_field_locked_msg,icon:"dashicons dashicons-info",type:"blue",buttons:{confirm:{text:c.i18n_close,btnClass:"btn-confirm",keys:["enter"]}}}):f.confirm({title:!1,content:c.i18n_delete_field_confirm,type:"orange",closeIcon:!1,backgroundDismiss:!1,icon:"dashicons dashicons-warning",buttons:{confirm:{text:c.i18n_ok,btnClass:"btn-confirm",keys:["enter"],action:function(){f(".evf-panel-fields-button").trigger("click"),e.fadeOut("slow",function(){e.remove(),t.remove()})}},cancel:{text:c.i18n_cancel}}})})},bindSaveOption:function(){f("body").on("click",".evf_save_form_action_button",function(){var i=f(this),e=f("form#everest-forms-builder-form"),t=s.getStructure(),n=e.serializeArray().concat(t),o={action:"everest_forms_save_form",security:c.evf_save_form,form_data:JSON.stringify(n)},r=f("#everest-forms-builder");f.ajax({url:c.ajax_url,data:o,type:"POST",beforeSend:function(){var e=f('<div class="evf-overlay"></div>');e.append('<div class="loading"></div>'),i.find(".spinner").remove(),r.find(".evf-overlay").remove(),r.css({position:"relative"}),r.append(e),i.append('<span style="margin-top:-1px;margin-right:0;" class="spinner is-active"></span>')},success:function(e){r.find(".evf-overlay").fadeOut(),r.find(".evf-overlay").remove(),r.removeAttr("style"),i.find(".spinner").remove(),"boolean"==typeof e.success&&!0===e.success&&window.location.reload()}})})},getStructure:function(){var e=f(".evf-admin-field-wrapper"),r=[];return f.each(e.find(".evf-admin-row"),function(){var e=f(this),o=e.attr("data-row-id");f.each(e.find(".evf-admin-grid"),function(){var e=f(this),t=e.attr("data-grid-id"),n=0;f.each(e.find(".everest-forms-field"),function(){var e={name:"",value:""},i=f(this).attr("data-field-id");e.name="structure[row_"+o+"][grid_"+t+"]["+n+"]",n++,e.value=i,r.push(e)}),e.find(".everest-forms-field").length<1&&r.push({name:"structure[row_"+o+"][grid_"+t+"]",value:""})})}),r},getFieldArray:function(e){var i=[];return f.each(e.find(".everest-forms-field"),function(){var e=f(this).attr("data-field-id");i.push(e)}),i},checkEmptyGrid:function(){f.each(f(".evf-admin-grid"),function(){f(this).find(".everest-forms-field").length<1?f(this).addClass("evf-empty-grid"):f(this).removeClass("evf-empty-grid")}),s.choicesInit()},bindDefaultTabs:function(){f(document).on("click","#evf-builder-tabs li",function(e){e.preventDefault(),s.switchTab(f(this).data("panel"))})},switchTab:function(e){var i=f("#everest-forms-panel-"+e),t=f(".evf-panel-"+e+"-button");f("#evf-builder-tabs").find("li a").removeClass("active"),t.find("a").addClass("active"),i.closest(".evf-tab-content").find(".everest-forms-panel").removeClass("active"),i.addClass("active"),"fields"===e&&(f(".everest-forms-field-options").hide(),f(".everest-forms-add-fields").show()),history.replaceState({},null,s.updateQueryString("tab",e)),s.switchPanel(e)},updateQueryString:function(e,i,t){t||(t=window.location.href);var n,o=new RegExp("([?&])"+e+"=.*?(&|#|$)(.*)","gi");if(o.test(t))return null!=i?t.replace(o,"$1"+e+"="+i+"$2$3"):(t=(n=t.split("#"))[0].replace(o,"$1$3").replace(/(&|\?)$/,""),"undefined"!=typeof n[1]&&null!==n[1]&&(t+="#"+n[1]),t);if(null!=i){var r=-1!==t.indexOf("?")?"&":"?";return t=(n=t.split("#"))[0]+r+e+"="+i,"undefined"!=typeof n[1]&&null!==n[1]&&(t+="#"+n[1]),t}return t},switchPanel:function(e){"field-options"===e&&s.switchToFieldOptionPanel()},switchToFieldOptionPanel:function(e){f("li.evf-panel-field-options-button.evf-disabled-tab").show(),f(".everest-forms-field-options").find(".no-fields").hide(),f(".evf-admin-field-wrapper .everest-forms-field").removeClass("active"),f(".everest-forms-panel").removeClass("active"),f("#everest-forms-panel-fields").addClass("active"),f(".everest-forms-add-fields").hide(),f(".everest-forms-field-options").show(),f(".everest-forms-field-options").find(".everest-forms-field-option").hide(),f(".evf-tab-lists").find("li a").removeClass("active"),f(".evf-tab-lists").find("li.evf-panel-field-options-button a").addClass("active"),void 0!==e?(f("#everest-forms-field-option-"+e).show(),f("#everest-forms-field-"+e).addClass("active")):0<f(".evf-admin-field-wrapper .everest-forms-field").length?(f(".evf-admin-field-wrapper .everest-forms-field").eq(0).addClass("active"),f("#everest-forms-field-option-"+f(".evf-admin-field-wrapper .everest-forms-field").eq(0).attr("data-field-id")).show()):f(".everest-forms-field-options").find(".no-fields").show()},bindFields:function(){f(".evf-admin-grid").sortable({containment:".evf-admin-field-wrapper",cancel:!1,over:function(e,i){f(e.target).addClass("evf-item-hover"),f(".evf-admin-grid").addClass("evf-hover"),s.checkEmptyGrid()},out:function(e,i){f(".evf-admin-grid").removeClass("evf-hover"),f(e.target).removeClass("evf-item-hover"),s.checkEmptyGrid()},revert:!0,connectWith:".evf-admin-grid"}).disableSelection(),f(".evf-admin-field-wrapper").sortable({containment:".evf-admin-field-wrapper",tolerance:"pointer",revert:"invalid",placeholder:"evf-admin-row",forceHelperSize:!0,over:function(){f(".evf-admin-field-wrapper").addClass("evf-hover")},out:function(){f(".evf-admin-field-wrapper").removeClass("evf-hover")}}),f(".evf-registered-buttons button.evf-registered-item").draggable({connectToSortable:".evf-admin-grid",containment:"#everest-forms-builder",helper:"clone",revert:"invalid",cancel:!1,start:function(e,i){f(".evf-admin-grid").addClass("evf-hover")},stop:function(e,i){f(".evf-admin-grid").removeClass("evf-hover");i.helper.closest(".evf-admin-grid");var t=i.helper;s.fieldDrop(t)}}).disableSelection()},bindFormPreview:function(){},bindGridSwitcher:function(){f("body").on("click",".evf-show-grid",function(){f(this).closest(".evf-toggle-row").find(".evf-toggle-row-content").slideToggle(200)});f("body").on("click",".evf-grid-selector",function(){var e=f(this).closest(".evf-admin-row");if(!f(this).hasClass("active")){var i=parseInt(f(this).attr("data-evf-grid"),10);if(!(2<i)){var t=f('<div class="evf-admin-grid evf-grid-'+i+' ui-sortable" />'),n=f("<div/>");f.each(e.find(".evf-admin-grid"),function(){f(this).children("*").each(function(){n.append(f(this).clone())})}),e.find(".evf-admin-grid").remove(),e.find(".evf-clear ").remove(),e.append('<div class="clear evf-clear"></div>');for(var o=1;o<=i;o++)t.attr("data-grid-id",o),e.append(t.clone());e.append('<div class="clear evf-clear"></div>'),e.find(".evf-admin-grid").eq(0).append(n.html()),e.find(".evf-grid-selector").removeClass("active"),f(this).addClass("active"),s.bindFields()}}})},fieldDrop:function(o){var e=o.attr("data-field-type");o.css({width:"100%",left:"0"}),o.append('<i class="spinner is-active" style="margin: 0;padding: 0;"></i>');var i={action:"everest_forms_new_field_"+e,security:c.evf_field_drop_nonce,field_type:e,form_id:c.form_id};f.ajax({url:c.ajax_url,data:i,type:"POST",beforeSend:function(){},success:function(e){var i=e.data.preview,t=e.data.options,n=e.data.form_field_id;f("#everest-forms-field-id").val(n),f(".everest-forms-field-options").find(".no-fields").hide(),f(".everest-forms-field-options").append(t),o.after(i),o.remove(),s.checkEmptyGrid()}})},bindFieldSettings:function(){f("body").on("click",".everest-forms-preview .everest-forms-field, .everest-forms-preview .everest-forms-field .everest-forms-field-setting",function(){var e=f(this).closest(".everest-forms-field").attr("data-field-id");s.switchToFieldOptionPanel(e)})}};f(function(){s.init()})}(jQuery,window.evf_data),jQuery(function(){var e=jQuery("#everest-forms-panel-field-settings-redirect_to option:selected").val();"0"==e?(jQuery("#everest-forms-panel-field-settings-custom_page-wrap").hide(),jQuery("#everest-forms-panel-field-settings-external_url-wrap").hide()):"1"==e?(jQuery("#everest-forms-panel-field-settings-custom_page-wrap").show(),jQuery("#everest-forms-panel-field-settings-external_url-wrap").hide()):"2"==e&&(jQuery("#everest-forms-panel-field-settings-external_url-wrap").show(),jQuery("#everest-forms-panel-field-settings-custom_page-wrap").hide()),jQuery("#everest-forms-panel-field-settings-redirect_to").on("change",function(){"0"==this.value?(jQuery("#everest-forms-panel-field-settings-custom_page-wrap").hide(),jQuery("#everest-forms-panel-field-settings-external_url-wrap").hide()):"1"==this.value?(jQuery("#everest-forms-panel-field-settings-custom_page-wrap").show(),jQuery("#everest-forms-panel-field-settings-external_url-wrap").hide()):"2"==this.value&&(jQuery("#everest-forms-panel-field-settings-custom_page-wrap").hide(),jQuery("#everest-forms-panel-field-settings-external_url-wrap").show())}),jQuery("li.evf-panel-field-options-button.evf-disabled-tab").hide()}),jQuery(function(i){i(document.body).on("init_tooltips",function(){i(".tips, .help_tip, .everest-forms-help-tooltip").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200})}).trigger("init_tooltips"),i(".everest-forms-tab-content").on("click",".everest-forms-add-fields-group > a",function(e){e.preventDefault()}),i(".everest-forms-field-option").on("click",".everest-forms-field-option-group > a",function(e){e.preventDefault(),i(this).parent(".everest-forms-field-option-group").toggleClass("closed").toggleClass("open")}),i(".everest-forms-field-option").on("click",".everest-forms-field-option-group a",function(e){i(e.target).filter(":input, option, .sort").length||i(this).next(".everest-forms-field-option-group-inner").stop().slideToggle()}),i(".everest-forms-field-option-group.closed").each(function(){i(this).find(".everest-forms-field-option-group-inner").hide()})});
|
1 |
+
!function(f,c){var v={init:function(){f(document).ready(v.ready),f(window).on("load",v.load),v.bindUI()},ready:function(){jconfirm.defaults={closeIcon:!0,backgroundDismiss:!0,escapeKey:!0,animationBounce:1,useBootstrap:!1,theme:"modern",boxWidth:"400px",columnClass:"evf-responsive-class"},f(document).trigger("everest_forms_ready")},load:function(){},bindUI:function(){v.bindDefaultTabs(),v.checkEmptyGrid(),v.bindFields(),v.bindFormPreview(),v.bindGridSwitcher(),v.bindFieldSettings(),v.bindFieldDelete(),v.bindCloneField(),v.bindSaveOption(),v.bindFieldOptionChange(),v.bindAddNewRow(),v.bindRemoveRow(),v.bindFormSettings(),v.choicesInit(),v.choicesUpdate(),"field-options"===c.tab&&f(".evf-panel-field-options-button").trigger("click")},choicesInit:function(){var e=f(".evf-choices-list");e.sortable({out:function(e,i){var t=f(e.target).attr("data-field-id");v.choiceChange(t)}});var i=e.closest(".everest-forms-field-option").attr("data-field-id");f("#everest-forms-field-"+i)},choicesUpdate:function(){f(".evf-choices-list");f("body").on("click",".evf-choices-list a.add",function(){var e=f(this).closest("li").clone();e.find('input[type="text"]').val("");var i=f(this).closest(".evf-choices-list"),t=i.attr("data-field-id"),n=i.find("li").length;n++,e.find('input[type="checkbox"],input[type="radio"]').prop("checked",!1),e.attr("data-key",n),e.find(".default").attr("name","form_fields["+t+"][choices]["+n+"][default]"),e.find(".label").attr("name","form_fields["+t+"][choices]["+n+"][label]"),e.find(".value").attr("name","form_fields["+t+"][choices]["+n+"][value]"),f(this).closest("li").after(e),v.choiceChange(t)}),f("body").on("click",".evf-choices-list a.remove",function(){var e=f(this).closest(".evf-choices-list"),i=e.attr("data-field-id");e.find("li").length<2?f.alert({title:!1,content:c.i18n_field_error_choice,icon:"dashicons dashicons-info",type:"blue",buttons:{ok:{text:c.i18n_ok,btnClass:"btn-confirm",keys:["enter"]}}}):(f(this).closest("li").remove(),v.choiceChange(i))});f("body").on("keyup paste click",".evf-choices-list input",function(){var e=f(this).closest(".evf-choices-list").attr("data-field-id");"radio"===f(this).attr("type").toLowerCase()&&f(this).is(":checked")&&(f(this).closest(".evf-choices-list").find('input[type="radio"]').prop("checked",!1),f(this).prop("checked",!0)),v.choiceChange(e)})},choiceChange:function(e){var i=f("#everest-forms-field-option-row-"+e+"-choices"),t=f("#everest-forms-field-"+e),n=t.find("ul.primary-input"),o=i.find("ul.evf-choices-list").attr("data-field-type");"select"===o&&(n=t.find("select.primary-input")),n.html(""),f.each(i.find("ul.evf-choices-list").find("li"),function(){var e=f(this).find(".default").attr("type"),i=f("<li/>").append('<input type="'+e+'" disabled="">');"select"===o&&(i=f("<option/>"),f(this).find(".default").is(":checked")&&i.attr("selected","selected")),i.append(f(this).find(".label").val()),f(this).find(".default").is(":checked")&&i.find("input").prop("checked",!0),n.append(i)})},bindFormSettings:function(){f("body").on("click",".evf-setting-panel",function(e){var i=f(this).attr("data-section");f(".evf-setting-panel").removeClass("active"),f(".evf-content-section").removeClass("active"),f(this).addClass("active"),f(".evf-content-"+i+"-settings").addClass("active"),e.preventDefault()}),f(".evf-setting-panel").eq(0).trigger("click")},removeRow:function(e){f.each(e.find(".everest-forms-field"),function(){var e=f(this),i=e.attr("data-field-id"),t=f("#everest-forms-field-option-"+i);e.remove(),t.remove()}),e.remove()},bindRemoveRow:function(){f("body").on("click",".evf-delete-row",function(){var e=f(this).closest(".evf-admin-row");f(".evf-admin-row").length<2?f.alert({title:c.i18n_row_locked,content:c.i18n_row_locked_msg,icon:"dashicons dashicons-info",type:"blue",buttons:{confirm:{text:c.i18n_close,btnClass:"btn-confirm",keys:["enter"]}}}):f.confirm({title:!1,content:c.i18n_delete_row_confirm,type:"red",closeIcon:!1,backgroundDismiss:!1,icon:"dashicons dashicons-warning",buttons:{confirm:{text:c.i18n_ok,btnClass:"btn-confirm",keys:["enter"],action:function(){v.removeRow(e)}},cancel:{text:c.i18n_cancel}}})})},bindAddNewRow:function(){f("body").on("click",".evf-add-row span",function(){var e=f(".evf-admin-row").eq(0).clone(),i=f(".evf-admin-row").length;e.find(".evf-admin-grid").html(""),e.attr("data-row-id",i+1),f(".evf-admin-field-wrapper").append(e),v.bindFields(),v.checkEmptyGrid()})},bindFieldOptionChange:function(){f("body").on("keyup paste click",'.everest-forms-field-option-row input[type="text"][name$="[label]"], .everest-forms-field-option-row textarea[name$="[description]"], .everest-forms-field-option-row input[type="checkbox"][name$="[required]"], .everest-forms-field-option-row input[type="checkbox"][name$="[label_hide]"], .everest-forms-field-option-row input[type="text"][name$="[placeholder]"]',function(){v.bindFormFieldChange(f(this))})},bindFormFieldChange:function(e){var i=e.closest(".everest-forms-field-option-row").attr("data-field-id"),t=f(".evf-admin-grid #everest-forms-field-"+i+".active"),n=e.attr("id");if("undefined"!==n&&n!==undefined)switch(n=n.replace("everest-forms-field-option-"+i+"-","")){case"label":t.find(".label-title .text").text(e.val());break;case"description":t.find(".description").html(e.val());break;case"required":e.is(":checked")?(t.find(".label-title .required").remove(),t.find(".label-title").append('<span class="required">*</span>')):t.find(".label-title .required").remove();break;case"label_hide":e.is(":checked")?t.find(".label-title").hide():t.find(".label-title").show();break;case"placeholder":t.find("input").attr("placeholder",e.val())}},bindCloneField:function(){f("body").on("click",".everest-forms-preview .everest-forms-field .everest-forms-field-duplicate",function(){var e=f(this).closest(".everest-forms-field");e.hasClass("no-duplicate")?f.alert({title:c.i18n_field_locked,content:c.i18n_field_locked_msg,icon:"dashicons dashicons-info",type:"blue",buttons:{confirm:{text:c.i18n_close,btnClass:"btn-confirm",keys:["enter"]}}}):f.confirm({title:!1,content:c.i18n_duplicate_field_confirm,type:"orange",closeIcon:!1,backgroundDismiss:!1,icon:"dashicons dashicons-warning",buttons:{confirm:{text:c.i18n_ok,btnClass:"btn-confirm",keys:["enter"],action:function(){v.cloneFieldAction(e)}},cancel:{text:c.i18n_cancel}}})})},cloneFieldAction:function(n){var o=n.attr("data-field-id"),e=c.form_id,i={action:"everest_forms_get_next_id",security:c.evf_get_next_id,form_id:e};f.ajax({url:c.ajax_url,data:i,type:"POST",beforeSend:function(){},success:function(e){if("boolean"==typeof e.success&&!0===e.success){var i=e.data.field_id,t=e.data.field_key;f("#everest-forms-field-id").val(i),v.render_node(n,o,t)}}})},render_node:function(e,o,r){var i=f(".everest-forms-field-options #everest-forms-field-option-"+o),t=e.attr("data-field-type"),n=i.html(),s=c.copy_of+f("#everest-forms-field-option-"+o+"-label").val(),a=e.clone(),d=new RegExp(o,"g");n=n.replace(d,r);var l=f('<div class="everest-forms-field-option everest-forms-field-option-'+t+'" id="everest-forms-field-option-'+r+'" data-field-id="'+r+'" />');l.append(n),f.each(i.find(":input"),function(){var e=f(this).attr("type"),i=f(this).attr("name").replace(d,r),t="";if("text"===e||"hidden"===e)t=f(this).val(),l.find('input[name="'+i+'"]').val(t),l.find('input[value="'+o+'"]').val(r);else if("checkbox"===e||"radio"===e)f(this).is(":checked")?l.find('input[name="'+i+'"]').prop("checked",!0).attr("checked","checked"):l.find('[name="'+i+'"]').prop("checked",!1).attr("checked",!1);else if(f(this).is("select")){if(f(this).find("option:selected").length){var n=f(this).find("option:selected").val();l.find('[name="'+i+'"]').find('[value="'+n+'"]').prop("selected",!0)}}else""!==f(this).val()&&l.find('[name="'+i+'"]').val(f(this).val())}),f(".everest-forms-field-options").append(l),f("#everest-forms-field-option-"+r+"-label").val(s),a.attr("class",e.attr("class")),a.attr("id","everest-forms-field-"+r),a.attr("data-field-id",r),a.attr("data-field-type",t),a.find(".label-title .text").text(s),e.closest(".evf-admin-grid").find('[data-field-id="'+o+'"]').after(a),f(document).trigger("everest-form-cloned",[r,t]),v.switchToFieldOptionPanel(r)},bindFieldDelete:function(){f("body").on("click",".everest-forms-preview .everest-forms-field .everest-forms-field-delete",function(){var e=f(this).closest(".everest-forms-field"),i=e.attr("data-field-id"),t=f("#everest-forms-field-option-"+i),n=f(this).closest(".evf-admin-grid");e.hasClass("no-delete")?f.alert({title:c.i18n_field_locked,content:c.i18n_field_locked_msg,icon:"dashicons dashicons-info",type:"blue",buttons:{confirm:{text:c.i18n_close,btnClass:"btn-confirm",keys:["enter"]}}}):f.confirm({title:!1,content:c.i18n_delete_field_confirm,type:"orange",closeIcon:!1,backgroundDismiss:!1,icon:"dashicons dashicons-warning",buttons:{confirm:{text:c.i18n_ok,btnClass:"btn-confirm",keys:["enter"],action:function(){f(".evf-panel-fields-button").trigger("click"),e.fadeOut("slow",function(){e.remove(),t.remove()}),1===n.children().length&&n.addClass("evf-empty-grid")}},cancel:{text:c.i18n_cancel}}})})},bindSaveOption:function(){f("body").on("click",".evf_save_form_action_button",function(){var i=f(this),e=f("form#everest-forms-builder-form"),t=v.getStructure(),n=e.serializeArray(),o=[];f(".everest-forms-field[data-field-id]").each(function(){o.push(f(this).attr("data-field-id"))});for(var r=n.length;r--;)if(n[r].name.startsWith("form_fields")){var s=!1;o.forEach(function(e){n[r].name.startsWith("form_fields["+e+"]")&&(s=!0)}),-1<r&&!1===s&&n.splice(r,1)}var a=n.concat(t),d={action:"everest_forms_save_form",security:c.evf_save_form,form_data:JSON.stringify(a)},l=f("#everest-forms-builder");f.ajax({url:c.ajax_url,data:d,type:"POST",beforeSend:function(){var e=f('<div class="evf-overlay"></div>');e.append('<div class="loading"></div>'),i.find(".spinner").remove(),l.find(".evf-overlay").remove(),l.css({position:"relative"}),l.append(e),i.append('<span style="margin-top:-1px;margin-right:0;" class="spinner is-active"></span>')},success:function(e){l.find(".evf-overlay").fadeOut(),l.find(".evf-overlay").remove(),l.removeAttr("style"),i.find(".spinner").remove(),"boolean"==typeof e.success&&!0===e.success&&window.location.reload()}})})},getStructure:function(){var e=f(".evf-admin-field-wrapper"),r=[];return f.each(e.find(".evf-admin-row"),function(){var e=f(this),o=e.attr("data-row-id");f.each(e.find(".evf-admin-grid"),function(){var e=f(this),t=e.attr("data-grid-id"),n=0;f.each(e.find(".everest-forms-field"),function(){var e={name:"",value:""},i=f(this).attr("data-field-id");e.name="structure[row_"+o+"][grid_"+t+"]["+n+"]",n++,e.value=i,r.push(e)}),e.find(".everest-forms-field").length<1&&r.push({name:"structure[row_"+o+"][grid_"+t+"]",value:""})})}),r},getFieldArray:function(e){var i=[];return f.each(e.find(".everest-forms-field"),function(){var e=f(this).attr("data-field-id");i.push(e)}),i},checkEmptyGrid:function(){f.each(f(".evf-admin-grid"),function(){f(this).find(".everest-forms-field").length<1?f(this).addClass("evf-empty-grid"):f(this).removeClass("evf-empty-grid")}),v.choicesInit()},bindDefaultTabs:function(){f(document).on("click","#evf-builder-tabs li",function(e){e.preventDefault(),v.switchTab(f(this).data("panel"))})},switchTab:function(e){var i=f("#everest-forms-panel-"+e),t=f(".evf-panel-"+e+"-button");f("#evf-builder-tabs").find("li a").removeClass("active"),t.find("a").addClass("active"),i.closest(".evf-tab-content").find(".everest-forms-panel").removeClass("active"),i.addClass("active"),"fields"===e&&(f(".everest-forms-field-options").hide(),f(".everest-forms-add-fields").show()),history.replaceState({},null,v.updateQueryString("tab",e)),v.switchPanel(e)},updateQueryString:function(e,i,t){t||(t=window.location.href);var n,o=new RegExp("([?&])"+e+"=.*?(&|#|$)(.*)","gi");if(o.test(t))return null!=i?t.replace(o,"$1"+e+"="+i+"$2$3"):(t=(n=t.split("#"))[0].replace(o,"$1$3").replace(/(&|\?)$/,""),"undefined"!=typeof n[1]&&null!==n[1]&&(t+="#"+n[1]),t);if(null!=i){var r=-1!==t.indexOf("?")?"&":"?";return t=(n=t.split("#"))[0]+r+e+"="+i,"undefined"!=typeof n[1]&&null!==n[1]&&(t+="#"+n[1]),t}return t},switchPanel:function(e){"field-options"===e&&v.switchToFieldOptionPanel()},switchToFieldOptionPanel:function(e){f("li.evf-panel-field-options-button.evf-disabled-tab").show(),f(".everest-forms-field-options").find(".no-fields").hide(),f(".evf-admin-field-wrapper .everest-forms-field").removeClass("active"),f(".everest-forms-panel").removeClass("active"),f("#everest-forms-panel-fields").addClass("active"),f(".everest-forms-add-fields").hide(),f(".everest-forms-field-options").show(),f(".everest-forms-field-options").find(".everest-forms-field-option").hide(),f(".evf-tab-lists").find("li a").removeClass("active"),f(".evf-tab-lists").find("li.evf-panel-field-options-button a").addClass("active"),void 0!==e?(f("#everest-forms-field-option-"+e).show(),f("#everest-forms-field-"+e).addClass("active")):0<f(".evf-admin-field-wrapper .everest-forms-field").length?(f(".evf-admin-field-wrapper .everest-forms-field").eq(0).addClass("active"),f("#everest-forms-field-option-"+f(".evf-admin-field-wrapper .everest-forms-field").eq(0).attr("data-field-id")).show()):f(".everest-forms-field-options").find(".no-fields").show()},bindFields:function(){f(".evf-admin-grid").sortable({containment:".evf-admin-field-wrapper",cancel:!1,over:function(e,i){f(e.target).addClass("evf-item-hover"),f(".evf-admin-grid").addClass("evf-hover"),v.checkEmptyGrid()},out:function(e,i){f(".evf-admin-grid").removeClass("evf-hover"),f(e.target).removeClass("evf-item-hover"),v.checkEmptyGrid()},revert:!0,connectWith:".evf-admin-grid"}).disableSelection(),f(".evf-admin-field-wrapper").sortable({containment:".evf-admin-field-wrapper",tolerance:"pointer",revert:"invalid",placeholder:"evf-admin-row",forceHelperSize:!0,over:function(){f(".evf-admin-field-wrapper").addClass("evf-hover")},out:function(){f(".evf-admin-field-wrapper").removeClass("evf-hover")}}),f(".evf-registered-buttons button.evf-registered-item").draggable({connectToSortable:".evf-admin-grid",containment:"#everest-forms-builder",helper:"clone",cancel:!1,scroll:!1,delay:200,opacity:.75,start:function(e,i){f(".evf-admin-grid").addClass("evf-hover"),f(this).data("uihelper",i.helper)},revert:function(e){return this.data("uihelper").data("dropped",!1!==e),!1===e},stop:function(e,i){if(!0===i.helper.data("dropped")){f(".evf-admin-grid").removeClass("evf-hover");var t=i.helper;v.fieldDrop(t)}}}).disableSelection()},bindFormPreview:function(){},bindGridSwitcher:function(){f("body").on("click",".evf-show-grid",function(){f(this).closest(".evf-toggle-row").find(".evf-toggle-row-content").slideToggle(200)});f("body").on("click",".evf-grid-selector",function(){var e=f(this).closest(".evf-admin-row");if(!f(this).hasClass("active")){var i=parseInt(f(this).attr("data-evf-grid"),10);if(!(2<i)){var t=f('<div class="evf-admin-grid evf-grid-'+i+' ui-sortable" />'),n=f("<div/>");f.each(e.find(".evf-admin-grid"),function(){f(this).children("*").each(function(){n.append(f(this).clone())})}),e.find(".evf-admin-grid").remove(),e.find(".evf-clear ").remove(),e.append('<div class="clear evf-clear"></div>');for(var o=1;o<=i;o++)t.attr("data-grid-id",o),e.append(t.clone());e.append('<div class="clear evf-clear"></div>'),e.find(".evf-admin-grid").eq(0).append(n.html()),e.find(".evf-grid-selector").removeClass("active"),f(this).addClass("active"),v.bindFields()}}})},fieldDrop:function(o){var e=o.attr("data-field-type");o.css({width:"100%",left:"0"}),o.append('<i class="spinner is-active" style="margin: 0;padding: 0;"></i>');var i={action:"everest_forms_new_field_"+e,security:c.evf_field_drop_nonce,field_type:e,form_id:c.form_id};f.ajax({url:c.ajax_url,data:i,type:"POST",beforeSend:function(){f(document.body).trigger("init_fields_toogle")},success:function(e){var i=e.data.preview,t=e.data.options,n=e.data.form_field_id;f("#everest-forms-field-id").val(n),f(".everest-forms-field-options").find(".no-fields").hide(),f(".everest-forms-field-options").append(t),o.after(i),o.remove(),v.checkEmptyGrid(),f(document.body).trigger("init_tooltips"),f(document.body).trigger("init_fields_toogle")}})},bindFieldSettings:function(){f("body").on("click",".everest-forms-preview .everest-forms-field, .everest-forms-preview .everest-forms-field .everest-forms-field-setting",function(){var e=f(this).closest(".everest-forms-field").attr("data-field-id");v.switchToFieldOptionPanel(e)})}};f(function(){v.init()})}(jQuery,window.evf_data),jQuery(function(){var e=jQuery("#everest-forms-panel-field-settings-redirect_to option:selected").val();"0"==e?(jQuery("#everest-forms-panel-field-settings-custom_page-wrap").hide(),jQuery("#everest-forms-panel-field-settings-external_url-wrap").hide()):"1"==e?(jQuery("#everest-forms-panel-field-settings-custom_page-wrap").show(),jQuery("#everest-forms-panel-field-settings-external_url-wrap").hide()):"2"==e&&(jQuery("#everest-forms-panel-field-settings-external_url-wrap").show(),jQuery("#everest-forms-panel-field-settings-custom_page-wrap").hide()),jQuery("#everest-forms-panel-field-settings-redirect_to").on("change",function(){"0"==this.value?(jQuery("#everest-forms-panel-field-settings-custom_page-wrap").hide(),jQuery("#everest-forms-panel-field-settings-external_url-wrap").hide()):"1"==this.value?(jQuery("#everest-forms-panel-field-settings-custom_page-wrap").show(),jQuery("#everest-forms-panel-field-settings-external_url-wrap").hide()):"2"==this.value&&(jQuery("#everest-forms-panel-field-settings-custom_page-wrap").hide(),jQuery("#everest-forms-panel-field-settings-external_url-wrap").show())}),jQuery("li.evf-panel-field-options-button.evf-disabled-tab").hide()}),jQuery(function(i){i(document.body).on("init_tooltips",function(){i(".tips, .help_tip, .everest-forms-help-tooltip").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200})}).trigger("init_tooltips"),i(".everest-forms-tab-content").on("click",".everest-forms-add-fields-group > a",function(e){e.preventDefault()}),i(document.body).on("init_fields_toogle",function(){i(".everest-forms-field-option").on("click",".everest-forms-field-option-group > a",function(e){e.preventDefault(),i(this).parent(".everest-forms-field-option-group").toggleClass("closed").toggleClass("open")}),i(".everest-forms-field-option").on("click",".everest-forms-field-option-group a",function(e){i(e.target).filter(":input, option, .sort").length||i(this).next(".everest-forms-field-option-group-inner").stop().slideToggle()}),i(".everest-forms-field-option-group.closed").each(function(){i(this).find(".everest-forms-field-option-group-inner").hide()})}).trigger("init_fields_toogle")});
|
everest-forms.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Everest Forms
|
4 |
* Plugin URI: https://wpeverest.com/wordpress-plugins/everest-forms/
|
5 |
* Description: Drag and Drop form builder to easily create contact forms and more.
|
6 |
-
* Version: 1.1.
|
7 |
* Author: WPEverest
|
8 |
* Author URI: https://wpeverest.com
|
9 |
* Text Domain: everest-forms
|
3 |
* Plugin Name: Everest Forms
|
4 |
* Plugin URI: https://wpeverest.com/wordpress-plugins/everest-forms/
|
5 |
* Description: Drag and Drop form builder to easily create contact forms and more.
|
6 |
+
* Version: 1.1.7
|
7 |
* Author: WPEverest
|
8 |
* Author URI: https://wpeverest.com
|
9 |
* Text Domain: everest-forms
|
includes/class-everest-forms.php
CHANGED
@@ -21,7 +21,7 @@ final class EverestForms {
|
|
21 |
*
|
22 |
* @var string
|
23 |
*/
|
24 |
-
public $version = '1.1.
|
25 |
|
26 |
/**
|
27 |
* The form data handler instance.
|
21 |
*
|
22 |
* @var string
|
23 |
*/
|
24 |
+
public $version = '1.1.7';
|
25 |
|
26 |
/**
|
27 |
* The form data handler instance.
|
includes/class-evf-form-task.php
CHANGED
@@ -80,7 +80,7 @@ class EVF_Form_Task {
|
|
80 |
|
81 |
// Validate form is real and active (published).
|
82 |
if ( ! $form || 'publish' !== $form->post_status ) {
|
83 |
-
evf_add_notice( __('Invalid form. Please check again.', 'everest-forms')
|
84 |
return;
|
85 |
}
|
86 |
|
@@ -101,17 +101,28 @@ class EVF_Form_Task {
|
|
101 |
do_action( "everest_forms_process_validate_{$field_type}", $field_id, $field_type, $field_submit, $form_data );
|
102 |
}
|
103 |
|
104 |
-
//
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
}
|
114 |
|
|
|
115 |
$errors = apply_filters( 'everest_forms_process_initial_errors', $this->errors, $form_data );
|
116 |
|
117 |
if ( ! empty( $errors[ $form_id ] ) ) {
|
80 |
|
81 |
// Validate form is real and active (published).
|
82 |
if ( ! $form || 'publish' !== $form->post_status ) {
|
83 |
+
evf_add_notice( __( 'Invalid form. Please check again.', 'everest-forms' ), 'error' );
|
84 |
return;
|
85 |
}
|
86 |
|
101 |
do_action( "everest_forms_process_validate_{$field_type}", $field_id, $field_type, $field_submit, $form_data );
|
102 |
}
|
103 |
|
104 |
+
// reCAPTCHA check.
|
105 |
+
$site_key = get_option( 'evf_recaptcha_site_key', '' );
|
106 |
+
$secret_key = get_option( 'evf_recaptcha_site_secret', '' );
|
107 |
+
if (
|
108 |
+
! empty( $site_key ) &&
|
109 |
+
! empty( $secret_key ) &&
|
110 |
+
isset( $form_data['settings']['recaptcha_support'] ) &&
|
111 |
+
'1' == $form_data['settings']['recaptcha_support']
|
112 |
+
) {
|
113 |
+
if ( ! empty( $_POST['g-recaptcha-response'] ) ) {
|
114 |
+
$data = wp_remote_get( 'https://www.google.com/recaptcha/api/siteverify?secret=' . $secret_key . '&response=' . $_POST['g-recaptcha-response'] );
|
115 |
+
$data = json_decode( wp_remote_retrieve_body( $data ) );
|
116 |
+
if ( empty( $data->success ) ) {
|
117 |
+
evf_add_notice( get_option( 'evf_recaptcha_validation', __( 'Incorrect reCAPTCHA, please try again.', 'everest-forms' ) ), 'error' );
|
118 |
+
return;
|
119 |
+
}
|
120 |
+
} else {
|
121 |
+
$this->errors[ $form_id ]['recaptcha'] = esc_html__( 'reCAPTCHA is required.', 'everest-forms' );
|
122 |
+
}
|
123 |
}
|
124 |
|
125 |
+
// Initial error check.
|
126 |
$errors = apply_filters( 'everest_forms_process_initial_errors', $this->errors, $form_data );
|
127 |
|
128 |
if ( ! empty( $errors[ $form_id ] ) ) {
|
languages/everest-forms.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the same license as the Everest Forms package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Everest Forms 1.1.
|
6 |
"Report-Msgid-Bugs-To: https://github.com/wpeverest/everest-forms/issues\n"
|
7 |
-
"POT-Creation-Date: 2018-05-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -968,25 +968,29 @@ msgstr ""
|
|
968 |
msgid "Invalid form. Please check again."
|
969 |
msgstr ""
|
970 |
|
971 |
-
#: includes/class-evf-form-task.php:
|
972 |
-
msgid "
|
973 |
msgstr ""
|
974 |
|
975 |
-
#: includes/class-evf-form-task.php:
|
|
|
|
|
|
|
|
|
976 |
msgid "Form has not been submitted, please see the errors below."
|
977 |
msgstr ""
|
978 |
|
979 |
-
#: includes/class-evf-form-task.php:
|
980 |
#: includes/shortcodes/class-evf-shortcode-form.php:142
|
981 |
#: includes/templates/contact.php:60
|
982 |
msgid "Thanks for contacting us! We will be in touch with you shortly."
|
983 |
msgstr ""
|
984 |
|
985 |
-
#: includes/class-evf-form-task.php:
|
986 |
msgid "No form ID was found."
|
987 |
msgstr ""
|
988 |
|
989 |
-
#: includes/class-evf-form-task.php:
|
990 |
msgid "Could not create an entry"
|
991 |
msgstr ""
|
992 |
|
@@ -1265,7 +1269,7 @@ msgid_plural "All <span class=\"count\">(%s)</span>"
|
|
1265 |
msgstr[0] ""
|
1266 |
msgstr[1] ""
|
1267 |
|
1268 |
-
#: includes/class-evf-form-task.php:
|
1269 |
msgctxt "Form name"
|
1270 |
msgid "New %s Entry"
|
1271 |
msgstr ""
|
2 |
# This file is distributed under the same license as the Everest Forms package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Everest Forms 1.1.7\n"
|
6 |
"Report-Msgid-Bugs-To: https://github.com/wpeverest/everest-forms/issues\n"
|
7 |
+
"POT-Creation-Date: 2018-05-28 10:09:19+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
968 |
msgid "Invalid form. Please check again."
|
969 |
msgstr ""
|
970 |
|
971 |
+
#: includes/class-evf-form-task.php:117
|
972 |
+
msgid "Incorrect reCAPTCHA, please try again."
|
973 |
msgstr ""
|
974 |
|
975 |
+
#: includes/class-evf-form-task.php:121
|
976 |
+
msgid "reCAPTCHA is required."
|
977 |
+
msgstr ""
|
978 |
+
|
979 |
+
#: includes/class-evf-form-task.php:130 includes/class-evf-form-task.php:170
|
980 |
msgid "Form has not been submitted, please see the errors below."
|
981 |
msgstr ""
|
982 |
|
983 |
+
#: includes/class-evf-form-task.php:198
|
984 |
#: includes/shortcodes/class-evf-shortcode-form.php:142
|
985 |
#: includes/templates/contact.php:60
|
986 |
msgid "Thanks for contacting us! We will be in touch with you shortly."
|
987 |
msgstr ""
|
988 |
|
989 |
+
#: includes/class-evf-form-task.php:439
|
990 |
msgid "No form ID was found."
|
991 |
msgstr ""
|
992 |
|
993 |
+
#: includes/class-evf-form-task.php:445
|
994 |
msgid "Could not create an entry"
|
995 |
msgstr ""
|
996 |
|
1269 |
msgstr[0] ""
|
1270 |
msgstr[1] ""
|
1271 |
|
1272 |
+
#: includes/class-evf-form-task.php:363
|
1273 |
msgctxt "Form name"
|
1274 |
msgid "New %s Entry"
|
1275 |
msgstr ""
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: form, form builder, easy form, clean form, login form, contact, contact fo
|
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 4.9
|
6 |
Requires PHP: 5.4
|
7 |
-
Stable tag: 1.1.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -79,6 +79,13 @@ Yes, the plugin is designed to work with any themes that have been coded followi
|
|
79 |
|
80 |
== Changelog ==
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
= 1.1.6 - 24-05-2018 =
|
83 |
* Fix - Appending HTMl instead of text for preview description.
|
84 |
* GDPR - If user details are disabled globally discard the IP address and User Agent.
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 4.9
|
6 |
Requires PHP: 5.4
|
7 |
+
Stable tag: 1.1.7
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
79 |
|
80 |
== Changelog ==
|
81 |
|
82 |
+
= 1.1.7 - 28-05-2018 =
|
83 |
+
* Fix - Google reCaptcha check with its own server.
|
84 |
+
* Fix - Switch to cloned field options after cloning.
|
85 |
+
* Fix - Hidden row design on last form field deletion.
|
86 |
+
* Fix - Failed draggable fields being hidden in form builder.
|
87 |
+
* Fix - Toggle and tooltip initialize if the field is new one.
|
88 |
+
|
89 |
= 1.1.6 - 24-05-2018 =
|
90 |
* Fix - Appending HTMl instead of text for preview description.
|
91 |
* GDPR - If user details are disabled globally discard the IP address and User Agent.
|