PluginProbe ʕ •ᴥ•ʔ
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 2.0.3
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v2.0.3
3.5.2 3.5.1 3.5.0 3.4.8 3.4.7 3.4.6 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5.1 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.6.1 1.6.7 1.7.0 1.7.0.1 1.7.0.2 1.7.0.3 1.7.1 1.7.2 1.7.2.1 1.7.2.2 1.7.3 1.7.4 1.7.5 1.7.5.1 1.7.5.2 1.7.6 1.7.7 1.7.7.1 1.7.7.2 1.7.8 1.7.9 1.8.0 1.8.0.1 1.8.1 1.8.2 1.8.2.1 1.8.2.2 1.8.2.3 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.0.1 1.9.1 1.9.2 1.9.3 1.9.4 1.9.4.1 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.0.1 2.0.1 2.0.2 2.0.3 2.0.3.1 2.0.4 2.0.4.1 2.0.5 2.0.6 2.0.7 2.0.8 2.0.8.1 2.0.9 3.0.0 3.0.0.1 3.0.1 3.0.2 3.0.3 3.0.3.1 3.0.4 3.0.4.1 3.0.4.2 3.0.5 3.0.5.1 3.0.5.2 3.0.6 3.0.6.1 3.0.7.1 3.0.8 3.0.8.1 3.0.9 3.0.9.1 3.0.9.2 3.0.9.3 3.0.9.4 3.0.9.5 3.1.0 3.1.1 3.1.2 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.3.0 3.4.0 3.4.1 3.4.2 3.4.2.1 3.4.3 3.4.4 3.4.5 trunk 1.0 1.0.1 1.0.2 1.0.3
everest-forms / assets / js / admin / extensions.js
everest-forms / assets / js / admin Last commit date
gutenberg 2 years ago admin.js 3 years ago admin.min.js 3 years ago deactivation-feedback.js 3 years ago deactivation-feedback.min.js 3 years ago editor.js 7 years ago editor.min.js 5 years ago evf-admin-email.js 2 years ago evf-admin-email.min.js 2 years ago evf-clipboard.js 7 years ago evf-clipboard.min.js 7 years ago evf-enhanced-select.js 3 years ago evf-enhanced-select.min.js 3 years ago evf-file-uploader.js 3 years ago evf-file-uploader.min.js 3 years ago evf-setup.js 2 years ago evf-setup.min.js 2 years ago extensions.js 2 years ago extensions.min.js 2 years ago form-builder.js 2 years ago form-builder.min.js 2 years ago form-template-controller.js 3 years ago form-template-controller.min.js 3 years ago settings.js 3 years ago settings.min.js 3 years ago tools.js 4 years ago tools.min.js 4 years ago upgrade.js 2 years ago upgrade.min.js 2 years ago
extensions.js
336 lines
1 ( function( $, wp ) {
2 var $document = $( document );
3 __ = wp.i18n.__,
4 _x = wp.i18n._x,
5 sprintf = wp.i18n.sprintf;
6
7 /**
8 * Sends an Ajax request to the server to install a extension.
9 *
10 * @since 4.6.0
11 *
12 * @param {object} args Arguments.
13 * @param {string} args.slug Plugin identifier in the WordPress.org Plugin repository.
14 * @param {installExtensionSuccess=} args.success Optional. Success callback. Default: wp.updates.installPluginSuccess
15 * @param {installExtensionError=} args.error Optional. Error callback. Default: wp.updates.installPluginError
16 * @return {$.promise} A jQuery promise that represents the request,
17 * decorated with an abort() method.
18 */
19 wp.updates.installExtension = function( args ) {
20 var $card = $( '.plugin-card-' + args.slug ),
21 $message = $card.find( '.install-now, .activate-now' );
22
23 args = _.extend( {
24 success: wp.updates.installExtensionSuccess,
25 error: wp.updates.installExtensionError
26 }, args );
27
28 if ( $message.html() !== __( 'Installing...' ) ) {
29 $message.data( 'originaltext', $message.html() );
30 }
31
32 $message
33 .addClass( 'updating-message' )
34 .attr(
35 'aria-label',
36 sprintf(
37 /* translators: %s: Plugin name and version. */
38 _x( 'Installing %s...', 'everest-forms' ),
39 $message.data( 'name' )
40 )
41 )
42 .text( __( 'Installing...' ) );
43
44 wp.a11y.speak( __( 'Installing... please wait.' ), 'polite' );
45
46 // Remove previous error messages, if any.
47 $card.removeClass( 'plugin-card-install-failed' ).find( '.notice.notice-error' ).remove();
48
49 $document.trigger( 'wp-extension-installing', args );
50
51 return wp.updates.ajax( 'everest_forms_install_extension', args );
52 };
53
54 /**
55 * Updates the UI appropriately after a successful extension install.
56 *
57 * @since 4.6.0
58 *
59 * @typedef {object} installPluginSuccess
60 * @param {object} response Response from the server.
61 * @param {string} response.slug Slug of the installed plugin.
62 * @param {string} response.pluginName Name of the installed plugin.
63 * @param {string} response.activateUrl URL to activate the just installed plugin.
64 */
65 wp.updates.installExtensionSuccess = function( response ) {
66 if ( 'everest-forms_page_evf-builder' === pagenow ) {
67 if (
68 !$(document).find(".everest-forms-form-template-wrapper")
69 .length
70 ) {
71 wp.a11y.speak(
72 __("Installation completed successfully."),
73 "polite"
74 );
75
76 $document.trigger("wp-plugin-install-success", response);
77 $document.trigger("ur-plugin-install-success", response);
78 } else {
79 var $pluginRow = $( 'tr[data-slug="' + response.slug + '"]' ).removeClass( 'install' ).addClass( 'installed' ),
80 $updateMessage = $pluginRow.find( '.plugin-status span' );
81
82 $updateMessage
83 .removeClass( 'updating-message install-now' )
84 .addClass( 'updated-message active' )
85 .attr(
86 'aria-label',
87 sprintf(
88 /* translators: %s: Plugin name and version. */
89 _x( '%s installed!', 'everest-forms' ),
90 response.pluginName
91 )
92 )
93 .text( _x( 'Installed!', 'plugin' ) );
94
95 wp.a11y.speak( __( 'Installation completed successfully.' ), 'polite' );
96
97
98 $document.trigger( 'wp-plugin-bulk-install-success', response );
99 }
100 } else {
101 var $message = $( '.plugin-card-' + response.slug ).find( '.install-now' ),
102 $status = $( '.plugin-card-' + response.slug ).find( '.status-label' );
103
104 $message
105 .removeClass( 'updating-message' )
106 .addClass( 'updated-message installed button-disabled' )
107 .attr(
108 'aria-label',
109 sprintf(
110 /* translators: %s: Plugin name and version. */
111 _x( '%s installed!', 'everest-forms' ),
112 response.pluginName
113 )
114 )
115 .text( _x( 'Installed!', 'everest-forms' ) );
116
117 wp.a11y.speak( __( 'Installation completed successfully.' ), 'polite' );
118
119 $document.trigger( 'wp-plugin-install-success', response );
120
121 if ( response.activateUrl ) {
122 setTimeout( function() {
123 $status.removeClass( 'status-install-now' ).addClass( 'status-active' ).text( wp.updates.l10n.pluginInstalled );
124
125 // Transform the 'Install' button into an 'Activate' button.
126 $message.removeClass( 'install-now installed button-disabled updated-message' )
127 .addClass( 'activate-now button-primary' )
128 .attr( 'href', response.activateUrl );
129
130 if ( 'plugins-network' === pagenow ) {
131 $message
132 .attr(
133 'aria-label',
134 sprintf(
135 /* translators: %s: Plugin name. */
136 _x( 'Network Activate %s', 'everest-forms' ),
137 response.pluginName
138 )
139 )
140 .text( __( 'Network Activate' ) );
141 } else {
142 $message
143 .attr(
144 'aria-label',
145 sprintf(
146 /* translators: %s: Plugin name. */
147 _x( 'Activate %s', 'everest-forms' ),
148 response.pluginName
149 )
150 )
151 .text( __( 'Activate' ) );
152 }
153 }, 1000 );
154 }
155 }
156 };
157
158 /**
159 * Updates the UI appropriately after a failed extension install.
160 *
161 * @since 4.6.0
162 *
163 * @typedef {object} installExtensionError
164 * @param {object} response Response from the server.
165 * @param {string} response.slug Slug of the plugin to be installed.
166 * @param {string=} response.pluginName Optional. Name of the plugin to be installed.
167 * @param {string} response.errorCode Error code for the error that occurred.
168 * @param {string} response.errorMessage The error that occurred.
169 */
170 wp.updates.installExtensionError = function( response ) {
171 if ( 'everest-forms_page_evf-builder' === pagenow ) {
172 if(!$(document).find(".everest-forms-form-template-wrapper")
173 .length
174 ) {
175 return;
176 }
177 var $pluginRow = $( 'tr[data-slug="' + response.slug + '"]' ),
178 $updateMessage = $pluginRow.find( '.plugin-status span' ),
179 errorMessage;
180
181 if ( ! wp.updates.isValidResponse( response, 'install' ) ) {
182 return;
183 }
184
185 if ( wp.updates.maybeHandleCredentialError( response, 'install-plugin' ) ) {
186 return;
187 }
188
189 errorMessage = sprintf(
190 /* translators: %s: Error string for a failed installation. */
191 __( 'Installation failed: %s' ),
192 response.errorMessage
193 );
194
195 $updateMessage
196 .removeClass( 'updating-message' )
197 .addClass( 'updated-message' )
198 .attr(
199 'aria-label',
200 sprintf(
201 /* translators: %s: Plugin name and version. */
202 _x( '%s installation failed', 'everest-forms' ),
203 $button.data( 'name' )
204 )
205 )
206 .text( __( 'Installation Failed!' ) );
207
208 wp.a11y.speak( errorMessage, 'assertive' );
209
210 $document.trigger( 'wp-plugin-bulk-install-error', response );
211 } else {
212 var $card = $( '.plugin-card-' + response.slug ),
213 $button = $card.find( '.install-now' ),
214 errorMessage;
215
216 if ( ! wp.updates.isValidResponse( response, 'install' ) ) {
217 return;
218 }
219
220 if ( wp.updates.maybeHandleCredentialError( response, 'everest_forms_install_extension' ) ) {
221 return;
222 }
223
224 errorMessage = sprintf(
225 /* translators: %s: Error string for a failed installation. */
226 __( 'Installation failed: %s' ),
227 response.errorMessage
228 );
229
230 $card
231 .addClass( 'plugin-card-update-failed' )
232 .append( '<div class="notice notice-error notice-alt is-dismissible"><p>' + errorMessage + '</p></div>' );
233
234 $card.on( 'click', '.notice.is-dismissible .notice-dismiss', function() {
235
236 // Use same delay as the total duration of the notice fadeTo + slideUp animation.
237 setTimeout( function() {
238 $card
239 .removeClass( 'plugin-card-update-failed' )
240 .find( '.column-name a' ).focus();
241 }, 200 );
242 } );
243
244 $button
245 .removeClass( 'updating-message' ).addClass( 'button-disabled' )
246 .attr(
247 'aria-label',
248 sprintf(
249 /* translators: %s: Plugin name and version. */
250 _x( '%s installation failed', 'everest-forms' ),
251 $button.data( 'name' )
252 )
253 )
254 .text( __( 'Installation Failed!' ) );
255
256 wp.a11y.speak( errorMessage, 'assertive' );
257
258 $document.trigger( 'wp-plugin-install-error', response );
259 }
260 };
261
262 /**
263 * Pulls available jobs from the queue and runs them.
264 * @see https://core.trac.wordpress.org/ticket/39364
265 */
266 wp.updates.queueChecker = function() {
267 var job;
268
269 if ( wp.updates.ajaxLocked || ! wp.updates.queue.length ) {
270 return;
271 }
272
273 job = wp.updates.queue.shift();
274
275 // Handle a queue job.
276 switch ( job.action ) {
277 case 'everest_forms_install_extension':
278 wp.updates.installExtension( job.data );
279 break;
280
281 default:
282 break;
283 }
284
285 // Handle a queue job.
286 $document.trigger( 'wp-updates-queue-job', job );
287 };
288
289 $( function() {
290 var $pluginFilter = $( '#extension-filter' );
291
292 /**
293 * Click handler for extension installs.
294 *
295 * @param {Event} event Event interface.
296 */
297 $pluginFilter.on( 'click', '.extension-install .install-now', function( event ) {
298 var $button = $( event.target ),
299 pluginName = $( this ).data( 'name' );
300
301 event.preventDefault();
302
303 if ( $button.hasClass( 'updating-message' ) || $button.hasClass( 'button-disabled' ) ) {
304 return;
305 }
306
307 if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.ajaxLocked ) {
308 wp.updates.requestFilesystemCredentials( event );
309
310 $document.on( 'credential-modal-cancel', function() {
311 var $message = $( '.install-now.updating-message' );
312
313 $message
314 .removeClass( 'updating-message' )
315 .attr(
316 'aria-label',
317 sprintf(
318 /* translators: %s: Plugin name. */
319 _x( 'Install %s now', 'everest-forms' ),
320 pluginName
321 )
322 )
323 .text( __( 'Install Now' ) );
324
325 wp.a11y.speak( __( 'Update canceled.' ), 'polite' );
326 } );
327 }
328
329 wp.updates.installExtension( {
330 name: pluginName,
331 slug: $button.data( 'slug' )
332 } );
333 } );
334 } );
335 })( jQuery, window.wp );
336