PluginProbe ʕ •ᴥ•ʔ
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin / 4.9.0
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin v4.9.0
4.9.0 0.9.6 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.6.0 1.6.2 1.7.0 1.7.1 1.8.0 1.8.1 1.9.0 2.0.0 2.0.1 2.1.1 2.2.1 2.3.1 2.4.0 2.5.0 2.5.1 2.6.0 2.7.0 2.8.0 2.9.0 3.0.1 3.0.2 3.0.3 3.1.0 3.10.0 3.11.0 3.11.1 3.2.0 3.2.1 3.3.0 3.4.0 3.5.0 3.5.1 3.5.2 3.6.1 3.7.0 3.8.0 3.8.2 3.9.0 4.0.1 4.1.0 4.1.1 4.2.0 4.3.0 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.8.0 trunk 0.10.0 0.10.1 0.11.1 0.11.2 0.3.1 0.3.2 0.4 0.4.1 0.4.2 0.5.0 0.5.1 0.5.2 0.6 0.7 0.8 0.8.2 0.8.3 0.8.4 0.8.5 0.8.6 0.8.7 0.9.0 0.9.1 0.9.2 0.9.3 0.9.4 0.9.5
wp-mail-smtp / assets / js / smtp-about.js
wp-mail-smtp / assets / js Last commit date
vendor 5 days ago connect.js 5 days ago connect.min.js 5 days ago smtp-about.js 5 days ago smtp-about.min.js 5 days ago smtp-activelayer-wc.js 5 days ago smtp-activelayer-wc.min.js 5 days ago smtp-admin-notices.js 5 days ago smtp-admin-notices.min.js 5 days ago smtp-admin.js 5 days ago smtp-admin.min.js 5 days ago smtp-ai-mcp.js 5 days ago smtp-ai-mcp.min.js 5 days ago smtp-code-snippets.js 5 days ago smtp-code-snippets.min.js 5 days ago smtp-dashboard-widget.js 5 days ago smtp-dashboard-widget.min.js 5 days ago smtp-notifications.js 5 days ago smtp-notifications.min.js 5 days ago smtp-recommendations.js 5 days ago smtp-recommendations.min.js 5 days ago smtp-tools-debug-events.js 5 days ago smtp-tools-debug-events.min.js 5 days ago
smtp-about.js
190 lines
1 /* eslint-disable no-prototype-builtins */
2 /* global wp_mail_smtp_about */
3 'use strict';
4
5 var WPMailSMTP = window.WPMailSMTP || {};
6 WPMailSMTP.Admin = WPMailSMTP.Admin || {};
7
8 /**
9 * WP Mail SMTP Admin area About module.
10 *
11 * @since 1.5.0
12 */
13 WPMailSMTP.Admin.About = WPMailSMTP.Admin.About || ( function( document, window, $ ) {
14
15 /**
16 * Public functions and properties.
17 *
18 * @since 1.5.0
19 *
20 * @type {object}
21 */
22 var app = {
23
24 /**
25 * Start the engine. DOM is not ready yet, use only to init something.
26 *
27 * @since 1.5.0
28 */
29 init: function() {
30
31 // Do that when DOM is ready.
32 $( app.ready );
33 },
34
35 /**
36 * DOM is fully loaded.
37 *
38 * @since 1.5.0
39 */
40 ready: function() {
41
42 app.pageHolder = $( '.wp-mail-smtp-page-about' );
43
44 app.bindActions();
45
46 $( '.wp-mail-smtp-page' ).trigger( 'WPMailSMTP.Admin.About.ready' );
47 },
48
49 /**
50 * Process all generic actions/events, mostly custom that were fired by our API.
51 *
52 * @since 1.5.0
53 */
54 bindActions: function() {
55
56 /*
57 * Make plugins description the same height.
58 */
59 jQuery( '.wp-mail-smtp-admin-about-plugins .plugin-item .details' ).matchHeight();
60
61 /*
62 * Install/Active the plugins.
63 */
64 $( document ).on( 'click', '.wp-mail-smtp-admin-about-plugins .plugin-item .action-button .button', function( e ) {
65 e.preventDefault();
66
67 var $btn = $( this );
68
69 if ( $btn.hasClass( 'disabled' ) || $btn.hasClass( 'loading' ) ) {
70 return false;
71 }
72
73 var $plugin = $btn.closest( '.plugin-item' ),
74 plugin = $btn.attr( 'data-plugin' ),
75 task,
76 cssClass,
77 statusText,
78 buttonText,
79 successText;
80
81 $btn.addClass( 'loading disabled' );
82 $btn.text( wp_mail_smtp_about.plugin_processing );
83
84 if ( $btn.hasClass( 'status-inactive' ) ) {
85
86 // Activate.
87 task = 'about_plugin_activate';
88 cssClass = 'status-active button button-secondary disabled';
89 statusText = wp_mail_smtp_about.plugin_active;
90 buttonText = wp_mail_smtp_about.plugin_activated;
91
92 } else if ( $btn.hasClass( 'status-download' ) ) {
93
94 // Install & Activate.
95 task = 'about_plugin_install';
96 cssClass = 'status-active button disabled';
97 statusText = wp_mail_smtp_about.plugin_active;
98 buttonText = wp_mail_smtp_about.plugin_activated;
99
100 } else if ( $btn.hasClass( 'status-open' ) ) {
101
102 // Open site in new window.
103 window.open( $btn.attr( 'href' ), '_blank' ).focus();
104 $btn.removeClass( 'loading disabled' );
105 $btn.text( wp_mail_smtp_about.plugin_visit );
106
107 return;
108
109 } else {
110 return;
111 }
112
113 // Setup ajax POST data.
114 var data = {
115 action: 'wp_mail_smtp_ajax',
116 task: task,
117 nonce : wp_mail_smtp_about.nonce,
118 plugin: plugin
119 };
120
121 $.post( wp_mail_smtp_about.ajax_url, data, function( res ) {
122 var isInstallSuccessful;
123
124 if ( res.success ) {
125 isInstallSuccessful = true;
126 if ( 'about_plugin_install' === task ) {
127 $btn.attr( 'data-plugin', res.data.basename );
128 successText = res.data.msg;
129 if ( ! res.data.is_activated ) {
130 cssClass = 'button';
131 statusText = wp_mail_smtp_about.plugin_inactive;
132 buttonText = wp_mail_smtp_about.plugin_activate;
133 }
134 } else {
135 successText = res.data;
136 }
137 $plugin.find( '.actions' ).append( '<div class="msg success">' + successText + '</div>' );
138 $plugin.find( 'span.status-label' )
139 .removeClass( 'status-active status-inactive status-download' )
140 .addClass( cssClass )
141 .removeClass( 'button button-primary button-secondary disabled' )
142 .text( statusText );
143 $btn
144 .removeClass( 'status-active status-inactive status-download' )
145 .removeClass( 'button button-primary button-secondary disabled' )
146 .addClass( cssClass ).html( buttonText );
147 } else {
148 isInstallSuccessful = false;
149
150 if (
151 res.hasOwnProperty( 'data' ) &&
152 res.data.hasOwnProperty( 0 ) &&
153 res.data[ 0 ].hasOwnProperty( 'code' )
154 ) {
155
156 // Specific server-returned error.
157 $plugin.find( '.actions' ).append( '<div class="msg error">' + wp_mail_smtp_about.plugin_install_error + '</div>' );
158 } else {
159
160 // Generic error.
161 $plugin.find( '.actions' ).append( '<div class="msg error">' + res.data + '</div>' );
162 }
163
164 $btn.html( wp_mail_smtp_about.plugin_download_btn );
165 }
166
167 if ( ! isInstallSuccessful ) {
168 $btn.removeClass( 'disabled' );
169 }
170 $btn.removeClass( 'loading' );
171
172 // Automatically clear plugin messages after 3 seconds.
173 setTimeout( function() {
174 $( '.plugin-item .msg' ).remove();
175 }, 3000 );
176
177 } ).fail( function( xhr ) {
178 console.log( xhr.responseText );
179 } );
180 } );
181 }
182 };
183
184 // Provide access to public functions/properties.
185 return app;
186 }( document, window, jQuery ) );
187
188 // Initialize.
189 WPMailSMTP.Admin.About.init();
190