: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if ( typeof wpcf7 === 'undefined' || wpcf7 === null ) {
var welcomePanel = $( '#wpcf7-welcome-panel' );
updateWelcomePanel = function( visible ) {
action: 'wpcf7-update-welcome-panel',
welcomepanelnonce: $( '#welcomepanelnonce' ).val()
$( 'a.welcome-panel-close', welcomePanel ).click( function( event ) {
welcomePanel.addClass( 'hidden' );
$( '#wpcf7-welcome-panel-show' ).prop( 'checked', false );
$( '#wpcf7-welcome-panel-show' ).click( function( event ) {
welcomePanel.removeClass( 'hidden' );
welcomePanel.addClass( 'hidden' );
$( '#contact-form-editor' ).tabs( {
activate: function( event, ui ) {
$( '#active-tab' ).val( ui.newTab.index() );
$( '#contact-form-editor-tabs' ).focusin( function( event ) {
$( '#contact-form-editor .keyboard-interaction' ).css(
'visibility', 'visible' );
} ).focusout( function( event ) {
$( '#contact-form-editor .keyboard-interaction' ).css(
'visibility', 'hidden' );
wpcf7.toggleMail2( 'input:checkbox.toggle-form-table' );
$( 'input:checkbox.toggle-form-table' ).click( function( event ) {
wpcf7.toggleMail2( this );
if ( '' === $( '#title' ).val() ) {
$( '.contact-form-editor-box-mail span.mailtag' ).click( function( event ) {
var range = document.createRange();
range.selectNodeContents( this );
window.getSelection().addRange( range );
wpcf7.updateConfigErrors();
$( '[data-config-field]' ).change( function() {
var postId = $( '#post_ID' ).val();
if ( ! postId || -1 == postId ) {
$( this ).closest( 'form' ).find( '[data-config-field]' ).each( function() {
var val = $( this ).val();
if ( $( this ).is( '[type=checkbox]' ) ) {
val = $( this ).is( ':checked' ) ? 1 : 0;
'name': $( this ).attr( 'name' ).replace( /^wpcf7-/, '' ).replace( /-/g, '_' ),
data.push( { 'name': 'context', 'value': 'dry-run' } );
url: wpcf7.apiSettings.getRoute( '/contact-forms/' + postId ),
beforeSend: function( xhr ) {
xhr.setRequestHeader( 'X-WP-Nonce', wpcf7.apiSettings.nonce );
} ).done( function( response ) {
wpcf7.configValidator.errors = response.config_errors;
wpcf7.updateConfigErrors();
$( window ).on( 'beforeunload', function( event ) {
$( '#wpcf7-admin-form-element :input[type!="hidden"]' ).each( function() {
if ( $( this ).is( ':checkbox, :radio' ) ) {
if ( this.defaultChecked != $( this ).is( ':checked' ) ) {
} else if ( $( this ).is( 'select' ) ) {
$( this ).find( 'option' ).each( function() {
if ( this.defaultSelected != $( this ).is( ':selected' ) ) {
if ( this.defaultValue != $( this ).val() ) {
event.returnValue = wpcf7.saveAlert;
$( '#wpcf7-admin-form-element' ).submit( function() {
if ( 'copy' != this.action.value ) {
$( window ).off( 'beforeunload' );
if ( 'save' == this.action.value ) {
$( '#publishing-action .spinner' ).addClass( 'is-active' );
$( '#wpcf7-ctct-enable-contact-list, #wpcf7-sendinblue-enable-contact-list, #wpcf7-sendinblue-enable-transactional-email' ).on( 'change', function() {
if ( $( this ).is( ':checked' ) ) {
$( this ).closest( 'tr' ).removeClass( 'inactive' );
$( this ).closest( 'tr' ).addClass( 'inactive' );
wpcf7.toggleMail2 = function( checkbox ) {
var $checkbox = $( checkbox );
var $fieldset = $( 'fieldset',
$checkbox.closest( '.contact-form-editor-box-mail' ) );
if ( $checkbox.is( ':checked' ) ) {
$fieldset.removeClass( 'hidden' );
$fieldset.addClass( 'hidden' );
wpcf7.updateConfigErrors = function() {
var errors = wpcf7.configValidator.errors;
var errorCount = { total: 0 };
$( '[data-config-field]' ).each( function() {
$( this ).removeAttr( 'aria-invalid' );
$( this ).next( 'ul.config-error' ).remove();
var section = $( this ).attr( 'data-config-field' );
$( this ).attr( 'aria-describedby', 'wpcf7-config-error-for-' + section );
if ( errors[ section ] ) {
var $list = $( '<ul></ul>' ).attr( {
'id': 'wpcf7-config-error-for-' + section,
$.each( errors[ section ], function( i, val ) {
var $li = $( '<li></li>' ).append(
wpcf7.iconInCircle( '!' )
$( '<span class="screen-reader-text"></span>' ).text( wpcf7.configValidator.iconAlt )
$( '<a></a>' ).attr( 'href', val.link ).text( val.message )
.replace( /^mail_\d+\./, 'mail.' ).replace( /\..*$/, '' );
if ( ! errorCount[ tab ] ) {
$( this ).after( $list ).attr( { 'aria-invalid': 'true' } );
$( '#contact-form-editor-tabs > li' ).each( function() {
$item.find( '.icon-in-circle' ).remove();
var tab = $item.attr( 'id' ).replace( /-panel-tab$/, '' );
$.each( errors, function( key, val ) {
key = key.replace( /^mail_\d+\./, 'mail.' );
if ( key.replace( /\..*$/, '' ) == tab.replace( '-', '_' ) ) {
var $mark = wpcf7.iconInCircle( '!' );
$item.find( 'a.ui-tabs-anchor' ).first().append( $mark );
var $tabPanelError = $( '#' + tab + '-panel > div.config-error:first' );
if ( errorCount[ tab.replace( '-', '_' ) ] ) {
$tabPanelError.append( wpcf7.iconInCircle( '!' ) );
if ( 1 < errorCount[ tab.replace( '-', '_' ) ] ) {
var manyErrorsInTab = wpcf7.configValidator.manyErrorsInTab
.replace( '%d', errorCount[ tab.replace( '-', '_' ) ] );
$tabPanelError.append( manyErrorsInTab );
$tabPanelError.append( wpcf7.configValidator.oneErrorInTab );
$( '#misc-publishing-actions .misc-pub-section.config-error' ).remove();
if ( errorCount.total ) {
var $warning = $( '<div></div>' )
.addClass( 'misc-pub-section config-error' )
.append( wpcf7.iconInCircle( '!' ) );
if ( 1 < errorCount.total ) {
wpcf7.configValidator.manyErrors.replace( '%d', errorCount.total )
$warning.append( wpcf7.configValidator.oneError );
$warning.append( '<br />' ).append(
.attr( 'href', wpcf7.configValidator.docUrl )
.text( wpcf7.configValidator.howToCorrect )
$( '#misc-publishing-actions' ).append( $warning );
* Copied from wptitlehint() in wp-admin/js/post.js
wpcf7.titleHint = function() {
var $title = $( '#title' );
var $titleprompt = $( '#title-prompt-text' );
if ( '' === $title.val() ) {
$titleprompt.removeClass( 'screen-reader-text' );
$titleprompt.click( function() {
$( this ).addClass( 'screen-reader-text' );
$title.blur( function() {
if ( '' === $(this).val() ) {
$titleprompt.removeClass( 'screen-reader-text' );
$titleprompt.addClass( 'screen-reader-text' );
} ).keydown( function( e ) {
$titleprompt.addClass( 'screen-reader-text' );
wpcf7.iconInCircle = function( icon ) {
var $span = $( '<span class="icon-in-circle" aria-hidden="true"></span>' );
return $span.text( icon );
wpcf7.apiSettings.getRoute = function( path ) {
var url = wpcf7.apiSettings.root;
wpcf7.apiSettings.namespace,
wpcf7.apiSettings.namespace + path );