: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
/* global wpforms_admin, WPFormsAdmin */
* WPForms Admin Notifications.
var WPFormsAdminNotifications = window.WPFormsAdminNotifications || ( function( document, window, $ ) {
$notifications: $( '#wpforms-notifications' ),
$nextButton: $( '#wpforms-notifications .navigation .next' ),
$prevButton: $( '#wpforms-notifications .navigation .prev' ),
$adminBarCounter: $( '#wp-admin-bar-wpforms-menu .wpforms-menu-notification-counter' ),
$adminBarMenuItem: $( '#wp-admin-bar-wpforms-notifications' ),
* Public functions and properties.
.on( 'click', '.dismiss', app.dismiss )
.on( 'click', '.next', app.navNext )
.on( 'click', '.prev', app.navPrev );
* Click on the Dismiss notification button.
* @param {object} event Event object.
dismiss: function( event ) {
if ( el.$currentMessage.length === 0 ) {
var count = parseInt( el.$adminBarCounter.text(), 10 );
el.$adminBarCounter.html( count );
el.$adminBarCounter.remove();
el.$adminBarMenuItem.remove();
var $nextMessage = el.$nextMessage.length < 1 ? el.$prevMessage : el.$nextMessage,
messageId = el.$currentMessage.data( 'message-id' );
if ( $nextMessage.length === 0 ) {
el.$notifications.remove();
el.$currentMessage.remove();
$nextMessage.addClass( 'current' );
// AJAX call - update option.
action: 'wpforms_notification_dismiss',
nonce: wpforms_admin.nonce,
$.post( wpforms_admin.ajax_url, data, function( res ) {
WPFormsAdmin.debug( res );
} ).fail( function( xhr, textStatus, e ) {
WPFormsAdmin.debug( xhr.responseText );
* Click on the Next notification button.
* @param {object} event Event object.
navNext: function( event ) {
if ( el.$nextButton.hasClass( 'disabled' ) ) {
el.$currentMessage.removeClass( 'current' );
el.$nextMessage.addClass( 'current' );
* Click on the Previous notification button.
* @param {object} event Event object.
navPrev: function( event ) {
if ( el.$prevButton.hasClass( 'disabled' ) ) {
el.$currentMessage.removeClass( 'current' );
el.$prevMessage.addClass( 'current' );
* Update navigation buttons.
updateNavigation: function() {
el.$currentMessage = el.$notifications.find( '.wpforms-notifications-message.current' );
el.$nextMessage = el.$currentMessage.next( '.wpforms-notifications-message' );
el.$prevMessage = el.$currentMessage.prev( '.wpforms-notifications-message' );
if ( el.$nextMessage.length === 0 ) {
el.$nextButton.addClass( 'disabled' );
el.$nextButton.removeClass( 'disabled' );
if ( el.$prevMessage.length === 0 ) {
el.$prevButton.addClass( 'disabled' );
el.$prevButton.removeClass( 'disabled' );
}( document, window, jQuery ) );
WPFormsAdminNotifications.init();