Version Description
Download this release
Release Info
Developer | mmuro |
Plugin | Visual Form Builder |
Version | 3.0.6 |
Comparing to | |
See all releases |
Code changes from version 3.0.5 to 3.0.6
- admin/assets/js/vfb-admin.js +5 -63
- admin/assets/js/vfb-admin.min.js +1 -1
- admin/class-ajax.php +5 -5
- admin/class-entries-detail.php +6 -6
- admin/class-entries-list.php +3 -3
- admin/class-export.php +365 -464
- admin/class-load-css-js.php +3 -1
- config.codekit3 +0 -289
- public/class-security.php +2 -2
- readme.txt +6 -1
- visual-form-builder.php +2 -2
admin/assets/js/vfb-admin.js
CHANGED
@@ -571,39 +571,16 @@ jQuery(document).ready(function($) {
|
|
571 |
});
|
572 |
|
573 |
// !Entries fields
|
574 |
-
$( '#vfb-export-
|
575 |
-
var
|
576 |
-
count = vfb_entries_count( id );
|
577 |
|
578 |
$( '#vfb-export-entries-fields' ).html( 'Loading...' );
|
579 |
|
580 |
$.get( ajaxurl,
|
581 |
{
|
582 |
-
action: '
|
583 |
-
id:
|
584 |
-
|
585 |
-
page: pagenow
|
586 |
-
}
|
587 |
-
).done( function( response ) {
|
588 |
-
$( '#vfb-export-entries-fields' ).html( response );
|
589 |
-
}).fail( function( response ) {
|
590 |
-
$( '#vfb-export-entries-fields' ).html( 'Error loading entry fields.' );
|
591 |
-
});
|
592 |
-
});
|
593 |
-
|
594 |
-
$( '#vfb-export-entries-rows' ).change( function(){
|
595 |
-
var id = $( '#vfb-export-entries-forms' ).val();
|
596 |
-
|
597 |
-
var page = $( this ).val();
|
598 |
-
|
599 |
-
$( '#vfb-export-entries-fields' ).html( 'Loading...' );
|
600 |
-
|
601 |
-
$.get( ajaxurl,
|
602 |
-
{
|
603 |
-
action: 'visual_form_builder_export_load_options',
|
604 |
-
id: id,
|
605 |
-
offset: page,
|
606 |
-
page: pagenow
|
607 |
}
|
608 |
).done( function( response ) {
|
609 |
$( '#vfb-export-entries-fields' ).html( response );
|
@@ -611,41 +588,6 @@ jQuery(document).ready(function($) {
|
|
611 |
$( '#vfb-export-entries-fields' ).html( 'Error loading entry fields.' );
|
612 |
});
|
613 |
});
|
614 |
-
|
615 |
-
function vfb_entries_count( id ) {
|
616 |
-
var count = '';
|
617 |
-
|
618 |
-
$.ajax( ajaxurl, {
|
619 |
-
async: false,
|
620 |
-
data:
|
621 |
-
{
|
622 |
-
action: 'visual_form_builder_export_entries_count',
|
623 |
-
id: id,
|
624 |
-
page: pagenow
|
625 |
-
}
|
626 |
-
}).done( function( response ) {
|
627 |
-
if ( response > 1000 ) {
|
628 |
-
|
629 |
-
$( '#vfb-export-entries-rows' ).empty();
|
630 |
-
|
631 |
-
var num_pages = Math.ceil( parseInt( response ) / 1000 );
|
632 |
-
|
633 |
-
for ( var i = 1; i <= num_pages; i++ ) {
|
634 |
-
$( '#vfb-export-entries-rows' ).append( $( '<option></option>' ).attr( 'value', i ).text( i ) );
|
635 |
-
}
|
636 |
-
|
637 |
-
$( '#vfb-export-entries-pages' ).show();
|
638 |
-
}
|
639 |
-
else {
|
640 |
-
$( '#vfb-export-entries-pages' ).hide();
|
641 |
-
}
|
642 |
-
|
643 |
-
count = response;
|
644 |
-
}).fail( function( response ) {
|
645 |
-
});
|
646 |
-
|
647 |
-
return count;
|
648 |
-
}
|
649 |
});
|
650 |
|
651 |
/**
|
571 |
});
|
572 |
|
573 |
// !Entries fields
|
574 |
+
$( '#vfb-export-forms-list' ).change( function(){
|
575 |
+
var form_id = $( this ).val();
|
|
|
576 |
|
577 |
$( '#vfb-export-entries-fields' ).html( 'Loading...' );
|
578 |
|
579 |
$.get( ajaxurl,
|
580 |
{
|
581 |
+
action: 'vfb-export-fields',
|
582 |
+
id: form_id,
|
583 |
+
vfb_ajax_nonce: vfb_settings.vfb_ajax_nonce
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
584 |
}
|
585 |
).done( function( response ) {
|
586 |
$( '#vfb-export-entries-fields' ).html( response );
|
588 |
$( '#vfb-export-entries-fields' ).html( 'Error loading entry fields.' );
|
589 |
});
|
590 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
591 |
});
|
592 |
|
593 |
/**
|
admin/assets/js/vfb-admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready((function(e){var t=null;e(document).on("mouseenter mouseleave",".vfb-tooltip",(function(i){if("mouseenter"==i.type){t&&(clearTimeout(t),t=null);var o=e(this).attr("title"),n=e(this).attr("rel"),a=e(this).width();e(this).append('<div class="vfb-tooltip-popup"><h3>'+o+"</h3><p>"+n+"</p></div>"),e.data(this,"title",o),this.title="",e(this).find(".vfb-tooltip-popup").css({left:a+22}),t=setTimeout((function(){e(".vfb-tooltip-popup").fadeIn(300)}),500)}else this.title=e.data(this,"title"),e(".vfb-tooltip-popup").fadeOut(500),e(this).children().remove()})),e(document).on("click","a.vfb-add-option",(function(t){t.preventDefault();var i=e(this).parent().siblings(".vfb-cloned-options").children(),o=i.length,n=o+1,a=i[o-1],s=e(a).attr("id"),r=e(a).children("label").attr("for").replace(new RegExp(/(\d+)$/g),""),l=s.replace(new RegExp(/(\d+)$/g),""),f=e("#"+s).clone().attr("id",l+n);f.children("label").attr("for",r+n),f.find('input[type="text"]').attr("id",r+n),f.find('input[type="radio"]').attr("value",n),e("#"+l+o).after(f)})),e(document).on("click","a.deleteOption",(function(t){t.preventDefault(),e(this).parent().parent().find(".clonedOption").length-1==0?alert("You must have at least one option."):e(this).closest("div").remove()})),e(".vfb-cloned-options").sortable({items:"div.option"}),e(document).on("click","a.addEmail",(function(t){t.preventDefault();var i=e(this).closest("#email-details").find(".clonedOption").length,o=i+1,n=e(this).closest("div").attr("id"),a=e(this).closest("div").find("label").attr("for").replace(new RegExp(/(\d+)$/g),""),s=n.replace(new RegExp(/(\d+)$/g),""),r=e("#"+n).clone().attr("id",s+o);r.find("label").attr("for",a+o),r.find("input").attr("id",a+o),e("#"+s+i).after(r)})),e(document).on("click","a.deleteEmail",(function(t){t.preventDefault(),e(this).closest("#email-details").find(".clonedOption").length-1==0?alert("You must have at least one option."):e(this).closest("div").remove()})),e('.option input[type="radio"]').mousedown((function(){e(this).attr("previousValue",e(this).prop("checked"))})).click((function(){"true"==e(this).attr("previousValue")&&e(this).prop("checked",!1)})),e(".menu-delete").click((function(){var t=e(this).hasClass("entry-delete")?"entry":"form";return!!confirm("You are about to permanently delete this "+t+" and all of its data.\n'Cancel' to stop, 'OK' to delete.")})),e(document).on("click","a.item-edit",(function(t){t.preventDefault(),e(t.target).closest("li").children(".menu-item-settings").slideToggle("fast"),e(this).toggleClass("opened");var i=e(t.target).closest("dl");i.hasClass("vfb-menu-item-inactive")?i.removeClass("vfb-menu-item-inactive").addClass("vfb-menu-item-active"):i.removeClass("vfb-menu-item-active").addClass("vfb-menu-item-inactive")})),e("#vfb-menu-to-edit").nestedSortable({listType:"ul",maxLevels:3,handle:".vfb-menu-item-handle",placeholder:"vfb-sortable-placeholder",forcePlaceholderSize:!0,forceHelperSize:!0,tolerance:"pointer",toleranceElement:"> dl",items:"li:not(.ui-state-disabled)",create:function(t,i){e(this).css("min-height",e(this).height())},start:function(e,t){t.placeholder.height(t.item.height())},stop:function(t,i){var o=e("#vfb-menu-to-edit .item-type:first").text();opts={url:ajaxurl,type:"POST",async:!0,cache:!1,data:{action:"visual_form_builder_sort_field",order:e(this).nestedSortable("toArray")},success:function(t){e("#loading-animation").hide(),"FIELDSET"!==o?e("#vfb-fieldset-first-warning").show():e("#vfb-fieldset-first-warning").hide()}},e.ajax(opts)}}),e("#vfb-form-items .vfb-draggable-form-items").click((function(t){t.preventDefault(),e(this).data("submit_value",e(this).text())})),e("#vfb-form-items .vfb-draggable-form-items").click((function(t){t.preventDefault();var i=e(this).closest("form").serializeArray(),o=e(this).data("submit_value"),n=e("#vfb-menu-to-edit li.ui-state-disabled:first").attr("id").match(new RegExp(/(\d+)$/g))[0];e("img.waiting").show(),e.post(ajaxurl,{action:"visual_form_builder_create_field",data:i,field_type:o,previous:n,page:pagenow,nonce:e("#_wpnonce").val()}).done((function(t){e("img.waiting").hide(),e(t).hide().insertBefore("#vfb-menu-to-edit li.ui-state-disabled:first").fadeIn()}))})),e(document).on("click","a.item-delete",(function(t){t.preventDefault();var i=childs=new Array,o=0,n=e(this).attr("href").split("&");if(!confirm("You are about to permanently delete this field.\n'Cancel' to stop, 'OK' to delete."))return!1;for(var a=0;a<n.length;a++){var s=n[a].indexOf("="),r=n[a].substring(0,s),l=n[a].substring(s+1);i[r]=l}var f=e(this).closest(".form-item").find("ul").children(),c=f.parent().html();f.each((function(t){childs[t]=e(this).attr("id").match(new RegExp(/(\d+)$/g))[0]}));var d=e(this).closest("li.form-item").parents("li.form-item");d.length&&(o=d.attr("id").match(new RegExp(/(\d+)$/g))[0]),e.post(ajaxurl,{action:"visual_form_builder_delete_field",form:i.form,field:i.field,child_ids:childs,parent_id:o,page:pagenow,nonce:i._wpnonce}).done((function(t){e("#form_item_"+i.field).addClass("deleting").animate({opacity:0,height:0},350,(function(){e(this).before(c).remove()}))}))})),e("#form-settings-button").click((function(t){t.preventDefault(),e(this).toggleClass("current"),e("#form-settings").slideToggle("fast");var i=e('input[name="form_id"]').val(),o=e(this).hasClass("current")?"opened":"closed";e.post(ajaxurl,{action:"visual_form_builder_form_settings",form:i,status:o,page:pagenow}).done((function(t){"closed"==o&&(e(".settings-links").removeClass("on"),e(".settings-links:first").addClass("on"),e(".form-details").slideUp("normal"),e(".form-details:first").show("normal"))}))})),e(".settings-links").click((function(t){t.preventDefault(),e(".settings-links").removeClass("on"),e(".form-details").slideUp("fast"),1==e(this).next("div").is(":hidden")&&(e(this).addClass("on"),e(this).next().slideDown("normal"));var i=e('input[name="form_id"]').val(),o=this.hash.replace(/#/g,"");e.post(ajaxurl,{action:"visual_form_builder_form_settings",form:i,accordion:o,page:pagenow})}));var i=!1;if(e("#vfb-form-builder-management input, #vfb-form-builder-management select, #vfb-form-builder-management textarea").change((function(){i=!0})),window.onbeforeunload=function(){if(i)return"The changes you made will be lost if you navigate away from this page."},e(document).on("submit","#visual-form-builder-update",(function(){window.onbeforeunload=null})),e(".columns-2 #side-sortables").length>0){var o=e("#vfb_form_items_meta_box"),n=o.width(),a=o.offset(),s=o.nextAll(),r=!1;e(window).on("scroll",(function(){e(window).scrollTop()>a.top?(o.stop().css({top:55,position:"fixed","z-index":"1",width:n}),s.is(":visible")&&(r=!0,s.stop().css({opacity:.1}))):(o.stop().css({top:0,position:"relative"}),r&&s.stop().css({opacity:1}))}))}var l=e(".form-success-type:checked").val();e("#form-success-message-"+l).show(),e(".form-success-type").change((function(){switch(e(this).val()){case"text":e("#form-success-message-text").show(),e("#form-success-message-page, #form-success-message-redirect").hide();break;case"page":e("#form-success-message-page").show(),e("#form-success-message-text, #form-success-message-redirect").hide();break;case"redirect":e("#form-success-message-redirect").show(),e("#form-success-message-text, #form-success-message-page").hide()}})),e(".vfb-field-types").click((function(t){t.preventDefault(),e("#vfb-field-tabs li").removeClass("tabs"),e(this).parent().addClass("tabs"),e(".tabs-panel-active").removeClass("tabs-panel-active").addClass("tabs-panel-inactive");var i=this.hash;e(i).removeClass("tabs-panel-inactive").addClass("tabs-panel-active")})),e("#visual-form-builder-update").validate({rules:{"form_email_to[]":{email:!0},form_email_from:{email:!0},form_success_message_redirect:{url:!0},form_notification_email_name:{required:function(t){return e("#form-notification-setting").is(":checked")}},form_notification_email_from:{required:function(t){return e("#form-notification-setting").is(":checked")},email:!0},form_notification_email:{required:function(t){return e("#form-notification-setting").is(":checked")}}},errorPlacement:function(e,t){e.insertAfter(t.parent())}}),e("#visual-form-builder-new-form").validate(),e("#form_email_from_name_override").change((function(){""==e("#form_email_from_name_override").val()?e("#form-email-sender-name").prop("readonly",!1):e("#form-email-sender-name").prop("readonly","readonly")})),e("#form_email_from_override").change((function(){""==e("#form_email_from_override").val()?e("#form-email-sender").prop("readonly",!1):e("#form-email-sender").prop("readonly","readonly")})),e("#notification-email").toggle(e("#form-notification-setting").prop("checked")),e("#form-notification-setting").change((function(){e(this).is(":checked")?(e("#notification-email").show(),e("#form-notification-email-name, #form-notification-email-from, #form-notification-email, #form-notification-subject, #form-notification-message, #form-notification-entry").prop("disabled",!1)):(e("#notification-email").hide(),e("#form-notification-email-name, #form-notification-email-from, #form-notification-email, #form-notification-subject, #form-notification-message, #form-notification-entry").prop("disabled","disabled"))})),e("#vfb-export-select-all").click((function(t){t.preventDefault(),e('#vfb-export-entries-fields input[type="checkbox"]').prop("checked",!0)})),e("#vfb-export-unselect-all").click((function(t){t.preventDefault(),e('#vfb-export-entries-fields input[type="checkbox"]').prop("checked",!1)})),e("#vfb-export-entries-forms").change((function(){var t=e(this).val(),i=function(t){var i="";return e.ajax(ajaxurl,{async:!1,data:{action:"visual_form_builder_export_entries_count",id:t,page:pagenow}}).done((function(t){if(t>1e3){e("#vfb-export-entries-rows").empty();for(var o=Math.ceil(parseInt(t)/1e3),n=1;n<=o;n++)e("#vfb-export-entries-rows").append(e("<option></option>").attr("value",n).text(n));e("#vfb-export-entries-pages").show()}else e("#vfb-export-entries-pages").hide();i=t})).fail((function(e){})),i}(t);e("#vfb-export-entries-fields").html("Loading..."),e.get(ajaxurl,{action:"visual_form_builder_export_load_options",id:t,count:i,page:pagenow}).done((function(t){e("#vfb-export-entries-fields").html(t)})).fail((function(t){e("#vfb-export-entries-fields").html("Error loading entry fields.")}))})),e("#vfb-export-entries-rows").change((function(){var t=e("#vfb-export-entries-forms").val(),i=e(this).val();e("#vfb-export-entries-fields").html("Loading..."),e.get(ajaxurl,{action:"visual_form_builder_export_load_options",id:t,offset:i,page:pagenow}).done((function(t){e("#vfb-export-entries-fields").html(t)})).fail((function(t){e("#vfb-export-entries-fields").html("Error loading entry fields.")}))}))})),function(e){e(document).ready((function(){e(".vfb-accordion-container").on("click keydown",".vfb-accordion-section-title",(function(t){"keydown"===t.type&&13!==t.which||(t.preventDefault(),function(e){var t=e.closest(".vfb-accordion-section"),i=t.closest(".vfb-accordion-container").find(".open"),o=t.find(".vfb-accordion-section-content");if(t.hasClass("cannot-expand"))return;t.hasClass("open")?(t.toggleClass("open"),o.toggle(!0).slideToggle(150)):(i.removeClass("open"),i.find(".vfb-accordion-section-content").show().slideUp(150),o.toggle(!1).slideToggle(150),t.toggleClass("open"))}(e(this)))}))}))}(jQuery);
|
1 |
+
jQuery(document).ready((function(e){var t=null;e(document).on("mouseenter mouseleave",".vfb-tooltip",(function(i){if("mouseenter"==i.type){t&&(clearTimeout(t),t=null);var o=e(this).attr("title"),n=e(this).attr("rel"),a=e(this).width();e(this).append('<div class="vfb-tooltip-popup"><h3>'+o+"</h3><p>"+n+"</p></div>"),e.data(this,"title",o),this.title="",e(this).find(".vfb-tooltip-popup").css({left:a+22}),t=setTimeout((function(){e(".vfb-tooltip-popup").fadeIn(300)}),500)}else this.title=e.data(this,"title"),e(".vfb-tooltip-popup").fadeOut(500),e(this).children().remove()})),e(document).on("click","a.vfb-add-option",(function(t){t.preventDefault();var i=e(this).parent().siblings(".vfb-cloned-options").children(),o=i.length,n=o+1,a=i[o-1],s=e(a).attr("id"),r=e(a).children("label").attr("for").replace(new RegExp(/(\d+)$/g),""),l=s.replace(new RegExp(/(\d+)$/g),""),c=e("#"+s).clone().attr("id",l+n);c.children("label").attr("for",r+n),c.find('input[type="text"]').attr("id",r+n),c.find('input[type="radio"]').attr("value",n),e("#"+l+o).after(c)})),e(document).on("click","a.deleteOption",(function(t){t.preventDefault(),e(this).parent().parent().find(".clonedOption").length-1==0?alert("You must have at least one option."):e(this).closest("div").remove()})),e(".vfb-cloned-options").sortable({items:"div.option"}),e(document).on("click","a.addEmail",(function(t){t.preventDefault();var i=e(this).closest("#email-details").find(".clonedOption").length,o=i+1,n=e(this).closest("div").attr("id"),a=e(this).closest("div").find("label").attr("for").replace(new RegExp(/(\d+)$/g),""),s=n.replace(new RegExp(/(\d+)$/g),""),r=e("#"+n).clone().attr("id",s+o);r.find("label").attr("for",a+o),r.find("input").attr("id",a+o),e("#"+s+i).after(r)})),e(document).on("click","a.deleteEmail",(function(t){t.preventDefault(),e(this).closest("#email-details").find(".clonedOption").length-1==0?alert("You must have at least one option."):e(this).closest("div").remove()})),e('.option input[type="radio"]').mousedown((function(){e(this).attr("previousValue",e(this).prop("checked"))})).click((function(){"true"==e(this).attr("previousValue")&&e(this).prop("checked",!1)})),e(".menu-delete").click((function(){var t=e(this).hasClass("entry-delete")?"entry":"form";return!!confirm("You are about to permanently delete this "+t+" and all of its data.\n'Cancel' to stop, 'OK' to delete.")})),e(document).on("click","a.item-edit",(function(t){t.preventDefault(),e(t.target).closest("li").children(".menu-item-settings").slideToggle("fast"),e(this).toggleClass("opened");var i=e(t.target).closest("dl");i.hasClass("vfb-menu-item-inactive")?i.removeClass("vfb-menu-item-inactive").addClass("vfb-menu-item-active"):i.removeClass("vfb-menu-item-active").addClass("vfb-menu-item-inactive")})),e("#vfb-menu-to-edit").nestedSortable({listType:"ul",maxLevels:3,handle:".vfb-menu-item-handle",placeholder:"vfb-sortable-placeholder",forcePlaceholderSize:!0,forceHelperSize:!0,tolerance:"pointer",toleranceElement:"> dl",items:"li:not(.ui-state-disabled)",create:function(t,i){e(this).css("min-height",e(this).height())},start:function(e,t){t.placeholder.height(t.item.height())},stop:function(t,i){var o=e("#vfb-menu-to-edit .item-type:first").text();opts={url:ajaxurl,type:"POST",async:!0,cache:!1,data:{action:"visual_form_builder_sort_field",order:e(this).nestedSortable("toArray")},success:function(t){e("#loading-animation").hide(),"FIELDSET"!==o?e("#vfb-fieldset-first-warning").show():e("#vfb-fieldset-first-warning").hide()}},e.ajax(opts)}}),e("#vfb-form-items .vfb-draggable-form-items").click((function(t){t.preventDefault(),e(this).data("submit_value",e(this).text())})),e("#vfb-form-items .vfb-draggable-form-items").click((function(t){t.preventDefault();var i=e(this).closest("form").serializeArray(),o=e(this).data("submit_value"),n=e("#vfb-menu-to-edit li.ui-state-disabled:first").attr("id").match(new RegExp(/(\d+)$/g))[0];e("img.waiting").show(),e.post(ajaxurl,{action:"visual_form_builder_create_field",data:i,field_type:o,previous:n,page:pagenow,nonce:e("#_wpnonce").val()}).done((function(t){e("img.waiting").hide(),e(t).hide().insertBefore("#vfb-menu-to-edit li.ui-state-disabled:first").fadeIn()}))})),e(document).on("click","a.item-delete",(function(t){t.preventDefault();var i=childs=new Array,o=0,n=e(this).attr("href").split("&");if(!confirm("You are about to permanently delete this field.\n'Cancel' to stop, 'OK' to delete."))return!1;for(var a=0;a<n.length;a++){var s=n[a].indexOf("="),r=n[a].substring(0,s),l=n[a].substring(s+1);i[r]=l}var c=e(this).closest(".form-item").find("ul").children(),f=c.parent().html();c.each((function(t){childs[t]=e(this).attr("id").match(new RegExp(/(\d+)$/g))[0]}));var d=e(this).closest("li.form-item").parents("li.form-item");d.length&&(o=d.attr("id").match(new RegExp(/(\d+)$/g))[0]),e.post(ajaxurl,{action:"visual_form_builder_delete_field",form:i.form,field:i.field,child_ids:childs,parent_id:o,page:pagenow,nonce:i._wpnonce}).done((function(t){e("#form_item_"+i.field).addClass("deleting").animate({opacity:0,height:0},350,(function(){e(this).before(f).remove()}))}))})),e("#form-settings-button").click((function(t){t.preventDefault(),e(this).toggleClass("current"),e("#form-settings").slideToggle("fast");var i=e('input[name="form_id"]').val(),o=e(this).hasClass("current")?"opened":"closed";e.post(ajaxurl,{action:"visual_form_builder_form_settings",form:i,status:o,page:pagenow}).done((function(t){"closed"==o&&(e(".settings-links").removeClass("on"),e(".settings-links:first").addClass("on"),e(".form-details").slideUp("normal"),e(".form-details:first").show("normal"))}))})),e(".settings-links").click((function(t){t.preventDefault(),e(".settings-links").removeClass("on"),e(".form-details").slideUp("fast"),1==e(this).next("div").is(":hidden")&&(e(this).addClass("on"),e(this).next().slideDown("normal"));var i=e('input[name="form_id"]').val(),o=this.hash.replace(/#/g,"");e.post(ajaxurl,{action:"visual_form_builder_form_settings",form:i,accordion:o,page:pagenow})}));var i=!1;if(e("#vfb-form-builder-management input, #vfb-form-builder-management select, #vfb-form-builder-management textarea").change((function(){i=!0})),window.onbeforeunload=function(){if(i)return"The changes you made will be lost if you navigate away from this page."},e(document).on("submit","#visual-form-builder-update",(function(){window.onbeforeunload=null})),e(".columns-2 #side-sortables").length>0){var o=e("#vfb_form_items_meta_box"),n=o.width(),a=o.offset(),s=o.nextAll(),r=!1;e(window).on("scroll",(function(){e(window).scrollTop()>a.top?(o.stop().css({top:55,position:"fixed","z-index":"1",width:n}),s.is(":visible")&&(r=!0,s.stop().css({opacity:.1}))):(o.stop().css({top:0,position:"relative"}),r&&s.stop().css({opacity:1}))}))}var l=e(".form-success-type:checked").val();e("#form-success-message-"+l).show(),e(".form-success-type").change((function(){switch(e(this).val()){case"text":e("#form-success-message-text").show(),e("#form-success-message-page, #form-success-message-redirect").hide();break;case"page":e("#form-success-message-page").show(),e("#form-success-message-text, #form-success-message-redirect").hide();break;case"redirect":e("#form-success-message-redirect").show(),e("#form-success-message-text, #form-success-message-page").hide()}})),e(".vfb-field-types").click((function(t){t.preventDefault(),e("#vfb-field-tabs li").removeClass("tabs"),e(this).parent().addClass("tabs"),e(".tabs-panel-active").removeClass("tabs-panel-active").addClass("tabs-panel-inactive");var i=this.hash;e(i).removeClass("tabs-panel-inactive").addClass("tabs-panel-active")})),e("#visual-form-builder-update").validate({rules:{"form_email_to[]":{email:!0},form_email_from:{email:!0},form_success_message_redirect:{url:!0},form_notification_email_name:{required:function(t){return e("#form-notification-setting").is(":checked")}},form_notification_email_from:{required:function(t){return e("#form-notification-setting").is(":checked")},email:!0},form_notification_email:{required:function(t){return e("#form-notification-setting").is(":checked")}}},errorPlacement:function(e,t){e.insertAfter(t.parent())}}),e("#visual-form-builder-new-form").validate(),e("#form_email_from_name_override").change((function(){""==e("#form_email_from_name_override").val()?e("#form-email-sender-name").prop("readonly",!1):e("#form-email-sender-name").prop("readonly","readonly")})),e("#form_email_from_override").change((function(){""==e("#form_email_from_override").val()?e("#form-email-sender").prop("readonly",!1):e("#form-email-sender").prop("readonly","readonly")})),e("#notification-email").toggle(e("#form-notification-setting").prop("checked")),e("#form-notification-setting").change((function(){e(this).is(":checked")?(e("#notification-email").show(),e("#form-notification-email-name, #form-notification-email-from, #form-notification-email, #form-notification-subject, #form-notification-message, #form-notification-entry").prop("disabled",!1)):(e("#notification-email").hide(),e("#form-notification-email-name, #form-notification-email-from, #form-notification-email, #form-notification-subject, #form-notification-message, #form-notification-entry").prop("disabled","disabled"))})),e("#vfb-export-select-all").click((function(t){t.preventDefault(),e('#vfb-export-entries-fields input[type="checkbox"]').prop("checked",!0)})),e("#vfb-export-unselect-all").click((function(t){t.preventDefault(),e('#vfb-export-entries-fields input[type="checkbox"]').prop("checked",!1)})),e("#vfb-export-forms-list").change((function(){var t=e(this).val();e("#vfb-export-entries-fields").html("Loading..."),e.get(ajaxurl,{action:"vfb-export-fields",id:t,vfb_ajax_nonce:vfb_settings.vfb_ajax_nonce}).done((function(t){e("#vfb-export-entries-fields").html(t)})).fail((function(t){e("#vfb-export-entries-fields").html("Error loading entry fields.")}))}))})),function(e){e(document).ready((function(){e(".vfb-accordion-container").on("click keydown",".vfb-accordion-section-title",(function(t){"keydown"===t.type&&13!==t.which||(t.preventDefault(),function(e){var t=e.closest(".vfb-accordion-section"),i=t.closest(".vfb-accordion-container").find(".open"),o=t.find(".vfb-accordion-section-content");if(t.hasClass("cannot-expand"))return;t.hasClass("open")?(t.toggleClass("open"),o.toggle(!0).slideToggle(150)):(i.removeClass("open"),i.find(".vfb-accordion-section-content").show().slideUp(150),o.toggle(!1).slideToggle(150),t.toggleClass("open"))}(e(this)))}))}))}(jQuery);
|
admin/class-ajax.php
CHANGED
@@ -149,7 +149,7 @@ class Visual_Form_Builder_Admin_AJAX {
|
|
149 |
global $wpdb;
|
150 |
|
151 |
if ( isset( $_POST['action'] ) && $_POST['action'] == 'visual_form_builder_delete_field' ) {
|
152 |
-
$form_id
|
153 |
$field_id = absint( $_POST['field'] );
|
154 |
|
155 |
check_ajax_referer( 'delete-field-' . $form_id, 'nonce' );
|
@@ -178,10 +178,10 @@ class Visual_Form_Builder_Admin_AJAX {
|
|
178 |
$current_user = wp_get_current_user();
|
179 |
|
180 |
if ( isset( $_POST['action'] ) && $_POST['action'] == 'visual_form_builder_form_settings' ) {
|
181 |
-
$form_id
|
182 |
-
$status
|
183 |
-
$accordion
|
184 |
-
$user_id
|
185 |
|
186 |
$form_settings = get_user_meta( $user_id, 'vfb-form-settings', true );
|
187 |
|
149 |
global $wpdb;
|
150 |
|
151 |
if ( isset( $_POST['action'] ) && $_POST['action'] == 'visual_form_builder_delete_field' ) {
|
152 |
+
$form_id = absint( $_POST['form'] );
|
153 |
$field_id = absint( $_POST['field'] );
|
154 |
|
155 |
check_ajax_referer( 'delete-field-' . $form_id, 'nonce' );
|
178 |
$current_user = wp_get_current_user();
|
179 |
|
180 |
if ( isset( $_POST['action'] ) && $_POST['action'] == 'visual_form_builder_form_settings' ) {
|
181 |
+
$form_id = absint( $_POST['form'] );
|
182 |
+
$status = isset( $_POST['status'] ) ? sanitize_text_field( $_POST['status'] ) : 'opened';
|
183 |
+
$accordion = isset( $_POST['accordion'] ) ? sanitize_text_field( $_POST['accordion'] ) : 'general-settings';
|
184 |
+
$user_id = $current_user instanceof WP_User ? $current_user->ID : 1;
|
185 |
|
186 |
$form_settings = get_user_meta( $user_id, 'vfb-form-settings', true );
|
187 |
|
admin/class-entries-detail.php
CHANGED
@@ -91,8 +91,8 @@ class Visual_Form_Builder_Entries_Detail {
|
|
91 |
<div class="inside">';
|
92 |
}
|
93 |
|
94 |
-
|
95 |
-
echo $v;
|
96 |
$count++;
|
97 |
else :
|
98 |
// Cast each array as an object
|
@@ -103,7 +103,7 @@ class Visual_Form_Builder_Entries_Detail {
|
|
103 |
if ( $open_fieldset == true )
|
104 |
echo '</table>';
|
105 |
|
106 |
-
|
107 |
|
108 |
$open_fieldset = true;
|
109 |
endif;
|
@@ -121,7 +121,7 @@ class Visual_Form_Builder_Entries_Detail {
|
|
121 |
case 'file-upload' :
|
122 |
?>
|
123 |
<tr valign="top">
|
124 |
-
<th scope="row"><label for="field[<?php echo $obj->id; ?>]"><?php echo
|
125 |
<td style="background:#eee;border:1px solid #ddd"><a href="<?php esc_attr_e( $obj->value ); ?>" target="_blank"><?php echo esc_html( $obj->value ); ?></a></td>
|
126 |
</tr>
|
127 |
<?php
|
@@ -131,7 +131,7 @@ class Visual_Form_Builder_Entries_Detail {
|
|
131 |
case 'html' :
|
132 |
?>
|
133 |
<tr valign="top">
|
134 |
-
<th scope="row"><label for="field[<?php echo $obj->id; ?>]"><?php echo
|
135 |
<td style="background:#eee;border:1px solid #ddd"><?php echo wpautop( esc_html( $obj->value ) ); ?></td>
|
136 |
</tr>
|
137 |
<?php
|
@@ -140,7 +140,7 @@ class Visual_Form_Builder_Entries_Detail {
|
|
140 |
default :
|
141 |
?>
|
142 |
<tr valign="top">
|
143 |
-
<th scope="row"><label for="field[<?php echo $obj->id; ?>]"><?php echo
|
144 |
<td style="background:#eee;border:1px solid #ddd"><?php echo esc_html( $obj->value ); ?></td>
|
145 |
</tr>
|
146 |
<?php
|
91 |
<div class="inside">';
|
92 |
}
|
93 |
|
94 |
+
printf( '<h4>%s</h4>', esc_html( ucwords( $k ) ) );
|
95 |
+
echo esc_html( $v );
|
96 |
$count++;
|
97 |
else :
|
98 |
// Cast each array as an object
|
103 |
if ( $open_fieldset == true )
|
104 |
echo '</table>';
|
105 |
|
106 |
+
printf( '<h3>%s</h3><table class="form-table">', esc_html( $obj->name ) );
|
107 |
|
108 |
$open_fieldset = true;
|
109 |
endif;
|
121 |
case 'file-upload' :
|
122 |
?>
|
123 |
<tr valign="top">
|
124 |
+
<th scope="row"><label for="field[<?php echo $obj->id; ?>]"><?php echo esc_html( $obj->name ); ?></label></th>
|
125 |
<td style="background:#eee;border:1px solid #ddd"><a href="<?php esc_attr_e( $obj->value ); ?>" target="_blank"><?php echo esc_html( $obj->value ); ?></a></td>
|
126 |
</tr>
|
127 |
<?php
|
131 |
case 'html' :
|
132 |
?>
|
133 |
<tr valign="top">
|
134 |
+
<th scope="row"><label for="field[<?php echo $obj->id; ?>]"><?php echo esc_html( $obj->name ); ?></label></th>
|
135 |
<td style="background:#eee;border:1px solid #ddd"><?php echo wpautop( esc_html( $obj->value ) ); ?></td>
|
136 |
</tr>
|
137 |
<?php
|
140 |
default :
|
141 |
?>
|
142 |
<tr valign="top">
|
143 |
+
<th scope="row"><label for="field[<?php echo $obj->id; ?>]"><?php echo esc_html( $obj->name ); ?></label></th>
|
144 |
<td style="background:#eee;border:1px solid #ddd"><?php echo esc_html( $obj->value ); ?></td>
|
145 |
</tr>
|
146 |
<?php
|
admin/class-entries-list.php
CHANGED
@@ -480,7 +480,7 @@ class Visual_Form_Builder_Entries_List extends Visual_Form_Builder_List_Table {
|
|
480 |
$this->_column_headers = array($columns, $hidden, $sortable);
|
481 |
|
482 |
// Get entries search terms
|
483 |
-
$search_terms = ( !empty( $_POST['s'] ) ) ? explode( ' ', $_POST['s'] ) : array();
|
484 |
|
485 |
$searchand = $search = '';
|
486 |
// Loop through search terms and build query
|
@@ -494,8 +494,8 @@ class Visual_Form_Builder_Entries_List extends Visual_Form_Builder_List_Table {
|
|
494 |
$search = ( !empty($search) ) ? " AND ({$search}) " : '';
|
495 |
|
496 |
// Set our ORDER BY and ASC/DESC to sort the entries
|
497 |
-
$orderby = ( !empty( $_GET['orderby'] ) ) ? $_GET['orderby'] : 'date';
|
498 |
-
$order
|
499 |
|
500 |
// Get the sorted entries
|
501 |
$entries = $this->get_entries( $orderby, $order, $per_page, $offset, $search );
|
480 |
$this->_column_headers = array($columns, $hidden, $sortable);
|
481 |
|
482 |
// Get entries search terms
|
483 |
+
$search_terms = ( !empty( $_POST['s'] ) ) ? explode( ' ', sanitize_text_field( $_POST['s'] ) ) : array();
|
484 |
|
485 |
$searchand = $search = '';
|
486 |
// Loop through search terms and build query
|
494 |
$search = ( !empty($search) ) ? " AND ({$search}) " : '';
|
495 |
|
496 |
// Set our ORDER BY and ASC/DESC to sort the entries
|
497 |
+
$orderby = ( !empty( $_GET['orderby'] ) ) ? sanitize_text_field( $_GET['orderby'] ) : 'date';
|
498 |
+
$order = ( !empty( $_GET['order'] ) ) ? sanitize_text_field( $_GET['order'] ) : 'desc';
|
499 |
|
500 |
// Get the sorted entries
|
501 |
$entries = $this->get_entries( $orderby, $order, $per_page, $offset, $search );
|
admin/class-export.php
CHANGED
@@ -4,13 +4,18 @@
|
|
4 |
*
|
5 |
*/
|
6 |
class Visual_Form_Builder_Export {
|
|
|
7 |
/**
|
8 |
-
* delimiter
|
9 |
*
|
10 |
-
*
|
11 |
-
*
|
|
|
|
|
|
|
|
|
12 |
*/
|
13 |
-
|
14 |
|
15 |
/**
|
16 |
* default_cols
|
@@ -21,218 +26,226 @@ class Visual_Form_Builder_Export {
|
|
21 |
public $default_cols;
|
22 |
|
23 |
/**
|
24 |
-
*
|
|
|
|
|
|
|
|
|
25 |
*/
|
26 |
-
public function __construct(){
|
27 |
-
global $wpdb;
|
28 |
-
|
29 |
// CSV delimiter
|
30 |
$this->delimiter = apply_filters( 'vfb_csv_delimiter', ',' );
|
31 |
|
32 |
// Setup our default columns
|
33 |
$this->default_cols = array(
|
34 |
-
'entries_id'
|
35 |
-
'date_submitted'
|
36 |
-
'ip_address'
|
37 |
-
'subject'
|
38 |
-
'sender_name'
|
39 |
-
'sender_email'
|
40 |
-
'emails_to'
|
41 |
);
|
42 |
|
43 |
-
|
44 |
-
add_action( '
|
45 |
-
|
46 |
-
// AJAX for getting entries count
|
47 |
-
add_action( 'wp_ajax_visual_form_builder_export_entries_count', array( $this, 'ajax_entries_count' ) );
|
48 |
-
|
49 |
-
$this->process_export_action();
|
50 |
}
|
51 |
|
52 |
/**
|
53 |
-
*
|
54 |
-
*
|
55 |
-
* @since 1.7
|
56 |
*
|
|
|
|
|
57 |
*/
|
58 |
-
public function display(){
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
|
|
71 |
|
|
|
72 |
return;
|
73 |
-
}
|
74 |
-
|
75 |
-
$entries_count = $this->count_entries( $forms[0]->form_id );
|
76 |
|
77 |
-
|
78 |
-
|
79 |
-
$no_entries = __( 'No entries to pull field names from.', 'visual-form-builder' );
|
80 |
-
}
|
81 |
-
else {
|
82 |
-
$limit = $entries_count > 1000 ? 1000 : $entries_count;
|
83 |
|
84 |
-
|
85 |
-
$entries = $wpdb->get_results( $wpdb->prepare( "SELECT data FROM " . VFB_WP_ENTRIES_TABLE_NAME . " WHERE form_id = %d AND entry_approved = 1 LIMIT %d", $forms[0]->form_id, $limit ), ARRAY_A );
|
86 |
|
87 |
-
|
88 |
-
$columns = $this->get_cols( $entries );
|
89 |
|
90 |
-
|
91 |
-
$data =
|
92 |
}
|
93 |
-
?>
|
94 |
-
<form method="post" id="vfb-export">
|
95 |
-
<p><?php _e( 'Backup and save some or all of your Visual Form Builder data.', 'visual-form-builder' ); ?></p>
|
96 |
-
<p><?php _e( 'Once you have saved the file, you will be able to import Visual Form Builder Pro data from this site into another site.', 'visual-form-builder' ); ?></p>
|
97 |
-
<h3><?php _e( 'Choose what to export', 'visual-form-builder' ); ?></h3>
|
98 |
-
|
99 |
-
<p><label><input type="radio" name="vfb-content" value="forms" disabled="disabled" /> <?php _e( 'Forms', 'visual-form-builder' ); ?></label></p>
|
100 |
-
<p class="description"><?php _e( 'This will contain all of your forms, fields, and email design settings', 'visual-form-builder' ); ?>.<br><strong>*<?php _e( 'Only available in Visual Form Builder Pro', 'visual-form-builder' ); ?>*</strong></p>
|
101 |
-
|
102 |
-
<p><label><input type="radio" name="vfb-content" value="entries" checked="checked" /> <?php _e( 'Entries', 'visual-form-builder' ); ?></label></p>
|
103 |
-
|
104 |
-
<ul id="entries-filters" class="vfb-export-filters">
|
105 |
-
<li><p class="description"><?php _e( 'This will export entries in either a .csv, .txt, or .xls and cannot be used with the Import. If you need to import entries on another site, please use the All data option above.', 'visual-form-builder' ); ?></p></li>
|
106 |
-
<!-- Format -->
|
107 |
-
<li>
|
108 |
-
<label class="vfb-export-label" for="format"><?php _e( 'Format', 'visual-form-builder' ); ?>:</label>
|
109 |
-
<select name="format">
|
110 |
-
<option value="csv" selected="selected"><?php _e( 'Comma Separated (.csv)', 'visual-form-builder' ); ?></option>
|
111 |
-
<option value="txt" disabled="disabled"><?php _e( 'Tab Delimited (.txt) - Pro only', 'visual-form-builder' ); ?></option>
|
112 |
-
<option value="xls" disabled="disabled"><?php _e( 'Excel (.xls) - Pro only', 'visual-form-builder' ); ?></option>
|
113 |
-
</select>
|
114 |
-
</li>
|
115 |
-
<!-- Forms -->
|
116 |
-
<li>
|
117 |
-
<label class="vfb-export-label" for="form_id"><?php _e( 'Form', 'visual-form-builder' ); ?>:</label>
|
118 |
-
<select id="vfb-export-entries-forms" name="entries_form_id">
|
119 |
-
<?php
|
120 |
-
foreach ( $forms as $form ) {
|
121 |
-
echo sprintf(
|
122 |
-
'<option value="%1$d" id="%2$s">%1$d - %3$s</option>',
|
123 |
-
$form->form_id,
|
124 |
-
$form->form_key,
|
125 |
-
stripslashes( $form->form_title )
|
126 |
-
);
|
127 |
-
}
|
128 |
-
?>
|
129 |
-
</select>
|
130 |
-
</li>
|
131 |
-
<!-- Date Range -->
|
132 |
-
<li>
|
133 |
-
<label class="vfb-export-label"><?php _e( 'Date Range', 'visual-form-builder' ); ?>:</label>
|
134 |
-
<select name="entries_start_date">
|
135 |
-
<option value="0">Start Date</option>
|
136 |
-
<?php $this->months_dropdown(); ?>
|
137 |
-
</select>
|
138 |
-
<select name="entries_end_date">
|
139 |
-
<option value="0">End Date</option>
|
140 |
-
<?php $this->months_dropdown(); ?>
|
141 |
-
</select>
|
142 |
-
</li>
|
143 |
-
<!-- Pages to Export -->
|
144 |
-
<?php $num_pages = ceil( $entries_count / 1000 ); ?>
|
145 |
-
<li id="vfb-export-entries-pages" style="display:<?php echo ( $entries_count > 1000 ) ? 'list-item' : 'none'; ?>">
|
146 |
-
<label class="vfb-export-label"><?php _e( 'Page to Export', 'visual-form-builder' ); ?>:</label>
|
147 |
-
<select id="vfb-export-entries-rows" name="entries_page">
|
148 |
-
<?php
|
149 |
-
for ( $i = 1; $i <= $num_pages; $i++ ) {
|
150 |
-
echo sprintf( '<option value="%1$d">%1$s</option>', $i );
|
151 |
-
}
|
152 |
-
?>
|
153 |
-
</select>
|
154 |
-
<p class="description"><?php _e( 'A large number of entries have been detected for this form. Only 1000 entries can be exported at a time.', 'visual-form-builder' ); ?></p>
|
155 |
-
</li>
|
156 |
-
<!-- Fields -->
|
157 |
-
<li>
|
158 |
-
<label class="vfb-export-label"><?php _e( 'Fields', 'visual-form-builder' ); ?>:</label>
|
159 |
-
|
160 |
-
<p>
|
161 |
-
<a id="vfb-export-select-all" href="#"><?php _e( 'Select All', 'visual-form-builder' ); ?></a>
|
162 |
-
<a id="vfb-export-unselect-all" href="#"><?php _e( 'Unselect All', 'visual-form-builder' ); ?></a>
|
163 |
-
</p>
|
164 |
-
|
165 |
-
<div id="vfb-export-entries-fields">
|
166 |
-
<?php
|
167 |
-
if ( isset( $no_entries ) )
|
168 |
-
echo $no_entries;
|
169 |
-
else
|
170 |
-
echo $this->build_options( $data );
|
171 |
-
?>
|
172 |
-
</div>
|
173 |
-
</li>
|
174 |
-
</ul>
|
175 |
-
|
176 |
-
<?php submit_button( __( 'Download Export File', 'visual-form-builder' ) ); ?>
|
177 |
-
</form>
|
178 |
-
<?php
|
179 |
-
}
|
180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
|
182 |
-
|
183 |
-
|
184 |
-
*
|
185 |
-
* @since 1.7
|
186 |
-
*
|
187 |
-
* @param array $args Filters defining what should be included in the export
|
188 |
-
*/
|
189 |
-
public function export_entries( $args = array() ) {
|
190 |
-
global $wpdb;
|
191 |
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
'format' => 'csv',
|
198 |
-
'form_id' => 0,
|
199 |
-
'start_date' => false,
|
200 |
-
'end_date' => false,
|
201 |
-
'page' => 0,
|
202 |
-
'fields' => $initial_fields,
|
203 |
-
);
|
204 |
|
205 |
-
|
|
|
206 |
|
207 |
-
|
|
|
208 |
|
209 |
-
|
|
|
210 |
|
211 |
-
|
212 |
-
|
213 |
-
|
|
|
214 |
|
215 |
-
|
216 |
-
$
|
|
|
217 |
|
218 |
-
|
219 |
-
$where .= $wpdb->prepare( " AND date_submitted < %s", date( 'Y-m-d', strtotime( '+1 month', strtotime( $args['end_date'] ) ) ) );
|
220 |
|
221 |
-
|
222 |
-
|
|
|
223 |
}
|
|
|
224 |
|
225 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
|
227 |
-
$
|
228 |
-
$form_key = $wpdb->get_var( $wpdb->prepare( "SELECT form_key, form_title FROM " . VFB_WP_FORMS_TABLE_NAME . " WHERE form_id = %d", $args['form_id'] ) );
|
229 |
-
$form_title = $wpdb->get_var( null, 1 );
|
230 |
|
231 |
$sitename = sanitize_key( get_bloginfo( 'name' ) );
|
232 |
if ( ! empty($sitename) ) $sitename .= '.';
|
233 |
-
$filename = $sitename
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
|
235 |
-
$
|
|
|
236 |
|
237 |
header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' );
|
238 |
header( 'Content-Description: File Transfer' );
|
@@ -241,20 +254,139 @@ class Visual_Form_Builder_Export {
|
|
241 |
header( 'Expires: 0' );
|
242 |
header( 'Pragma: public' );
|
243 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
// Get columns
|
245 |
$columns = $this->get_cols( $entries );
|
246 |
|
247 |
// Get JSON data
|
248 |
-
$
|
249 |
|
250 |
-
|
251 |
-
$fields = !is_array( $args['fields'] ) ? array_map( 'trim', explode( ',', $args['fields'] ) ) : $args['fields'];
|
252 |
|
253 |
-
//
|
254 |
-
|
|
|
|
|
|
|
255 |
|
256 |
-
|
257 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
}
|
259 |
|
260 |
/**
|
@@ -331,300 +463,38 @@ class Visual_Form_Builder_Export {
|
|
331 |
$output[ $row ][ stripslashes( $obj->name ) . "{{{$obj->id}}}" ] = $val;
|
332 |
|
333 |
break;
|
334 |
-
}
|
335 |
-
}
|
336 |
}
|
337 |
break;
|
338 |
-
}
|
339 |
-
} // end $entry loop
|
340 |
-
$row++;
|
341 |
-
} //end $entries loop
|
342 |
-
|
343 |
-
return json_encode( $output );
|
344 |
-
}
|
345 |
-
|
346 |
-
/**
|
347 |
-
* [count_entries description]
|
348 |
-
* @param [type] $form_id [description]
|
349 |
-
* @return [type] [description]
|
350 |
-
*/
|
351 |
-
public function count_entries( $form_id ) {
|
352 |
-
global $wpdb;
|
353 |
-
|
354 |
-
$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM " . VFB_WP_ENTRIES_TABLE_NAME . " WHERE form_id = %d", $form_id ) );
|
355 |
-
|
356 |
-
if ( !$count )
|
357 |
-
return 0;
|
358 |
-
|
359 |
-
return $count;
|
360 |
-
}
|
361 |
-
|
362 |
-
/**
|
363 |
-
* [get_form_IDs description]
|
364 |
-
* @param [type] $form_id [description]
|
365 |
-
* @return [type] [description]
|
366 |
-
*/
|
367 |
-
public function get_form_IDs( $form_id = null ) {
|
368 |
-
global $wpdb;
|
369 |
-
|
370 |
-
$where = '';
|
371 |
-
|
372 |
-
if ( $form_id )
|
373 |
-
$where .= $wpdb->prepare( " AND form_id = %d", $form_id );
|
374 |
-
|
375 |
-
$form_ids = $wpdb->get_col( "SELECT DISTINCT form_id FROM " . VFB_WP_FORMS_TABLE_NAME . " WHERE 1=1 $where" );
|
376 |
-
|
377 |
-
if ( !$form_ids )
|
378 |
-
return;
|
379 |
-
|
380 |
-
return $form_ids;
|
381 |
-
}
|
382 |
-
|
383 |
-
/**
|
384 |
-
* [get_field_IDs description]
|
385 |
-
* @param [type] $form_id [description]
|
386 |
-
* @return [type] [description]
|
387 |
-
*/
|
388 |
-
public function get_field_IDs( $form_id = null ) {
|
389 |
-
global $wpdb;
|
390 |
-
|
391 |
-
$where = '';
|
392 |
-
|
393 |
-
if ( $form_id )
|
394 |
-
$where .= $wpdb->prepare( " AND form_id = %d", $form_id );
|
395 |
-
|
396 |
-
$field_ids = $wpdb->get_col( "SELECT DISTINCT field_id FROM " . VFB_WP_FIELDS_TABLE_NAME . " WHERE 1=1 $where" );
|
397 |
-
|
398 |
-
if ( !$field_ids )
|
399 |
-
return;
|
400 |
-
|
401 |
-
return $field_ids;
|
402 |
-
}
|
403 |
-
|
404 |
-
/**
|
405 |
-
* [get_entry_IDs description]
|
406 |
-
* @param [type] $form_id [description]
|
407 |
-
* @return [type] [description]
|
408 |
-
*/
|
409 |
-
public function get_entry_IDs( $form_id = null ) {
|
410 |
-
global $wpdb;
|
411 |
-
|
412 |
-
$where = '';
|
413 |
-
|
414 |
-
if ( $form_id ) {
|
415 |
-
$where .= $wpdb->prepare( " AND form_id = %d", $form_id );
|
416 |
-
|
417 |
-
$count = $this->count_entries( $form_id );
|
418 |
-
$where .= " LIMIT $count";
|
419 |
-
}
|
420 |
-
|
421 |
-
$entry_ids = $wpdb->get_col( "SELECT DISTINCT entries_id FROM " . VFB_WP_ENTRIES_TABLE_NAME . " WHERE entry_approved = 1 $where" );
|
422 |
-
|
423 |
-
if ( !$entry_ids )
|
424 |
-
return;
|
425 |
-
|
426 |
-
return $entry_ids;
|
427 |
-
}
|
428 |
-
|
429 |
-
/**
|
430 |
-
* Return the entries data formatted for CSV
|
431 |
-
*
|
432 |
-
* @since 1.7
|
433 |
-
*
|
434 |
-
* @param array $data The multidimensional array of entries data
|
435 |
-
* @param array $fields The selected fields to export
|
436 |
-
*/
|
437 |
-
public function csv( $data, $fields ) {
|
438 |
-
// Open file with PHP wrapper
|
439 |
-
$fh = @fopen( 'php://output', 'w' );
|
440 |
-
|
441 |
-
$rows = $fields_clean = $fields_header = array();
|
442 |
-
|
443 |
-
// Decode special characters
|
444 |
-
foreach ( $fields as $field ) {
|
445 |
-
// Strip unique ID for a clean header
|
446 |
-
$search = preg_replace( '/{{(\d+)}}/', '', $field );
|
447 |
-
$fields_header[] = wp_specialchars_decode( $search, ENT_QUOTES );
|
448 |
-
|
449 |
-
// Field with unique ID to use as matching data
|
450 |
-
$fields_clean[] = wp_specialchars_decode( $field, ENT_QUOTES );
|
451 |
-
}
|
452 |
-
|
453 |
-
// Build headers
|
454 |
-
fputcsv( $fh, $fields_header, $this->delimiter );
|
455 |
-
|
456 |
-
// Build table rows and cells
|
457 |
-
foreach ( $data as $row ) {
|
458 |
-
|
459 |
-
foreach ( $fields_clean as $label ) {
|
460 |
-
$label = wp_specialchars_decode( $label );
|
461 |
-
$rows[ $label ] = ( isset( $row[ $label ] ) && in_array( $label, $fields_clean ) ) ? $row[ $label ] : '';
|
462 |
}
|
463 |
-
|
464 |
-
fputcsv( $fh, $rows, $this->delimiter );
|
465 |
}
|
466 |
|
467 |
-
|
468 |
-
fclose( $fh );
|
469 |
-
|
470 |
-
exit();
|
471 |
}
|
472 |
|
473 |
/**
|
474 |
-
*
|
475 |
*
|
476 |
-
* @
|
477 |
-
*
|
478 |
-
* @return string Either no entries or the entry headers
|
479 |
-
*/
|
480 |
-
public function ajax_load_options() {
|
481 |
-
global $wpdb;
|
482 |
-
|
483 |
-
if ( !isset( $_GET['action'] ) )
|
484 |
-
return;
|
485 |
-
|
486 |
-
if ( $_GET['action'] !== 'visual_form_builder_export_load_options' )
|
487 |
-
return;
|
488 |
-
|
489 |
-
$form_id = absint( $_GET['id'] );
|
490 |
-
|
491 |
-
// Safe to get entries now
|
492 |
-
$entry_ids = $this->get_entry_IDs( $form_id );
|
493 |
-
|
494 |
-
// Return nothing if no entries found
|
495 |
-
if ( !$entry_ids ) {
|
496 |
-
echo __( 'No entries to pull field names from.', 'visual-form-builder' );
|
497 |
-
wp_die();
|
498 |
-
}
|
499 |
-
|
500 |
-
$offset = '';
|
501 |
-
$limit = 1000;
|
502 |
-
|
503 |
-
if ( isset( $_GET['count'] ) ) {
|
504 |
-
$limit = ( $_GET['count'] < 1000 ) ? absint( $_GET['count'] ) : 1000;
|
505 |
-
}
|
506 |
-
elseif ( isset( $_GET['offset'] ) ) {
|
507 |
-
// Reset offset/page to a zero index
|
508 |
-
$offset = absint( $_GET['offset'] ) - 1;
|
509 |
-
|
510 |
-
// Calculate the offset
|
511 |
-
$offset_num = $offset * 1000;
|
512 |
-
|
513 |
-
// If page is 2 or greater, set the offset (page 2 is equal to offset 1 because of zero index)
|
514 |
-
$offset = $offset >= 1 ? "OFFSET $offset_num" : '';
|
515 |
-
}
|
516 |
-
|
517 |
-
$entries = $wpdb->get_results( "SELECT data FROM " . VFB_WP_ENTRIES_TABLE_NAME . " WHERE form_id = $form_id AND entry_approved = 1 LIMIT $limit $offset", ARRAY_A );
|
518 |
-
|
519 |
-
// Get columns
|
520 |
-
$columns = $this->get_cols( $entries );
|
521 |
-
|
522 |
-
// Get JSON data
|
523 |
-
$data = json_decode( $columns, true );
|
524 |
-
|
525 |
-
echo $this->build_options( $data );
|
526 |
-
|
527 |
-
wp_die();
|
528 |
-
}
|
529 |
-
|
530 |
-
/**
|
531 |
-
* [ajax_entries_count description]
|
532 |
-
* @return [type] [description]
|
533 |
*/
|
534 |
-
public function
|
535 |
global $wpdb;
|
536 |
|
537 |
-
|
538 |
-
|
539 |
|
540 |
-
if ( $_GET['action'] !== '
|
541 |
return;
|
542 |
|
543 |
$form_id = absint( $_GET['id'] );
|
544 |
|
545 |
-
|
546 |
-
|
547 |
-
wp_die();
|
548 |
-
}
|
549 |
-
|
550 |
-
/**
|
551 |
-
* [build_options description]
|
552 |
-
* @param [type] $data [description]
|
553 |
-
* @return [type] [description]
|
554 |
-
*/
|
555 |
-
public function build_options( $data ) {
|
556 |
-
$output = '';
|
557 |
-
|
558 |
-
$array = array();
|
559 |
-
foreach ( $data as $row ) {
|
560 |
-
$array = array_merge( $row, $array );
|
561 |
-
}
|
562 |
-
|
563 |
-
$array = array_keys( $array );
|
564 |
-
$array = array_values( array_merge( $this->default_cols, $array ) );
|
565 |
-
$array = array_map( 'stripslashes', $array );
|
566 |
-
|
567 |
-
foreach ( $array as $k => $v ) {
|
568 |
-
$selected = ( in_array( $v, $this->default_cols ) ) ? ' checked="checked"' : '';
|
569 |
-
|
570 |
-
// Strip unique ID for a clean list
|
571 |
-
$search = preg_replace( '/{{(\d+)}}/', '', $v );
|
572 |
-
|
573 |
-
$output .= sprintf( '<label for="vfb-display-entries-val-%1$d"><input name="entries_columns[]" class="vfb-display-entries-vals" id="vfb-display-entries-val-%1$d" type="checkbox" value="%4$s" %3$s> %2$s</label><br>', $k, $search, $selected, esc_attr( $v ) );
|
574 |
-
}
|
575 |
-
|
576 |
-
return $output;
|
577 |
-
}
|
578 |
-
|
579 |
-
/**
|
580 |
-
* Return the selected export type
|
581 |
-
*
|
582 |
-
* @since 1.7
|
583 |
-
*
|
584 |
-
* @return string|bool The type of export
|
585 |
-
*/
|
586 |
-
public function export_action() {
|
587 |
-
if ( isset( $_POST['vfb-content'] ) )
|
588 |
-
return $_POST['vfb-content'];
|
589 |
-
|
590 |
-
return false;
|
591 |
-
}
|
592 |
-
|
593 |
-
/**
|
594 |
-
* Determine which export process to run
|
595 |
-
*
|
596 |
-
* @since 1.7
|
597 |
-
*
|
598 |
-
*/
|
599 |
-
public function process_export_action() {
|
600 |
-
$args = array();
|
601 |
-
|
602 |
-
if ( !isset( $_POST['vfb-content'] ) || 'entries' == $_POST['vfb-content'] ) {
|
603 |
-
$args['content'] = 'entries';
|
604 |
-
|
605 |
-
$args['format'] = 'csv';
|
606 |
-
|
607 |
-
if ( isset( $_POST['entries_form_id'] ) )
|
608 |
-
$args['form_id'] = (int) $_POST['entries_form_id'];
|
609 |
-
|
610 |
-
if ( isset( $_POST['entries_start_date'] ) || isset( $_POST['entries_end_date'] ) ) {
|
611 |
-
$args['start_date'] = $_POST['entries_start_date'];
|
612 |
-
$args['end_date'] = $_POST['entries_end_date'];
|
613 |
-
}
|
614 |
-
|
615 |
-
if ( isset( $_POST['entries_columns'] ) )
|
616 |
-
$args['fields'] = array_map( 'esc_html', $_POST['entries_columns'] );
|
617 |
|
618 |
-
|
619 |
-
$args['page'] = absint( $_POST['entries_page'] );
|
620 |
-
}
|
621 |
-
|
622 |
-
switch( $this->export_action() ) {
|
623 |
-
case 'entries' :
|
624 |
-
$this->export_entries( $args );
|
625 |
-
die(1);
|
626 |
-
break;
|
627 |
-
}
|
628 |
}
|
629 |
|
630 |
/**
|
@@ -637,9 +507,8 @@ class Visual_Form_Builder_Export {
|
|
637 |
|
638 |
$where = apply_filters( 'vfb_pre_get_entries', '' );
|
639 |
|
640 |
-
|
641 |
-
SELECT DISTINCT YEAR( forms.date_submitted ) AS year, MONTH( forms.date_submitted ) AS month
|
642 |
-
FROM " . VFB_WP_ENTRIES_TABLE_NAME . " AS forms
|
643 |
WHERE 1=1 $where
|
644 |
ORDER BY forms.date_submitted DESC
|
645 |
" );
|
@@ -664,4 +533,36 @@ class Visual_Form_Builder_Export {
|
|
664 |
);
|
665 |
}
|
666 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
667 |
}
|
4 |
*
|
5 |
*/
|
6 |
class Visual_Form_Builder_Export {
|
7 |
+
|
8 |
/**
|
9 |
+
* Default delimiter for CSV and Tab export
|
10 |
*
|
11 |
+
* Override using the vfb_csv_delimiter filter
|
12 |
+
*
|
13 |
+
* (default value: ',')
|
14 |
+
*
|
15 |
+
* @var string
|
16 |
+
* @access protected
|
17 |
*/
|
18 |
+
protected $delimiter = ',';
|
19 |
|
20 |
/**
|
21 |
* default_cols
|
26 |
public $default_cols;
|
27 |
|
28 |
/**
|
29 |
+
* __construct function
|
30 |
+
*
|
31 |
+
* @access public
|
32 |
+
* @param mixed $id
|
33 |
+
* @return void
|
34 |
*/
|
35 |
+
public function __construct() {
|
|
|
|
|
36 |
// CSV delimiter
|
37 |
$this->delimiter = apply_filters( 'vfb_csv_delimiter', ',' );
|
38 |
|
39 |
// Setup our default columns
|
40 |
$this->default_cols = array(
|
41 |
+
'entries_id' => __( 'Entries ID' , 'visual-form-builder'),
|
42 |
+
'date_submitted' => __( 'Date Submitted' , 'visual-form-builder'),
|
43 |
+
'ip_address' => __( 'IP Address' , 'visual-form-builder'),
|
44 |
+
'subject' => __( 'Subject' , 'visual-form-builder'),
|
45 |
+
'sender_name' => __( 'Sender Name' , 'visual-form-builder'),
|
46 |
+
'sender_email' => __( 'Sender Email' , 'visual-form-builder'),
|
47 |
+
'emails_to' => __( 'Emailed To' , 'visual-form-builder'),
|
48 |
);
|
49 |
|
50 |
+
add_action( 'admin_init', array( $this, 'export_action' ) );
|
51 |
+
add_action( 'wp_ajax_vfb-export-fields', array( $this, 'load_fields' ) );
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
53 |
|
54 |
/**
|
55 |
+
* display function.
|
|
|
|
|
56 |
*
|
57 |
+
* @access public
|
58 |
+
* @return void
|
59 |
*/
|
60 |
+
public function display() {
|
61 |
+
$forms = $this->get_all_forms();
|
62 |
+
?>
|
63 |
+
<div class="wrap">
|
64 |
+
<h2><?php _e( 'Export', 'visual-form-builder' ); ?></h2>
|
65 |
+
<form method="post" id="vfbp-export" action="">
|
66 |
+
<input name="_vfb_action" type="hidden" value="export" />
|
67 |
+
<?php
|
68 |
+
wp_nonce_field( 'vfb_export' );
|
69 |
+
?>
|
70 |
+
|
71 |
+
<p><?php _e( 'Backup and save some or all of your Visual Form Builder data.', 'visual-form-builder' ); ?></p>
|
72 |
+
<p><?php _e( 'Once you have saved the file, you will be able to import Visual Form Builder Pro data from this site into another site.', 'visual-form-builder' ); ?></p>
|
73 |
+
<h3><?php _e( 'Choose what to export', 'visual-form-builder' ); ?></h3>
|
74 |
+
|
75 |
+
<p>
|
76 |
+
<label for="content-forms">
|
77 |
+
<input type="radio" id="content-forms" name="settings[content]" value="forms" disabled="disabled" /> <?php _e( 'Forms', 'visual-form-builder' ); ?>
|
78 |
+
</label>
|
79 |
+
</p>
|
80 |
+
<p class="description"><?php _e( 'This will export a single form with all fields and settings for that form.', 'visual-form-builder' ); ?><br><strong>*<?php _e( 'Only available in VFB Pro', 'visual-form-builder' ); ?>*</strong></p>
|
81 |
+
|
82 |
+
<p>
|
83 |
+
<label for="content-entries">
|
84 |
+
<input type="radio" id="content-entries" name="settings[content]" value="entries" checked="checked" /> <?php _e( 'Entries', 'visual-form-builder' ); ?>
|
85 |
+
</label>
|
86 |
+
</p>
|
87 |
+
<p class="description"><?php _e( 'This will export entries in either .csv, .txt, or .xls and cannot be used with the Import.', 'visual-form-builder' ); ?></p>
|
88 |
+
|
89 |
+
<h3><?php _e( 'Select a form', 'vfb-pro' ); ?></h3>
|
90 |
+
<select name="settings[form-id]" id="vfb-export-forms-list">
|
91 |
+
<?php
|
92 |
+
$first_form = '';
|
93 |
+
$entries_count = 0;
|
94 |
+
|
95 |
+
if ( is_array( $forms ) && !empty( $forms ) ) {
|
96 |
+
$first_form = $forms[0];
|
97 |
+
|
98 |
+
foreach ( $forms as $form ) {
|
99 |
+
echo sprintf(
|
100 |
+
'<option value="%1$d">%1$d - %2$s</option>',
|
101 |
+
$form['form_id'],
|
102 |
+
$form['form_title']
|
103 |
+
);
|
104 |
+
}
|
105 |
+
}
|
106 |
+
?>
|
107 |
+
</select>
|
108 |
+
|
109 |
+
<div class="vfb-export-entries-options">
|
110 |
+
<h3><?php _e( 'Customize your export', 'visual-form-builder' ); ?></h3>
|
111 |
+
|
112 |
+
<p>
|
113 |
+
<label class="vfb-export-label" for="format"><?php _e( 'Format:', 'visual-form-builder' ); ?></label>
|
114 |
+
<select name="settings[format]">
|
115 |
+
<option value="csv" selected="selected"><?php _e( 'Comma Separated (.csv)', 'visual-form-builder' ); ?></option>
|
116 |
+
<option value="txt" disabled="disabled"><?php _e( 'Tab Delimited (.txt)', 'visual-form-builder' ); ?></option>
|
117 |
+
<option value="xls" disabled="disabled"><?php _e( 'Excel (.xls)', 'visual-form-builder' ); ?></option>
|
118 |
+
</select>
|
119 |
+
</p>
|
120 |
+
|
121 |
+
<p>
|
122 |
+
<label class="vfb-export-label" for="start-date"><?php _e( 'Date Range:', 'visual-form-builder' ); ?></label>
|
123 |
+
<select name="settings[start-date]">
|
124 |
+
<option value="0">Start Date</option>
|
125 |
+
<?php $this->months_dropdown(); ?>
|
126 |
+
</select>
|
127 |
+
<select name="settings[end-date]">
|
128 |
+
<option value="0">End Date</option>
|
129 |
+
<?php $this->months_dropdown(); ?>
|
130 |
+
</select>
|
131 |
+
</p>
|
132 |
+
|
133 |
+
<label class="vfb-export-label"><?php _e( 'Fields:', 'visual-form-builder' ); ?></label>
|
134 |
+
|
135 |
+
<p>
|
136 |
+
<a id="vfb-export-select-all" href="#"><?php _e( 'Select All', 'visual-form-builder' ); ?></a>
|
137 |
+
<a id="vfb-export-unselect-all" href="#"><?php _e( 'Unselect All', 'visual-form-builder' ); ?></a>
|
138 |
+
</p>
|
139 |
+
|
140 |
+
<div id="vfb-export-entries-fields">
|
141 |
+
<?php $this->fields_list( $first_form['form_id'] ); ?>
|
142 |
+
</div>
|
143 |
+
</div>
|
144 |
+
|
145 |
+
<?php
|
146 |
+
submit_button(
|
147 |
+
__( 'Download Export File', 'visual-form-builder' ),
|
148 |
+
'primary',
|
149 |
+
'' // leave blank so "name" attribute will not be added
|
150 |
+
);
|
151 |
+
?>
|
152 |
+
</form>
|
153 |
+
</div>
|
154 |
+
<?php
|
155 |
+
}
|
156 |
|
157 |
+
/**
|
158 |
+
* Determine which export function to execute based on selected options
|
159 |
+
*
|
160 |
+
* @access public
|
161 |
+
* @return void
|
162 |
+
*/
|
163 |
+
public function export_action() {
|
164 |
|
165 |
+
if ( !isset( $_POST['_vfb_action'] ) || !isset( $_GET['page'] ) )
|
166 |
return;
|
|
|
|
|
|
|
167 |
|
168 |
+
if ( 'export' !== $_POST['_vfb_action'] )
|
169 |
+
return;
|
|
|
|
|
|
|
|
|
170 |
|
171 |
+
check_admin_referer( 'vfb_export' );
|
|
|
172 |
|
173 |
+
$data = array();
|
|
|
174 |
|
175 |
+
foreach ( $_POST['settings'] as $key => $val ) {
|
176 |
+
$data[ $key ] = $val;
|
177 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
|
179 |
+
$data = stripslashes_deep( $data );
|
180 |
+
$content = isset( $data['content'] ) ? $data['content'] : 'forms';
|
181 |
+
$form_id = isset( $data['form-id'] ) ? absint( $data['form-id'] ) : 0;
|
182 |
+
$format = isset( $data['format'] ) ? sanitize_text_field( $data['format'] ) : 'csv';
|
183 |
+
$start_date = isset( $data['start-date'] ) ? sanitize_text_field( $data['start-date'] ) : '';
|
184 |
+
$end_date = isset( $data['end-date'] ) ? sanitize_text_field( $data['end-date'] ) : '';
|
185 |
+
$fields = isset( $data['fields'] ) ? $data['fields'] : '';
|
186 |
|
187 |
+
if ( 0 == $form_id )
|
188 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
|
190 |
+
switch ( $content ) {
|
191 |
+
case 'entries' :
|
192 |
+
// If no fields selected, exit because there's nothing to do
|
193 |
+
if ( empty( $fields ) )
|
194 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
|
196 |
+
global $wpdb;
|
197 |
+
$where = '';
|
198 |
|
199 |
+
if ( 0 !== $form_id )
|
200 |
+
$where .= $wpdb->prepare( " AND form_id = %d", $form_id );
|
201 |
|
202 |
+
if ( $start_date )
|
203 |
+
$where .= $wpdb->prepare( " AND date_submitted >= %s", date( 'Y-m-d', strtotime( $start_date ) ) );
|
204 |
|
205 |
+
if ( $end_date )
|
206 |
+
$where .= $wpdb->prepare( " AND date_submitted < %s", date( 'Y-m-d', strtotime( '+1 month', strtotime( $end_date ) ) ) );
|
207 |
+
|
208 |
+
$title = $wpdb->get_var( null, 1 );
|
209 |
|
210 |
+
$settings['format'] = $format;
|
211 |
+
$settings['fields'] = $fields;
|
212 |
+
$settings['where'] = $where;
|
213 |
|
214 |
+
$this->export_entries( $settings, $title );
|
|
|
215 |
|
216 |
+
die(1);
|
217 |
+
|
218 |
+
break;
|
219 |
}
|
220 |
+
}
|
221 |
|
222 |
+
/**
|
223 |
+
* [export_entries description]
|
224 |
+
*
|
225 |
+
* @param [type] $data [$data description]
|
226 |
+
* @param array $title [$title description]
|
227 |
+
*
|
228 |
+
* @return [type] [return description]
|
229 |
+
*/
|
230 |
+
public function export_entries( $data = array(), $title = '' ) {
|
231 |
+
if ( !is_array( $data ) || empty( $data ) )
|
232 |
+
return;
|
233 |
|
234 |
+
$format = $data['format'];
|
|
|
|
|
235 |
|
236 |
$sitename = sanitize_key( get_bloginfo( 'name' ) );
|
237 |
if ( ! empty($sitename) ) $sitename .= '.';
|
238 |
+
$filename = "{$sitename}vfb-export.{$title}." . date( 'Y-m-d-Hi' ) . ".{$format}";
|
239 |
+
|
240 |
+
// Set content type based on file format
|
241 |
+
switch ( $format ) {
|
242 |
+
case 'csv' :
|
243 |
+
$content_type = 'text/csv';
|
244 |
+
break;
|
245 |
+
}
|
246 |
|
247 |
+
$upload_dir = wp_upload_dir();
|
248 |
+
$file_path = trailingslashit( $upload_dir['path'] ) . $filename;
|
249 |
|
250 |
header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' );
|
251 |
header( 'Content-Description: File Transfer' );
|
254 |
header( 'Expires: 0' );
|
255 |
header( 'Pragma: public' );
|
256 |
|
257 |
+
if ( in_array( $format, array( 'csv', 'txt' ) ) )
|
258 |
+
$this->csv_tab( $data['fields'], $data['where'], $format, $file_path );
|
259 |
+
}
|
260 |
+
|
261 |
+
/**
|
262 |
+
* [csv_tab description]
|
263 |
+
*
|
264 |
+
* @param [type] $fields [$fields description]
|
265 |
+
* @param [type] $where [$where description]
|
266 |
+
* @param [type] $format [$format description]
|
267 |
+
* @param [type] $file_path [$file_path description]
|
268 |
+
*
|
269 |
+
* @return [type] [return description]
|
270 |
+
*/
|
271 |
+
public function csv_tab( $fields, $where, $format, $file_path ) {
|
272 |
+
global $wpdb;
|
273 |
+
$file = fopen( $file_path, 'w' );
|
274 |
+
|
275 |
+
$headers = $rows = array();
|
276 |
+
$entries = $wpdb->get_results( "SELECT * FROM " . VFB_WP_ENTRIES_TABLE_NAME . " WHERE entry_approved = 1 $where ORDER BY entries_id ASC" );
|
277 |
+
|
278 |
// Get columns
|
279 |
$columns = $this->get_cols( $entries );
|
280 |
|
281 |
// Get JSON data
|
282 |
+
$json = json_decode( $columns, true );
|
283 |
|
284 |
+
$rows = $fields_clean = $fields_header = array();
|
|
|
285 |
|
286 |
+
// Decode special characters
|
287 |
+
foreach ( $fields as $field ) {
|
288 |
+
// Strip unique ID for a clean header
|
289 |
+
$search = preg_replace( '/{{(\d+)}}/', '', $field );
|
290 |
+
$fields_header[] = wp_specialchars_decode( $search, ENT_QUOTES );
|
291 |
|
292 |
+
// Field with unique ID to use as matching data
|
293 |
+
$fields_clean[] = wp_specialchars_decode( $field, ENT_QUOTES );
|
294 |
+
}
|
295 |
+
|
296 |
+
// Build headers
|
297 |
+
fputcsv( $file, $fields_header, $this->delimiter );
|
298 |
+
|
299 |
+
// Build table rows and cells
|
300 |
+
foreach ( $json as $row ) {
|
301 |
+
foreach ( $fields_clean as $label ) {
|
302 |
+
$label = wp_specialchars_decode( $label );
|
303 |
+
// Prepend a space to prevent CSV injection attacks
|
304 |
+
$value = ' ' . wp_specialchars_decode( $row[ $label ] );
|
305 |
+
|
306 |
+
$rows[ $label ] = ( isset( $row[ $label ] ) && in_array( $label, $fields_clean ) ) ? $value : '';
|
307 |
+
}
|
308 |
+
|
309 |
+
fputcsv( $file, $rows, $this->delimiter );
|
310 |
+
}
|
311 |
+
|
312 |
+
// Close the file
|
313 |
+
fclose( $file );
|
314 |
+
|
315 |
+
// Reads file in uploads folder and writes to output buffer
|
316 |
+
readfile( $file_path );
|
317 |
+
|
318 |
+
// Delete export file
|
319 |
+
wp_delete_file( $file_path );
|
320 |
+
|
321 |
+
exit();
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* [fields_list description]
|
326 |
+
*
|
327 |
+
* @param [type] $form_id [$form_id description]
|
328 |
+
*
|
329 |
+
* @return [type] [return description]
|
330 |
+
*/
|
331 |
+
public function fields_list( $form_id ) {
|
332 |
+
$entries = $this->get_entries( $form_id );
|
333 |
+
$entries_count = $this->get_entries_count( $form_id );
|
334 |
+
|
335 |
+
if ( 0 == $entries_count )
|
336 |
+
return _e( 'No entries.', 'visual-form-builder' );
|
337 |
+
|
338 |
+
if ( is_array( $entries ) && !empty( $entries ) ) {
|
339 |
+
$columns = $this->get_cols( $entries );
|
340 |
+
$data = json_decode( $columns, true );
|
341 |
+
|
342 |
+
$output = '';
|
343 |
+
|
344 |
+
$array = array();
|
345 |
+
foreach ( $data as $row ) {
|
346 |
+
$array = array_merge( $row, $array );
|
347 |
+
}
|
348 |
+
|
349 |
+
$array = array_keys( $array );
|
350 |
+
$array = array_values( array_merge( $this->default_cols, $array ) );
|
351 |
+
$array = array_map( 'stripslashes', $array );
|
352 |
+
|
353 |
+
foreach ( $array as $id => $value ) {
|
354 |
+
$selected = in_array( $value, $this->default_cols ) ? ' checked="checked"' : '';
|
355 |
+
|
356 |
+
// Strip unique ID for a clean list
|
357 |
+
$search = preg_replace( '/{{(\d+)}}/', '', $value );
|
358 |
+
|
359 |
+
?>
|
360 |
+
<label for="vfb-export-fields-val-<?php echo $id; ?>">
|
361 |
+
<input
|
362 |
+
name="settings[fields][<?php echo $id; ?>]"
|
363 |
+
class="vfb-export-fields-vals"
|
364 |
+
id="vfb-export-fields-val-<?php echo $id; ?>"
|
365 |
+
type="checkbox"
|
366 |
+
value="<?php echo esc_attr( $value ); ?>"
|
367 |
+
<?php echo $selected; ?>
|
368 |
+
/>
|
369 |
+
<?php echo esc_html( $search ); ?>
|
370 |
+
</label><br>
|
371 |
+
<?php
|
372 |
+
}
|
373 |
+
|
374 |
+
return $output;
|
375 |
+
}
|
376 |
+
}
|
377 |
+
|
378 |
+
/**
|
379 |
+
* [get_entries description]
|
380 |
+
*
|
381 |
+
* @param [type] $form_id [$form_id description]
|
382 |
+
*
|
383 |
+
* @return [type] [return description]
|
384 |
+
*/
|
385 |
+
public function get_entries( $form_id ) {
|
386 |
+
global $wpdb;
|
387 |
+
|
388 |
+
$entries = $wpdb->get_results( $wpdb->prepare( "SELECT data FROM " . VFB_WP_ENTRIES_TABLE_NAME . " WHERE form_id = %d AND entry_approved = 1", $form_id ), ARRAY_A );
|
389 |
+
return $entries;
|
390 |
}
|
391 |
|
392 |
/**
|
463 |
$output[ $row ][ stripslashes( $obj->name ) . "{{{$obj->id}}}" ] = $val;
|
464 |
|
465 |
break;
|
466 |
+
}
|
467 |
+
}
|
468 |
}
|
469 |
break;
|
470 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
471 |
}
|
472 |
+
$row++;
|
|
|
473 |
}
|
474 |
|
475 |
+
return json_encode( $output );
|
|
|
|
|
|
|
476 |
}
|
477 |
|
478 |
/**
|
479 |
+
* AJAX function to load new fields list when a new form is selected
|
480 |
*
|
481 |
+
* @access public
|
482 |
+
* @return void
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
483 |
*/
|
484 |
+
public function load_fields() {
|
485 |
global $wpdb;
|
486 |
|
487 |
+
// Check AJAX nonce set via wp_localize_script
|
488 |
+
check_ajax_referer( 'vfb_ajax', 'vfb_ajax_nonce' );
|
489 |
|
490 |
+
if ( isset( $_GET['action'] ) && 'vfb-export-fields' !== $_GET['action'] )
|
491 |
return;
|
492 |
|
493 |
$form_id = absint( $_GET['id'] );
|
494 |
|
495 |
+
$this->fields_list( $form_id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
496 |
|
497 |
+
die(1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
498 |
}
|
499 |
|
500 |
/**
|
507 |
|
508 |
$where = apply_filters( 'vfb_pre_get_entries', '' );
|
509 |
|
510 |
+
$months = $wpdb->get_results(
|
511 |
+
"SELECT DISTINCT YEAR( forms.date_submitted ) AS year, MONTH( forms.date_submitted ) AS month FROM " . VFB_WP_ENTRIES_TABLE_NAME . " AS forms
|
|
|
512 |
WHERE 1=1 $where
|
513 |
ORDER BY forms.date_submitted DESC
|
514 |
" );
|
533 |
);
|
534 |
}
|
535 |
}
|
536 |
+
|
537 |
+
/**
|
538 |
+
* [count_entries description]
|
539 |
+
* @param [type] $form_id [description]
|
540 |
+
* @return [type] [description]
|
541 |
+
*/
|
542 |
+
public function get_entries_count( $form_id ) {
|
543 |
+
global $wpdb;
|
544 |
+
|
545 |
+
$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM " . VFB_WP_ENTRIES_TABLE_NAME . " WHERE form_id = %d", $form_id ) );
|
546 |
+
|
547 |
+
if ( !$count )
|
548 |
+
return 0;
|
549 |
+
|
550 |
+
return $count;
|
551 |
+
}
|
552 |
+
|
553 |
+
/**
|
554 |
+
* [get_all_forms description]
|
555 |
+
*
|
556 |
+
* @return [type] [return description]
|
557 |
+
*/
|
558 |
+
public function get_all_forms() {
|
559 |
+
global $wpdb;
|
560 |
+
|
561 |
+
// Query to get all forms
|
562 |
+
$order = sanitize_sql_orderby( 'form_id ASC' );
|
563 |
+
$where = apply_filters( 'vfb_pre_get_forms_export', '' );
|
564 |
+
$forms = $wpdb->get_results( "SELECT form_id, form_key, form_title FROM " . VFB_WP_FORMS_TABLE_NAME . " WHERE 1=1 $where ORDER BY $order", ARRAY_A );
|
565 |
+
|
566 |
+
return $forms;
|
567 |
+
}
|
568 |
}
|
admin/class-load-css-js.php
CHANGED
@@ -33,7 +33,9 @@ class Visual_Form_Builder_Admin_Scripts_Loader {
|
|
33 |
wp_enqueue_script( 'jquery-ui-sortable' );
|
34 |
wp_enqueue_script( 'postbox' );
|
35 |
wp_enqueue_script( 'jquery-form-validation', VFB_WP_PLUGIN_URL . 'admin/assets/js/jquery.validate.min.js', array( 'jquery' ), '1.9.0', true );
|
36 |
-
wp_enqueue_script( 'vfb-admin', VFB_WP_PLUGIN_URL . 'admin/assets/js/vfb-admin.min.js', array( 'jquery', 'jquery-form-validation' ), '2021.
|
37 |
wp_enqueue_script( 'nested-sortable', VFB_WP_PLUGIN_URL . 'admin/assets/js/jquery.ui.nestedSortable.min.js', array( 'jquery', 'jquery-ui-sortable' ), '1.3.5', true );
|
|
|
|
|
38 |
}
|
39 |
}
|
33 |
wp_enqueue_script( 'jquery-ui-sortable' );
|
34 |
wp_enqueue_script( 'postbox' );
|
35 |
wp_enqueue_script( 'jquery-form-validation', VFB_WP_PLUGIN_URL . 'admin/assets/js/jquery.validate.min.js', array( 'jquery' ), '1.9.0', true );
|
36 |
+
wp_enqueue_script( 'vfb-admin', VFB_WP_PLUGIN_URL . 'admin/assets/js/vfb-admin.min.js', array( 'jquery', 'jquery-form-validation' ), '2021.11.02', true );
|
37 |
wp_enqueue_script( 'nested-sortable', VFB_WP_PLUGIN_URL . 'admin/assets/js/jquery.ui.nestedSortable.min.js', array( 'jquery', 'jquery-ui-sortable' ), '1.3.5', true );
|
38 |
+
|
39 |
+
wp_localize_script( 'vfb-admin', 'vfb_settings', array( 'vfb_ajax_nonce' => wp_create_nonce( 'vfb_ajax') ) );
|
40 |
}
|
41 |
}
|
config.codekit3
CHANGED
@@ -1023,295 +1023,6 @@
|
|
1023 |
"oAP": "/public/assets/index.php",
|
1024 |
"oF": 0
|
1025 |
},
|
1026 |
-
"/public/assets/js/ckeditor/ckeditor.js": {
|
1027 |
-
"bF": 0,
|
1028 |
-
"ft": 64,
|
1029 |
-
"ma": 0,
|
1030 |
-
"mi": 1,
|
1031 |
-
"oA": 0,
|
1032 |
-
"oAP": "/public/assets/js/ckeditor/ckeditor.min.js",
|
1033 |
-
"oF": 0,
|
1034 |
-
"sC": 3,
|
1035 |
-
"tS": 0
|
1036 |
-
},
|
1037 |
-
"/public/assets/js/ckeditor/config.js": {
|
1038 |
-
"bF": 0,
|
1039 |
-
"ft": 64,
|
1040 |
-
"ma": 0,
|
1041 |
-
"mi": 1,
|
1042 |
-
"oA": 0,
|
1043 |
-
"oAP": "/public/assets/js/ckeditor/config.min.js",
|
1044 |
-
"oF": 0,
|
1045 |
-
"sC": 3,
|
1046 |
-
"tS": 0
|
1047 |
-
},
|
1048 |
-
"/public/assets/js/ckeditor/contents.css": {
|
1049 |
-
"aP": 1,
|
1050 |
-
"bl": 0,
|
1051 |
-
"ft": 16,
|
1052 |
-
"ma": 0,
|
1053 |
-
"oA": 0,
|
1054 |
-
"oAP": "/public/assets/js/ckeditor/contents-min.css",
|
1055 |
-
"oF": 0,
|
1056 |
-
"oS": 3
|
1057 |
-
},
|
1058 |
-
"/public/assets/js/ckeditor/index.php": {
|
1059 |
-
"cB": 0,
|
1060 |
-
"ft": 8192,
|
1061 |
-
"hM": 0,
|
1062 |
-
"oA": 0,
|
1063 |
-
"oAP": "/public/assets/js/ckeditor/index.php",
|
1064 |
-
"oF": 0
|
1065 |
-
},
|
1066 |
-
"/public/assets/js/ckeditor/lang/en.js": {
|
1067 |
-
"bF": 0,
|
1068 |
-
"ft": 64,
|
1069 |
-
"ma": 0,
|
1070 |
-
"mi": 1,
|
1071 |
-
"oA": 0,
|
1072 |
-
"oAP": "/public/assets/js/ckeditor/lang/en.min.js",
|
1073 |
-
"oF": 0,
|
1074 |
-
"sC": 3,
|
1075 |
-
"tS": 0
|
1076 |
-
},
|
1077 |
-
"/public/assets/js/ckeditor/plugins/dialog/dialogDefinition.js": {
|
1078 |
-
"bF": 0,
|
1079 |
-
"ft": 64,
|
1080 |
-
"ma": 0,
|
1081 |
-
"mi": 1,
|
1082 |
-
"oA": 0,
|
1083 |
-
"oAP": "/public/assets/js/ckeditor/plugins/dialog/dialogDefinition.min.js",
|
1084 |
-
"oF": 0,
|
1085 |
-
"sC": 3,
|
1086 |
-
"tS": 0
|
1087 |
-
},
|
1088 |
-
"/public/assets/js/ckeditor/plugins/icons.png": {
|
1089 |
-
"ft": 32768,
|
1090 |
-
"iS": 10452,
|
1091 |
-
"oA": 0,
|
1092 |
-
"oAP": "/public/assets/js/ckeditor/plugins/icons.png",
|
1093 |
-
"oF": 0,
|
1094 |
-
"oIPL": 0,
|
1095 |
-
"opt": 0,
|
1096 |
-
"oT": 1,
|
1097 |
-
"q": 100
|
1098 |
-
},
|
1099 |
-
"/public/assets/js/ckeditor/plugins/link/dialogs/anchor.js": {
|
1100 |
-
"bF": 0,
|
1101 |
-
"ft": 64,
|
1102 |
-
"ma": 0,
|
1103 |
-
"mi": 1,
|
1104 |
-
"oA": 0,
|
1105 |
-
"oAP": "/public/assets/js/ckeditor/plugins/link/dialogs/anchor.min.js",
|
1106 |
-
"oF": 0,
|
1107 |
-
"sC": 3,
|
1108 |
-
"tS": 0
|
1109 |
-
},
|
1110 |
-
"/public/assets/js/ckeditor/plugins/link/dialogs/link.js": {
|
1111 |
-
"bF": 0,
|
1112 |
-
"ft": 64,
|
1113 |
-
"ma": 0,
|
1114 |
-
"mi": 1,
|
1115 |
-
"oA": 0,
|
1116 |
-
"oAP": "/public/assets/js/ckeditor/plugins/link/dialogs/link.min.js",
|
1117 |
-
"oF": 0,
|
1118 |
-
"sC": 3,
|
1119 |
-
"tS": 0
|
1120 |
-
},
|
1121 |
-
"/public/assets/js/ckeditor/plugins/link/images/anchor.png": {
|
1122 |
-
"ft": 32768,
|
1123 |
-
"iS": 566,
|
1124 |
-
"oA": 0,
|
1125 |
-
"oAP": "/public/assets/js/ckeditor/plugins/link/images/anchor.png",
|
1126 |
-
"oF": 0,
|
1127 |
-
"oIPL": 0,
|
1128 |
-
"opt": 0,
|
1129 |
-
"oT": 1,
|
1130 |
-
"q": 100
|
1131 |
-
},
|
1132 |
-
"/public/assets/js/ckeditor/skins/moono/dialog.css": {
|
1133 |
-
"aP": 1,
|
1134 |
-
"bl": 0,
|
1135 |
-
"ft": 16,
|
1136 |
-
"ma": 0,
|
1137 |
-
"oA": 0,
|
1138 |
-
"oAP": "/public/assets/js/ckeditor/skins/moono/dialog-min.css",
|
1139 |
-
"oF": 0,
|
1140 |
-
"oS": 3
|
1141 |
-
},
|
1142 |
-
"/public/assets/js/ckeditor/skins/moono/dialog_ie.css": {
|
1143 |
-
"aP": 1,
|
1144 |
-
"bl": 0,
|
1145 |
-
"ft": 16,
|
1146 |
-
"ma": 0,
|
1147 |
-
"oA": 0,
|
1148 |
-
"oAP": "/public/assets/js/ckeditor/skins/moono/dialog_ie-min.css",
|
1149 |
-
"oF": 0,
|
1150 |
-
"oS": 3
|
1151 |
-
},
|
1152 |
-
"/public/assets/js/ckeditor/skins/moono/dialog_ie7.css": {
|
1153 |
-
"aP": 1,
|
1154 |
-
"bl": 0,
|
1155 |
-
"ft": 16,
|
1156 |
-
"ma": 0,
|
1157 |
-
"oA": 0,
|
1158 |
-
"oAP": "/public/assets/js/ckeditor/skins/moono/dialog_ie7-min.css",
|
1159 |
-
"oF": 0,
|
1160 |
-
"oS": 3
|
1161 |
-
},
|
1162 |
-
"/public/assets/js/ckeditor/skins/moono/dialog_ie8.css": {
|
1163 |
-
"aP": 1,
|
1164 |
-
"bl": 0,
|
1165 |
-
"ft": 16,
|
1166 |
-
"ma": 0,
|
1167 |
-
"oA": 0,
|
1168 |
-
"oAP": "/public/assets/js/ckeditor/skins/moono/dialog_ie8-min.css",
|
1169 |
-
"oF": 0,
|
1170 |
-
"oS": 3
|
1171 |
-
},
|
1172 |
-
"/public/assets/js/ckeditor/skins/moono/dialog_iequirks.css": {
|
1173 |
-
"aP": 1,
|
1174 |
-
"bl": 0,
|
1175 |
-
"ft": 16,
|
1176 |
-
"ma": 0,
|
1177 |
-
"oA": 0,
|
1178 |
-
"oAP": "/public/assets/js/ckeditor/skins/moono/dialog_iequirks-min.css",
|
1179 |
-
"oF": 0,
|
1180 |
-
"oS": 3
|
1181 |
-
},
|
1182 |
-
"/public/assets/js/ckeditor/skins/moono/dialog_opera.css": {
|
1183 |
-
"aP": 1,
|
1184 |
-
"bl": 0,
|
1185 |
-
"ft": 16,
|
1186 |
-
"ma": 0,
|
1187 |
-
"oA": 0,
|
1188 |
-
"oAP": "/public/assets/js/ckeditor/skins/moono/dialog_opera-min.css",
|
1189 |
-
"oF": 0,
|
1190 |
-
"oS": 3
|
1191 |
-
},
|
1192 |
-
"/public/assets/js/ckeditor/skins/moono/editor.css": {
|
1193 |
-
"aP": 1,
|
1194 |
-
"bl": 0,
|
1195 |
-
"ft": 16,
|
1196 |
-
"ma": 0,
|
1197 |
-
"oA": 0,
|
1198 |
-
"oAP": "/public/assets/js/ckeditor/skins/moono/editor-min.css",
|
1199 |
-
"oF": 0,
|
1200 |
-
"oS": 3
|
1201 |
-
},
|
1202 |
-
"/public/assets/js/ckeditor/skins/moono/editor_gecko.css": {
|
1203 |
-
"aP": 1,
|
1204 |
-
"bl": 0,
|
1205 |
-
"ft": 16,
|
1206 |
-
"ma": 0,
|
1207 |
-
"oA": 0,
|
1208 |
-
"oAP": "/public/assets/js/ckeditor/skins/moono/editor_gecko-min.css",
|
1209 |
-
"oF": 0,
|
1210 |
-
"oS": 3
|
1211 |
-
},
|
1212 |
-
"/public/assets/js/ckeditor/skins/moono/editor_ie.css": {
|
1213 |
-
"aP": 1,
|
1214 |
-
"bl": 0,
|
1215 |
-
"ft": 16,
|
1216 |
-
"ma": 0,
|
1217 |
-
"oA": 0,
|
1218 |
-
"oAP": "/public/assets/js/ckeditor/skins/moono/editor_ie-min.css",
|
1219 |
-
"oF": 0,
|
1220 |
-
"oS": 3
|
1221 |
-
},
|
1222 |
-
"/public/assets/js/ckeditor/skins/moono/editor_ie7.css": {
|
1223 |
-
"aP": 1,
|
1224 |
-
"bl": 0,
|
1225 |
-
"ft": 16,
|
1226 |
-
"ma": 0,
|
1227 |
-
"oA": 0,
|
1228 |
-
"oAP": "/public/assets/js/ckeditor/skins/moono/editor_ie7-min.css",
|
1229 |
-
"oF": 0,
|
1230 |
-
"oS": 3
|
1231 |
-
},
|
1232 |
-
"/public/assets/js/ckeditor/skins/moono/editor_ie8.css": {
|
1233 |
-
"aP": 1,
|
1234 |
-
"bl": 0,
|
1235 |
-
"ft": 16,
|
1236 |
-
"ma": 0,
|
1237 |
-
"oA": 0,
|
1238 |
-
"oAP": "/public/assets/js/ckeditor/skins/moono/editor_ie8-min.css",
|
1239 |
-
"oF": 0,
|
1240 |
-
"oS": 3
|
1241 |
-
},
|
1242 |
-
"/public/assets/js/ckeditor/skins/moono/editor_iequirks.css": {
|
1243 |
-
"aP": 1,
|
1244 |
-
"bl": 0,
|
1245 |
-
"ft": 16,
|
1246 |
-
"ma": 0,
|
1247 |
-
"oA": 0,
|
1248 |
-
"oAP": "/public/assets/js/ckeditor/skins/moono/editor_iequirks-min.css",
|
1249 |
-
"oF": 0,
|
1250 |
-
"oS": 3
|
1251 |
-
},
|
1252 |
-
"/public/assets/js/ckeditor/skins/moono/icons.png": {
|
1253 |
-
"ft": 32768,
|
1254 |
-
"iS": 20881,
|
1255 |
-
"oA": 0,
|
1256 |
-
"oAP": "/public/assets/js/ckeditor/skins/moono/icons.png",
|
1257 |
-
"oF": 0,
|
1258 |
-
"oIPL": 0,
|
1259 |
-
"opt": 0,
|
1260 |
-
"oT": 1,
|
1261 |
-
"q": 100
|
1262 |
-
},
|
1263 |
-
"/public/assets/js/ckeditor/skins/moono/images/arrow.png": {
|
1264 |
-
"ft": 32768,
|
1265 |
-
"iS": 261,
|
1266 |
-
"oA": 0,
|
1267 |
-
"oAP": "/public/assets/js/ckeditor/skins/moono/images/arrow.png",
|
1268 |
-
"oF": 0,
|
1269 |
-
"oIPL": 0,
|
1270 |
-
"opt": 0,
|
1271 |
-
"oT": 1,
|
1272 |
-
"q": 100
|
1273 |
-
},
|
1274 |
-
"/public/assets/js/ckeditor/skins/moono/images/close.png": {
|
1275 |
-
"ft": 32768,
|
1276 |
-
"iS": 389,
|
1277 |
-
"oA": 0,
|
1278 |
-
"oAP": "/public/assets/js/ckeditor/skins/moono/images/close.png",
|
1279 |
-
"oF": 0,
|
1280 |
-
"oIPL": 0,
|
1281 |
-
"opt": 0,
|
1282 |
-
"oT": 1,
|
1283 |
-
"q": 100
|
1284 |
-
},
|
1285 |
-
"/public/assets/js/ckeditor/skins/moono/images/mini.png": {
|
1286 |
-
"ft": 32768,
|
1287 |
-
"iS": 818,
|
1288 |
-
"oA": 0,
|
1289 |
-
"oAP": "/public/assets/js/ckeditor/skins/moono/images/mini.png",
|
1290 |
-
"oF": 0,
|
1291 |
-
"oIPL": 0,
|
1292 |
-
"opt": 0,
|
1293 |
-
"oT": 1,
|
1294 |
-
"q": 100
|
1295 |
-
},
|
1296 |
-
"/public/assets/js/ckeditor/skins/moono/readme.md": {
|
1297 |
-
"cB": 0,
|
1298 |
-
"cS": 0,
|
1299 |
-
"eF": 1,
|
1300 |
-
"eL": 1,
|
1301 |
-
"ema": 1,
|
1302 |
-
"eSQ": 1,
|
1303 |
-
"ft": 4096,
|
1304 |
-
"hM": 0,
|
1305 |
-
"oA": 0,
|
1306 |
-
"oAP": "/public/assets/js/ckeditor/skins/moono/readme.html",
|
1307 |
-
"oF": 0,
|
1308 |
-
"oFM": 0,
|
1309 |
-
"oS": 0,
|
1310 |
-
"pHT": 0,
|
1311 |
-
"pME": 1,
|
1312 |
-
"rFN": 0,
|
1313 |
-
"uCM": 0
|
1314 |
-
},
|
1315 |
"/public/assets/js/i18n/datepicker/datepicker-cs_CS.js": {
|
1316 |
"bF": 0,
|
1317 |
"ft": 64,
|
1023 |
"oAP": "/public/assets/index.php",
|
1024 |
"oF": 0
|
1025 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1026 |
"/public/assets/js/i18n/datepicker/datepicker-cs_CS.js": {
|
1027 |
"bF": 0,
|
1028 |
"ft": 64,
|
public/class-security.php
CHANGED
@@ -37,7 +37,7 @@ class Visual_Form_Builder_Security {
|
|
37 |
*/
|
38 |
public function secret_check() {
|
39 |
$required = ( isset( $_POST['_vfb-required-secret'] ) && $_POST['_vfb-required-secret'] == '0' ) ? false : true;
|
40 |
-
$secret_field
|
41 |
|
42 |
// If the verification is set to required, run validation check
|
43 |
if ( true == $required && !empty( $secret_field ) ) {
|
@@ -54,7 +54,7 @@ class Visual_Form_Builder_Security {
|
|
54 |
* @return [type] [description]
|
55 |
*/
|
56 |
public function referer_check() {
|
57 |
-
$referrer = ( isset( $_POST['_wp_http_referer'] ) ) ?
|
58 |
$wp_get_referer = wp_get_referer();
|
59 |
$form_id = absint( $_POST['form_id'] );
|
60 |
|
37 |
*/
|
38 |
public function secret_check() {
|
39 |
$required = ( isset( $_POST['_vfb-required-secret'] ) && $_POST['_vfb-required-secret'] == '0' ) ? false : true;
|
40 |
+
$secret_field = ( isset( $_POST['_vfb-secret'] ) ) ? sanitize_text_field( $_POST['_vfb-secret'] ) : '';
|
41 |
|
42 |
// If the verification is set to required, run validation check
|
43 |
if ( true == $required && !empty( $secret_field ) ) {
|
54 |
* @return [type] [description]
|
55 |
*/
|
56 |
public function referer_check() {
|
57 |
+
$referrer = ( isset( $_POST['_wp_http_referer'] ) ) ? sanitize_text_field( $_POST['_wp_http_referer'] ) : false;
|
58 |
$wp_get_referer = wp_get_referer();
|
59 |
$form_id = absint( $_POST['form_id'] );
|
60 |
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=G87A9
|
|
4 |
Tags: form, forms, contact form, contact forms, form, forms, form to email, email form, email, input, validation, jquery, shortcode, form builder, contact form builder, form manager, form creator
|
5 |
Requires at least: 4.7
|
6 |
Tested up to: 5.8.1
|
7 |
-
Stable tag: 3.0.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Build beautiful, fully functional contact forms in only a few minutes without writing PHP, CSS, or HTML.
|
@@ -231,6 +231,11 @@ function my_scripts_method() {
|
|
231 |
|
232 |
== Changelog ==
|
233 |
|
|
|
|
|
|
|
|
|
|
|
234 |
**Version 3.0.5 - Oct 21, 2021**
|
235 |
|
236 |
* Update some URLs to no longer rely on query params
|
4 |
Tags: form, forms, contact form, contact forms, form, forms, form to email, email form, email, input, validation, jquery, shortcode, form builder, contact form builder, form manager, form creator
|
5 |
Requires at least: 4.7
|
6 |
Tested up to: 5.8.1
|
7 |
+
Stable tag: 3.0.6
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Build beautiful, fully functional contact forms in only a few minutes without writing PHP, CSS, or HTML.
|
231 |
|
232 |
== Changelog ==
|
233 |
|
234 |
+
**Version 3.0.6 - Nov 03, 2021**
|
235 |
+
|
236 |
+
* Update export code with various improvements
|
237 |
+
* More security updates
|
238 |
+
|
239 |
**Version 3.0.5 - Oct 21, 2021**
|
240 |
|
241 |
* Update some URLs to no longer rely on query params
|
visual-form-builder.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Visual Form Builder
|
4 |
Plugin URI: https://wordpress.org/plugins/visual-form-builder/
|
5 |
Description: Dynamically build forms using a simple interface. Forms include jQuery validation, a basic logic-based verification system, and entry tracking.
|
6 |
-
Version: 3.0.
|
7 |
Author: Matthew Muro
|
8 |
Author URI: http://vfbpro.com
|
9 |
Text Domain: visual-form-builder
|
@@ -26,7 +26,7 @@ class Visual_Form_Builder {
|
|
26 |
* The current version of the plugin.
|
27 |
* @var [type]
|
28 |
*/
|
29 |
-
protected $version = '3.0.
|
30 |
|
31 |
/**
|
32 |
* The current DB version. Used if we need to update the DB later.
|
3 |
Plugin Name: Visual Form Builder
|
4 |
Plugin URI: https://wordpress.org/plugins/visual-form-builder/
|
5 |
Description: Dynamically build forms using a simple interface. Forms include jQuery validation, a basic logic-based verification system, and entry tracking.
|
6 |
+
Version: 3.0.6
|
7 |
Author: Matthew Muro
|
8 |
Author URI: http://vfbpro.com
|
9 |
Text Domain: visual-form-builder
|
26 |
* The current version of the plugin.
|
27 |
* @var [type]
|
28 |
*/
|
29 |
+
protected $version = '3.0.6';
|
30 |
|
31 |
/**
|
32 |
* The current DB version. Used if we need to update the DB later.
|