updated plugin WP Mail SMTP
version 2.3.1
This commit is contained in:
@ -165,10 +165,49 @@ WPMailSMTP.Admin.Settings = WPMailSMTP.Admin.Settings || ( function( document, w
|
||||
target.select();
|
||||
|
||||
document.execCommand( 'Copy' );
|
||||
|
||||
var $buttonIcon = $( this ).find( '.dashicons' );
|
||||
|
||||
$buttonIcon
|
||||
.removeClass( 'dashicons-admin-page' )
|
||||
.addClass( 'dashicons-yes-alt wp-mail-smtp-success wp-mail-smtp-animate' );
|
||||
|
||||
setTimeout(
|
||||
function() {
|
||||
$buttonIcon
|
||||
.removeClass( 'dashicons-yes-alt wp-mail-smtp-success wp-mail-smtp-animate' )
|
||||
.addClass( 'dashicons-admin-page' );
|
||||
},
|
||||
1000
|
||||
);
|
||||
} );
|
||||
|
||||
// Notice bar: click on the dissmiss button.
|
||||
$( '#wp-mail-smtp-notice-bar' ).on( 'click', '.dismiss', function() {
|
||||
var $notice = $( this ).closest( '#wp-mail-smtp-notice-bar' );
|
||||
|
||||
$notice.addClass( 'out' );
|
||||
setTimeout(
|
||||
function() {
|
||||
$notice.remove();
|
||||
},
|
||||
300
|
||||
);
|
||||
|
||||
$.post(
|
||||
ajaxurl,
|
||||
{
|
||||
action: 'wp_mail_smtp_notice_bar_dismiss',
|
||||
nonce: wp_mail_smtp.nonce,
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
app.triggerExitNotice();
|
||||
app.beforeSaveChecks();
|
||||
|
||||
// Register change event to show/hide plugin supported settings for currently selected mailer.
|
||||
$( '.js-wp-mail-smtp-setting-mailer-radio-input', app.pageHolder ).on( 'change', this.processMailerSettingsOnChange );
|
||||
},
|
||||
|
||||
education: {
|
||||
@ -313,6 +352,43 @@ WPMailSMTP.Admin.Settings = WPMailSMTP.Admin.Settings || ( function( document, w
|
||||
return false;
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* On change callback for showing/hiding plugin supported settings for currently selected mailer.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*/
|
||||
processMailerSettingsOnChange: function() {
|
||||
|
||||
var mailerSupportedSettings = wp_mail_smtp.all_mailers_supports[ $( this ).val() ];
|
||||
|
||||
for ( var setting in mailerSupportedSettings ) {
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
if ( mailerSupportedSettings.hasOwnProperty( setting ) ) {
|
||||
$( '.js-wp-mail-smtp-setting-' + setting, app.pageHolder ).toggle( mailerSupportedSettings[ setting ] );
|
||||
}
|
||||
}
|
||||
|
||||
// Special case: "from email" (group settings).
|
||||
var $mainSettingInGroup = $( '.js-wp-mail-smtp-setting-from_email' );
|
||||
|
||||
$mainSettingInGroup.closest( '.wp-mail-smtp-setting-row' ).toggle(
|
||||
mailerSupportedSettings['from_email'] || mailerSupportedSettings['from_email_force']
|
||||
);
|
||||
$mainSettingInGroup.siblings( '.wp-mail-smtp-setting-mid-row-sep' ).toggle(
|
||||
mailerSupportedSettings['from_email'] && mailerSupportedSettings['from_email_force']
|
||||
);
|
||||
|
||||
// Special case: "from name" (group settings).
|
||||
$mainSettingInGroup = $( '.js-wp-mail-smtp-setting-from_name' );
|
||||
|
||||
$mainSettingInGroup.closest( '.wp-mail-smtp-setting-row' ).toggle(
|
||||
mailerSupportedSettings['from_name'] || mailerSupportedSettings['from_name_force']
|
||||
);
|
||||
$mainSettingInGroup.siblings( '.wp-mail-smtp-setting-mid-row-sep' ).toggle(
|
||||
mailerSupportedSettings['from_name'] && mailerSupportedSettings['from_name_force']
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
185
wp-content/plugins/wp-mail-smtp/assets/js/smtp-notifications.js
Normal file
185
wp-content/plugins/wp-mail-smtp/assets/js/smtp-notifications.js
Normal file
@ -0,0 +1,185 @@
|
||||
/* global wp_mail_smtp, ajaxurl */
|
||||
|
||||
/**
|
||||
* WP Mail SMTP Admin Notifications.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var WPMailSMTPAdminNotifications = window.WPMailSMTPAdminNotifications || ( function( document, window, $ ) {
|
||||
|
||||
/**
|
||||
* Elements holder.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*
|
||||
* @type {object}
|
||||
*/
|
||||
var el = {
|
||||
$notifications: $( '#wp-mail-smtp-notifications' ),
|
||||
$nextButton: $( '#wp-mail-smtp-notifications .navigation .next' ),
|
||||
$prevButton: $( '#wp-mail-smtp-notifications .navigation .prev' ),
|
||||
$adminBarCounter: $( '#wp-admin-bar-wp-mail-smtp-menu .wp-mail-smtp-admin-bar-menu-notification-counter' ),
|
||||
};
|
||||
|
||||
/**
|
||||
* Public functions and properties.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*
|
||||
* @type {object}
|
||||
*/
|
||||
var app = {
|
||||
|
||||
/**
|
||||
* Start the engine.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*/
|
||||
init: function() {
|
||||
|
||||
$( document ).ready( app.ready );
|
||||
},
|
||||
|
||||
/**
|
||||
* Document ready.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*/
|
||||
ready: function() {
|
||||
|
||||
app.updateNavigation();
|
||||
app.events();
|
||||
},
|
||||
|
||||
/**
|
||||
* Register JS events.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*/
|
||||
events: function() {
|
||||
|
||||
el.$notifications
|
||||
.on( 'click', '.dismiss', app.dismiss )
|
||||
.on( 'click', '.next', app.navNext )
|
||||
.on( 'click', '.prev', app.navPrev );
|
||||
},
|
||||
|
||||
/**
|
||||
* Click on the Dismiss notification button.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*
|
||||
* @param {object} event Event object.
|
||||
*/
|
||||
dismiss: function( event ) {
|
||||
|
||||
if ( el.$currentMessage.length === 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// AJAX call - update option.
|
||||
var data = {
|
||||
action: 'wp_mail_smtp_notification_dismiss',
|
||||
nonce: wp_mail_smtp.nonce,
|
||||
id: el.$currentMessage.data( 'message-id' ),
|
||||
};
|
||||
|
||||
$.post( ajaxurl, data, function( response ) {
|
||||
if ( ! response.success ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Update counter.
|
||||
var count = parseInt( el.$adminBarCounter.text(), 10 );
|
||||
if ( count > 1 ) {
|
||||
--count;
|
||||
el.$adminBarCounter.html( '<span>' + count + '</span>' );
|
||||
} else {
|
||||
el.$adminBarCounter.remove();
|
||||
}
|
||||
|
||||
// Remove notification.
|
||||
var $nextMessage = el.$nextMessage.length < 1 ? el.$prevMessage : el.$nextMessage;
|
||||
|
||||
if ( $nextMessage.length === 0 ) {
|
||||
el.$notifications.remove();
|
||||
} else {
|
||||
el.$currentMessage.remove();
|
||||
$nextMessage.addClass( 'current' );
|
||||
app.updateNavigation();
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Click on the Next notification button.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*
|
||||
* @param {object} event Event object.
|
||||
*/
|
||||
navNext: function( event ) {
|
||||
|
||||
if ( el.$nextButton.hasClass( 'disabled' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
el.$currentMessage.removeClass( 'current' );
|
||||
el.$nextMessage.addClass( 'current' );
|
||||
|
||||
app.updateNavigation();
|
||||
},
|
||||
|
||||
/**
|
||||
* Click on the Previous notification button.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*
|
||||
* @param {object} event Event object.
|
||||
*/
|
||||
navPrev: function( event ) {
|
||||
|
||||
if ( el.$prevButton.hasClass( 'disabled' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
el.$currentMessage.removeClass( 'current' );
|
||||
el.$prevMessage.addClass( 'current' );
|
||||
|
||||
app.updateNavigation();
|
||||
},
|
||||
|
||||
/**
|
||||
* Update navigation buttons.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*/
|
||||
updateNavigation: function() {
|
||||
|
||||
el.$currentMessage = el.$notifications.find( '.message.current' );
|
||||
el.$nextMessage = el.$currentMessage.next( '.message' );
|
||||
el.$prevMessage = el.$currentMessage.prev( '.message' );
|
||||
|
||||
if ( el.$nextMessage.length === 0 ) {
|
||||
el.$nextButton.addClass( 'disabled' );
|
||||
} else {
|
||||
el.$nextButton.removeClass( 'disabled' );
|
||||
}
|
||||
|
||||
if ( el.$prevMessage.length === 0 ) {
|
||||
el.$prevButton.addClass( 'disabled' );
|
||||
} else {
|
||||
el.$prevButton.removeClass( 'disabled' );
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
return app;
|
||||
|
||||
}( document, window, jQuery ) );
|
||||
|
||||
// Initialize.
|
||||
WPMailSMTPAdminNotifications.init();
|
1
wp-content/plugins/wp-mail-smtp/assets/js/smtp-notifications.min.js
vendored
Normal file
1
wp-content/plugins/wp-mail-smtp/assets/js/smtp-notifications.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
"use strict";var WPMailSMTPAdminNotifications=window.WPMailSMTPAdminNotifications||function(e,t){var a={$notifications:t("#wp-mail-smtp-notifications"),$nextButton:t("#wp-mail-smtp-notifications .navigation .next"),$prevButton:t("#wp-mail-smtp-notifications .navigation .prev"),$adminBarCounter:t("#wp-admin-bar-wp-mail-smtp-menu .wp-mail-smtp-admin-bar-menu-notification-counter")},s={init:function(){t(e).ready(s.ready)},ready:function(){s.updateNavigation(),s.events()},events:function(){a.$notifications.on("click",".dismiss",s.dismiss).on("click",".next",s.navNext).on("click",".prev",s.navPrev)},dismiss:function(e){if(0!==a.$currentMessage.length){var n={action:"wp_mail_smtp_notification_dismiss",nonce:wp_mail_smtp.nonce,id:a.$currentMessage.data("message-id")};t.post(ajaxurl,n,function(e){if(e.success){var n=parseInt(a.$adminBarCounter.text(),10);1<n?(--n,a.$adminBarCounter.html("<span>"+n+"</span>")):a.$adminBarCounter.remove();var t=a.$nextMessage.length<1?a.$prevMessage:a.$nextMessage;0===t.length?a.$notifications.remove():(a.$currentMessage.remove(),t.addClass("current"),s.updateNavigation())}})}},navNext:function(e){a.$nextButton.hasClass("disabled")||(a.$currentMessage.removeClass("current"),a.$nextMessage.addClass("current"),s.updateNavigation())},navPrev:function(e){a.$prevButton.hasClass("disabled")||(a.$currentMessage.removeClass("current"),a.$prevMessage.addClass("current"),s.updateNavigation())},updateNavigation:function(){a.$currentMessage=a.$notifications.find(".message.current"),a.$nextMessage=a.$currentMessage.next(".message"),a.$prevMessage=a.$currentMessage.prev(".message"),0===a.$nextMessage.length?a.$nextButton.addClass("disabled"):a.$nextButton.removeClass("disabled"),0===a.$prevMessage.length?a.$prevButton.addClass("disabled"):a.$prevButton.removeClass("disabled")}};return s}(document,(window,jQuery));WPMailSMTPAdminNotifications.init();
|
Reference in New Issue
Block a user