: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
title: wpforms_admin.heads_up,
content: wpforms_admin.provider_delete_confirm,
icon: 'fa fa-exclamation-circle',
$.post( wpforms_admin.ajax_url, data, function( response ) {
if ( response.success ) {
$this.parent().parent().remove();
// Hide Connected status label if no more integrations are linked.
var numberOfIntegrations = $provider.find( '.wpforms-settings-provider-accounts-list li' ).length;
if ( typeof numberOfIntegrations === 'undefined' || numberOfIntegrations === 0 ) {
$provider.removeClass( 'connected' );
* Provider account has been removed.
$( document ).trigger( 'wpformsProviderRemoved', [ $provider, response ] );
Object.prototype.hasOwnProperty.call( response, 'data' ) &&
Object.prototype.hasOwnProperty.call( response.data, 'error_msg' )
errorMessage += '<br>' + response.data.error_msg;
WPFormsAdmin.integrationError( errorMessage );
WPFormsAdmin.integrationError( errorMessage );
text: wpforms_admin.cancel,
* @param {string} error Error message.
integrationError: function( error ) {
title: wpforms_admin.something_went_wrong,
icon: 'fa fa-exclamation-circle',
//--------------------------------------------------------------------//
//--------------------------------------------------------------------//
* Element bindings for Tools page.
// Enable import/export buttons when a value is selected.
$( document ).on( 'change', '#wpforms-tools-form-import, #wpforms-tools-form-other-import, #wpforms-tools-form-export, #wpforms-tools-form-template', function() {
const $field = $( this );
const $button = $field.parents( 'form' ).find( 'button' );
$button.attr( 'aria-disabled', $field.val().length === 0 );
// Copy system information to clipboard.
$( document ).on( 'click', '#wpforms-system-information-copy', function( event ) {
WPFormsAdmin.copySystemInformation();
$( document ).on( 'click', '#wpforms-ssl-verify', function( event ) {
WPFormsAdmin.verifySSLConnection();
// Run import for a specific provider.
$( document ).on( 'click', '#wpforms-importer-forms-submit', function( event ) {
// Check to confirm user as selected a form.
if ( $( '#wpforms-importer-forms input:checked' ).length ) {
$( '#wpforms-importer-forms input:checked' ).each( function( i ) {
ids[ i ] = $( this ).val();
if ( ! wpforms_admin.isPro ) {
// We need to analyze the forms before starting the actual import.
WPFormsAdmin.analyzeForms( ids );
// Begin the import process.
WPFormsAdmin.importForms( ids );
// User didn't actually select a form so alert them.
title: wpforms_admin.heads_up,
content: wpforms_admin.importer_forms_required,
icon: 'fa fa-info-circle',
// Continue import after analyzing.
$( document ).on( 'click', '#wpforms-importer-continue-submit', function( event ) {
WPFormsAdmin.importForms( s.formIDs );
* Copy system information to clipboard.
copySystemInformation() {
$( '#wpforms-system-information' ).select();
document.execCommand( 'copy' );
* Perform test connection to verify that the current web host
* can successfully make outbound SSL connections.
const $btn = $( '#wpforms-ssl-verify' );
const btnLabel = $btn.text();
const btnWidth = $btn.outerWidth();
const $settings = $btn.parent();
$btn.css( 'width', btnWidth ).prop( 'disabled', true ).text( wpforms_admin.testing );
action: 'wpforms_verify_ssl',
nonce: wpforms_admin.nonce,
// Trigger AJAX to test connection
$.post( wpforms_admin.ajax_url, data, function( res ) {
WPFormsAdmin.debug( res );
// Remove any previous alerts.
$settings.find( '.wpforms-notice' ).remove();
$btn.before( '<div class="notice wpforms-notice notice-success">' + res.data.msg + '</div>' );
if ( ! res.success && res.data.msg ) {
$btn.before( '<div class="notice wpforms-notice notice-error">' + res.data.msg + '</div>' );
if ( ! res.success && res.data.debug ) {
$btn.before( '<div class="wpforms-ssl-error pre-error">' + res.data.debug + '</div>' );
$btn.css( 'width', btnWidth ).prop( 'disabled', false ).text( btnLabel );
* Begins the process of analyzing the forms.
* This runs for non-Pro installs to check if any of the forms to be
* imported contain fields
* not currently available.
analyzeForms: function( forms ) {
var $processAnalyze = $( '#wpforms-importer-analyze' );
// Display total number of forms we have to import.
$processAnalyze.find( '.form-total' ).text( forms.length );
$processAnalyze.find( '.form-current' ).text( '1' );
// Hide the form select section.
$( '#wpforms-importer-forms' ).hide();
// Create global analyze queue.
// Analyze the first form in the queue.
WPFormsAdmin.analyzeForm();
* Analyze a single form from the queue.
analyzeForm: function() {
var $analyzeSettings = $( '#wpforms-importer-analyze' ),
formID = _.first( s.analyzeQueue ),
provider = WPFormsAdmin.getQueryString( 'provider' ),
action: 'wpforms_import_form_' + provider,
nonce: wpforms_admin.nonce,
// Trigger AJAX analyze for this form.
$.post( wpforms_admin.ajax_url, data, function( res ) {
if ( ! _.isEmpty( res.data.upgrade_plain ) || ! _.isEmpty( res.data.upgrade_omit ) ) {
fields: _.union( res.data.upgrade_omit, res.data.upgrade_plain ),
// Remove this form ID from the queue.
s.analyzeQueue = _.without( s.analyzeQueue, formID );
if ( _.isEmpty( s.analyzeQueue ) ) {
if ( _.isEmpty( s.analyzeUpgrade ) ) {
// Continue to import forms as no Pro fields were found.
WPFormsAdmin.importForms( s.formIDs );
// We found Pro fields, so alert the user.
var upgradeDetails = wp.template( 'wpforms-importer-upgrade' );
$analyzeSettings.find( '.upgrade' ).append( upgradeDetails( s.analyzeUpgrade ) );
$analyzeSettings.find( '.upgrade' ).show();
$analyzeSettings.find( '.process-analyze' ).hide();
// Analyze next form in the queue.
$analyzeSettings.find( '.form-current' ).text( s.analyzed + 1 );
WPFormsAdmin.analyzeForm();
* Begins the process of importing the forms.
importForms: function( forms ) {
var $processSettings = $( '#wpforms-importer-process' );
// Display total number of forms we have to import.
$processSettings.find( '.form-total' ).text( forms.length );
$processSettings.find( '.form-current' ).text( '1' );
// Hide the form select and form analyze sections.
$( '#wpforms-importer-forms, #wpforms-importer-analyze' ).hide();
// Show processing status.
// Create global import queue.
// Import the first form in the queue.
WPFormsAdmin.importForm();
* Imports a single form from the import queue.
var $processSettings = $( '#wpforms-importer-process' ),
formID = _.first( s.importQueue ),
provider = WPFormsAdmin.getQueryString( 'provider' ),
action: 'wpforms_import_form_' + provider,
nonce: wpforms_admin.nonce,
// Trigger AJAX import for this form.
$.post( wpforms_admin.ajax_url, data, function( res ) {
statusUpdate = wp.template( 'wpforms-importer-status-error' );
statusUpdate = wp.template( 'wpforms-importer-status-update' );
$processSettings.find( '.status' ).prepend( statusUpdate( res.data ) );
$processSettings.find( '.status' ).show();
// Remove this form ID from the queue.
s.importQueue = _.without( s.importQueue, formID );
if ( _.isEmpty( s.importQueue ) ) {
$processSettings.find( '.process-count' ).hide();
$processSettings.find( '.forms-completed' ).text( s.imported );
$processSettings.find( '.process-completed' ).show();
// Import next form in the queue.
$processSettings.find( '.form-current' ).text( s.imported + 1 );
WPFormsAdmin.importForm();
//--------------------------------------------------------------------//
//--------------------------------------------------------------------//
* Element bindings for Tools page.
initUpgrades: function() {
// Prepare to run the v1.4.3 upgrade routine.
$( document ).on( 'click', '#wpforms-upgrade-143 button', function( event ) {
buttonWidth = $this.outerWidth(),
$status = $( '#wpforms-upgrade-143 .status' ),
action: 'wpforms_upgrade_143',
nonce: wpforms_admin.nonce,
incomplete: $this.data( 'incomplete' ),
// Change the button to indicate we are doing initial processing.
$this.html( s.iconSpinner ).css( 'width', buttonWidth ).prop( 'disabled', true );
// Get the total number of entries, then kick off the routine.
$.post( wpforms_admin.ajax_url, data, function( res ) {
s.upgraded = Number( res.data.upgraded );
s.upgradeTotal = Number( res.data.total );
var percent = Math.round( ( Number( s.upgraded ) / Number( s.upgradeTotal ) ) * 100 );
$status.find( '.bar' ).css( 'width', percent + '%' );
$status.show().find( '.total' ).text( s.upgradeTotal );
$status.find( '.current' ).text( s.upgraded );
$status.find( '.percent' ).text( percent + '%' );
// Begin the actual upgrade routine.
WPFormsAdmin.upgrade143();
* The v1.4.3 entry fields upgrade routine.
var $status = $( '#wpforms-upgrade-143 .status' ),
action: 'wpforms_upgrade_143',
nonce: wpforms_admin.nonce,
// Get the total number of entries, then kick off the routine.
$.post( wpforms_admin.ajax_url, data, function( res ) {
s.upgraded = Number( s.upgraded ) + Number( res.data.count );
var percent = Math.round( ( Number( s.upgraded ) / Number( s.upgradeTotal ) ) * 100 );
$status.find( '.bar' ).css( 'width', percent + '%' );
if ( Number( res.data.count ) < 10 ) {
// This batch completed the upgrade routine.
$status.find( '.progress-bar' ).addClass( 'complete' );
$status.find( '.msg' ).text( wpforms_admin.upgrade_completed );
$status.find( '.current' ).text( s.upgraded );
$status.find( '.percent' ).text( percent + '%' );
// Batch the next round of entries.
WPFormsAdmin.upgrade143();
* Element bindings for Flyout Menu.
initFlyoutMenu: function() {
var $flyoutMenu = $( '#wpforms-flyout' );
if ( $flyoutMenu.length === 0 ) {
var $head = $flyoutMenu.find( '.wpforms-flyout-head' ),
$sullie = $head.find( 'img' ),
srcInactive: $sullie.attr( 'src' ),
srcActive: $sullie.data( 'active' ),
// Click on the menu head icon.
$head.on( 'click', function( e ) {
if ( menu.state === 'active' ) {
$flyoutMenu.removeClass( 'opened' );
$sullie.attr( 'src', menu.srcInactive );