Contact Form 7 Multi-Step Forms - Version 4.1.7

Version Description

  • fixed next url to support external urls.
Download this release

Release Info

Developer webheadllc
Plugin Icon 128x128 Contact Form 7 Multi-Step Forms
Version 4.1.7
Comparing to
See all releases

Code changes from version 4.1.6 to 4.1.7

contact-form-7-multi-step-module.php CHANGED
@@ -6,10 +6,10 @@ Plugin URI: http://www.mymonkeydo.com/contact-form-7-multi-step-module/
6
  Description: Enables the Contact Form 7 plugin to create multi-page, multi-step forms.
7
  Author: Webhead LLC.
8
  Author URI: http://webheadcoder.com
9
- Version: 4.1.6
10
  Text Domain: contact-form-7-multi-step-module
11
  */
12
- /* Copyright 2018 Webhead LLC (email: info at webheadcoder.com)
13
 
14
  This program is free software; you can redistribute it and/or
15
  modify it under the terms of the GNU General Public License
@@ -68,7 +68,7 @@ if ( function_exists( 'cf7msm_fs' ) ) {
68
  cf7msm_fs();
69
  // Signal that SDK was initiated.
70
  do_action( 'cf7msm_fs_loaded' );
71
- define( 'CF7MSM_VERSION', '4.1.6' );
72
  define( 'CF7MSM_PLUGIN', __FILE__ );
73
  define( 'CF7MSM_FREE_TEXT_PREFIX_RADIO', '_wpcf7_radio_free_text_' );
74
  define( 'CF7MSM_FREE_TEXT_PREFIX_CHECKBOX', '_wpcf7_checkbox_free_text_' );
6
  Description: Enables the Contact Form 7 plugin to create multi-page, multi-step forms.
7
  Author: Webhead LLC.
8
  Author URI: http://webheadcoder.com
9
+ Version: 4.1.7
10
  Text Domain: contact-form-7-multi-step-module
11
  */
