diff --git a/.circleci/config.yml b/.circleci/config.yml
index 16c38cc42..5301267ec 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -138,4 +138,3 @@ workflows:
- run_php_72_unit_tests
- run_php_80_unit_tests
# - run_acceptance_tests
-
diff --git a/assets/css/admin-global.css b/assets/css/admin-global.css
index 29220307e..e0c462b78 100644
--- a/assets/css/admin-global.css
+++ b/assets/css/admin-global.css
@@ -1 +1 @@
-@font-face{font-family:"gravityview";src:url("../fonts/gravityview.eot");src:url("../fonts/gravityview.eot?#iefix") format("embedded-opentype"),url("../fonts/gravityview.woff") format("woff"),url("../fonts/gravityview.ttf") format("truetype"),url("../fonts/gravityview.svg#gravityview") format("svg");font-weight:normal;font-style:normal}a.icon{text-decoration:none}[data-gv-icon]:before{font-family:"gravityview" !important;content:attr(data-gv-icon);font-style:normal !important;font-weight:normal !important;font-variant:normal !important;text-transform:none !important;speak:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.gv-icon__before,#toplevel_page_gravityview_settings .wp-menu-image:before,#adminmenu .menu-icon-gravityview div.wp-menu-image:before,#available-widgets [class*=gv_recent_entries] .widget-title:before,#available-widgets [class*=gravityview_search] .widget-title:before,[class^="gv-icon-"]:before,[class*=" gv-icon-"]:before{font-family:"gravityview" !important;font-style:normal !important;font-weight:normal !important;font-variant:normal !important;text-transform:none !important;speak:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.gv-icon-astronaut-head__before,#toplevel_page_gravityview_settings .wp-menu-image:before,#adminmenu .menu-icon-gravityview div.wp-menu-image:before,#available-widgets [class*=gv_recent_entries] .widget-title:before,#available-widgets [class*=gravityview_search] .widget-title:before,.gv-icon-astronaut-head:before{content:"\61"}.gv-icon-astronaut:before{content:"\62"}.gv-icon-datatables-icon:before{content:"\63"}.gv-icon-caret-up-down:before{content:"\64"}.gv-icon-minus-square:before{content:"\66"}.gv-icon-plus-square:before{content:"\67"}.gv-icon-level-down:before{content:"\65"}.gv-icon-sort-asc:before{content:"\68"}.gv-icon-sort-desc:before{content:"\69"}.gv-icon-number-one:before{content:"\6a"}.gv-icon-question-circle:before{content:"\6b"}.members-tab-title a[href$="type-gravityview"]{display:none !important}.members-tab-title .gv-icon-astronaut-head{font-size:20px;width:20px;line-height:20px;margin-right:6.25px;display:block;float:left}#hs-beacon iframe[style*="max-height"],#beacon-container iframe[style*="max-height"]{z-index:10010 !important}.admin-bar #hs-beacon iframe[style*="bottom: 0"],.admin-bar #beacon-container iframe[style*="bottom: 0"]{padding-top:32px}#hs-beacon iframe[data-reactid-hs=".0.0"],#beacon-container iframe[data-reactid-hs=".0.0"]{right:-5px !important;bottom:-5px !important}.rtl #hs-beacon iframe[data-reactid-hs=".0.0"],.rtl #beacon-container iframe[data-reactid-hs=".0.0"]{right:auto !important;left:-5px !important}#menu-posts-gravityview .wp-submenu .dashicons{padding:0 .2em}.wp-editor-tools #add_gravityview{width:auto}.gravitykit_page_gv-getting-started .about-wrap .feature-video iframe,.post-type-gravityview .about-wrap .feature-video iframe{width:100%;max-width:560px}.gravitykit_page_gv-getting-started .about-wrap .feature-video .button-hero,.post-type-gravityview .about-wrap .feature-video .button-hero{font-size:22px;max-width:100%;overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis;height:auto}.gravitykit_page_gv-getting-started .about-wrap .feature-section.three-col .col,.post-type-gravityview .about-wrap .feature-section.three-col .col{-webkit-flex-basis:30%;-ms-flex-preferred-size:30%;flex-basis:30%;max-width:250px}.gravitykit_page_gv-getting-started .about-wrap .feature-section img,.post-type-gravityview .about-wrap .feature-section img{border:1px solid #ccc;max-width:99%}#wpwrap .gv_connected_forms .gv-icon{font-size:19px;height:19px;width:20px;display:inline-block}#wpwrap .gv_connected_forms .gv-create-view:before{content:"\f132";display:inline-block;font-weight:normal;font-size:20px;font-family:dashicons !important;line-height:20px !important;margin:0 auto;padding:0;position:relative;text-align:center;width:20px;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#wpwrap .gv_connected_forms .hidden{display:none !important}#wpwrap .gv_connected_forms .gf_submenu{min-width:150px;max-width:100%}#wpwrap .gv_connected_forms li a{width:auto}.gf-popover__button[data-url="#gravityview-group-heading"]{font-weight:500;color:#40464d;padding-top:12px;padding-bottom:6px;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;cursor:default !important}.gf-popover__button__icon:empty{display:none}.gf-popover__button[data-url="#gravityview-group-heading"]:hover{background:white;color:#40464d}.post-type-gravityview .changelog ul,.gravitykit_page_gv-changelog .changelog ul{list-style-type:square}.post-type-gravityview .changelog ul ul,.gravitykit_page_gv-changelog .changelog ul ul{list-style:circle;margin:.5em 0 .5em 1.3em}.gv-entry-creator-dropdown .select2-search__field{padding:0 4px 0 4px}.gv-entry-creator-dropdown.gf25 .select2-search__field{line-height:1.25rem;padding:.6875rem 1rem}.gv-entry-creator-dropdown.gf25.select2-dropdown--below{border-top:initial;margin-top:-8px}.gv-entry-creator-container.select2-container--default.gf25{min-height:4em}.gv-entry-creator-container.select2-container--default.gf25 .select2-selection__arrow{display:none}.gv-entry-creator-container.select2-container--default.gf25 .select2-selection__rendered{margin:-1px}.gv-shortcode{position:relative}.gv-shortcode .dashicons-editor-code{color:#888;left:-1px;font-size:20px;line-height:1}html[dir=rtl] .gv-shortcode .dashicons-editor-code{left:auto;right:-1px}html[dir=rtl] .gv-shortcode .code.widefat{text-align:right}.gv-shortcode input.code{cursor:pointer}.gv-shortcode span.copied{display:none;position:absolute;top:30px;right:15px;background-color:#000;color:#FFF;padding:2px 5px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.wp-list-table .gv-shortcode span.copied{top:3px;right:3px}
+@font-face{font-family:"gravityview";src:url("../fonts/gravityview.eot");src:url("../fonts/gravityview.eot?#iefix") format("embedded-opentype"),url("../fonts/gravityview.woff") format("woff"),url("../fonts/gravityview.ttf") format("truetype"),url("../fonts/gravityview.svg#gravityview") format("svg");font-weight:normal;font-style:normal}a.icon{text-decoration:none}[data-gv-icon]:before{font-family:"gravityview" !important;content:attr(data-gv-icon);font-style:normal !important;font-weight:normal !important;font-variant:normal !important;text-transform:none !important;speak:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.gv-icon__before,#toplevel_page_gravityview_settings .wp-menu-image:before,#adminmenu .menu-icon-gravityview div.wp-menu-image:before,#available-widgets [class*=gv_recent_entries] .widget-title:before,#available-widgets [class*=gravityview_search] .widget-title:before,[class^="gv-icon-"]:before,[class*=" gv-icon-"]:before{font-family:"gravityview" !important;font-style:normal !important;font-weight:normal !important;font-variant:normal !important;text-transform:none !important;speak:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.gv-icon-astronaut-head__before,#toplevel_page_gravityview_settings .wp-menu-image:before,#adminmenu .menu-icon-gravityview div.wp-menu-image:before,#available-widgets [class*=gv_recent_entries] .widget-title:before,#available-widgets [class*=gravityview_search] .widget-title:before,.gv-icon-astronaut-head:before{content:"\61"}.gv-icon-astronaut:before{content:"\62"}.gv-icon-datatables-icon:before{content:"\63"}.gv-icon-caret-up-down:before{content:"\64"}.gv-icon-minus-square:before{content:"\66"}.gv-icon-plus-square:before{content:"\67"}.gv-icon-level-down:before{content:"\65"}.gv-icon-sort-asc:before{content:"\68"}.gv-icon-sort-desc:before{content:"\69"}.gv-icon-number-one:before{content:"\6a"}.gv-icon-question-circle:before{content:"\6b"}.members-tab-title a[href$="type-gravityview"]{display:none !important}.members-tab-title .gv-icon-astronaut-head{font-size:20px;width:20px;line-height:20px;margin-right:6.25px;display:block;float:left}#hs-beacon iframe[style*="max-height"],#beacon-container iframe[style*="max-height"]{z-index:10010 !important}.admin-bar #hs-beacon iframe[style*="bottom: 0"],.admin-bar #beacon-container iframe[style*="bottom: 0"]{padding-top:32px}#hs-beacon iframe[data-reactid-hs=".0.0"],#beacon-container iframe[data-reactid-hs=".0.0"]{right:-5px !important;bottom:-5px !important}.rtl #hs-beacon iframe[data-reactid-hs=".0.0"],.rtl #beacon-container iframe[data-reactid-hs=".0.0"]{right:auto !important;left:-5px !important}#menu-posts-gravityview .wp-submenu .dashicons{padding:0 .2em}.wp-editor-tools #add_gravityview{width:auto}.gravitykit_page_gv-getting-started .about-wrap .feature-video iframe,.post-type-gravityview .about-wrap .feature-video iframe{width:100%;max-width:560px}.gravitykit_page_gv-getting-started .about-wrap .feature-video .button-hero,.post-type-gravityview .about-wrap .feature-video .button-hero{font-size:22px;max-width:100%;overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis;height:auto}.gravitykit_page_gv-getting-started .about-wrap .feature-section.three-col .col,.post-type-gravityview .about-wrap .feature-section.three-col .col{-webkit-flex-basis:30%;-ms-flex-preferred-size:30%;flex-basis:30%;max-width:250px}.gravitykit_page_gv-getting-started .about-wrap .feature-section img,.post-type-gravityview .about-wrap .feature-section img{border:1px solid #ccc;max-width:99%}#wpwrap .gv_connected_forms .gv-icon{font-size:19px;height:19px;width:20px;display:inline-block}#wpwrap .gv_connected_forms .gv-create-view:before{content:"\f132";display:inline-block;font-weight:normal;font-size:20px;font-family:dashicons !important;line-height:20px !important;margin:0 auto;padding:0;position:relative;text-align:center;width:20px;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#wpwrap .gv_connected_forms .hidden{display:none !important}#wpwrap .gv_connected_forms .gf_submenu{min-width:150px;max-width:100%}#wpwrap .gv_connected_forms li a{width:auto}.gf-popover__button[data-url="#gravityview-group-heading"]{font-weight:500;color:#40464d;padding-top:12px;padding-bottom:6px;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;cursor:default !important}.gf-popover__button__icon:empty{display:none}.gf-popover__button[data-url="#gravityview-group-heading"]:hover{background:white;color:#40464d}.post-type-gravityview .changelog ul,.gravitykit_page_gv-changelog .changelog ul{list-style-type:square}.post-type-gravityview .changelog ul ul,.gravitykit_page_gv-changelog .changelog ul ul{list-style:circle;margin:.5em 0 .5em 1.3em}.gv-entry-creator-dropdown .select2-search__field{padding:0 4px 0 4px}.gv-entry-creator-dropdown.gf25 .select2-search__field{line-height:1.25rem;padding:.6875rem 1rem}.gv-entry-creator-dropdown.gf25.select2-dropdown--below{border-top:initial;margin-top:-8px}.gv-entry-creator-container.select2-container--default.gf25{min-height:4em}.gv-entry-creator-container.select2-container--default.gf25 .select2-selection__arrow{display:none}.gv-entry-creator-container.select2-container--default.gf25 .select2-selection__rendered{margin:-1px}.gv-fields.csv-disabled{cursor:not-allowed}.gv-fields.csv-disabled .csv-disabled-notice{display:block}.gv-fields.csv-disabled .gv-field-label,.gv-fields.csv-disabled .gv-field-controls button{color:#d7dade !important}.ui-tooltip-content .gv-items-picker-container.gv-widget-picker-container .gv-fields.csv-disabled{display:none}.gv-shortcode{position:relative}.gv-shortcode .dashicons-editor-code{color:#888;left:-1px;font-size:20px;line-height:1}html[dir=rtl] .gv-shortcode .dashicons-editor-code{left:auto;right:-1px}html[dir=rtl] .gv-shortcode .code.widefat{text-align:right}.gv-shortcode input.code{cursor:pointer}.gv-shortcode span.copied{display:none;position:absolute;top:30px;right:15px;background-color:#000;color:#FFF;padding:2px 5px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.wp-list-table .gv-shortcode span.copied{top:3px;right:3px}
diff --git a/assets/css/scss/admin-global.scss b/assets/css/scss/admin-global.scss
index 1c86169b5..d08026d61 100644
--- a/assets/css/scss/admin-global.scss
+++ b/assets/css/scss/admin-global.scss
@@ -173,6 +173,23 @@
}
+.gv-fields.csv-disabled {
+ cursor: not-allowed;
+
+ .csv-disabled-notice {
+ display: block;
+ }
+ .gv-field-label,
+ .gv-field-controls button {
+ color: #d7dade !important;
+ }
+
+ .ui-tooltip-content .gv-items-picker-container.gv-widget-picker-container & {
+ display: none;
+ }
+}
+
+
/** The "Embed Shortcode" section in the Publish metabox */
.gv-shortcode {
.dashicons-editor-code {
diff --git a/assets/js/admin-shortcode.min.js b/assets/js/admin-shortcode.min.js
index 68212e853..73bb28334 100644
--- a/assets/js/admin-shortcode.min.js
+++ b/assets/js/admin-shortcode.min.js
@@ -1 +1 @@
-!function($){$(document).on("ready",function(){new ClipboardJS(".gv-shortcode input.code",{text:function(trigger){return $(trigger).val()}}),$(".gv-shortcode input.code").on("click",function(e){e.preventDefault();var $el=$(this).closest(".gv-shortcode").find(".copied");$el.show(),setTimeout(function(){$el.fadeOut()},1e3)})})}(jQuery);
\ No newline at end of file
+!function($){$(document).on("ready",function(){new ClipboardJS(".gv-shortcode input.code",{text:function(trigger){return $(trigger).val()}}).on("success",function(e){var $el=$(e.trigger).closest(".gv-shortcode").find(".copied");$el.show(),setTimeout(function(){$el.fadeOut()},1e3)}),$(".gv-shortcode input.code").on("keydown",function(e){"Enter"===e.key&&(e.preventDefault(),$(this).trigger("click"))})})}(jQuery);
\ No newline at end of file
diff --git a/assets/js/admin-views.js b/assets/js/admin-views.js
index 2602f6671..94dd84e5d 100644
--- a/assets/js/admin-views.js
+++ b/assets/js/admin-views.js
@@ -2815,4 +2815,22 @@
$( document.body ).trigger( 'gravityview/loaded' );
} );
+
+ /**
+ * Handles CSV widget classes.
+ * @since $ver$
+ */
+ $( function () {
+ const $csv_enable = $( '#gravityview_se_csv_enable' );
+ const update_csv_widget_classes = function () {
+ $( '[data-fieldid="export_link"]' )
+ .toggleClass( 'csv-disabled', !$csv_enable.is( ':checked' ) )
+ .attr( 'aria-disabled', $csv_enable.is( ':checked' ) ? 'false' : 'true' )
+ ;
+ };
+
+ $csv_enable.on( 'change', update_csv_widget_classes );
+ update_csv_widget_classes();
+ } );
+
}(jQuery));
diff --git a/assets/js/admin-views.min.js b/assets/js/admin-views.min.js
index 66db2ec66..036765a9d 100644
--- a/assets/js/admin-views.min.js
+++ b/assets/js/admin-views.min.js
@@ -1 +1 @@
-!function($){var viewConfiguration,viewGeneralSettings;$.widget.bridge("gvTooltip",$.ui.tooltip),viewConfiguration={startFreshStatus:!1,hasUnsavedChanges:!1,altKey:!1,dialogWidth:750,performingAjaxAction:!1,init:function(){var vcfg=viewConfiguration;vcfg.gvSelectForm=$("#gravityview_form_id"),vcfg.gvSwitchView=$("#gv_switch_view_button"),vcfg.currentFormId=vcfg.gvSelectForm.val(),vcfg.currentTemplateId=$("#gravityview_directory_template").val(),vcfg.directAccessSelect=$("#gv-direct-access-select"),vcfg.toggleInitialVisibility(vcfg),$(document.body).on("keydown keyup",vcfg.altKeyListener).on("change","#gravityview_form_id",vcfg.formChange).on("click",'a[href="#gv_start_fresh"]',vcfg.startFresh).on("click","#publish, #save-post",vcfg.processFormSubmit).on("submit","#post",vcfg.processFormSubmit).on("click",".gv-view-types-hover",vcfg.selectTemplateHover).on("click","a[rel*=external]",vcfg.openExternalLinks).on("click mouseup keyup",vcfg.closeTooltips).on("click",'.gv-field-filter-form span[role="button"]',vcfg.switchTooltipLayout).on("click","#gv_switch_view_button",vcfg.switchView).on("click",".clear-all-fields",vcfg.removeAllFields).on("click",".gv_select_template",vcfg.selectTemplate).on("click",".ui-tooltip-content .gv-fields",vcfg.startAddField).on("click","#gv-direct-access .edit-direct-access",vcfg.editDirectAccess).on("click","#gv-direct-access-select .cancel-direct-access",vcfg.cancelDirectAccess).on("click","#gv-direct-access-select .save-direct-access",vcfg.updateDirectAccess).on("gravityview_form_change",vcfg.updateFormLinks).on("gravityview_form_change",vcfg.updateWidgetFormIds).on("change",".gv-dialog-options input[name*=show_as_link]",vcfg.toggleShowAsEntry).on("change",".gv-dialog-options input[name*=only_loggedin]",vcfg.toggleCustomVisibility).on("change",".gv-dialog-options [name*=allow_edit_cap]",vcfg.toggleCustomVisibility).on("click",".gv-field-controls .gv-remove-field",vcfg.removeField).on("click",".gv-field-controls .gv-field-settings",vcfg.openFieldSettings).on("dblclick",".gv-fields:not(.gv-nonexistent-form-field)",vcfg.openFieldSettings).on("change","#gravityview_settings",vcfg.zebraStripeSettings).on("click",".gv-field-details--toggle",function(e){var $dialog=$(this).parents(".ui-dialog"),was_closed=$(".gv-field-details",$dialog).hasClass("gv-field-details--closed");return viewConfiguration.toggleFieldDetails($dialog,was_closed),$.cookie("gv-field-details-expanded",was_closed,{path:gvGlobals.admin_cookiepath}),!1}).on("search keydown keyup",".gv-field-filter-form input:visible",vcfg.setupFieldFilters).on("click",".gv-section .is-dismissible .notice-dismiss",function(e){var warning_name=$(this).parents(".gv-section").attr("id")+"-"+$("#post_ID").val();$.cookie("warning-dismissed-"+warning_name,1,{path:gvGlobals.admin_cookiepath}),$(document.body).trigger("gravityview/tabs-ready")}).on("gravityview/loaded gravityview/tabs-ready gravityview/field-added gravityview/field-removed gravityview/all-fields-removed gravityview/show-as-entry gravityview/view-config-updated",vcfg.toggleTabConfigurationWarnings).on("gravityview/loaded gravityview/tabs-ready gravityview/field-added gravityview/field-removed gravityview/all-fields-removed gravityview/show-as-entry gravityview/view-config-updated",vcfg.toggleRemoveAllFields).on("search keydown keyup",".gv-field-filter-form input:visible",vcfg.setupFieldFilters).on("gravityview/loaded",function(){$(".gv-setting-list, #gravityview_settings").on("change",vcfg.toggleCheckboxes)}).on("change",".gv-dialog-options",vcfg.toggleCheckboxes).on("focus",".gv-add-field",function(e){$(this).parent(".gv-fields").addClass("trigger--hover")}).on("blur",".gv-add-field",function(e){$(this).parent(".gv-fields").removeClass("trigger--hover")}).on("keydown",".gv-add-field",function(e){return 13!==e.keyCode&&32!==e.keyCode||void $(this).parent(".gv-fields").addClass("trigger--active")}).on("keyup",".gv-add-field",function(e){return 13!==e.keyCode&&32!==e.keyCode||void $(this).parent(".gv-fields").removeClass("trigger--active")}),$(window).resize(function(){var $open_dialog=$(".ui-dialog:visible").find(".ui-dialog-content");$open_dialog.dialog("option","position",{my:"center",at:"center",of:window});var window_width=vcfg.dialogWidth,ninety_five_per=.95*$(window).width();vcfg.dialogWidth>ninety_five_per&&(window_width=ninety_five_per),$open_dialog.dialog("option","width",window_width)}),window.addEventListener("beforeunload",event=>{vcfg.hasUnsavedChanges&&event.preventDefault()}),gvGlobals.passed_form_id&&vcfg.gvSelectForm.trigger("change");var _sendToEditor=window.send_to_editor;window.send_to_editor=function(val){var cursorPosition=$("#"+window.wpActiveEditor);if(!cursorPosition.hasClass("codemirror")&&_sendToEditor)return _sendToEditor(val);var codeMirror=cursorPosition.next(".CodeMirror")[0].CodeMirror,cursorPosition=codeMirror.getCursor();codeMirror.replaceRange(val,window.wp.CodeMirror.Pos(cursorPosition.line,cursorPosition.ch))},$("div .gform-dropdown__trigger").on("click.gravityforms",vcfg.sendMergeTagValueToCodemirrorEditor)},getCookieVal:function(cookie){return!(!cookie||"undefined"===cookie||"false"===cookie)&&cookie},toggleTabConfigurationWarnings:function(e){var tabs={single:{configured:$(".gv-dialog-options input[name*=show_as_link]:checked","#directory-active-fields").length||$('[data-fieldid="entry_link"]',"#directory-active-fields").length,icon:"dashicons-media-default"},edit:{configured:$('.gv-fields .field-key[value="edit_link"]').length,icon:"dashicons-welcome-write-blog"}};$.each(tabs,function(index,value){var show_warning=index+"-fields-"+$("#post_ID").val(),show_warning=!viewConfiguration.getCookieVal($.cookie("warning-dismissed-"+show_warning))&&0===value.configured;$("#"+index+"-fields").find(".notice-no-link").toggle(show_warning),$('li[aria-controls="'+index+'-view"]').toggleClass("tab-not-configured",show_warning).find(".tab-icon").toggleClass("dashicons-warning",show_warning).toggleClass(value.icon,!show_warning)})},altKeyListener:function(e){viewConfiguration.altKey=e.altKey},zebraStripeSettings:function(){jQuery("#gravityview_settings").find("table").each(function(){$trs=$(this).find("tr").not('[style="display: none;"]'),$trs.removeClass("alternate"),$trs.filter(":even").addClass("alternate")})},toggleCheckboxes:function($parent){$parent=$parent.currentTarget||$parent;viewConfiguration.toggleRequired($parent,"requires",!1),viewConfiguration.toggleRequired($parent,"requires-not",!0);$parent=$($parent).is(".gv-fields")?$($parent):$($parent).parents(".gv-fields");$parent.length&&(viewConfiguration.toggleDisabled($("input[type=checkbox][name*=link_to_]",$parent),$("input[type=checkbox][name*=show_as_link]",$parent)),viewConfiguration.toggleDisabled($("input[type=checkbox][name*=link_phone]",$parent),$("input[type=checkbox][name*=show_as_link]",$parent)))},toggleDisabled:function($one,$two){0!==$one.length&&0!==$two.length&&($one.is(":checked")?$two.prop("disabled",!0):$two.is(":checked")&&$one.prop("disabled",!0))},toggleRequired:function(currentTarget,data_attr,reverse_logic){var $parent=$(currentTarget,"#post");$parent.find("[data-"+data_attr+"]").each(function(){var $this=$(this),requires_value=$this.data(data_attr).split("="),$input=requires_value[0],requires_value=requires_value[1],$input=$parent.find('[name$="['+$input+']"]').filter(":input");$input.is("[type=checkbox]")?reverse_logic?$this.toggle($input.not(":checked")):$this.toggle($input.is(":checked")):void 0!==requires_value&&(reverse_logic?$this.toggle($input.val()!==requires_value):$this.toggle($input.val()===requires_value))})},switchTooltipLayout:function(e){var layout=$(this).data("value");viewConfiguration.setTooltipLayout(layout)},setTooltipLayout:function(layout){$(".gv-items-picker--"+layout).addClass("active"),$(".gv-items-picker").not(".gv-items-picker--"+layout).removeClass("active"),$(".gv-items-picker-container").attr("data-layout",layout),$.cookie("gv-items-picker-layout",layout,{path:gvGlobals.admin_cookiepath})},closeTooltips:function(e){var activeTooltips=$("[data-tooltip='active']"),close=!1,return_false=!1;switch(e.type){case"keyup":if(27===e.keyCode){if($(".ui-autocomplete").is(":visible"))return;return_false=close=0===$(".gv-field-filter-form input[data-has-search]:focus").length,window.Beacon&&window.Beacon("close")}((13===e.keyCode||32===e.keyCode)&&$(e.target).is(".close")||$(e.target).is(".dashicons-dismiss"))&&(close=!0);break;case"mouseup":$(e.target).parents(".ui-dialog,.ui-tooltip").length||$(e.target).is(".ui-dialog,.ui-tooltip")?close=!1:0vcfg.dialogWidth?vcfg.dialogWidth:$(window).width()-10},open:function(){return $('').prependTo("#wpwrap"),vcfg.toggleCheckboxes(thisDialog),vcfg.setupFieldDetails(thisDialog),vcfg.refresh_merge_tags(thisDialog,function(){vcfg.setupCodeMirror(thisDialog)}),$sortableEls=$('.ui-widget-content[aria-hidden="false"]').find(".active-drop-widget, .active-drop-field"),$sortableEls.length&&$sortableEls.each((i,el)=>{$(el).hasClass("ui-sortable")&&$(el).sortable("disable")}),!0},close:function(e){e.preventDefault(),$("textarea.code",thisDialog).each(function(){$CodeMirror=$(this).next(".CodeMirror"),0!==$CodeMirror.length&&$CodeMirror[0].hasOwnProperty("CodeMirror")&&$CodeMirror[0].CodeMirror.toTextArea()}),thisDialog.find(".merge-tag-support").removeClass("merge-tag-support").addClass("gv-merge-tag-support"),$(".gv-field-settings.active","#gravityview_view_config").removeClass("active"),vcfg.setCustomLabel(thisDialog),$("#wpwrap").find("> .gv-overlay").fadeOut("fast",function(){$(this).remove()}),$sortableEls=$('.ui-widget-content[aria-hidden="false"]').find(".active-drop-widget, .active-drop-field"),$sortableEls.length&&$sortableEls.each((i,el)=>{$(el).hasClass("ui-sortable")&&$(el).sortable("enable")}),$(document.body).trigger("gravityview/dialog-closed",thisDialog)},closeOnEscape:!0,buttons:buttons})},setupCodeMirror:function(dialog){var vcfg=viewConfiguration;$("textarea.code:visible",dialog).each(function(){const codemirrorConfig=$.extend(!0,{},wp.codeEditor.defaultSettings);var $textarea,editorId,mergeTag,initialEditorCursorPos,$autocompleteEl,closeAutocompletion,mergeTags=$(this).data("codemirror");mergeTags&&(codemirrorConfig.codemirror=$.extend({},codemirrorConfig.codemirror,mergeTags));let editor=wp.codeEditor.initialize($(this),codemirrorConfig);($(this).hasClass("merge-tag-support")||$(this).hasClass("gv-merge-tag-support"))&&(editor.codemirror.setSize("95%"),$textarea=$(this),editorId=$textarea.attr("id"),mergeTags=window.gfMergeTags.getAutoCompleteMergeTags($textarea),mergeTag="",initialEditorCursorPos=editor.codemirror.getCursor(),$textarea.parent().find(".all-merge-tags").detach().insertBefore($textarea),$textarea.parent().find("div .gform-dropdown__trigger").on("click.gravityforms",vcfg.sendMergeTagValueToCodemirrorEditor),$textarea.autocomplete({appendTo:$textarea.parent(),minLength:1,position:{my:"center top",at:"center bottom",collision:"none"},source:mergeTags,select:function(event,currentEditorCursorPos){var val=currentEditorCursorPos.item.value.replace(/^{|}$/gm,""),currentEditorCursorPos=editor.codemirror.getCursor();editor.codemirror.replaceRange(val,initialEditorCursorPos,window.wp.CodeMirror.Pos(currentEditorCursorPos.line,currentEditorCursorPos.ch)),editor.codemirror.focus(),editor.codemirror.setCursor(window.wp.CodeMirror.Pos(currentEditorCursorPos.line,currentEditorCursorPos.ch+val.length+1))}}),$autocompleteEl=$textarea.parent().find("ul.ui-autocomplete"),closeAutocompletion=function(){$("#"+editorId).autocomplete("close")},$(document.body).on("keyup",function(e){$autocompleteEl.is(":visible")&&27===e.which&&(e.preventDefault(),closeAutocompletion(),$textarea.focus())}),editor.codemirror.on("mousedown",function(){closeAutocompletion()}),editor.codemirror.on("keydown",function(el,e){$autocompleteEl.is(":visible")&&(38!==e.which&&40!==e.which&&13!==e.which||($autocompleteEl.not(":focus")&&$autocompleteEl.focus(),e.preventDefault()))}),editor.codemirror.on("change",function(e,currentEditorCursorPos){"{}"===currentEditorCursorPos.text[0]&&(initialEditorCursorPos=editor.codemirror.getCursor());currentEditorCursorPos=editor.codemirror.getCursor();"{"!==(mergeTag=editor.codemirror.getRange({ch:initialEditorCursorPos.ch-1,line:initialEditorCursorPos.line},currentEditorCursorPos))[0]?closeAutocompletion():$("#"+editorId).autocomplete("search",mergeTag)}))})},sendMergeTagValueToCodemirrorEditor:function(e){var _activeEditorBackup=window.wpActiveEditor;window.wpActiveEditor=$(e.currentTarget).parentsUntil(".gv-setting-container").find("textarea").attr("id"),window.wpActiveEditor&&window.send_to_editor($(this).data("value")),window.wpActiveEditor=_activeEditorBackup},setupFieldDetails:function(dialog){$(".gv-field-details--container",dialog).insertAfter(".ui-dialog-title:visible");var show_details=$.cookie("gv-field-details-expanded"),show_details=viewConfiguration.getCookieVal(show_details);viewConfiguration.toggleFieldDetails(dialog,show_details),viewConfiguration.migrateSurveyScore(dialog)},migrateSurveyScore:function($dialog){var $score;0===$dialog.parents('[data-inputtype="survey"]').length||($score=$dialog.find(".gv-setting-container-score input"))&&0!=+$score.val()&&$dialog.find('.gv-setting-container-choice_display input[value="score"]').trigger("click").trigger("focus")},toggleFieldDetails:function($dialog,show_details){$parent=$dialog.parent(),$parent.find(".gv-field-details").toggleClass("gv-field-details--closed",!show_details).end().find(".gv-field-details--toggle .dashicons").toggleClass("dashicons-arrow-down",!!show_details).toggleClass("dashicons-arrow-right",!show_details).end()},setCustomLabel:function($label){var custom_label_text=$("[name*=admin_label]",$label),custom_label_text=custom_label_text.length&&custom_label_text.val()?custom_label_text:$("[name*=custom_label]",$label),$label=$label.parents(".gv-fields").find(".gv-field-label-text-container");custom_label_text.length&&(0<(custom_label_text=custom_label_text.val().trim()).length?$label.html(custom_label_text):$label.html($label.attr("data-original-title")))},getSortableFields:function(context,id){return new Promise((resolve,reject)=>{var vcfg=viewConfiguration;$(".gravityview_sort_field").prop("disabled","disabled").empty().append("");var data={action:"gv_sortable_fields_form",nonce:gvGlobals.nonce};void 0!==context&&"preset"===context?data.template_id=id:data.form_id=vcfg.gvSelectForm.val(),$.post(ajaxurl,data,function(response){"false"!==response&&"0"!==response&&$(".gravityview_sort_field").empty().append(response).prop("disabled",null),resolve()})})},hideViewConfig:function(){$("#gravityview_view_config").slideUp(150),$(document).trigger("gv_admin_views_hideViewConfig")},showViewConfig:function(){$("#gravityview_view_config").slideDown(150),viewGeneralSettings.metaboxObj.show(),viewConfiguration.toggleDropMessage(),viewConfiguration.init_tooltips(),$(document).trigger("gv_admin_views_showViewConfig")},switchView:function(vcfg){vcfg.preventDefault(),vcfg.stopImmediatePropagation();vcfg=viewConfiguration;vcfg.templateFilter("custom"),vcfg.toggleViewTypeMetabox()},templateFilter:function(templateType){$(".gv-view-types-module").each(function(){$(this).attr("data-filter")===templateType?$(this).parent().show():$(this).parent().hide()})},selectTemplate:function(slugmatch){var vcfg=viewConfiguration;slugmatch.preventDefault(),slugmatch.stopImmediatePropagation(),vcfg.wantedTemplate=$(this);var selectedTemplateId=vcfg.wantedTemplate.attr("data-templateid"),regexMatch=/(.*?)_(.*?)$/i,slugmatch=vcfg.currentTemplateId.replace(regexMatch,"$2"),slugmatch=selectedTemplateId.replace(regexMatch,"$2")===slugmatch;vcfg.currentTemplateId&&!slugmatch&&vcfg.getConfiguredFields().length?vcfg.currentTemplateId!==selectedTemplateId?vcfg.getConfiguredFields().length?vcfg.showDialog("#gravityview_switch_template_dialog"):(vcfg.toggleViewTypeMetabox(),vcfg.selectTemplateContinue(slugmatch)):(vcfg.toggleViewTypeMetabox(),vcfg.showViewConfig()):($("#gravityview_select_template").slideUp(150),vcfg.selectTemplateContinue(slugmatch))},selectTemplateContinue:function(slugmatch){var vcfg=viewConfiguration,selectedTemplateId=vcfg.wantedTemplate.attr("data-templateid"),selectedFormId=vcfg.gvSelectForm.val();$("#gravityview_directory_template").val(selectedTemplateId).trigger("change");var $parent=vcfg.wantedTemplate.parents(".gv-view-types-module");$parent.parents(".gv-grid").find(".gv-view-types-module").removeClass("gv-selected"),$parent.addClass("gv-selected"),vcfg.waiting("start"),vcfg.startFreshStatus?Promise.all([vcfg.getAvailableFields("preset",selectedTemplateId),vcfg.getPresetFields(selectedTemplateId),vcfg.getSortableFields("preset",selectedTemplateId)]).then(function(){$(".ui-tabs-panel").each(function(){vcfg.init_droppables(this)})}):(slugmatch?vcfg.waiting("stop"):vcfg.updateActiveAreas(selectedTemplateId,+selectedFormId),vcfg.gvSwitchView.fadeIn(150),vcfg.toggleViewTypeMetabox()),vcfg.currentTemplateId=selectedTemplateId,vcfg.setUnsavedChanges(!0)},selectTemplateHover:function(on_success){const vcfg=viewConfiguration,$link=$(on_success.target),$parent=$link.parents(".gv-view-types-module");if($link.is("[rel=internal]")&&!$link.hasClass("gv-layout-activate")&&!$link.hasClass("gv-layout-install"))return!0;on_success.preventDefault(),on_success.stopImmediatePropagation();var server_request=(ajaxRoute,payload)=>{const defer=$.Deferred();$link.addClass("disabled"),vcfg.performingAjaxAction=!0,$(".gv-view-template-notice").hide();var{_wpNonce:nonce,_wpAjaxAction:action,_wpAjaxUrl:url,ajaxRouter,frontendFoundationVersion}=window.gvGlobals.foundation_licenses_router;return $.post(url,{nonce:nonce,action:action,ajaxRouter:ajaxRouter,ajaxRoute:ajaxRoute,frontendFoundationVersion:frontendFoundationVersion,payload:payload}).done(response=>{response.success?defer.resolve():defer.reject(response.data)}).fail(response=>{defer.reject(response.responseText)}),defer.promise()},on_fail=error=>{$(".gv-view-template-notice").show().find("p").html(error),document.querySelector(".gv-view-template-notice").scrollIntoView({behavior:"smooth"})},do_always=()=>{vcfg.performingAjaxAction=!1,$link.removeClass("disabled")},on_success=()=>{$parent.find(".gv-view-types-hover > div:eq(0)").hide(),$parent.find(".gv-view-types-hover > div:eq(1)").removeClass("hidden"),$parent.removeClass("gv-view-template-placeholder"),$parent.find("a.gv_select_template").attr("data-templateid",$link.data("templateid")).trigger("click")};return $link.hasClass("gv-layout-activate")?vcfg.performingAjaxAction?void 0:void $.when(server_request("activate_product",{text_domain:$link.attr("data-template-text-domain")})).then(on_success).always(do_always).fail(on_fail):$link.hasClass("gv-layout-install")?vcfg.performingAjaxAction?void 0:void $.when(server_request("install_product",{id:$link.attr("data-download-id"),activate:!0})).then(on_success).always(do_always).fail(on_fail):void $(this).find(".gv_select_template").trigger("click")},openExternalLinks:function(){return window.Beacon&&($(this).is("[data-beacon-article]")||$(this).is("[data-beacon-article-modal]")||$(this).is("[data-beacon-article-sidebar]")||$(this).is("[data-beacon-article-inline]"))||window.open(this.href),!1},previewTemplate:function(e){e.preventDefault(),e.stopImmediatePropagation();var parent=$(e.currentTarget).parents(".gv-view-types-module");parent.find(".gv-template-preview").dialog({dialogClass:"wp-dialog gv-dialog",appendTo:$("#gravityview_select_template"),width:viewConfiguration.dialogWidth,open:function(){$('').prependTo("#wpwrap")},close:function(){$(this).dialog("option","appendTo",parent),$("#wpwrap").find("> .gv-overlay").fadeOut("fast",function(){$(this).remove()})},closeOnEscape:!0,buttons:[{text:gvGlobals.label_close,click:function(){$(this).dialog("close")}}]})},updateActiveAreas:function(template,data){var vcfg=viewConfiguration;$("#directory-active-fields, #single-active-fields").children().remove();data={action:"gv_get_active_areas",template_id:template,form_id:data,nonce:gvGlobals.nonce};return vcfg.updateViewConfig(data)},getPresetFields:function(data){var vcfg=viewConfiguration;$("#directory-active-fields, #single-active-fields").children().remove();data={action:"gv_get_preset_fields",template_id:data,nonce:gvGlobals.nonce};return vcfg.updateViewConfig(data)},updateViewConfig:function(data){return new Promise((resolve,reject)=>{var vcfg=viewConfiguration;$.post(ajaxurl,data,function(content){content&&(content=JSON.parse(content),$("#directory-header-widgets").html(content.header),$("#directory-footer-widgets").html(content.footer),$("#directory-active-fields").append(content.directory),$("#single-active-fields").append(content.single),vcfg.showViewConfig(),vcfg.waiting("stop"),$(document.body).trigger("gravityview/view-config-updated",content)),resolve()}),vcfg.setUnsavedChanges(!0)})},waiting:function(action){$containers=$("#wpwrap,.gv-fields"),"start"===action?$containers.addClass("gv-wait"):$containers.removeClass("gv-wait")},remove_tooltips:function(el){$(el||".gv-add-field").is(":ui-tooltip")&&$(".gv-add-field").gvTooltip("destroy").off("click")},init_tooltips:function(el){0!==$(el||".gv-add-field","#post").not(":ui-tooltip").length&&$(el||".gv-add-field","#post").gvTooltip({show:150,hide:200,content:function(){var context=$(this).attr("data-context"),formId=$(this).attr("data-formid")||$("#gravityview_form_id").val(),templateId=$("#gravityview_directory_template").val();switch($(this).attr("data-objecttype")){case"field":return $("#"+context+"-available-fields-"+(formId||templateId)).html();case"widget":return $("#directory-available-widgets").html()}},close:function(){$(this).attr("data-tooltip",null)},open:function(event,tooltip){$(this).attr("data-tooltip","active").attr("data-tooltip-id",$(this).attr("aria-describedby")),$focus_item=$("input[type=search]",tooltip.tooltip),$focus_item.length||($focus_item=$(tooltip.tooltip).find(".close").first());var activate_layout="list";$(tooltip).find(".gv-items-picker-container[data-layout]").length?activate_layout=$(tooltip).find(".gv-items-picker-container[data-layout]").attr("data-layout"):(layout_cookie=$.cookie("gv-items-picker-layout"),viewConfiguration.getCookieVal(layout_cookie)&&(activate_layout=layout_cookie)),viewConfiguration.setTooltipLayout(activate_layout),$focus_item.trigger("focus")},closeOnEscape:!0,disabled:!0,position:{my:"center bottom",at:"center top-12"},tooltipClass:"gravityview-item-picker-tooltip top"}).attr("title","").on("mouseout focusout",function(e){e.stopImmediatePropagation()}).on("click",function(e){$(this).attr("title",""),e.preventDefault(),$(this).gvTooltip("open")})},setupFieldFilters:function(e){var input=$(this).val().trim(),$tooltip=$(this).parents(".ui-tooltip-content"),$resultsNotFound=$tooltip.find(".gv-no-results");"keydown"!==e.type?($tooltip.find(".gv-fields").show().filter(function(){var match_title=$(this).find(".gv-field-label").attr("data-original-title").match(new RegExp(input,"i")),match_id=$(this).attr("data-fieldid").match(new RegExp(input,"i")),match_parent=!!$(this).attr("data-parent-label")&&$(this).attr("data-parent-label").match(new RegExp(input,"i"));return!match_title&&!match_id&&!match_parent}).hide(),$tooltip.find(".gv-fields:visible").length?$resultsNotFound.hide():$resultsNotFound.show()):$(this).attr("data-has-search",0{var vcfg=viewConfiguration;vcfg.toggleDropMessage(),vcfg.getConfiguredFields().remove();var data={action:"gv_available_fields",nonce:gvGlobals.nonce};data.form_preset_ids=void 0!==preset&&"preset"===preset?[templateid]:[vcfg.gvSelectForm.val()],$("#directory-available-fields-"+data.form_preset_ids[0]).length||$.post(ajaxurl,data,function(response){response.success||response.data||resolve(),$.each(response.data,function(context,markup){$("#"+context+"-fields").append(markup)}),resolve()})})},startAddField:function(e){$(this).has(".field-id-all-fields").length?viewConfiguration.addAllFields($(this)):viewConfiguration.addField($(this),e)},addAllFields:function(clicked){clicked.siblings(".gv-fields").filter(function(){var field_id=$(this).data("fieldid");return+field_id===parseInt(field_id,10)}).each(function(){$(this).trigger("click")}),$("a.gv-add-field[data-tooltip='active']").gvTooltip("close")},addField:function(data,addButton){addButton.preventDefault();var vcfg=viewConfiguration,newField=data.clone().hide(),areaId=data.parents(".ui-tooltip").attr("id"),templateId=$("#gravityview_directory_template").val(),addButton=data.parents(".ui-tooltip").attr("id"),addButton=$('.gv-add-field[data-tooltip-id="'+addButton+'"]'),data={action:"gv_field_options",template:templateId,area:addButton.attr("data-areaid"),context:addButton.attr("data-context"),field_id:newField.attr("data-fieldid"),field_label:newField.find(".gv-field-label").attr("data-original-title"),field_type:addButton.attr("data-objecttype"),input_type:newField.attr("data-inputtype"),form_id:parseInt($(data).attr("data-formid"),10)||vcfg.currentFormId,nonce:gvGlobals.nonce};$.ajax({type:"POST",url:ajaxurl,data:data,async:!0,beforeSend:function(){vcfg.disable_publish()},complete:function(){vcfg.enable_publish()}}).done(function(response){newField.append(response),$(".ui-tabs-panel").each(function(){vcfg.init_droppables(this)}),0<$(".gv-dialog-options",newField).length&&$(".gv-field-settings",newField).removeClass("hide-if-js"),$('[data-tooltip-id="'+areaId+'"]').parents(".gv-droppable-area").find(".active-drop").append(newField).end().attr("data-tooltip-id",""),$(document.body).trigger("gravityview/field-added",newField),newField.fadeIn(100),vcfg.refreshGFtooltips()}).fail(function(jqXHR){vcfg.enable_publish(),alert(gvGlobals.field_loaderror),console.log(jqXHR)}).always(function(){vcfg.toggleDropMessage(),vcfg.setUnsavedChanges(!0)})},refresh_merge_tags:function($source,onRefresh){let $merge_tag_supported=$source?$(".gv-merge-tag-support,.merge-tag-support",$source):$(".gv-merge-tag-support:visible");if($merge_tag_supported.removeClass("gv-merge-tag-support mt-initialized").addClass("merge-tag-support"),window.gform?.instances?.mergeTags)return $(".all-merge-tags",$source).remove(),document.dispatchEvent(new Event("DOMContentLoaded")),void setTimeout(function(){$merge_tag_supported.removeClass("merge-tag-support").addClass("gv-merge-tag-support"),onRefresh&&onRefresh()},300);"undefined"!=typeof form&&$(document.body).not(".gv-form-changed")&&0<=$merge_tag_supported.length&&(window.gfMergeTags&&($(".all-merge-tags:visible").remove(),gfMergeTags.hasOwnProperty("destroy")?$merge_tag_supported.each(function(){new gfMergeTagsObj(form,$(this))}):window.gfMergeTags=new gfMergeTagsObj(form)),$merge_tag_supported.removeClass("merge-tag-support").addClass("gv-merge-tag-support"),onRefresh&&onRefresh())},enable_publish:function(){$(document).trigger("autosave-enable-buttons.edit-post"),$("#publishing-action").find("#publish").prop("disabled",null).removeClass("button-primary-disabled")},disable_publish:function(){$(document).trigger("autosave-disable-buttons.edit-post"),$("#publishing-action").find("#publish").prop("disabled","disabled").addClass("button-primary-disabled")},init_droppables:function(panel){var vcfg;$(panel).find(".active-drop-field").sortable("instance")||(vcfg=viewConfiguration,$(panel).find(".active-drop-widget").sortable({placeholder:"fields-placeholder",items:"> .gv-fields",distance:2,revert:75,connectWith:".active-drop-widget",start:function(event,ui){$("#directory-fields, #single-fields").find(".active-drop-container-widget").addClass("is-receivable")},stop:function(event,ui){$("#directory-fields, #single-fields").find(".active-drop-container-widget").removeClass("is-receivable")},change:function(event,ui){vcfg.setUnsavedChanges(!0)},receive:function(event,ui){var sender_area=ui.sender.attr("data-areaid"),receiver_area=$(this).attr("data-areaid");ui.item.find('[name^="widgets['+sender_area+']"]').each(function(){var name=$(this).attr("name");$(this).attr("name",name.replace(sender_area,receiver_area))}),vcfg.toggleDropMessage()}}),$(panel).find(".active-drop-field").sortable({placeholder:"fields-placeholder",items:"> .gv-fields",distance:2,revert:75,connectWith:".active-drop-field",start:function(event,ui){$(panel).find(".active-drop-container-field").addClass("is-receivable")},stop:function(event,ui){$(panel).find(".active-drop-container-field").removeClass("is-receivable")},change:function(event,ui){vcfg.setUnsavedChanges(!0)},receive:function(event,ui){var sender_area,receiver_area;0",{name:"gv_fields",value:serialized_data,type:"hidden"})),setTimeout(function(){$post.data("gv-valid",!0),"click"===e.type?$(e.target).trigger("click"):$post.trigger("submit")},101),!1)},createPresetForm:function(e,data){var vcfg=viewConfiguration,$target=$(e.target);e.stopPropagation();data={action:"gv_set_preset_form",template_id:data,nonce:gvGlobals.nonce};return $.ajax({type:"POST",url:ajaxurl,data:data,async:!1,success:function(response){"false"!==response&&"0"!==response?(vcfg.startFreshStatus=!1,vcfg.gvSelectForm.find("option:selected").removeAttr("selected").end().append(response),"click"===e.type?$target.trigger("click"):$("#post").trigger("submit")):$target.before(''+gvGlobals.label_publisherror+"
")}}),!1}},viewGeneralSettings={templateId:null,metaboxObj:null,init:function(){viewGeneralSettings.metaboxObj=$("#gravityview_settings"),viewGeneralSettings.initTabs(),$("#gravityview_directory_template").on("change",viewGeneralSettings.updateSettingsDisplay).trigger("change"),$(document.body).on("gravityview/settings/tab/enable",viewGeneralSettings.enableSettingTab).on("gravityview/settings/tab/disable",viewGeneralSettings.disableSettingTab)},updateSettingsDisplay:function(){viewGeneralSettings.templateId=$(this).val(),$("tr[data-show-if]").each(viewGeneralSettings.toggleSetting)},toggleSetting:function(){var row=$(this),templates=row.attr("data-show-if");templates.length<1||(0ninety_five_per&&(window_width=ninety_five_per),$open_dialog.dialog("option","width",window_width)}),window.addEventListener("beforeunload",event=>{vcfg.hasUnsavedChanges&&event.preventDefault()}),gvGlobals.passed_form_id&&vcfg.gvSelectForm.trigger("change");var _sendToEditor=window.send_to_editor;window.send_to_editor=function(val){var cursorPosition=$("#"+window.wpActiveEditor);if(!cursorPosition.hasClass("codemirror")&&_sendToEditor)return _sendToEditor(val);var codeMirror=cursorPosition.next(".CodeMirror")[0].CodeMirror,cursorPosition=codeMirror.getCursor();codeMirror.replaceRange(val,window.wp.CodeMirror.Pos(cursorPosition.line,cursorPosition.ch))},$("div .gform-dropdown__trigger").on("click.gravityforms",vcfg.sendMergeTagValueToCodemirrorEditor)},getCookieVal:function(cookie){return!(!cookie||"undefined"===cookie||"false"===cookie)&&cookie},toggleTabConfigurationWarnings:function(e){var tabs={single:{configured:$(".gv-dialog-options input[name*=show_as_link]:checked","#directory-active-fields").length||$('[data-fieldid="entry_link"]',"#directory-active-fields").length,icon:"dashicons-media-default"},edit:{configured:$('.gv-fields .field-key[value="edit_link"]').length,icon:"dashicons-welcome-write-blog"}};$.each(tabs,function(index,value){var show_warning=index+"-fields-"+$("#post_ID").val(),show_warning=!viewConfiguration.getCookieVal($.cookie("warning-dismissed-"+show_warning))&&0===value.configured;$("#"+index+"-fields").find(".notice-no-link").toggle(show_warning),$('li[aria-controls="'+index+'-view"]').toggleClass("tab-not-configured",show_warning).find(".tab-icon").toggleClass("dashicons-warning",show_warning).toggleClass(value.icon,!show_warning)})},altKeyListener:function(e){viewConfiguration.altKey=e.altKey},zebraStripeSettings:function(){jQuery("#gravityview_settings").find("table").each(function(){$trs=$(this).find("tr").not('[style="display: none;"]'),$trs.removeClass("alternate"),$trs.filter(":even").addClass("alternate")})},toggleCheckboxes:function($parent){$parent=$parent.currentTarget||$parent;viewConfiguration.toggleRequired($parent,"requires",!1),viewConfiguration.toggleRequired($parent,"requires-not",!0);$parent=$($parent).is(".gv-fields")?$($parent):$($parent).parents(".gv-fields");$parent.length&&(viewConfiguration.toggleDisabled($("input[type=checkbox][name*=link_to_]",$parent),$("input[type=checkbox][name*=show_as_link]",$parent)),viewConfiguration.toggleDisabled($("input[type=checkbox][name*=link_phone]",$parent),$("input[type=checkbox][name*=show_as_link]",$parent)))},toggleDisabled:function($one,$two){0!==$one.length&&0!==$two.length&&($one.is(":checked")?$two.prop("disabled",!0):$two.is(":checked")&&$one.prop("disabled",!0))},toggleRequired:function(currentTarget,data_attr,reverse_logic){var $parent=$(currentTarget,"#post");$parent.find("[data-"+data_attr+"]").each(function(){var $this=$(this),requires_value=$this.data(data_attr).split("="),$input=requires_value[0],requires_value=requires_value[1],$input=$parent.find('[name$="['+$input+']"]').filter(":input");$input.is("[type=checkbox]")?reverse_logic?$this.toggle($input.not(":checked")):$this.toggle($input.is(":checked")):void 0!==requires_value&&(reverse_logic?$this.toggle($input.val()!==requires_value):$this.toggle($input.val()===requires_value))})},switchTooltipLayout:function(e){var layout=$(this).data("value");viewConfiguration.setTooltipLayout(layout)},setTooltipLayout:function(layout){$(".gv-items-picker--"+layout).addClass("active"),$(".gv-items-picker").not(".gv-items-picker--"+layout).removeClass("active"),$(".gv-items-picker-container").attr("data-layout",layout),$.cookie("gv-items-picker-layout",layout,{path:gvGlobals.admin_cookiepath})},closeTooltips:function(e){var activeTooltips=$("[data-tooltip='active']"),close=!1,return_false=!1;switch(e.type){case"keyup":if(27===e.keyCode){if($(".ui-autocomplete").is(":visible"))return;return_false=close=0===$(".gv-field-filter-form input[data-has-search]:focus").length,window.Beacon&&window.Beacon("close")}((13===e.keyCode||32===e.keyCode)&&$(e.target).is(".close")||$(e.target).is(".dashicons-dismiss"))&&(close=!0);break;case"mouseup":$(e.target).parents(".ui-dialog,.ui-tooltip").length||$(e.target).is(".ui-dialog,.ui-tooltip")?close=!1:0vcfg.dialogWidth?vcfg.dialogWidth:$(window).width()-10},open:function(){return $('').prependTo("#wpwrap"),vcfg.toggleCheckboxes(thisDialog),vcfg.setupFieldDetails(thisDialog),vcfg.refresh_merge_tags(thisDialog,function(){vcfg.setupCodeMirror(thisDialog)}),$sortableEls=$('.ui-widget-content[aria-hidden="false"]').find(".active-drop-widget, .active-drop-field"),$sortableEls.length&&$sortableEls.each((i,el)=>{$(el).hasClass("ui-sortable")&&$(el).sortable("disable")}),!0},close:function(e){e.preventDefault(),$("textarea.code",thisDialog).each(function(){$CodeMirror=$(this).next(".CodeMirror"),0!==$CodeMirror.length&&$CodeMirror[0].hasOwnProperty("CodeMirror")&&$CodeMirror[0].CodeMirror.toTextArea()}),thisDialog.find(".merge-tag-support").removeClass("merge-tag-support").addClass("gv-merge-tag-support"),$(".gv-field-settings.active","#gravityview_view_config").removeClass("active"),vcfg.setCustomLabel(thisDialog),$("#wpwrap").find("> .gv-overlay").fadeOut("fast",function(){$(this).remove()}),$sortableEls=$('.ui-widget-content[aria-hidden="false"]').find(".active-drop-widget, .active-drop-field"),$sortableEls.length&&$sortableEls.each((i,el)=>{$(el).hasClass("ui-sortable")&&$(el).sortable("enable")}),$(document.body).trigger("gravityview/dialog-closed",thisDialog)},closeOnEscape:!0,buttons:buttons})},setupCodeMirror:function(dialog){var vcfg=viewConfiguration;$("textarea.code:visible",dialog).each(function(){const codemirrorConfig=$.extend(!0,{},wp.codeEditor.defaultSettings);var $textarea,editorId,mergeTag,initialEditorCursorPos,$autocompleteEl,closeAutocompletion,mergeTags=$(this).data("codemirror");mergeTags&&(codemirrorConfig.codemirror=$.extend({},codemirrorConfig.codemirror,mergeTags));let editor=wp.codeEditor.initialize($(this),codemirrorConfig);($(this).hasClass("merge-tag-support")||$(this).hasClass("gv-merge-tag-support"))&&(editor.codemirror.setSize("95%"),$textarea=$(this),editorId=$textarea.attr("id"),mergeTags=window.gfMergeTags.getAutoCompleteMergeTags($textarea),mergeTag="",initialEditorCursorPos=editor.codemirror.getCursor(),$textarea.parent().find(".all-merge-tags").detach().insertBefore($textarea),$textarea.parent().find("div .gform-dropdown__trigger").on("click.gravityforms",vcfg.sendMergeTagValueToCodemirrorEditor),$textarea.autocomplete({appendTo:$textarea.parent(),minLength:1,position:{my:"center top",at:"center bottom",collision:"none"},source:mergeTags,select:function(event,currentEditorCursorPos){var val=currentEditorCursorPos.item.value.replace(/^{|}$/gm,""),currentEditorCursorPos=editor.codemirror.getCursor();editor.codemirror.replaceRange(val,initialEditorCursorPos,window.wp.CodeMirror.Pos(currentEditorCursorPos.line,currentEditorCursorPos.ch)),editor.codemirror.focus(),editor.codemirror.setCursor(window.wp.CodeMirror.Pos(currentEditorCursorPos.line,currentEditorCursorPos.ch+val.length+1))}}),$autocompleteEl=$textarea.parent().find("ul.ui-autocomplete"),closeAutocompletion=function(){$("#"+editorId).autocomplete("close")},$(document.body).on("keyup",function(e){$autocompleteEl.is(":visible")&&27===e.which&&(e.preventDefault(),closeAutocompletion(),$textarea.focus())}),editor.codemirror.on("mousedown",function(){closeAutocompletion()}),editor.codemirror.on("keydown",function(el,e){$autocompleteEl.is(":visible")&&(38!==e.which&&40!==e.which&&13!==e.which||($autocompleteEl.not(":focus")&&$autocompleteEl.focus(),e.preventDefault()))}),editor.codemirror.on("change",function(e,currentEditorCursorPos){"{}"===currentEditorCursorPos.text[0]&&(initialEditorCursorPos=editor.codemirror.getCursor());currentEditorCursorPos=editor.codemirror.getCursor();"{"!==(mergeTag=editor.codemirror.getRange({ch:initialEditorCursorPos.ch-1,line:initialEditorCursorPos.line},currentEditorCursorPos))[0]?closeAutocompletion():$("#"+editorId).autocomplete("search",mergeTag)}))})},sendMergeTagValueToCodemirrorEditor:function(e){var _activeEditorBackup=window.wpActiveEditor;window.wpActiveEditor=$(e.currentTarget).parentsUntil(".gv-setting-container").find("textarea").attr("id"),window.wpActiveEditor&&window.send_to_editor($(this).data("value")),window.wpActiveEditor=_activeEditorBackup},setupFieldDetails:function(dialog){$(".gv-field-details--container",dialog).insertAfter(".ui-dialog-title:visible");var show_details=$.cookie("gv-field-details-expanded"),show_details=viewConfiguration.getCookieVal(show_details);viewConfiguration.toggleFieldDetails(dialog,show_details),viewConfiguration.migrateSurveyScore(dialog)},migrateSurveyScore:function($dialog){var $score;0===$dialog.parents('[data-inputtype="survey"]').length||($score=$dialog.find(".gv-setting-container-score input"))&&0!=+$score.val()&&$dialog.find('.gv-setting-container-choice_display input[value="score"]').trigger("click").trigger("focus")},toggleFieldDetails:function($dialog,show_details){$parent=$dialog.parent(),$parent.find(".gv-field-details").toggleClass("gv-field-details--closed",!show_details).end().find(".gv-field-details--toggle .dashicons").toggleClass("dashicons-arrow-down",!!show_details).toggleClass("dashicons-arrow-right",!show_details).end()},setCustomLabel:function($label){var custom_label_text=$("[name*=admin_label]",$label),custom_label_text=custom_label_text.length&&custom_label_text.val()?custom_label_text:$("[name*=custom_label]",$label),$label=$label.parents(".gv-fields").find(".gv-field-label-text-container");custom_label_text.length&&(0<(custom_label_text=custom_label_text.val().trim()).length?$label.html(custom_label_text):$label.html($label.attr("data-original-title")))},getSortableFields:function(context,id){return new Promise((resolve,reject)=>{var vcfg=viewConfiguration;$(".gravityview_sort_field").prop("disabled","disabled").empty().append("");var data={action:"gv_sortable_fields_form",nonce:gvGlobals.nonce};void 0!==context&&"preset"===context?data.template_id=id:data.form_id=vcfg.gvSelectForm.val(),$.post(ajaxurl,data,function(response){"false"!==response&&"0"!==response&&$(".gravityview_sort_field").empty().append(response).prop("disabled",null),resolve()})})},hideViewConfig:function(){$("#gravityview_view_config").slideUp(150),$(document).trigger("gv_admin_views_hideViewConfig")},showViewConfig:function(){$("#gravityview_view_config").slideDown(150),viewGeneralSettings.metaboxObj.show(),viewConfiguration.toggleDropMessage(),viewConfiguration.init_tooltips(),$(document).trigger("gv_admin_views_showViewConfig")},switchView:function(vcfg){vcfg.preventDefault(),vcfg.stopImmediatePropagation();vcfg=viewConfiguration;vcfg.templateFilter("custom"),vcfg.toggleViewTypeMetabox()},templateFilter:function(templateType){$(".gv-view-types-module").each(function(){$(this).attr("data-filter")===templateType?$(this).parent().show():$(this).parent().hide()})},selectTemplate:function(slugmatch){var vcfg=viewConfiguration;slugmatch.preventDefault(),slugmatch.stopImmediatePropagation(),vcfg.wantedTemplate=$(this);var selectedTemplateId=vcfg.wantedTemplate.attr("data-templateid"),regexMatch=/(.*?)_(.*?)$/i,slugmatch=vcfg.currentTemplateId.replace(regexMatch,"$2"),slugmatch=selectedTemplateId.replace(regexMatch,"$2")===slugmatch;vcfg.currentTemplateId&&!slugmatch&&vcfg.getConfiguredFields().length?vcfg.currentTemplateId!==selectedTemplateId?vcfg.getConfiguredFields().length?vcfg.showDialog("#gravityview_switch_template_dialog"):(vcfg.toggleViewTypeMetabox(),vcfg.selectTemplateContinue(slugmatch)):(vcfg.toggleViewTypeMetabox(),vcfg.showViewConfig()):($("#gravityview_select_template").slideUp(150),vcfg.selectTemplateContinue(slugmatch))},selectTemplateContinue:function(slugmatch){var vcfg=viewConfiguration,selectedTemplateId=vcfg.wantedTemplate.attr("data-templateid"),selectedFormId=vcfg.gvSelectForm.val();$("#gravityview_directory_template").val(selectedTemplateId).trigger("change");var $parent=vcfg.wantedTemplate.parents(".gv-view-types-module");$parent.parents(".gv-grid").find(".gv-view-types-module").removeClass("gv-selected"),$parent.addClass("gv-selected"),vcfg.waiting("start"),vcfg.startFreshStatus?Promise.all([vcfg.getAvailableFields("preset",selectedTemplateId),vcfg.getPresetFields(selectedTemplateId),vcfg.getSortableFields("preset",selectedTemplateId)]).then(function(){$(".ui-tabs-panel").each(function(){vcfg.init_droppables(this)})}):(slugmatch?vcfg.waiting("stop"):vcfg.updateActiveAreas(selectedTemplateId,+selectedFormId),vcfg.gvSwitchView.fadeIn(150),vcfg.toggleViewTypeMetabox()),vcfg.currentTemplateId=selectedTemplateId,vcfg.setUnsavedChanges(!0)},selectTemplateHover:function(on_success){const vcfg=viewConfiguration,$link=$(on_success.target),$parent=$link.parents(".gv-view-types-module");if($link.is("[rel=internal]")&&!$link.hasClass("gv-layout-activate")&&!$link.hasClass("gv-layout-install"))return!0;on_success.preventDefault(),on_success.stopImmediatePropagation();var server_request=(ajaxRoute,payload)=>{const defer=$.Deferred();$link.addClass("disabled"),vcfg.performingAjaxAction=!0,$(".gv-view-template-notice").hide();var{_wpNonce:nonce,_wpAjaxAction:action,_wpAjaxUrl:url,ajaxRouter,frontendFoundationVersion}=window.gvGlobals.foundation_licenses_router;return $.post(url,{nonce:nonce,action:action,ajaxRouter:ajaxRouter,ajaxRoute:ajaxRoute,frontendFoundationVersion:frontendFoundationVersion,payload:payload}).done(response=>{response.success?defer.resolve():defer.reject(response.data)}).fail(response=>{defer.reject(response.responseText)}),defer.promise()},on_fail=error=>{$(".gv-view-template-notice").show().find("p").html(error),document.querySelector(".gv-view-template-notice").scrollIntoView({behavior:"smooth"})},do_always=()=>{vcfg.performingAjaxAction=!1,$link.removeClass("disabled")},on_success=()=>{$parent.find(".gv-view-types-hover > div:eq(0)").hide(),$parent.find(".gv-view-types-hover > div:eq(1)").removeClass("hidden"),$parent.removeClass("gv-view-template-placeholder"),$parent.find("a.gv_select_template").attr("data-templateid",$link.data("templateid")).trigger("click")};return $link.hasClass("gv-layout-activate")?vcfg.performingAjaxAction?void 0:void $.when(server_request("activate_product",{text_domain:$link.attr("data-template-text-domain")})).then(on_success).always(do_always).fail(on_fail):$link.hasClass("gv-layout-install")?vcfg.performingAjaxAction?void 0:void $.when(server_request("install_product",{id:$link.attr("data-download-id"),activate:!0})).then(on_success).always(do_always).fail(on_fail):void $(this).find(".gv_select_template").trigger("click")},openExternalLinks:function(){return window.Beacon&&($(this).is("[data-beacon-article]")||$(this).is("[data-beacon-article-modal]")||$(this).is("[data-beacon-article-sidebar]")||$(this).is("[data-beacon-article-inline]"))||window.open(this.href),!1},previewTemplate:function(e){e.preventDefault(),e.stopImmediatePropagation();var parent=$(e.currentTarget).parents(".gv-view-types-module");parent.find(".gv-template-preview").dialog({dialogClass:"wp-dialog gv-dialog",appendTo:$("#gravityview_select_template"),width:viewConfiguration.dialogWidth,open:function(){$('').prependTo("#wpwrap")},close:function(){$(this).dialog("option","appendTo",parent),$("#wpwrap").find("> .gv-overlay").fadeOut("fast",function(){$(this).remove()})},closeOnEscape:!0,buttons:[{text:gvGlobals.label_close,click:function(){$(this).dialog("close")}}]})},updateActiveAreas:function(template,data){var vcfg=viewConfiguration;$("#directory-active-fields, #single-active-fields").children().remove();data={action:"gv_get_active_areas",template_id:template,form_id:data,nonce:gvGlobals.nonce};return vcfg.updateViewConfig(data)},getPresetFields:function(data){var vcfg=viewConfiguration;$("#directory-active-fields, #single-active-fields").children().remove();data={action:"gv_get_preset_fields",template_id:data,nonce:gvGlobals.nonce};return vcfg.updateViewConfig(data)},updateViewConfig:function(data){return new Promise((resolve,reject)=>{var vcfg=viewConfiguration;$.post(ajaxurl,data,function(content){content&&(content=JSON.parse(content),$("#directory-header-widgets").html(content.header),$("#directory-footer-widgets").html(content.footer),$("#directory-active-fields").append(content.directory),$("#single-active-fields").append(content.single),vcfg.showViewConfig(),vcfg.waiting("stop"),$(document.body).trigger("gravityview/view-config-updated",content)),resolve()}),vcfg.setUnsavedChanges(!0)})},waiting:function(action){$containers=$("#wpwrap,.gv-fields"),"start"===action?$containers.addClass("gv-wait"):$containers.removeClass("gv-wait")},remove_tooltips:function(el){$(el||".gv-add-field").is(":ui-tooltip")&&$(".gv-add-field").gvTooltip("destroy").off("click")},init_tooltips:function(el){0!==$(el||".gv-add-field","#post").not(":ui-tooltip").length&&$(el||".gv-add-field","#post").gvTooltip({show:150,hide:200,content:function(){var context=$(this).attr("data-context"),formId=$(this).attr("data-formid")||$("#gravityview_form_id").val(),templateId=$("#gravityview_directory_template").val();switch($(this).attr("data-objecttype")){case"field":return $("#"+context+"-available-fields-"+(formId||templateId)).html();case"widget":return $("#directory-available-widgets").html()}},close:function(){$(this).attr("data-tooltip",null)},open:function(event,tooltip){$(this).attr("data-tooltip","active").attr("data-tooltip-id",$(this).attr("aria-describedby")),$focus_item=$("input[type=search]",tooltip.tooltip),$focus_item.length||($focus_item=$(tooltip.tooltip).find(".close").first());var activate_layout="list";$(tooltip).find(".gv-items-picker-container[data-layout]").length?activate_layout=$(tooltip).find(".gv-items-picker-container[data-layout]").attr("data-layout"):(layout_cookie=$.cookie("gv-items-picker-layout"),viewConfiguration.getCookieVal(layout_cookie)&&(activate_layout=layout_cookie)),viewConfiguration.setTooltipLayout(activate_layout),$focus_item.trigger("focus")},closeOnEscape:!0,disabled:!0,position:{my:"center bottom",at:"center top-12"},tooltipClass:"gravityview-item-picker-tooltip top"}).attr("title","").on("mouseout focusout",function(e){e.stopImmediatePropagation()}).on("click",function(e){$(this).attr("title",""),e.preventDefault(),$(this).gvTooltip("open")})},setupFieldFilters:function(e){var input=$(this).val().trim(),$tooltip=$(this).parents(".ui-tooltip-content"),$resultsNotFound=$tooltip.find(".gv-no-results");"keydown"!==e.type?($tooltip.find(".gv-fields").show().filter(function(){var match_title=$(this).find(".gv-field-label").attr("data-original-title").match(new RegExp(input,"i")),match_id=$(this).attr("data-fieldid").match(new RegExp(input,"i")),match_parent=!!$(this).attr("data-parent-label")&&$(this).attr("data-parent-label").match(new RegExp(input,"i"));return!match_title&&!match_id&&!match_parent}).hide(),$tooltip.find(".gv-fields:visible").length?$resultsNotFound.hide():$resultsNotFound.show()):$(this).attr("data-has-search",0{var vcfg=viewConfiguration;vcfg.toggleDropMessage(),vcfg.getConfiguredFields().remove();var data={action:"gv_available_fields",nonce:gvGlobals.nonce};data.form_preset_ids=void 0!==preset&&"preset"===preset?[templateid]:[vcfg.gvSelectForm.val()],$("#directory-available-fields-"+data.form_preset_ids[0]).length||$.post(ajaxurl,data,function(response){response.success||response.data||resolve(),$.each(response.data,function(context,markup){$("#"+context+"-fields").append(markup)}),resolve()})})},startAddField:function(e){$(this).has(".field-id-all-fields").length?viewConfiguration.addAllFields($(this)):viewConfiguration.addField($(this),e)},addAllFields:function(clicked){clicked.siblings(".gv-fields").filter(function(){var field_id=$(this).data("fieldid");return+field_id===parseInt(field_id,10)}).each(function(){$(this).trigger("click")}),$("a.gv-add-field[data-tooltip='active']").gvTooltip("close")},addField:function(data,addButton){addButton.preventDefault();var vcfg=viewConfiguration,newField=data.clone().hide(),areaId=data.parents(".ui-tooltip").attr("id"),templateId=$("#gravityview_directory_template").val(),addButton=data.parents(".ui-tooltip").attr("id"),addButton=$('.gv-add-field[data-tooltip-id="'+addButton+'"]'),data={action:"gv_field_options",template:templateId,area:addButton.attr("data-areaid"),context:addButton.attr("data-context"),field_id:newField.attr("data-fieldid"),field_label:newField.find(".gv-field-label").attr("data-original-title"),field_type:addButton.attr("data-objecttype"),input_type:newField.attr("data-inputtype"),form_id:parseInt($(data).attr("data-formid"),10)||vcfg.currentFormId,nonce:gvGlobals.nonce};$.ajax({type:"POST",url:ajaxurl,data:data,async:!0,beforeSend:function(){vcfg.disable_publish()},complete:function(){vcfg.enable_publish()}}).done(function(response){newField.append(response),$(".ui-tabs-panel").each(function(){vcfg.init_droppables(this)}),0<$(".gv-dialog-options",newField).length&&$(".gv-field-settings",newField).removeClass("hide-if-js"),$('[data-tooltip-id="'+areaId+'"]').parents(".gv-droppable-area").find(".active-drop").append(newField).end().attr("data-tooltip-id",""),$(document.body).trigger("gravityview/field-added",newField),newField.fadeIn(100),vcfg.refreshGFtooltips()}).fail(function(jqXHR){vcfg.enable_publish(),alert(gvGlobals.field_loaderror),console.log(jqXHR)}).always(function(){vcfg.toggleDropMessage(),vcfg.setUnsavedChanges(!0)})},refresh_merge_tags:function($source,onRefresh){let $merge_tag_supported=$source?$(".gv-merge-tag-support,.merge-tag-support",$source):$(".gv-merge-tag-support:visible");if($merge_tag_supported.removeClass("gv-merge-tag-support mt-initialized").addClass("merge-tag-support"),window.gform?.instances?.mergeTags)return $(".all-merge-tags",$source).remove(),document.dispatchEvent(new Event("DOMContentLoaded")),void setTimeout(function(){$merge_tag_supported.removeClass("merge-tag-support").addClass("gv-merge-tag-support"),onRefresh&&onRefresh()},300);"undefined"!=typeof form&&$(document.body).not(".gv-form-changed")&&0<=$merge_tag_supported.length&&(window.gfMergeTags&&($(".all-merge-tags:visible").remove(),gfMergeTags.hasOwnProperty("destroy")?$merge_tag_supported.each(function(){new gfMergeTagsObj(form,$(this))}):window.gfMergeTags=new gfMergeTagsObj(form)),$merge_tag_supported.removeClass("merge-tag-support").addClass("gv-merge-tag-support"),onRefresh&&onRefresh())},enable_publish:function(){$(document).trigger("autosave-enable-buttons.edit-post"),$("#publishing-action").find("#publish").prop("disabled",null).removeClass("button-primary-disabled")},disable_publish:function(){$(document).trigger("autosave-disable-buttons.edit-post"),$("#publishing-action").find("#publish").prop("disabled","disabled").addClass("button-primary-disabled")},init_droppables:function(panel){var vcfg;$(panel).find(".active-drop-field").sortable("instance")||(vcfg=viewConfiguration,$(panel).find(".active-drop-widget").sortable({placeholder:"fields-placeholder",items:"> .gv-fields",distance:2,revert:75,connectWith:".active-drop-widget",start:function(event,ui){$("#directory-fields, #single-fields").find(".active-drop-container-widget").addClass("is-receivable")},stop:function(event,ui){$("#directory-fields, #single-fields").find(".active-drop-container-widget").removeClass("is-receivable")},change:function(event,ui){vcfg.setUnsavedChanges(!0)},receive:function(event,ui){var sender_area=ui.sender.attr("data-areaid"),receiver_area=$(this).attr("data-areaid");ui.item.find('[name^="widgets['+sender_area+']"]').each(function(){var name=$(this).attr("name");$(this).attr("name",name.replace(sender_area,receiver_area))}),vcfg.toggleDropMessage()}}),$(panel).find(".active-drop-field").sortable({placeholder:"fields-placeholder",items:"> .gv-fields",distance:2,revert:75,connectWith:".active-drop-field",start:function(event,ui){$(panel).find(".active-drop-container-field").addClass("is-receivable")},stop:function(event,ui){$(panel).find(".active-drop-container-field").removeClass("is-receivable")},change:function(event,ui){vcfg.setUnsavedChanges(!0)},receive:function(event,ui){var sender_area,receiver_area;0",{name:"gv_fields",value:serialized_data,type:"hidden"})),setTimeout(function(){$post.data("gv-valid",!0),"click"===e.type?$(e.target).trigger("click"):$post.trigger("submit")},101),!1)},createPresetForm:function(e,data){var vcfg=viewConfiguration,$target=$(e.target);e.stopPropagation();data={action:"gv_set_preset_form",template_id:data,nonce:gvGlobals.nonce};return $.ajax({type:"POST",url:ajaxurl,data:data,async:!1,success:function(response){"false"!==response&&"0"!==response?(vcfg.startFreshStatus=!1,vcfg.gvSelectForm.find("option:selected").removeAttr("selected").end().append(response),"click"===e.type?$target.trigger("click"):$("#post").trigger("submit")):$target.before(''+gvGlobals.label_publisherror+"
")}}),!1}},viewGeneralSettings={templateId:null,metaboxObj:null,init:function(){viewGeneralSettings.metaboxObj=$("#gravityview_settings"),viewGeneralSettings.initTabs(),$("#gravityview_directory_template").on("change",viewGeneralSettings.updateSettingsDisplay).trigger("change"),$(document.body).on("gravityview/settings/tab/enable",viewGeneralSettings.enableSettingTab).on("gravityview/settings/tab/disable",viewGeneralSettings.disableSettingTab)},updateSettingsDisplay:function(){viewGeneralSettings.templateId=$(this).val(),$("tr[data-show-if]").each(viewGeneralSettings.toggleSetting)},toggleSetting:function(){var row=$(this),templates=row.attr("data-show-if");templates.length<1||(0custom_label ) ) {
- return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ? : null : null, $entry ? $entry->as_entry() : null );
+ return \GravityView_API::replace_variables(
+ $this->custom_label,
+ $source ? $source->form ?? null : null,
+ $entry ? $entry->as_entry() : null
+ );
}
return '';
diff --git a/future/includes/rest/class-gv-rest-views-route.php b/future/includes/rest/class-gv-rest-views-route.php
index f9204a668..2d735398b 100644
--- a/future/includes/rest/class-gv-rest-views-route.php
+++ b/future/includes/rest/class-gv-rest-views-route.php
@@ -10,6 +10,9 @@
*/
namespace GV\REST;
+use GravityView_Widget_Export_Link;
+use WP_REST_Request;
+
/** If this file is called directly, abort. */
if ( ! defined( 'GRAVITYVIEW_DIR' ) ) {
die();
@@ -36,6 +39,23 @@ class Views_Route extends Route {
protected $sub_type = 'entries';
+ /**
+ * Whether the headers are rendered.
+ *
+ * @since $ver$
+ * @var bool
+ */
+ private $headers_done;
+
+ /**
+ * The headers for the output.
+ *
+ * @since $ver$
+ * @var array
+ */
+ private $headers = [];
+
+
/**
* Get a collection of views
*
@@ -150,8 +170,10 @@ function ( $field ) use ( $allowed_field_ids ) {
$used_ids = array();
foreach ( $allowed as $field ) {
- $source = is_numeric( $field->ID ) ? $view->form : new \GV\Internal_Source();
+ // remove all links from output.
+ $field->update_configuration( [ 'show_as_link' => '0' ] );
+ $source = is_numeric( $field->ID ) ? $view->form : new \GV\Internal_Source();
$field_id = $field->ID;
$index = null;
@@ -171,14 +193,26 @@ function ( $field ) use ( $allowed_field_ids ) {
/**
* Filter the key name in the results for JSON output.
*
- * @param string $field_id The ID. Should be unique or keys will be gobbled up.
- * @param \GV\View $view The view.
- * @param \GV\Entry $entry The entry.
- * @param \WP_REST_Request $request Request object.
- * @param string $context The context (directory, single)
+ * @param string $field_id The ID. Should be unique or keys will be gobbled up.
+ * @param \GV\View $view The view.
+ * @param \GV\Entry $entry The entry.
+ * @param \WP_REST_Request $request Request object.
+ * @param string $context The context (directory, single)
*/
$field_id = apply_filters( 'gravityview/api/field/key', $field_id, $view, $entry, $request, $context );
+ if ( ! $this->headers_done ) {
+ $label = $field->get_label( $view, $source, $entry );
+ if ( ! $label ) {
+ $label = $field_id;
+ }
+
+ $this->headers[] = [
+ 'field_id' => $field_id,
+ 'label' => $label,
+ ];
+ }
+
if ( ! $class && in_array( $field->ID, array( 'custom' ) ) ) {
/**
* Custom fields (and perhaps some others) will require rendering as they don't
@@ -294,21 +328,25 @@ function ( $context ) use ( &$count, &$total ) {
$csv_or_tsv = fopen( 'php://output', 'w' );
+ $filename = apply_filters( 'gravityview/output/' . $format . '/filename', get_the_title( $view->post ), $view );
+
/** Da' BOM :) */
if ( apply_filters( 'gform_include_bom_export_entries', true, $view->form ? $view->form->form : null ) ) {
fputs( $csv_or_tsv, "\xef\xbb\xbf" );
}
- $headers_done = false;
+ $this->headers_done = false;
+ $this->headers = [];
- // If not "tsv" then use comma
+ // If not "tsv" then use comma.
$delimiter = ( 'tsv' === $format ) ? "\t" : ',';
foreach ( $entries->all() as $entry ) {
$entry = $this->prepare_entry_for_response( $view, $entry, $request, 'directory', '\GV\Field_CSV_Template' );
+ $label = $request->get_param( 'use_labels' ) ? 'label' : 'field_id';
- if ( ! $headers_done ) {
- $headers_done = fputcsv( $csv_or_tsv, array_map( array( '\GV\Utils', 'strip_excel_formulas' ), array_keys( $entry ) ), $delimiter );
+ if ( ! $this->headers_done ) {
+ $this->headers_done = false !== fputcsv( $csv_or_tsv, array_map( array( '\GV\Utils', 'strip_excel_formulas' ), array_column( $this->headers, $label ) ), $delimiter );
}
fputcsv( $csv_or_tsv, array_map( array( '\GV\Utils', 'strip_excel_formulas' ), $entry ), $delimiter );
@@ -318,6 +356,8 @@ function ( $context ) use ( &$count, &$total ) {
$response->header( 'X-Item-Count', $entries->count() );
$response->header( 'X-Item-Total', $entries->total() );
$response->header( 'Content-Type', 'text/' . $format );
+ $response->header( 'Content-Transfer-Encoding', 'binary' );
+ $response->header( 'Content-Disposition', sprintf( 'attachment;filename="%s.%s"', sanitize_file_name( $filename ), $format ) );
fflush( $csv_or_tsv );
@@ -526,8 +566,36 @@ public function get_items_permissions_check( $request ) {
return true;
}
+ /**
+ * Permission check for the REST endpoint.
+ *
+ * @param WP_REST_Request $request The request object.
+ *
+ * @return bool|\WP_Error The permission result.
+ */
public function get_sub_items_permissions_check( $request ) {
- // Accessing all entries of a View needs the same permissions as accessing the View.
+ // Make sure to get the format from the URL.
+ $params = $request->get_url_params();
+ $format = strtolower( rgar( $params, 'format', '' ) );
+ $nonce = $request->get_param( '_nonce' );
+ $view_id = rgar( $params, 'id', 0 );
+
+ if ( ! $view = \GV\View::by_id( $view_id ) ) {
+ return new \WP_Error( 'rest_forbidden', __( 'You are not allowed to access this content.', 'gk-gravityview' ) );
+ }
+
+ if (
+ '1' === $view->settings->get( 'csv_enable' )
+ && in_array( $format, [ 'csv', 'tsv' ], true )
+ && wp_verify_nonce( $nonce, sprintf( '%s.%d', GravityView_Widget_Export_Link::WIDGET_ID, $view->ID ) )
+ ) {
+ // All results.
+ $request->set_param( 'limit', 0 );
+
+ // The current request is a nonce verified CSV download request.
+ return true;
+ }
+
return $this->get_item_permissions_check( $request );
}
}
diff --git a/includes/plugin-and-theme-hooks/class-gravityview-plugin-hooks-lifterlms.php b/includes/plugin-and-theme-hooks/class-gravityview-plugin-hooks-lifterlms.php
index bb0991f98..6d9e6df71 100644
--- a/includes/plugin-and-theme-hooks/class-gravityview-plugin-hooks-lifterlms.php
+++ b/includes/plugin-and-theme-hooks/class-gravityview-plugin-hooks-lifterlms.php
@@ -364,7 +364,7 @@ public function get_integration_settings() {
return [
[
'type' => 'custom-html',
- 'value' => '' . esc_html__( 'No Views found.', 'gravityview' ) . '
',
+ 'value' => '' . esc_html__( 'No Views found.', 'gk-gravityview' ) . '
',
],
];
}
diff --git a/includes/widgets/class-gravityview-widget-export-link.php b/includes/widgets/class-gravityview-widget-export-link.php
new file mode 100644
index 000000000..4c6793cf9
--- /dev/null
+++ b/includes/widgets/class-gravityview-widget-export-link.php
@@ -0,0 +1,235 @@
+ [
+ 'label' => __( 'Type', 'gk-gravityview' ),
+ 'type' => 'radio',
+ 'choices' => [
+ 'csv' => 'CSV',
+ 'tsv' => 'TSV',
+ ],
+ 'value' => $defaults['type'],
+ ],
+ 'title' => [
+ 'type' => 'text',
+ 'class' => 'widefat',
+ 'label' => __( 'Label', 'gk-gravityview' ),
+ 'desc' => __( 'Enter the label of the link.', 'gk-gravityview' ),
+ 'value' => $defaults['title'],
+ 'merge_tags' => false,
+ ],
+ 'in_paragraph' => [
+ 'type' => 'checkbox',
+ 'label' => __( 'Wrap link in paragraph', 'gk-gravityview' ),
+ // translators: %s is replaced by a code block.
+ 'desc' => sprintf( esc_html__( 'Will wrap the link in a paragraph HTML tag (%s).', 'gk-gravityview' ), '<p>
' ),
+ ],
+ 'use_labels' => [
+ 'type' => 'checkbox',
+ 'label' => __( 'Use labels instead of field IDs', 'gk-gravityview' ),
+ 'desc' => __( 'The headers of the file will use the labels instead of the field IDs', 'gk-gravityview' ),
+ 'value' => $defaults['use_labels'],
+ ],
+ 'classes' => [
+ 'type' => 'text',
+ 'class' => 'widefat',
+ 'label' => __( 'Custom CSS Class:', 'gk-gravityview' ),
+ 'desc' => __( 'This class will be added to the widget container', 'gk-gravityview' ),
+ ],
+ ];
+ }
+
+ /**
+ * Returns the default settings.
+ *
+ * @since $ver$
+ */
+ private static function defaults(): array {
+ return [
+ 'title' => __( 'Download CSV', 'gk-gravityview' ),
+ 'type' => 'csv',
+ 'use_labels' => true,
+ ];
+ }
+
+ /**
+ * @inheritDoc
+ * @since $ver$
+ */
+ public function __construct() {
+ $this->widget_short = esc_html__( 'Insert a link to download a CSV or TSV of the current View results.', 'gk-gravityview' );
+ $disabled_warning = esc_html__( 'To use this feature, you must enable the "Allow Export" setting for this View. This setting is located in the Permissions tab of the Settings section.', 'gk-gravityview' );
+ $all_entries_notice = esc_html__( 'Note: All matching entries will be downloaded in the generated file.', 'gk-gravityview' );
+
+ $this->widget_description = <<{$this->widget_short}
+{$disabled_warning}
+{$all_entries_notice}
+HTML;
+ parent::__construct( 'Export Link', self::WIDGET_ID, self::defaults(), self::settings() );
+
+ add_filter( 'gravityview_admin_label_item_info', [ $this, 'hide_description_picker' ], 10, 2 );
+ }
+
+ /**
+ * Removes the notification part from the description.
+ *
+ * @since $ver$
+ *
+ * @param array $items The description items.
+ * @param GravityView_Admin_View_Item $view_item The view item.
+ *
+ * @return array The adjusted description items.
+ */
+ public function hide_description_picker( array $items, GravityView_Admin_View_Item $view_item ): array {
+ if (
+ ! $view_item instanceof GravityView_Admin_View_Widget
+ || GV\Utils::get( $items[0] ?? [], 'value' ) !== $this->widget_description
+ ) {
+ return $items;
+ }
+
+ $items[0]['value'] = $this->widget_short;
+
+ return $items;
+ }
+
+ /**
+ * @inheritDoc
+ * @since $ver$
+ */
+ public function render_frontend( $widget_args, $content = '', $context = '' ): void {
+ global $wp_query;
+
+ if (
+ ! $context instanceof Template_Context
+ || ! $this->pre_render_frontend( $context )
+ ) {
+ return;
+ }
+
+ $view = $context->view;
+ $nonce = $this->get_nonce( $view );
+ if (
+ ! $nonce
+ || ! $view->settings->get( 'csv_enable' )
+ ) {
+ return;
+ }
+
+ $available_types = [ 'csv', 'tsv' ];
+ $type = strtolower( GV\Utils::get( $widget_args, 'type', 'csv' ) );
+ if ( ! in_array( $type, $available_types, true ) ) {
+ $type = 'csv';
+ }
+ $mime_type = 'csv' === $type ? 'text/csv' : 'text/tab-separated-values';
+
+ $label = GV\Utils::get( $widget_args, 'title', 'Download CSV' );
+ $in_paragraph = (bool) GV\Utils::get( $widget_args, 'in_paragraph', false );
+ $use_labels = (bool) GV\Utils::get( $widget_args, 'use_labels', false );
+ $classes = (string) GV\Utils::get( $widget_args, 'classes', '' );
+
+ $page_query_params = array_filter(
+ $_GET,
+ static function ( $value, string $key ): bool {
+ return 'mode' === $key || preg_match( '/^filter_?/i', $key );
+ },
+ ARRAY_FILTER_USE_BOTH
+ );
+
+ /**
+ * In order to provide easier JS modification of the URL, we provide both the base URL and the full URL.
+ */
+ $rest_nonce_url = sprintf( '%sgravityview/v1/views/%d/entries.%s', get_rest_url(), $view->ID, $type );
+ $rest_nonce_url = add_query_arg( [
+ '_nonce' => $nonce,
+ 'use_labels' => $use_labels,
+ ], $rest_nonce_url );
+
+ $rest_url = add_query_arg(
+ $page_query_params,
+ $rest_nonce_url
+ );
+
+ $link = strtr( '{label}', [
+ '{url}' => esc_url( $rest_url ),
+ '{nonce_url}' => esc_url( $rest_nonce_url ),
+ '{mime_type}' => $mime_type,
+ '{label}' => esc_html( $label ),
+ ] );
+
+ $link = $in_paragraph ? sprintf( '%s
', $link ) : $link;
+
+ printf( '' . $link . '
', gravityview_sanitize_html_class( $classes ) );
+ }
+
+ /**
+ * Create a nonce for a guest, as the REST API is stateless.
+ *
+ * @since $ver$
+ *
+ * @param View|null $view The view object.
+ *
+ * @return string The nonce.
+ */
+ private function get_nonce( $view ): string {
+ if ( ! $view instanceof View ) {
+ return '';
+ }
+
+ $user_id = wp_get_current_user()->ID;
+ if ( $user_id ) {
+ wp_set_current_user( 0 );
+ }
+
+ $nonce = wp_create_nonce( sprintf( '%s.%d', $this->get_widget_id(), $view->ID ) );
+
+ if ( $user_id ) {
+ wp_set_current_user( $user_id );
+ }
+
+ return $nonce ?: '';
+ }
+}
+
+new GravityView_Widget_Export_Link();
diff --git a/includes/widgets/register-gravityview-widgets.php b/includes/widgets/register-gravityview-widgets.php
index 6f4482ebb..e71bb813f 100644
--- a/includes/widgets/register-gravityview-widgets.php
+++ b/includes/widgets/register-gravityview-widgets.php
@@ -21,6 +21,7 @@ function gravityview_register_gravityview_widgets() {
include_once GRAVITYVIEW_DIR . 'includes/widgets/search-widget/class-search-widget.php';
include_once GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-custom-content.php';
+ include_once GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-export-link.php';
include_once GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-gravityforms.php';
include_once GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-size.php';
include_once GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-pagination-info.php';
diff --git a/readme.txt b/readme.txt
index 31f66096a..1946499d0 100644
--- a/readme.txt
+++ b/readme.txt
@@ -23,11 +23,13 @@ Beautifully display your Gravity Forms entries. Learn more on [gravitykit.com](h
= 2.21 [unreleased] =
+* Added: A widget to export all entries as CSV or TSV.
* Added: Support for SVG images.
* Added: Search Bar support for Gravity Flow "Workflow User" and "Workflow Multi-User" fields.
* Added: Integration with LifterLMS: Embed Views inside your LifterLMS Student Dashboards.
* Fixed: PHP 8.2 deprecation notices.
-* Updated: [Foundation](https://www.gravitykit.com/foundation/) to version 1.2.11
+* Fixed: Entry Link field values were wrapped in `` HTML tags.
+* Updated: [Foundation](https://www.gravitykit.com/foundation/) to version 1.2.11.
- GravityKit product updates are now showing on the Plugins page.
- Database options that are no longer used are now automatically removed.
@@ -48,6 +50,9 @@ This release enhances performance by optimizing caching and managing transients
#### 🔧 Updated
* Updated [Foundation](https://www.gravitykit.com/foundation/) to version 1.2.10.
- Transients are no longer autoloaded.
+Improved: The database now stores fewer cache records due to enhanced detection of duplicate queries.
+Added: a widget to quickly download as a CSV.
+Fixed: No entry link on CSV output.
= 2.20.1 on February 29, 2024 =
diff --git a/tests/unit-tests/GravityView_20_Issues.php b/tests/unit-tests/GravityView_20_Issues.php
index cd351c724..3ff72c32e 100644
--- a/tests/unit-tests/GravityView_20_Issues.php
+++ b/tests/unit-tests/GravityView_20_Issues.php
@@ -79,7 +79,7 @@ public function test_search_widget_embedded() {
$content = apply_filters( 'the_content', $post->post_content );
- $this->assertContains( get_permalink( $post->ID ), $content );
+ $this->assertStringContainsString( get_permalink( $post->ID ), $content );
}
/**
@@ -258,8 +258,8 @@ function test_shortcode_search_value_search_filter() {
$content = apply_filters( 'the_content', $post->post_content );
- $this->assertContains( 'no-no-no', $content );
- $this->assertNotContains( 'yes-yes-yes', $content );
+ $this->assertStringContainsString( 'no-no-no', $content );
+ $this->assertStringNotContainsString( 'yes-yes-yes', $content );
}
/**
@@ -303,9 +303,9 @@ public function test_merge_tags_in_labels() {
$output = $renderer->render( $entry, $view );
- $this->assertContains( 'Content: 12345678 Entry: Just some entry', $output );
- $this->assertContains( 'Textarea with entry Just some entry', $output );
- $this->assertContains( 'Label: 12345678 Entry: Just some entry', $output );
+ $this->assertStringContainsString( 'Content: 12345678 Entry: Just some entry', $output );
+ $this->assertStringContainsString( 'Textarea with entry Just some entry', $output );
+ $this->assertStringContainsString( 'Label: 12345678 Entry: Just some entry', $output );
}
/**
@@ -382,8 +382,8 @@ public function test_hide_until_searched_widgets() {
$future = $renderer->render( $view );
$this->assertEquals( $legacy, $future );
- $this->assertContains( 'Search Entries', $future );
- $this->assertContains( 'Here we go again! Now', $future );
+ $this->assertStringContainsString( 'Search Entries', $future );
+ $this->assertStringContainsString( 'Here we go again! Now', $future );
remove_all_filters( 'gravityview/view/anchor_id' );
remove_all_filters( 'gravityview/widget/search/append_view_id_anchor' );
@@ -466,7 +466,7 @@ public function test_view_in_view_embedded() {
'id' => $another_view->ID,
);
- $this->assertContains( 'Embed this view', $future->callback( $args ) );
+ $this->assertStringContainsString( 'Embed this view', $future->callback( $args ) );
global $post;
@@ -474,7 +474,7 @@ public function test_view_in_view_embedded() {
gravityview()->request->returns['is_entry'] = $another_entry;
- $this->assertContains( 'Embed this view', $future->callback( $args ) );
+ $this->assertStringContainsString( 'Embed this view', $future->callback( $args ) );
$this->_reset_context();
}
@@ -513,8 +513,8 @@ public function test_is_approved_field_values() {
$output = $renderer->render( $entry, $view );
- $this->assertContains( 'Unapproved', $output );
- $this->assertContains( 'Nicht bestätigt', $output );
+ $this->assertStringContainsString( 'Unapproved', $output );
+ $this->assertStringContainsString( 'Nicht bestätigt', $output );
}
/**
@@ -591,10 +591,10 @@ public function test_fileupload_download_link_index_php_detection() {
$files[0] = $field->field->get_download_url( $files[0] );
$files[1] = $field->field->get_download_url( $files[1] );
- $this->assertContains( 'index.php', $files[0] );
- $this->assertContains( 'one.jpg', $files[0] );
- $this->assertContains( 'index.php', $files[1] );
- $this->assertContains( 'two.mp3', $files[1] );
+ $this->assertStringContainsString( 'index.php', $files[0] );
+ $this->assertStringContainsString( 'one.jpg', $files[0] );
+ $this->assertStringContainsString( 'index.php', $files[1] );
+ $this->assertStringContainsString( 'two.mp3', $files[1] );
$output = $renderer->render( $field, $view, $form, $entry, $request );
@@ -602,10 +602,10 @@ public function test_fileupload_download_link_index_php_detection() {
$expected .= '';
$expected .= '';
- $this->assertContains( $expected, $output );
- $this->assertContains( '' . esc_html( $files[1] ) . '', $output );
+ $this->assertStringContainsString( $expected, $output );
+ $this->assertStringContainsString( '' . esc_html( $files[1] ) . '', $output );
}
public function test_fileupload_download_link_lightbox() {
diff --git a/tests/unit-tests/GravityView_Admin_Test.php b/tests/unit-tests/GravityView_Admin_Test.php
index e68c4360d..df4612c92 100644
--- a/tests/unit-tests/GravityView_Admin_Test.php
+++ b/tests/unit-tests/GravityView_Admin_Test.php
@@ -38,7 +38,7 @@ public function test_change_entry_creator_dropdown() {
$admin->add_select( $form['id'], $entry );
$select = ob_get_clean();
- $this->assertNotContains( '251-i-only-see-some-users-in-the-change-entry-creator-dropdown', $select );
+ $this->assertStringNotContainsString( '251-i-only-see-some-users-in-the-change-entry-creator-dropdown', $select );
remove_filter( 'gravityview/get_users/change_entry_creator', $callback );
@@ -46,7 +46,7 @@ public function test_change_entry_creator_dropdown() {
return $total;
} );
- $this->assertNotContains( '251-i-only-see-some-users-in-the-change-entry-creator-dropdown', $select );
+ $this->assertStringNotContainsString( '251-i-only-see-some-users-in-the-change-entry-creator-dropdown', $select );
remove_filter( 'gravityview/get_users/change_entry_creator', $callback );
diff --git a/tests/unit-tests/GravityView_Duplicate_Entry_Test.php b/tests/unit-tests/GravityView_Duplicate_Entry_Test.php
index d2cd3710d..3d1b43790 100644
--- a/tests/unit-tests/GravityView_Duplicate_Entry_Test.php
+++ b/tests/unit-tests/GravityView_Duplicate_Entry_Test.php
@@ -103,7 +103,7 @@ public function test_get_confirm_dialog() {
$confirm_dialog = GravityView_Duplicate_Entry::get_confirm_dialog();
- $this->assertContains( 'return window.confirm', $confirm_dialog, 'confirm JS is not in the confirm dialog response' );
+ $this->assertStringContainsString( 'return window.confirm', $confirm_dialog, 'confirm JS is not in the confirm dialog response' );
add_filter( 'gravityview/duplicate-entry/confirm-text', '__return_empty_string' );
@@ -438,12 +438,12 @@ public function test_duplicate_basic() {
$_GET['duplicate'] = wp_create_nonce( GravityView_Duplicate_Entry::get_nonce_key( $_GET['entry_id'] ) );
- $this->assertContains( 'The+entry+does+not+exist', $duplicate->process_duplicate() ); // Invalid entry
+ $this->assertStringContainsString( 'The+entry+does+not+exist', $duplicate->process_duplicate() ); // Invalid entry
$_GET['entry_id'] = $entry['id'];
$_GET['duplicate'] = wp_create_nonce( GravityView_Duplicate_Entry::get_nonce_key( $_GET['entry_id'] ) );
- $this->assertContains( 'You+do+not+have+permission+to+duplicate+this+entry', $duplicate->process_duplicate() ); // Not allowed
+ $this->assertStringContainsString( 'You+do+not+have+permission+to+duplicate+this+entry', $duplicate->process_duplicate() ); // Not allowed
$this->factory->user->set( $admin->ID );
@@ -453,7 +453,7 @@ public function test_duplicate_basic() {
$wpdb->suppress_errors( true );
- $this->assertContains( 'There+was+an+error+duplicating+the+entry.', $duplicate->process_duplicate() ); // User agent cannot be NULL
+ $this->assertStringContainsString( 'There+was+an+error+duplicating+the+entry.', $duplicate->process_duplicate() ); // User agent cannot be NULL
$wpdb->suppress_errors( false );
@@ -465,7 +465,7 @@ public function test_duplicate_basic() {
$this->assertCount( 1, GFAPI::get_entries( $form['id'] ) );
- $this->assertContains( '?status=duplicated', $duplicate->process_duplicate() ); // OK
+ $this->assertStringContainsString( '?status=duplicated', $duplicate->process_duplicate() ); // OK
$this->assertCount( 2, list( $duplicate_entry, $source_entry ) = GFAPI::get_entries( $form['id'] ) );
@@ -478,7 +478,7 @@ public function test_duplicate_basic() {
$this->assertNotEquals( $duplicate_entry['id'], $source_entry['id'] );
$this->assertNotEquals( $duplicate_entry['source_url'], $source_entry['source_url'] );
- $this->assertContains( 'tests', $duplicate_entry['source_url'] );
+ $this->assertStringContainsString( 'tests', $duplicate_entry['source_url'] );
$this->assertEquals( 'Tests', $duplicate_entry['user_agent'] );
diff --git a/tests/unit-tests/GravityView_Edit_Entry_Test.php b/tests/unit-tests/GravityView_Edit_Entry_Test.php
index 924dad322..e16456926 100644
--- a/tests/unit-tests/GravityView_Edit_Entry_Test.php
+++ b/tests/unit-tests/GravityView_Edit_Entry_Test.php
@@ -593,22 +593,22 @@ public function test_edit_entry_render() {
'entries' => array( $entry ),
) );
ob_start() && $render->init( $data );
- $this->assertContains( 'do not have permission', ob_get_clean() );
+ $this->assertStringContainsString( 'do not have permission', ob_get_clean() );
/** Let's try again. */
$subscriber = $this->_generate_user( 'subscriber' );
wp_set_current_user( $subscriber );
ob_start() && $render->init( $data );
- $this->assertContains( 'do not have permission', ob_get_clean() );
+ $this->assertStringContainsString( 'do not have permission', ob_get_clean() );
$administrator = $this->_generate_user( 'administrator' );
wp_set_current_user( $administrator );
ob_start() && $render->init( $data );
- $this->assertContains( 'link to edit this entry is not valid', ob_get_clean() );
+ $this->assertStringContainsString( 'link to edit this entry is not valid', ob_get_clean() );
$_GET['edit'] = wp_create_nonce( $render::$nonce_key ); /** @todo: also test gravityview/edit_entry/verify_nonce */
ob_start() && $render->init( $data, null, \GV\View::from_post( $view ));
- $this->assertContains( 'gv-edit-entry-wrapper', ob_get_clean() );
+ $this->assertStringContainsString( 'gv-edit-entry-wrapper', ob_get_clean() );
/** So this is the basic emulation of viewing the edit entry. Let's try something more complex: */
@@ -676,7 +676,7 @@ public function test_edit_entry_simple() {
$this->_reset_context();
wp_set_current_user( $administrator );
list( $output, $render, $entry ) = $this->_emulate_render( $form, $view, $entry );
- $this->assertContains( 'gform_submit', $output );
+ $this->assertStringContainsString( 'gform_submit', $output );
/** Submit an edit */
$this->_reset_context();
@@ -692,7 +692,7 @@ public function test_edit_entry_simple() {
$this->assertEquals( $entry['1'], 'we changed it' );
$this->assertEquals( $entry['2'], 102 );
- $this->assertContains( 'Entry Updated', $output );
+ $this->assertStringContainsString( 'Entry Updated', $output );
/** Cleanup */
$this->_reset_context();
@@ -720,8 +720,8 @@ public function test_edit_entry_upload() {
$this->_reset_context();
wp_set_current_user( $administrator );
list( $output, $render, $entry ) = $this->_emulate_render( $form, $view, $entry );
- $this->assertContains( 'gform_submit', $output );
- $this->assertContains( 'upload.txt', $output );
+ $this->assertStringContainsString( 'gform_submit', $output );
+ $this->assertStringContainsString( 'upload.txt', $output );
/** Try saving a change, but no touching the upload field. */
$_POST = array(
@@ -819,14 +819,14 @@ public function test_edit_entry_simple_fails() {
/** No permissions to edit this entry */
$this->_reset_context(); $_POST = $post;
list( $output, $render, $entry ) = $this->_emulate_render( $form, $view, $entry );
- $this->assertContains( 'do not have permission to edit this entry', $output );
+ $this->assertStringContainsString( 'do not have permission to edit this entry', $output );
$this->assertEquals( $entry['1'], $entry['1'] );
$this->assertEquals( $entry['2'], $entry['2'] );
/** No permissions to edit this entry, not logged in. */
$this->_reset_context(); $_POST = $post;
list( $output, $render, $entry ) = $this->_emulate_render( $form, $view, $entry );
- $this->assertContains( 'do not have permission to edit this entry', $output );
+ $this->assertStringContainsString( 'do not have permission to edit this entry', $output );
$this->assertEquals( $entry['1'], $entry['1'] );
$this->assertEquals( $entry['2'], $entry['2'] );
@@ -834,7 +834,7 @@ public function test_edit_entry_simple_fails() {
$this->_reset_context(); $_POST = $post;
wp_set_current_user( $subscriber2 );
list( $output, $render, $entry ) = $this->_emulate_render( $form, $view, $entry );
- $this->assertContains( 'do not have permission to edit this entry', $output );
+ $this->assertStringContainsString( 'do not have permission to edit this entry', $output );
$this->assertEquals( $entry['1'], $entry['1'] );
$this->assertEquals( $entry['2'], $entry['2'] );
@@ -857,7 +857,7 @@ public function test_edit_entry_simple_fails() {
$_POST['input_2'] = 'this is not a number nanananana';
list( $output, $render, $entry ) = $this->_emulate_render( $form, $view, $entry );
$this->assertEquals( $entry['2'], $post['input_2'], 'A numeric field was changed! WTF?' );
- $this->assertContains( 'enter a valid number', $output );
+ $this->assertStringContainsString( 'enter a valid number', $output );
/** Cleanup */
$this->_reset_context();
@@ -894,15 +894,15 @@ public function test_edit_entry_post_image() {
$this->_reset_context();
wp_set_current_user( $administrator );
list( $output, $render, $entry ) = $this->_emulate_render( $form, $view, $entry );
- $this->assertContains( 'gform_submit', $output );
- $this->assertContains( "{$input}_1", $output );
- $this->assertContains( 'upload.png', $output );
- $this->assertContains( "{$input}_1_1", $output );
- $this->assertContains( 'this is a title', $output );
- $this->assertContains( "{$input}_1_4", $output );
- $this->assertContains( 'this is a caption', $output );
- $this->assertContains( "{$input}_1_7", $output );
- $this->assertContains( 'this is a description', $output );
+ $this->assertStringContainsString( 'gform_submit', $output );
+ $this->assertStringContainsString( "{$input}_1", $output );
+ $this->assertStringContainsString( 'upload.png', $output );
+ $this->assertStringContainsString( "{$input}_1_1", $output );
+ $this->assertStringContainsString( 'this is a title', $output );
+ $this->assertStringContainsString( "{$input}_1_4", $output );
+ $this->assertStringContainsString( 'this is a caption', $output );
+ $this->assertStringContainsString( "{$input}_1_7", $output );
+ $this->assertStringContainsString( 'this is a description', $output );
/** Try saving a change, but not touching the image upload field. */
$_POST = array(
@@ -1207,13 +1207,13 @@ public function test_unapprove_on_edit() {
gravityview()->request->returns['is_entry'] = $entry;
// The entry is not approved for viewing
- $this->assertContains( 'are not allowed', \GV\View::content( 'entry' ) );
+ $this->assertStringContainsString( 'are not allowed', \GV\View::content( 'entry' ) );
// Approve the entry
gform_update_meta( $entry->ID, \GravityView_Entry_Approval::meta_key, \GravityView_Entry_Approval_Status::APPROVED );
// The entry is approved for viewing
- $this->assertNotContains( 'are not allowed', \GV\View::content( 'entry' ) );
+ $this->assertStringNotContainsString( 'are not allowed', \GV\View::content( 'entry' ) );
wp_set_current_user( $subscriber );
@@ -1224,7 +1224,7 @@ public function test_unapprove_on_edit() {
$this->_emulate_render( $form, $view, $entry->as_entry() );
// It's still approved and modified
- $this->assertNotContains( 'this is two', \GV\View::content( 'entry' ) );
+ $this->assertStringNotContainsString( 'this is two', \GV\View::content( 'entry' ) );
// Update the View settings
$view->settings->update( array( 'unapprove_edit' => true ) );
@@ -1238,7 +1238,7 @@ public function test_unapprove_on_edit() {
wp_set_current_user( 0 );
// The entry is no longer approved
- $this->assertContains( 'are not allowed', \GV\View::content( 'entry' ) );
+ $this->assertStringContainsString( 'are not allowed', \GV\View::content( 'entry' ) );
// Approve it
gform_update_meta( $entry->ID, \GravityView_Entry_Approval::meta_key, \GravityView_Entry_Approval_Status::APPROVED );
@@ -1252,7 +1252,7 @@ public function test_unapprove_on_edit() {
$this->_emulate_render( $form, $view, $entry->as_entry() );
// It's still approved and modified
- $this->assertNotContains( 'this is four', \GV\View::content( 'entry' ) );
+ $this->assertStringNotContainsString( 'this is four', \GV\View::content( 'entry' ) );
$this->_reset_context();
}
@@ -1281,7 +1281,7 @@ public function test_form_render_default_fields() {
$this->_reset_context();
wp_set_current_user( $administrator );
list( $output, $render, $entry ) = $this->_emulate_render( $form, $view, $entry );
- $this->assertNotContains( "value='Much Worse' checked='checked'", $output );
+ $this->assertStringNotContainsString( "value='Much Worse' checked='checked'", $output );
$this->_reset_context();
@@ -1303,8 +1303,8 @@ public function test_form_render_default_fields() {
$this->_reset_context();
wp_set_current_user( $administrator );
list( $output, $render, $entry ) = $this->_emulate_render( $form, $view, $entry );
- $this->assertContains( "value='Much Better' checked='checked'", $output );
- $this->assertNotContains( "value='Much Worse' checked='checked'", $output );
+ $this->assertStringContainsString( "value='Much Better' checked='checked'", $output );
+ $this->assertStringNotContainsString( "value='Much Worse' checked='checked'", $output );
$this->_reset_context();
}
@@ -1712,16 +1712,16 @@ public function test_redirect_after_edit( $edit_redirect, $location, $edit_redir
list( $output, $render, $entry ) = $this->_emulate_render( $form, $view, $entry );
- $this->assertContains( 'Entry Updated', $output );
+ $this->assertStringContainsString( 'Entry Updated', $output );
if ( false !== $location ) {
$output = str_replace( json_encode( get_permalink( $view ) ), '"{permalink}"', $output );
- $this->assertContains( sprintf( 'location.href = %s', json_encode( $location ) ), $output );
+ $this->assertStringContainsString( sprintf( 'location.href = %s', json_encode( $location ) ), $output );
$location = str_replace( '{permalink}', get_permalink( $view ), $location );
- $this->assertContains( sprintf( '', esc_attr( $location ) ), $output );
+ $this->assertStringContainsString( sprintf( '', esc_attr( $location ) ), $output );
} else {
- $this->assertNotContains( 'location.href', $output );
+ $this->assertStringNotContainsString( 'location.href', $output );
}
$this->_reset_context();
@@ -1931,15 +1931,15 @@ public function test_field_visibility_and_editability_admin() {
list( $output, $render, $entry ) = $this->_emulate_render( $form, $view, $entry );
remove_filter( 'gravityview/edit_entry/render_hidden_field', '__return_false' );
- $this->assertNotContains( "name='input_1'", $output );
- $this->assertNotContains( "name='input_2'", $output );
+ $this->assertStringNotContainsString( "name='input_1'", $output );
+ $this->assertStringNotContainsString( "name='input_2'", $output );
$this->assertEquals( 'this is one', $entry[1], 'The value should not be updated when the Hidden field is not being rendered.' );
$this->assertEquals( 'this is two', $entry[2] );
// Since input 1 is now rendered, the value will be updated by _emulate_render()
list( $output, $render, $entry ) = $this->_emulate_render( $form, $view, $entry );
- $this->assertContains( "name='input_1'", $output );
- $this->assertNotContains( "name='input_2'", $output );
+ $this->assertStringContainsString( "name='input_1'", $output );
+ $this->assertStringNotContainsString( "name='input_2'", $output );
$this->assertEquals( 'this is ' . $random_string, $entry[1] );
$this->assertEquals( 'this is two', $entry[2] );
@@ -1956,8 +1956,8 @@ public function test_field_visibility_and_editability_admin() {
list( $output, $render, $entry ) = $this->_emulate_render( $form, $view, $entry );
- $this->assertNotContains( "name='input_1'", $output );
- $this->assertContains( "name='input_2'", $output );
+ $this->assertStringNotContainsString( "name='input_1'", $output );
+ $this->assertStringContainsString( "name='input_2'", $output );
$this->assertEquals( 'this is one', $entry[1] );
$this->assertEquals( '666', $entry[2] );
@@ -1971,8 +1971,8 @@ public function test_field_visibility_and_editability_admin() {
list( $output, $render, $entry ) = $this->_emulate_render( $form, $view, $entry );
- $this->assertContains( "name='input_1'", $output );
- $this->assertNotContains( "name='input_2'", $output );
+ $this->assertStringContainsString( "name='input_1'", $output );
+ $this->assertStringNotContainsString( "name='input_2'", $output );
$this->assertNotEquals( 'this is one', $entry[1] );
$this->assertEquals( '666', $entry[2] );
@@ -2025,8 +2025,8 @@ public function test_field_visibility_and_editability_caps() {
list( $output, $render, $entry ) = $this->_emulate_render( $form, $view, $entry );
remove_filter( 'gravityview/edit_entry/render_hidden_field', '__return_false' );
- $this->assertNotContains( "name='input_1'", $output );
- $this->assertNotContains( "name='input_2'", $output );
+ $this->assertStringNotContainsString( "name='input_1'", $output );
+ $this->assertStringNotContainsString( "name='input_2'", $output );
$this->assertEquals( 'this is one', $entry[1] );
$this->assertEquals( 'this is two', $entry[2] );
@@ -2041,8 +2041,8 @@ public function test_field_visibility_and_editability_caps() {
list( $output, $render, $entry ) = $this->_emulate_render( $form, $view, $entry );
- $this->assertNotContains( "name='input_1'", $output );
- $this->assertNotContains( "name='input_2'", $output );
+ $this->assertStringNotContainsString( "name='input_1'", $output );
+ $this->assertStringNotContainsString( "name='input_2'", $output );
$this->assertEquals( 'this is one', $entry[1] );
$this->assertEquals( 'this is two', $entry[2] );
@@ -2057,8 +2057,8 @@ public function test_field_visibility_and_editability_caps() {
list( $output, $render, $entry ) = $this->_emulate_render( $form, $view, $entry );
- $this->assertNotContains( "name='input_1'", $output );
- $this->assertNotContains( "name='input_2'", $output );
+ $this->assertStringNotContainsString( "name='input_1'", $output );
+ $this->assertStringNotContainsString( "name='input_2'", $output );
$this->assertEquals( 'this is one', $entry[1] );
$this->assertEquals( 'this is two', $entry[2] );
@@ -2073,8 +2073,8 @@ public function test_field_visibility_and_editability_caps() {
list( $output, $render, $entry ) = $this->_emulate_render( $form, $view, $entry );
- $this->assertNotContains( "name='input_1'", $output );
- $this->assertContains( "name='input_2'", $output );
+ $this->assertStringNotContainsString( "name='input_1'", $output );
+ $this->assertStringContainsString( "name='input_2'", $output );
$this->assertEquals( 'this is one', $entry[1] );
$this->assertEquals( '666', $entry[2] );
@@ -2087,8 +2087,8 @@ public function test_field_visibility_and_editability_caps() {
list( $output, $render, $entry ) = $this->_emulate_render( $form, $view, $entry );
- $this->assertNotContains( 'input_1', $output );
- $this->assertNotContains( 'input_2', $output );
+ $this->assertStringNotContainsString( 'input_1', $output );
+ $this->assertStringNotContainsString( 'input_2', $output );
$this->assertEquals( 'this is one', $entry[1] );
$this->assertEquals( '666', $entry[2] );
@@ -2492,7 +2492,7 @@ public function test_required_upload_field_with_conditional_logic_and_invalid_ex
wp_set_current_user( $administrator );
list( $output, $render, $entry ) = $this->_emulate_render( $form, $view, $entry );
- $this->assertContains("gfield_validation_message'>The uploaded file type is not allowed. Must be one of the following: pdf", $output);
+ $this->assertStringContainsString("gfield_validation_message'>The uploaded file type is not allowed. Must be one of the following: pdf", $output);
$this->_reset_context();
}
@@ -2552,7 +2552,7 @@ public function test_validation_of_required_fields_with_conditional_logic() {
list( $output, $render, $entry ) = $this->_emulate_render( $form, $view, $entry );
$this->assertEmpty( $entry['8'] );
- $this->assertContains('This field is required', $output);
+ $this->assertStringContainsString('This field is required', $output);
$this->_reset_context();
}
diff --git a/tests/unit-tests/GravityView_Entry_Link_Shortcode_Test.php b/tests/unit-tests/GravityView_Entry_Link_Shortcode_Test.php
index 1411057d3..c4c9a1aa7 100644
--- a/tests/unit-tests/GravityView_Entry_Link_Shortcode_Test.php
+++ b/tests/unit-tests/GravityView_Entry_Link_Shortcode_Test.php
@@ -248,8 +248,8 @@ public function test_entry_link_in_custom_content() {
- $this->assertContains( 'entry='.$entry['id'].'">No Attributes Defined', $rendered_view );
- $this->assertContains( 'entry='.$entry['id'].'">Only Entry ID', $rendered_view );
+ $this->assertStringContainsString( 'entry='.$entry['id'].'">No Attributes Defined', $rendered_view );
+ $this->assertStringContainsString( 'entry='.$entry['id'].'">Only Entry ID', $rendered_view );
$post = $this->factory->post->create_and_get(array(
'post_content' => sprintf( '[gravityview id="%d"]', $view->ID )
diff --git a/tests/unit-tests/GravityView_Field_Test.php b/tests/unit-tests/GravityView_Field_Test.php
index 8856d6824..6efa30ab6 100644
--- a/tests/unit-tests/GravityView_Field_Test.php
+++ b/tests/unit-tests/GravityView_Field_Test.php
@@ -401,8 +401,8 @@ function test_GravityView_Field_Unsubscribe_render_permissions() {
$this->assertEquals( 'sentinel', $field->modify_entry_value_unsubscribe( 'sentinel', array( 'created_by' => $author, 'id' => 1 ), array( 'unsub_all' => true ), null ) );
$this->assertEquals( 'sentinel', $field->modify_entry_value_unsubscribe( 'sentinel', array( 'created_by' => $author, 'id' => 1, 'payment_status' => 'null' ), array( 'unsub_all' => true ), null ) );
- $this->assertContains( 'Unsubscribe', $field->modify_entry_value_unsubscribe( 'sentinel', array( 'created_by' => $author, 'id' => 1, 'payment_status' => 'active' ), array( 'unsub_all' => true ), null ) );
- $this->assertContains( 'Unsubscribe', $field->modify_entry_value_unsubscribe( 'sentinel', array( 'created_by' => $administrator, 'id' => 1, 'payment_status' => 'active' ), null, null ) );
+ $this->assertStringContainsString( 'Unsubscribe', $field->modify_entry_value_unsubscribe( 'sentinel', array( 'created_by' => $author, 'id' => 1, 'payment_status' => 'active' ), array( 'unsub_all' => true ), null ) );
+ $this->assertStringContainsString( 'Unsubscribe', $field->modify_entry_value_unsubscribe( 'sentinel', array( 'created_by' => $administrator, 'id' => 1, 'payment_status' => 'active' ), null, null ) );
wp_set_current_user( $author );
@@ -414,7 +414,7 @@ function test_GravityView_Field_Unsubscribe_render_permissions() {
$this->assertEquals( 'sentinel', $field->modify_entry_value_unsubscribe( 'sentinel', array( 'created_by' => $author ), null, null ) );
$this->assertEquals( 'sentinel', $field->modify_entry_value_unsubscribe( 'sentinel', array( 'created_by' => $author, 'id' => 1, 'payment_status' => 'null' ), null, null ) );
- $this->assertContains( 'Unsubscribe', $field->modify_entry_value_unsubscribe( 'sentinel', array( 'created_by' => $author, 'id' => 1, 'payment_status' => 'active' ), null, null ) );
+ $this->assertStringContainsString( 'Unsubscribe', $field->modify_entry_value_unsubscribe( 'sentinel', array( 'created_by' => $author, 'id' => 1, 'payment_status' => 'active' ), null, null ) );
wp_set_current_user( 0 );
}
@@ -445,7 +445,7 @@ function test_GravityView_Field_Unsubscribe_unsubscribe_permissions() {
'payment_status' => 'active',
) ) );
- $this->assertContains( 'Unsubscribe', $field->modify_entry_value_unsubscribe( 'sentinel', $entry, null, null ) );
+ $this->assertStringContainsString( 'Unsubscribe', $field->modify_entry_value_unsubscribe( 'sentinel', $entry, null, null ) );
$entry = \GV\GF_Entry::by_id( $entry['id'] )->as_entry();
@@ -455,7 +455,7 @@ function test_GravityView_Field_Unsubscribe_unsubscribe_permissions() {
'unsubscribe' => wp_create_nonce( 'unsubscribe_' . $entry['id'] ),
);
- $this->assertContains( 'Unsubscribe', $field->modify_entry_value_unsubscribe( 'sentinel', $entry, null, null ) );
+ $this->assertStringContainsString( 'Unsubscribe', $field->modify_entry_value_unsubscribe( 'sentinel', $entry, null, null ) );
$entry = \GV\GF_Entry::by_id( $entry['id'] )->as_entry();
@@ -470,7 +470,7 @@ function test_GravityView_Field_Unsubscribe_unsubscribe_permissions() {
gform_update_meta( $entry['id'], 'processed_feeds', array( 'gf_paymentaddon_test' => array( $feed_id ) ) );
- $this->assertContains( 'Cancelled', $field->modify_entry_value_unsubscribe( 'sentinel', $entry, null, null ) );
+ $this->assertStringContainsString( 'Cancelled', $field->modify_entry_value_unsubscribe( 'sentinel', $entry, null, null ) );
$entry = \GV\GF_Entry::by_id( $entry['id'] )->as_entry();
diff --git a/tests/unit-tests/GravityView_Future_Test.php b/tests/unit-tests/GravityView_Future_Test.php
index baae6ac5f..df08691bb 100644
--- a/tests/unit-tests/GravityView_Future_Test.php
+++ b/tests/unit-tests/GravityView_Future_Test.php
@@ -530,7 +530,7 @@ public function test_data_get_views() {
$fe = \GravityView_frontend::getInstance();
- $this->assertContains( 'insert_view_in_content( '' ) );
+ $this->assertStringContainsString( 'insert_view_in_content( '' ) );
$fe->add_scripts_and_styles();
}
@@ -547,12 +547,12 @@ public function test_data_get_views() {
gravityview()->request->returns['is_view'] = $and_another_view;
$fe->setIsGravityviewPostType( true );
- $this->assertContains( 'not allowed to view this content', $fe->render_view( array(
+ $this->assertStringContainsString( 'not allowed to view this content', $fe->render_view( array(
'id' => $and_another_view->ID,
'embed_only' => true, /** Check propagation of $passed_args */
) ) );
- $this->assertContains( 'gv-container-' . $and_another_view->ID, $fe->render_view( array(
+ $this->assertStringContainsString( 'gv-container-' . $and_another_view->ID, $fe->render_view( array(
'id' => $and_another_view->ID,
'embed_only' => false, /** Check propagation of $passed_args */
) ) );
@@ -563,7 +563,7 @@ public function test_data_get_views() {
/**
* The back link.
*/
- $this->assertContains( sprintf( 'data-viewid="%d"', $and_another_view->ID ), $fe->render_view( array(
+ $this->assertStringContainsString( sprintf( 'data-viewid="%d"', $and_another_view->ID ), $fe->render_view( array(
'id' => $and_another_view->ID,
'debug' => true,
) ) );
@@ -685,7 +685,7 @@ public function test_view_collection_from_post() {
gform_update_meta( $entry['id'], \GravityView_Entry_Approval::meta_key, \GravityView_Entry_Approval_Status::APPROVED );
$embed_content = sprintf( "\n%s\n", add_query_arg( 'entry', $entry['id'], get_permalink( $view->ID ) ) );
- $this->assertContains( 'table class="gv-table-view-content"', $GLOBALS['wp_embed']->autoembed( $embed_content ) );
+ $this->assertStringContainsString( 'table class="gv-table-view-content"', $GLOBALS['wp_embed']->autoembed( $embed_content ) );
/** Test GravityView_View_Data::is_valid_embed_id regression. */
$this->assertTrue( GravityView_View_Data::is_valid_embed_id( $post->ID, $view->ID ) );
@@ -1685,7 +1685,7 @@ public function test_filter_entries() {
/** No matching entries... */
$this->assertEquals( $legacy, $future );
- $this->assertContains( 'No entries match your request', $future );
+ $this->assertStringContainsString( 'No entries match your request', $future );
// Disable caching as we'll be running the same query but after creating new entries.
@@ -1708,10 +1708,10 @@ public function test_filter_entries() {
$this->assertEquals( 25, $view->get_entries( new GV\Frontend_Request() )->fetch()->count() );
$future = $renderer->render( $view );
- $this->assertContains( '[1] Some text in a textarea', $future );
- $this->assertContains( '[2] Some text in a textarea', $future );
- $this->assertContains( '[24] Some text in a textarea', $future );
- $this->assertContains( '[25] Some text in a textarea', $future );
+ $this->assertStringContainsString( '[1] Some text in a textarea', $future );
+ $this->assertStringContainsString( '[2] Some text in a textarea', $future );
+ $this->assertStringContainsString( '[24] Some text in a textarea', $future );
+ $this->assertStringContainsString( '[25] Some text in a textarea', $future );
/**
* After filtering the entries.
@@ -1721,11 +1721,11 @@ public function test_filter_entries() {
$this->assertEquals( 13, $view->get_entries( new GV\Frontend_Request() )->count() );
$future = $renderer->render( $view );
- $this->assertContains( '[1] Some text in a textarea', $future );
- $this->assertNotContains( '[2] Some text in a textarea', $future );
- $this->assertContains( '[3] Some text in a textarea', $future );
- $this->assertNotContains( '[24] Some text in a textarea', $future );
- $this->assertContains( '[25] Some text in a textarea', $future );
+ $this->assertStringContainsString( '[1] Some text in a textarea', $future );
+ $this->assertStringNotContainsString( '[2] Some text in a textarea', $future );
+ $this->assertStringContainsString( '[3] Some text in a textarea', $future );
+ $this->assertStringNotContainsString( '[24] Some text in a textarea', $future );
+ $this->assertStringContainsString( '[25] Some text in a textarea', $future );
$this->assertTrue( remove_filter( 'gravityview/view/entries', $callback ) );
@@ -1819,7 +1819,7 @@ public function test_frontend_view_renderer_table() {
/** No matching entries... */
$this->assertEquals( $legacy, $future );
- $this->assertContains( 'No entries match your request', $future );
+ $this->assertStringContainsString( 'No entries match your request', $future );
/** Some entries */
$entry = $this->factory->entry->create_and_get( array(
@@ -1834,7 +1834,7 @@ public function test_frontend_view_renderer_table() {
/** One entry */
$this->assertEquals( $legacy, $future );
- $this->assertContains( 'Some text in a textarea', $future );
+ $this->assertStringContainsString( 'Some text in a textarea', $future );
/** Some more */
foreach ( range( 1, 5 ) as $i ) {
@@ -1851,8 +1851,8 @@ public function test_frontend_view_renderer_table() {
/** Page one */
$this->assertEquals( $legacy, $future );
- $this->assertContains( '[5] Some text in a textarea', $future );
- $this->assertNotContains( '[1] Some text in a textarea', $future );
+ $this->assertStringContainsString( '[5] Some text in a textarea', $future );
+ $this->assertStringNotContainsString( '[1] Some text in a textarea', $future );
/** Page two? */
$_GET = array( 'pagenum' => 2 );
@@ -1861,7 +1861,7 @@ public function test_frontend_view_renderer_table() {
$future = $renderer->render( $view );
$this->assertEquals( $legacy, $future );
- $this->assertContains( '[1] Some text in a textarea', $future );
+ $this->assertStringContainsString( '[1] Some text in a textarea', $future );
/** Some more */
foreach ( range( 1, 5 ) as $i ) {
@@ -1878,8 +1878,8 @@ public function test_frontend_view_renderer_table() {
/** Page two */
$this->assertEquals( $legacy, $future );
- $this->assertContains( '[5] Some text in a textarea', $future );
- $this->assertNotContains( '[1] Some text in a textarea', $future );
+ $this->assertStringContainsString( '[5] Some text in a textarea', $future );
+ $this->assertStringNotContainsString( '[1] Some text in a textarea', $future );
/** Search */
$_GET = array( 'pagenum' => 1, 'gv_search' => 'thisissomemoretext' );
@@ -1888,8 +1888,8 @@ public function test_frontend_view_renderer_table() {
$future = $renderer->render( $view );
$this->assertEquals( $legacy, $future );
- $this->assertContains( '[5] thisissomemoretext', $future );
- $this->assertNotContains( 'Some text', $future );
+ $this->assertStringContainsString( '[5] thisissomemoretext', $future );
+ $this->assertStringNotContainsString( 'Some text', $future );
$_GET = array( 'pagenum' => 2, 'gv_search' => 'thisissomemoretext' );
@@ -1897,14 +1897,14 @@ public function test_frontend_view_renderer_table() {
$future = $renderer->render( $view );
$this->assertEquals( $legacy, $future );
- $this->assertContains( '[1] thisissomemoretext', $future );
- $this->assertNotContains( 'Some text', $future );
+ $this->assertStringContainsString( '[1] thisissomemoretext', $future );
+ $this->assertStringNotContainsString( 'Some text', $future );
$_GET = array( 'pagenum' => 3, 'gv_search' => 'thisissomemoretext' );
$future = $renderer->render( $view );
- $this->assertContains( 'No entries match your request.', $future );
+ $this->assertStringContainsString( 'No entries match your request.', $future );
/** Hide until searched */
$view->settings->update( array( 'hide_until_searched' => true ) );
@@ -1915,7 +1915,7 @@ public function test_frontend_view_renderer_table() {
$future = $renderer->render( $view );
$this->assertEquals( $legacy, $future );
- $this->assertContains( 'No entries match your request.', $future );
+ $this->assertStringContainsString( 'No entries match your request.', $future );
$_GET = array( 'pagenum' => 2, 'gv_search' => 'thisissomemoretext' );
gravityview()->request->returns['is_search'] = true;
@@ -1924,8 +1924,8 @@ public function test_frontend_view_renderer_table() {
$future = $renderer->render( $view );
$this->assertEquals( $legacy, $future );
- $this->assertContains( '[1] thisissomemoretext', $future );
- $this->assertNotContains( 'Country', $future );
+ $this->assertStringContainsString( '[1] thisissomemoretext', $future );
+ $this->assertStringNotContainsString( 'Country', $future );
$_GET = array();
gravityview()->request->returns['is_search'] = false;
@@ -1937,7 +1937,7 @@ public function test_frontend_view_renderer_table() {
/** No matching entries... */
$this->assertEquals( $legacy, $future );
- $this->assertContains( 'No entries match your request.', $future );
+ $this->assertStringContainsString( 'No entries match your request.', $future );
$_entries = $entries->all();
foreach ( array_rand( $_entries, 5 ) as $entry_num ) {
@@ -1949,7 +1949,7 @@ public function test_frontend_view_renderer_table() {
/** No matching entries... */
$this->assertEquals( $legacy, $future );
- $this->assertNotContains( 'No entries match your request.', $future );
+ $this->assertStringNotContainsString( 'No entries match your request.', $future );
$administrator = $this->factory->user->create( array(
'user_login' => md5( microtime() ),
@@ -1965,7 +1965,7 @@ public function test_frontend_view_renderer_table() {
/** No matching entries... */
$this->assertEquals( $legacy, $future );
- $this->assertContains( 'Country', $future );
+ $this->assertStringContainsString( 'Country', $future );
/** No configuration */
$view->fields = new \GV\Field_Collection();
@@ -1974,7 +1974,7 @@ public function test_frontend_view_renderer_table() {
$future = $renderer->render( $view );
$this->assertEquals( $legacy, $future );
- $this->assertContains( 'The Multiple Entries layout has not been configured.', $future );
+ $this->assertStringContainsString( 'The Multiple Entries layout has not been configured.', $future );
wp_set_current_user( -1 );
@@ -1982,8 +1982,8 @@ public function test_frontend_view_renderer_table() {
$future = $renderer->render( $view );
$this->assertEquals( $legacy, $future );
- $this->assertNotContains( 'The Multiple Entries layout has not been configured.', $future );
- $this->assertNotContains( 'Textarea', $future );
+ $this->assertStringNotContainsString( 'The Multiple Entries layout has not been configured.', $future );
+ $this->assertStringNotContainsString( 'Textarea', $future );
remove_all_filters( 'gravityview/view/anchor_id' );
remove_all_filters( 'gravityview/widget/search/append_view_id_anchor' );
@@ -2129,7 +2129,7 @@ public function test_frontend_view_renderer_list() {
/** No matching entries... */
$this->assertEquals( $legacy, $future );
- $this->assertContains( 'No entries match your request', $future );
+ $this->assertStringContainsString( 'No entries match your request', $future );
/** Some entries */
$entry = $this->factory->entry->create_and_get( array(
@@ -2241,10 +2241,10 @@ public function test_frontend_widgets() {
$future = $renderer->render( $view );
$this->assertEquals( $legacy, $future );
- $this->assertContains( 'Search Entries', $future );
- $this->assertContains( 'Displaying 1 - 3 of 5', $future );
- $this->assertContains( "class='page-numbers'", $future );
- $this->assertContains( 'Here we go again! Now', $future );
+ $this->assertStringContainsString( 'Search Entries', $future );
+ $this->assertStringContainsString( 'Displaying 1 - 3 of 5', $future );
+ $this->assertStringContainsString( "class='page-numbers'", $future );
+ $this->assertStringContainsString( 'Here we go again! Now', $future );
remove_all_filters( 'gravityview/view/anchor_id' );
remove_all_filters( 'gravityview/widget/search/append_view_id_anchor' );
@@ -2295,7 +2295,7 @@ public function test_entry_renderer_table() {
$future = $renderer->render( $entry, $view );
$this->assertEquals( $legacy, $future );
- $this->assertContains( 'The Single Entry layout has not been configured', $future );
+ $this->assertStringContainsString( 'The Single Entry layout has not been configured', $future );
$post = $this->factory->view->create_and_get( array(
'form_id' => $form['id'],
@@ -2341,7 +2341,7 @@ public function test_entry_renderer_table() {
$future = $renderer->render( $entry, $view );
$this->assertEquals( $legacy, $future );
- $this->assertContains( 'text in a textarea', $future );
+ $this->assertStringContainsString( 'text in a textarea', $future );
wp_set_current_user( -1 );
@@ -2349,9 +2349,9 @@ public function test_entry_renderer_table() {
$future = $renderer->render( $entry, $view );
$this->assertEquals( $legacy, $future );
- $this->assertContains( 'text in a textarea', $future );
- $this->assertContains( 'Let's go back!', $future );
- $this->assertNotContains( 'Country', $future );
+ $this->assertStringContainsString( 'text in a textarea', $future );
+ $this->assertStringContainsString( 'Let's go back!', $future );
+ $this->assertStringNotContainsString( 'Country', $future );
// Check sorting links
@@ -2360,7 +2360,7 @@ public function test_entry_renderer_table() {
$legacy = \GravityView_frontend::getInstance()->insert_view_in_content( '' );
$future = $renderer->render( $entry, $view );
$this->assertEquals( $legacy, $future );
- $this->assertContains( 'class="gv-sort', $future );
+ $this->assertStringContainsString( 'class="gv-sort', $future );
// Check sorting links
$view->settings->set( 'sort_columns', '0' );
@@ -2368,7 +2368,7 @@ public function test_entry_renderer_table() {
$legacy = \GravityView_frontend::getInstance()->insert_view_in_content( '' );
$future = $renderer->render( $entry, $view );
$this->assertEquals( $legacy, $future );
- $this->assertNotContains( 'class="gv-sort', $future );
+ $this->assertStringNotContainsString( 'class="gv-sort', $future );
}
public function test_entry_renderer_table_hide_empty() {
@@ -2421,8 +2421,8 @@ public function test_entry_renderer_table_hide_empty() {
$future = $renderer->render( $entry, $view );
- $this->assertNotContains( 'Textarea', $future, 'This field is empty and should not be displayed.' );
- $this->assertNotContains( 'Product', $future, 'This field is empty and should not be displayed.' );
+ $this->assertStringNotContainsString( 'Textarea', $future, 'This field is empty and should not be displayed.' );
+ $this->assertStringNotContainsString( 'Product', $future, 'This field is empty and should not be displayed.' );
}
/**
@@ -2469,7 +2469,7 @@ public function test_entry_renderer_list() {
$future = $renderer->render( $entry, $view );
$this->assertEquals( $legacy, $future );
- $this->assertContains( 'The Single Entry layout has not been configured', $future );
+ $this->assertStringContainsString( 'The Single Entry layout has not been configured', $future );
$post = $this->factory->view->create_and_get( array(
'form_id' => $form['id'],
@@ -2595,7 +2595,7 @@ public function test_entry_renderer_list() {
$future = $renderer->render( $entry, $view );
$this->assertEquals( $legacy, $future );
- $this->assertContains( 'Country', $future );
+ $this->assertStringContainsString( 'Country', $future );
wp_set_current_user( -1 );
@@ -2603,9 +2603,9 @@ public function test_entry_renderer_list() {
$future = $renderer->render( $entry, $view );
$this->assertEquals( $legacy, $future );
- $this->assertContains( 'Let's go back!', $future );
- $this->assertContains( 'text in a textarea', $future );
- $this->assertNotContains( 'Country', $future );
+ $this->assertStringContainsString( 'Let's go back!', $future );
+ $this->assertStringContainsString( 'text in a textarea', $future );
+ $this->assertStringNotContainsString( 'Country', $future );
}
/**
@@ -2778,7 +2778,7 @@ public function test_frontend_field_html_address() {
return 'Sentinel Map Link';
} );
- $this->assertContains( 'Sentinel Map Link', $renderer->render( $field, $view, $form, $entry, $request ) );
+ $this->assertStringContainsString( 'Sentinel Map Link', $renderer->render( $field, $view, $form, $entry, $request ) );
remove_filter( 'gravityview_map_link', $callback );
}
@@ -3089,8 +3089,8 @@ public function test_frontend_field_html_phone() {
$field->update_configuration( array( 'link_phone' => true ) );
$output = $renderer->render( $field, $view, $form, $entry, $request );
- $this->assertContains( '93 43A99-392<script>1</script>', $output );
+ $this->assertStringContainsString( '93 43A99-392<script>1</script>', $output );
}
/**
@@ -3593,7 +3593,7 @@ public function test_frontend_field_html_delete_link() {
$field = \GV\Internal_Field::by_id( 'delete_link' );
$expected = sprintf( 'Delete Entry', esc_attr( GravityView_Delete_Entry::get_delete_link( $entry->as_entry(), $view->ID ) ), esc_attr( GravityView_Delete_Entry::get_confirm_dialog() ) );
$this->assertEquals( $expected, $renderer->render( $field, $view, null, $entry, $request ) );
- $this->assertContains( 'action=delete', $expected );
+ $this->assertStringContainsString( 'action=delete', $expected );
$field->update_configuration( array( 'delete_link' => 'Deletes les Entrios' ) );
$expected = sprintf( 'Deletes les Entrios', esc_attr( GravityView_Delete_Entry::get_delete_link( $entry->as_entry(), $view->ID ) ), esc_attr( GravityView_Delete_Entry::get_confirm_dialog() ) );
@@ -3631,7 +3631,7 @@ public function test_frontend_field_html_edit_link() {
$field = \GV\Internal_Field::by_id( 'edit_link' );
$expected = sprintf( 'Edit Entry', esc_attr( GravityView_Edit_Entry::get_edit_link( $entry->as_entry(), $view->ID ) ) );
$this->assertEquals( $expected, $renderer->render( $field, $view, null, $entry, $request ) );
- $this->assertContains( 'edit=', $expected );
+ $this->assertStringContainsString( 'edit=', $expected );
$field->update_configuration( array( 'edit_link' => 'Editoriales los Entries', 'new_window' => true ) );
$expected = sprintf( 'Editoriales los Entries', esc_attr( GravityView_Edit_Entry::get_edit_link( $entry->as_entry(), $view->ID ) ) );
@@ -3660,8 +3660,8 @@ public function test_frontend_field_html_notes() {
$this->assertEmpty( $renderer->render( $field, $view, null, $entry, $request ) );
$field->update_configuration( array( 'notes' => array( 'view' => true, 'view_loggedout' => true ) ) );
- $this->assertContains( 'There are no notes.', $renderer->render( $field, $view, null, $entry, $request ) );
- $this->assertContains( 'gv-show-notes', $renderer->render( $field, $view, null, $entry, $request ) );
+ $this->assertStringContainsString( 'There are no notes.', $renderer->render( $field, $view, null, $entry, $request ) );
+ $this->assertStringContainsString( 'gv-show-notes', $renderer->render( $field, $view, null, $entry, $request ) );
$administrator = $this->factory->user->create( array(
'user_login' => md5( microtime() ),
@@ -3674,14 +3674,14 @@ public function test_frontend_field_html_notes() {
$field = \GV\Internal_Field::by_id( 'notes' );
$field->update_configuration( array( 'notes' => array( 'view' => true ) ) );
- $this->assertContains( 'gv-has-notes', $renderer->render( $field, $view, null, $entry, $request ) );
- $this->assertContains( 'this <script>1</script> is a note :) {entry_id}', $renderer->render( $field, $view, null, $entry, $request ) );
+ $this->assertStringContainsString( 'gv-has-notes', $renderer->render( $field, $view, null, $entry, $request ) );
+ $this->assertStringContainsString( 'this <script>1</script> is a note :) {entry_id}', $renderer->render( $field, $view, null, $entry, $request ) );
$field->update_configuration( array( 'notes' => array( 'view' => true, 'add' => true ) ) );
- $this->assertContains( 'gv-add-note-submit', $renderer->render( $field, $view, null, $entry, $request ) );
+ $this->assertStringContainsString( 'gv-add-note-submit', $renderer->render( $field, $view, null, $entry, $request ) );
$field->update_configuration( array( 'notes' => array( 'view' => true, 'delete' => true ) ) );
- $this->assertContains( 'gv-notes-delete', $renderer->render( $field, $view, null, $entry, $request ) );
+ $this->assertStringContainsString( 'gv-notes-delete', $renderer->render( $field, $view, null, $entry, $request ) );
}
/**
@@ -4178,7 +4178,7 @@ public function test_frontend_field_html_post() {
), $expected );
}
foreach ( $expected as $_expected ) {
- $this->assertContains( $_expected, $renderer->render( $field, $view, $form, $entry, $request ) );
+ $this->assertStringContainsString( $_expected, $renderer->render( $field, $view, $form, $entry, $request ) );
}
$field->update_configuration( array( 'dynamic_data' => true ) );
@@ -4194,13 +4194,13 @@ public function test_frontend_field_html_post() {
}
foreach ( $expected as $_expected ) {
- $this->assertContains( $_expected, $renderer->render( $field, $view, $form, $entry, $request ) );
+ $this->assertStringContainsString( $_expected, $renderer->render( $field, $view, $form, $entry, $request ) );
}
$field->update_configuration( array( 'link_to_term' => false ) );
$expected = explode( ', ', '[gvtest_shortcode_p1], hi, more, oh no, some, tag 1' );
foreach ( $expected as $_expected ) {
- $this->assertContains( $_expected, $renderer->render( $field, $view, $form, $entry, $request ) );
+ $this->assertStringContainsString( $_expected, $renderer->render( $field, $view, $form, $entry, $request ) );
}
/** Post categories */
@@ -4213,7 +4213,7 @@ public function test_frontend_field_html_post() {
'',
);
foreach ( $expected as $_expected ) {
- $this->assertContains( $_expected, $renderer->render( $field, $view, $form, $entry, $request ) );
+ $this->assertStringContainsString( $_expected, $renderer->render( $field, $view, $form, $entry, $request ) );
}
$this->assertEquals( strlen( implode( '', $expected ) ), strlen( $renderer->render( $field, $view, $form, $entry, $request ) ) );
@@ -4223,7 +4223,7 @@ public function test_frontend_field_html_post() {
sprintf( 'Category 6 [gvtest_shortcode_p1] 5', esc_url( get_term_link( $cat_2, 'category' ) ) ),
);
foreach ( $expected as $_expected ) {
- $this->assertContains( $_expected, $renderer->render( $field, $view, $form, $entry, $request ) );
+ $this->assertStringContainsString( $_expected, $renderer->render( $field, $view, $form, $entry, $request ) );
}
$this->assertEquals( strlen( implode( ', ', $expected ) ), strlen( $renderer->render( $field, $view, $form, $entry, $request ) ) );
@@ -4233,7 +4233,7 @@ public function test_frontend_field_html_post() {
sprintf( 'Category 6 [gvtest_shortcode_p1] 5', esc_url( get_term_link( $cat_2, 'category' ) ) ),
);
foreach ( $expected as $_expected ) {
- $this->assertContains( $_expected, $renderer->render( $field, $view, $form, $entry, $request ) );
+ $this->assertStringContainsString( $_expected, $renderer->render( $field, $view, $form, $entry, $request ) );
}
$this->assertEquals( strlen( implode( ', ', $expected ) ), strlen( $renderer->render( $field, $view, $form, $entry, $request ) ) );
@@ -4243,7 +4243,7 @@ public function test_frontend_field_html_post() {
'Category 6 [gvtest_shortcode_p1] 5',
);
foreach ( $expected as $_expected ) {
- $this->assertContains( $_expected, $renderer->render( $field, $view, $form, $entry, $request ) );
+ $this->assertStringContainsString( $_expected, $renderer->render( $field, $view, $form, $entry, $request ) );
}
$this->assertEquals( strlen( implode( ', ', $expected ) ), strlen( $renderer->render( $field, $view, $form, $entry, $request ) ) );
@@ -4370,9 +4370,9 @@ public function test_frontend_field_html_pipe_recorder() {
$field->update_configuration( array( 'embed' => true ) );
- $this->assertContains( '