PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.6.5
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.6.5
1.6.7 1.6.8 1.6.9 1.6.12 1.6.13 1.6.14 1.6.15 1.6.16 1.6.17 1.6.18 1.6.19 1.6.2 1.6.20 1.6.21 1.6.22 1.6.23 1.6.24 1.6.25 1.6.26 1.6.27 1.6.28 1.6.3 1.6.4 1.6.5 1.6.6 All 74 releases
← All changes | assets/js/weforms.js +9 -28 1.6.131.6.5 View file →
@@ -10,24 +10,9 @@
10 10 $(this).width(liw-s);
11 11 });
12 12 });
13 13 };
14 - $.fn.extend({
15 - /**
16 - * Custom jQuery serialize wrapper.
17 - *
18 - * When WordPress 5.6 increased the jQuery version to 3.5.1, the serialize function changed. Instead of
19 - * sending spaces as "+", they are sent as "%20". This wrapper is for backwards compatibility.
20 - *
21 - * @todo This function is duplicated in both the frontend and backend. Need to have the code live in
22 - * just one location.
23 - *
24 - * @since 1.6.7
25 - */
26 - weSerialize: function() {
27 - return $( this ).serialize().replaceAll( '%20', '+' );
28 - },
29 - });
14 +
30 15 window.WP_User_Frontend = {
31 16
32 17 init: function() {
33 18
@@ -322,9 +307,9 @@
322 307 e.preventDefault();
323 308
324 309 var self = $(this),
325 310 form = $(this).closest('form'),
326 - form_data = form.weSerialize() + '&action=wpuf_draft_post',
311 + form_data = form.serialize() + '&action=wpuf_draft_post',
327 312 post_id = form.find('input[type="hidden"][name="post_id"]').val();
328 313
329 314 var rich_texts = [],
330 315 val;
@@ -368,9 +353,9 @@
368 353 account_update_profile: function (e) {
369 354 e.preventDefault();
370 355 var form = $(this).closest('form');
371 356
372 - $.post(wpuf_frontend.ajaxurl, form.weSerialize(), function (res) {
357 + $.post(wpuf_frontend.ajaxurl, form.serialize(), function (res) {
373 358 if (res.success) {
374 359 form.find('.wpuf-error').hide();
375 360 form.find('.wpuf-success').show();
376 361 } else {
@@ -477,13 +462,15 @@
477 462 // remove all initial errors if any
478 463 WP_User_Frontend.removeErrors(self);
479 464 WP_User_Frontend.removeErrorNotice(self);
480 465
481 - // Validate: Required Fields
466 + // ===== Validate: Text and Textarea ========
482 467 var required = self.find('[data-required="yes"]:visible');
483 468
484 469 required.each(function(i, item) {
470 + // temp_val = $.trim($(item).val());
485 471
472 + // console.log( $(item).data('type') );
486 473 var data_type = $(item).data('type')
487 474 val = '';
488 475
489 476 switch(data_type) {
@@ -658,9 +645,9 @@
658 645
659 646 return false;
660 647 }
661 648
662 - var form_data = self.weSerialize(),
649 + var form_data = self.serialize(),
663 650 rich_texts = [];
664 651
665 652 // grab rich texts from tinyMCE
666 653 $('.wpuf-rich-validation', self).each(function (index, item) {
@@ -728,17 +715,11 @@
728 715 isValidEmail: function( email ) {
729 716 var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
730 717 return pattern.test(email);
731 718 },
732 - /**
733 - * Validate a url.
734 - *
735 - * While we could use the standard HTML5 form validator for urls, this regex does a more thorough job.
736 - *
737 - * @link https://gist.github.com/dperini/729294
738 - */
719 +
739 720 isValidURL: function(url) {
740 - var urlregex = new RegExp(/^(?:(?:https?|ftp):\/\/)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/);
721 + var urlregex = new RegExp("^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.|http:\/\/|https:\/\/){1}([0-9A-Za-z]+\.)");
741 722 return urlregex.test(url);
742 723 },
743 724
744 725 insertImage: function(button, form_id) {