12
+ /* Copyright 2021 Webhead LLC (email: info at webheadcoder.com)
13
 
14
  This program is free software; you can redistribute it and/or
15
  modify it under the terms of the GNU General Public License
68
  cf7msm_fs();
69
  // Signal that SDK was initiated.
70
  do_action( 'cf7msm_fs_loaded' );
71
+ define( 'CF7MSM_VERSION', '4.1.7' );
72
  define( 'CF7MSM_PLUGIN', __FILE__ );
73
  define( 'CF7MSM_FREE_TEXT_PREFIX_RADIO', '_wpcf7_radio_free_text_' );
74
  define( 'CF7MSM_FREE_TEXT_PREFIX_CHECKBOX', '_wpcf7_checkbox_free_text_' );
js_src/cf7msm.js CHANGED
@@ -319,12 +319,16 @@ var cf7msm_ss;
319
  }
320
 
321
  if (nextUrl && nextUrl != '') {
 
 
 
 
322
  var steps_prev_urls = {};
323
  if ( cf7msm_ss && cf7msm_ss.cf7msm_prev_urls ) {
324
  steps_prev_urls = cf7msm_ss.cf7msm_prev_urls;
325
  }
326
  var startOfUrl = window.location.protocol + "//" + window.location.host;
327
- if ( nextUrl.indexOf( startOfUrl ) !== 0 ) {
328
  if (nextUrl.indexOf('/') !== 0 ) {
329
  startOfUrl += '/';
330
  }
319
  }
320
 
321
  if (nextUrl && nextUrl != '') {
322
+ var parser = document.createElement('a');
323
+ parser.href = nextUrl;
324
+ var nextUrlHostName = parser.hostname ? parser.hostname : '';
325
+
326
  var steps_prev_urls = {};
327
  if ( cf7msm_ss && cf7msm_ss.cf7msm_prev_urls ) {
328
  steps_prev_urls = cf7msm_ss.cf7msm_prev_urls;
329
  }
330
  var startOfUrl = window.location.protocol + "//" + window.location.host;
331
+ if ( nextUrl.indexOf( startOfUrl ) !== 0 && (nextUrlHostName == '' || nextUrlHostName == window.location.host)) {
332
  if (nextUrl.indexOf('/') !== 0 ) {
333
  startOfUrl += '/';
334
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate Link: https://webheadcoder.com/donate-cf7-multi-step-forms
4
  Tags: contact form 7, multistep form, form, multiple pages, contact, multi, step
5
  Requires at least: 4.7
6
  Tested up to: 5.8
7
- Stable tag: 4.1.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -135,6 +135,9 @@ When checkboxes are not checked they aren't submitted through the form so the la
135
 
136
  == Changelog ==
137
 
 
 
 
138
  = 4.1.6 =
139
  * fixed conditional fields not trigerring after form population.
140
  * fixed 500 error due to conflict with Conditional Fields plugin expecting an array in cookie values.
4
  Tags: contact form 7, multistep form, form, multiple pages, contact, multi, step
5
  Requires at least: 4.7
6
  Tested up to: 5.8
7
+ Stable tag: 4.1.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
135
 
136
  == Changelog ==
137
 
138
+ = 4.1.7 =
139
+ * fixed next url to support external urls.
140
+
141
  = 4.1.6 =
142
  * fixed conditional fields not trigerring after form population.
143
  * fixed 500 error due to conflict with Conditional Fields plugin expecting an array in cookie values.
resources/cf7msm.min.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){for(var n in t)e[n]=t[n]}(window,function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}({6:function(e,t,n){e.exports=n(7)},7:function(e,t,n){"use strict";n.r(t);var r,i;n(8);function o(){try{return sessionStorage.setItem("test","test"),sessionStorage.removeItem("test"),!0}catch(e){return!1}}i=jQuery,document.addEventListener("DOMContentLoaded",e=>{var t=cf7msm_posted_data,n=i("input[name='_cf7msm_multistep_tag']"),s=n.length>0;if(s||(s=(n=i("input[name='cf7msm-step']")).length>0),s){var a=n.closest("form"),f=a.find('input[name="_wpcf7"]').val();o()?null!=(r=sessionStorage.getObject("cf7msm"))&&i.each(r,(function(e,t){if("cf7msm_prev_urls"==e){var n=a.find(".wpcf7-back, .wpcf7-previous"),r=window.location.href,i=r.replace(/\/$/,""),o=!t.hasOwnProperty(r)||""==t[r];o&&(o=!t.hasOwnProperty(i)||""==t[i]),o&&(r=r.split("?")[0],i=r.replace(/\/$/,""),(o=!t.hasOwnProperty(r)||""==t[r])&&(o=!t.hasOwnProperty(i)||""==t[i])),o?n.hide():n.click((function(e){t.hasOwnProperty(r)&&""!=t[r]?window.location.href=t[r]:t.hasOwnProperty(i)&&""!=t[i]?window.location.href=t[i]:window.history.go(-1),e.preventDefault()}))}})):(i("input[name='cf7msm-no-ss']").val(1),i(".wpcf7-previous").hide());var c=wpcf7.submit;wpcf7.submit=function(e,t){!function(e){!function(e){var t=e;t instanceof jQuery||(t=i(e));var n=t.find("input[name='_cf7msm_multistep_tag']");0!=n.length&&(n.length>1&&(n=n.last()),i("<input />",{type:"hidden",name:"cf7msm_options",value:n.val()}).appendTo(t))}(e)}(e),c(e,t)},window.addEventListener("load",(function(){t&&(i.each(t,(function(e,t){if(e.indexOf("[]")===e.length-2&&(e=e.substring(0,e.length-2)),(0!=e.indexOf("_")||0==e.indexOf("_wpcf7_radio_free_text_")||0==e.indexOf("_wpcf7_checkbox_free_text_"))&&"cf7msm-step"!=e&&"cf7msm_options"!=e){var n=a.find('*[name="'+e+'"]:not([data-cf7msm-previous])'),r=a.find('input[name="'+e+'[]"]:not([data-cf7msm-previous])'),o=a.find('select[name="'+e+'[]"]:not([data-cf7msm-previous])');n.length>0?"radio"==n.prop("type")||"checkbox"==n.prop("type")?n.filter((function(){return i(this).val()==t})).prop("checked",!0):n.is("select")?n.find("option").filter((function(){return this.value==t})).attr("selected","selected"):n.val(t):r.length>0&&t.constructor===Array?""!=t&&t.length>0&&i.each(t,(function(e,t){r.filter((function(){return i(this).val()==t})).prop("checked",!0)})):o.length>0&&t.constructor===Array&&""!=t&&t.length>0&&i.each(t,(function(e,t){o.find("option").filter((function(){return this.value==t})).attr("selected","selected")}))}})),a.find('input[name="_wpcf7cf_options"]').trigger("change"))})),document.addEventListener("wpcf7mailsent",(function(e){if(o()){var t=0,n=0,s=[],a={};(r=sessionStorage.getObject("cf7msm"))||(r={});var c=!1,u=!1,p=!0,l=!1,d=null,m=!1;if(i.each(e.detail.inputs,(function(r){var o=e.detail.inputs[r].name,v=e.detail.inputs[r].value;if(o.indexOf("[]")===o.length-2?(-1===i.inArray(o,s)&&(a[o]=[]),a[o].push(v)):a[o]=v,"cf7msm-step"===o){if(-1!==v.indexOf("-")){c=!0,u=!1;var h=v.split("-");t=parseInt(h[0]),n=parseInt(h[1]),void 0!==cf7msm_redirect_urls[f]&&(d=cf7msm_redirect_urls[f]),t<n?p=!1:t===n&&(l=!0)}}else if("cf7msm_options"===o){c=!0,u=!0,p=!1;var w=JSON.parse(v);w.hasOwnProperty("next_url")&&(d=w.next_url),w.hasOwnProperty("last_step")&&(m=!0,d&&""!==d||(l=!0,p=!0))}else s.push(o)})),!c)return;if(!p){var v=i("#"+e.detail.unitTag).find("div.wpcf7-mail-sent-ok");0==v.length&&(v=i("#"+e.detail.unitTag).find(".wpcf7-response-output")),v.remove()}if(l){var h=i("#"+e.detail.unitTag+" form");h.find("*").not("div.wpcf7-response-output").hide(),h.find("div.wpcf7-response-output").parentsUntil("form").show()}if(u?m&&(r={}):0!=t&&t===n&&(r={}),d&&""!=d){var w={};r&&r.cf7msm_prev_urls&&(w=r.cf7msm_prev_urls);var _=window.location.protocol+"//"+window.location.host;0!==d.indexOf(_)&&(0!==d.indexOf("/")&&(_+="/"),d=_+d),w[d]=window.location.href;var g=d.split("?")[0];d!=g&&(w[g]=window.location.href),r.cf7msm_prev_urls=w}sessionStorage.setObject("cf7msm",r),d&&""!=d&&(window.location.href=d)}}),!1)}}),Storage.prototype.setObject=function(e,t){this.setItem(e,JSON.stringify(t))},Storage.prototype.getObject=function(e){var t=this.getItem(e);return t&&JSON.parse(t)}},8:function(e,t,n){}}));
1
+ !function(e,t){for(var n in t)e[n]=t[n]}(window,function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}({6:function(e,t,n){e.exports=n(7)},7:function(e,t,n){"use strict";n.r(t);var r,o;n(8);function i(){try{return sessionStorage.setItem("test","test"),sessionStorage.removeItem("test"),!0}catch(e){return!1}}o=jQuery,document.addEventListener("DOMContentLoaded",e=>{var t=cf7msm_posted_data,n=o("input[name='_cf7msm_multistep_tag']"),s=n.length>0;if(s||(s=(n=o("input[name='cf7msm-step']")).length>0),s){var a=n.closest("form"),f=a.find('input[name="_wpcf7"]').val();i()?null!=(r=sessionStorage.getObject("cf7msm"))&&o.each(r,(function(e,t){if("cf7msm_prev_urls"==e){var n=a.find(".wpcf7-back, .wpcf7-previous"),r=window.location.href,o=r.replace(/\/$/,""),i=!t.hasOwnProperty(r)||""==t[r];i&&(i=!t.hasOwnProperty(o)||""==t[o]),i&&(r=r.split("?")[0],o=r.replace(/\/$/,""),(i=!t.hasOwnProperty(r)||""==t[r])&&(i=!t.hasOwnProperty(o)||""==t[o])),i?n.hide():n.click((function(e){t.hasOwnProperty(r)&&""!=t[r]?window.location.href=t[r]:t.hasOwnProperty(o)&&""!=t[o]?window.location.href=t[o]:window.history.go(-1),e.preventDefault()}))}})):(o("input[name='cf7msm-no-ss']").val(1),o(".wpcf7-previous").hide());var c=wpcf7.submit;wpcf7.submit=function(e,t){!function(e){!function(e){var t=e;t instanceof jQuery||(t=o(e));var n=t.find("input[name='_cf7msm_multistep_tag']");0!=n.length&&(n.length>1&&(n=n.last()),o("<input />",{type:"hidden",name:"cf7msm_options",value:n.val()}).appendTo(t))}(e)}(e),c(e,t)},window.addEventListener("load",(function(){t&&(o.each(t,(function(e,t){if(e.indexOf("[]")===e.length-2&&(e=e.substring(0,e.length-2)),(0!=e.indexOf("_")||0==e.indexOf("_wpcf7_radio_free_text_")||0==e.indexOf("_wpcf7_checkbox_free_text_"))&&"cf7msm-step"!=e&&"cf7msm_options"!=e){var n=a.find('*[name="'+e+'"]:not([data-cf7msm-previous])'),r=a.find('input[name="'+e+'[]"]:not([data-cf7msm-previous])'),i=a.find('select[name="'+e+'[]"]:not([data-cf7msm-previous])');n.length>0?"radio"==n.prop("type")||"checkbox"==n.prop("type")?n.filter((function(){return o(this).val()==t})).prop("checked",!0):n.is("select")?n.find("option").filter((function(){return this.value==t})).attr("selected","selected"):n.val(t):r.length>0&&t.constructor===Array?""!=t&&t.length>0&&o.each(t,(function(e,t){r.filter((function(){return o(this).val()==t})).prop("checked",!0)})):i.length>0&&t.constructor===Array&&""!=t&&t.length>0&&o.each(t,(function(e,t){i.find("option").filter((function(){return this.value==t})).attr("selected","selected")}))}})),a.find('input[name="_wpcf7cf_options"]').trigger("change"))})),document.addEventListener("wpcf7mailsent",(function(e){if(i()){var t=0,n=0,s=[],a={};(r=sessionStorage.getObject("cf7msm"))||(r={});var c=!1,u=!1,p=!0,l=!1,d=null,m=!1;if(o.each(e.detail.inputs,(function(r){var i=e.detail.inputs[r].name,h=e.detail.inputs[r].value;if(i.indexOf("[]")===i.length-2?(-1===o.inArray(i,s)&&(a[i]=[]),a[i].push(h)):a[i]=h,"cf7msm-step"===i){if(-1!==h.indexOf("-")){c=!0,u=!1;var v=h.split("-");t=parseInt(v[0]),n=parseInt(v[1]),void 0!==cf7msm_redirect_urls[f]&&(d=cf7msm_redirect_urls[f]),t<n?p=!1:t===n&&(l=!0)}}else if("cf7msm_options"===i){c=!0,u=!0,p=!1;var w=JSON.parse(h);w.hasOwnProperty("next_url")&&(d=w.next_url),w.hasOwnProperty("last_step")&&(m=!0,d&&""!==d||(l=!0,p=!0))}else s.push(i)})),!c)return;if(!p){var h=o("#"+e.detail.unitTag).find("div.wpcf7-mail-sent-ok");0==h.length&&(h=o("#"+e.detail.unitTag).find(".wpcf7-response-output")),h.remove()}if(l){var v=o("#"+e.detail.unitTag+" form");v.find("*").not("div.wpcf7-response-output").hide(),v.find("div.wpcf7-response-output").parentsUntil("form").show()}if(u?m&&(r={}):0!=t&&t===n&&(r={}),d&&""!=d){var w=document.createElement("a");w.href=d;var _=w.hostname?w.hostname:"",g={};r&&r.cf7msm_prev_urls&&(g=r.cf7msm_prev_urls);var y=window.location.protocol+"//"+window.location.host;0===d.indexOf(y)||""!=_&&_!=window.location.host||(0!==d.indexOf("/")&&(y+="/"),d=y+d),g[d]=window.location.href;var O=d.split("?")[0];d!=O&&(g[O]=window.location.href),r.cf7msm_prev_urls=g}sessionStorage.setObject("cf7msm",r),d&&""!=d&&(window.location.href=d)}}),!1)}}),Storage.prototype.setObject=function(e,t){this.setItem(e,JSON.stringify(t))},Storage.prototype.getObject=function(e){var t=this.getItem(e);return t&&JSON.parse(t)}},8:function(e,t,n){}}));