Version Description
fixed quotes in values causing errors.
added plugin action links.
Download this release
Release Info
Developer | webheadllc |
Plugin | Contact Form 7 Multi-Step Forms |
Version | 3.0.2 |
Comparing to | |
See all releases |
Code changes from version 3.0.1 to 3.0.2
- contact-form-7-multi-step-module.php +80 -74
- js_src/cf7msm.js +45 -2
- readme.txt +6 -2
- resources/cf7msm.min.js +1 -1
contact-form-7-multi-step-module.php
CHANGED
@@ -1,14 +1,15 @@
|
|
1 |
<?php
|
|
|
2 |
/*
|
3 |
Plugin Name: Contact Form 7 Multi-Step Forms
|
4 |
Plugin URI: http://www.mymonkeydo.com/contact-form-7-multi-step-module/
|
5 |
Description: Enables the Contact Form 7 plugin to create multi-page, multi-step forms.
|
6 |
Author: Webhead LLC.
|
7 |
Author URI: http://webheadcoder.com
|
8 |
-
Version: 3.0.
|
9 |
Text Domain: contact-form-7-multi-step-module
|
10 |
*/
|
11 |
-
/* Copyright
|
12 |
|
13 |
This program is free software; you can redistribute it and/or
|
14 |
modify it under the terms of the GNU General Public License
|
@@ -24,81 +25,86 @@ Text Domain: contact-form-7-multi-step-module
|
|
24 |
along with this program; if not, write to the Free Software
|
25 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
26 |
*/
|
27 |
-
|
28 |
-
|
29 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
30 |
exit;
|
31 |
}
|
32 |
|
33 |
-
if ( !
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
'first-path' => 'plugins.php',
|
55 |
-
'contact' => false,
|
56 |
-
'support' => false,
|
57 |
),
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
62 |
}
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
define( '
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
)
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/*
|
4 |
Plugin Name: Contact Form 7 Multi-Step Forms
|
5 |
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: 3.0.2
|
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
|
25 |
along with this program; if not, write to the Free Software
|
26 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
27 |
*/
|
28 |
+
if ( !defined( 'ABSPATH' ) ) {
|
|
|
|
|
29 |
exit;
|
30 |
}
|
31 |
|
32 |
+
if ( !function_exists( 'cf7msm_fs' ) ) {
|
33 |
+
// Create a helper function for easy SDK access.
|
34 |
+
function cf7msm_fs()
|
35 |
+
{
|
36 |
+
global $cf7msm_fs ;
|
37 |
+
|
38 |
+
if ( !isset( $cf7msm_fs ) ) {
|
39 |
+
// Include Freemius SDK.
|
40 |
+
require_once dirname( __FILE__ ) . '/freemius/start.php';
|
41 |
+
$cf7msm_fs = fs_dynamic_init( array(
|
42 |
+
'id' => '1614',
|
43 |
+
'slug' => 'contact-form-7-multi-step-module',
|
44 |
+
'type' => 'plugin',
|
45 |
+
'public_key' => 'pk_b445061ad8b540f6a89c2c4f4df19',
|
46 |
+
'is_premium' => false,
|
47 |
+
'has_addons' => false,
|
48 |
+
'has_paid_plans' => true,
|
49 |
+
'menu' => array(
|
50 |
+
'first-path' => 'plugins.php',
|
51 |
+
'contact' => false,
|
52 |
+
'support' => false,
|
|
|
|
|
|
|
53 |
),
|
54 |
+
'is_live' => true,
|
55 |
+
) );
|
56 |
+
}
|
57 |
+
|
58 |
+
return $cf7msm_fs;
|
59 |
}
|
60 |
+
|
61 |
+
// Init Freemius.
|
62 |
+
cf7msm_fs();
|
63 |
+
// Signal that SDK was initiated.
|
64 |
+
do_action( 'cf7msm_fs_loaded' );
|
65 |
+
define( 'CF7MSM_VERSION', '3.0.2' );
|
66 |
+
define( 'CF7MSM_PLUGIN', __FILE__ );
|
67 |
+
define( 'CF7MSM_FREE_TEXT_PREFIX_RADIO', '_wpcf7_radio_free_text_' );
|
68 |
+
define( 'CF7MSM_FREE_TEXT_PREFIX_CHECKBOX', '_wpcf7_checkbox_free_text_' );
|
69 |
+
define( 'CF7MSM_MIN_CF7_VERSION', '4.8' );
|
70 |
+
define( 'CF7MSM_LEARN_MORE_URL', 'https://webheadcoder.com/contact-form-7-multi-step-forms/' );
|
71 |
+
/**
|
72 |
+
* Change update message
|
73 |
+
*/
|
74 |
+
function cf7msm_fs_custom_connect_message_on_update(
|
75 |
+
$message,
|
76 |
+
$user_first_name,
|
77 |
+
$plugin_title,
|
78 |
+
$user_login,
|
79 |
+
$site_link,
|
80 |
+
$freemius_link
|
81 |
+
)
|
82 |
+
{
|
83 |
+
$limited_time = '';
|
84 |
+
return cf7msm_kses( sprintf( __( 'Please help improve the %1$s plugin! I have chosen to use %2$s to get an idea of how users use my plugin.<br><br> If you opt-in, the administrator email and some data about your usage of %1$s will be sent to %2$s. If you skip this, that\'s okay! The plugin will still work just fine.', 'contact-form-7-multi-step-module' ), '<strong>' . $plugin_title . '</strong>', $freemius_link ) ) . $limited_time;
|
85 |
+
}
|
86 |
+
|
87 |
+
cf7msm_fs()->add_filter(
|
88 |
+
'connect_message_on_update',
|
89 |
+
'cf7msm_fs_custom_connect_message_on_update',
|
90 |
+
10,
|
91 |
+
6
|
92 |
+
);
|
93 |
+
/**
|
94 |
+
* Add account link if paying.
|
95 |
+
*/
|
96 |
+
function cf7msm_plugin_action_links( $links )
|
97 |
+
{
|
98 |
+
if ( cf7msm_fs()->is_not_paying() ) {
|
99 |
+
$links[] = '<a href="' . CF7MSM_LEARN_MORE_URL . '" target="_blank">' . __( 'Learn about PRO' ) . '</a>';
|
100 |
+
}
|
101 |
+
return $links;
|
102 |
+
}
|
103 |
+
|
104 |
+
add_filter( "plugin_action_links_" . plugin_basename( CF7MSM_PLUGIN ), 'cf7msm_plugin_action_links' );
|
105 |
+
require_once plugin_dir_path( CF7MSM_PLUGIN ) . 'cf7msm.php';
|
106 |
+
require_once plugin_dir_path( CF7MSM_PLUGIN ) . 'cf7msm-admin.php';
|
107 |
+
require_once plugin_dir_path( CF7MSM_PLUGIN ) . 'form-tags/module-multistep.php';
|
108 |
+
require_once plugin_dir_path( CF7MSM_PLUGIN ) . 'form-tags/module-session.php';
|
109 |
+
require_once plugin_dir_path( CF7MSM_PLUGIN ) . 'form-tags/module-back.php';
|
110 |
}
|
js_src/cf7msm.js
CHANGED
@@ -50,7 +50,9 @@ jQuery(document).ready(function($) {
|
|
50 |
var checkbox_field = cf7_form.find('input[name="' + key + '[]"]:not([data-cf7msm-previous])'); //value is this or this or tihs
|
51 |
if (field.length > 0) {
|
52 |
if ( field.prop('type') == 'radio' || field.prop('type') == 'checkbox' ) {
|
53 |
-
field.filter(
|
|
|
|
|
54 |
}
|
55 |
else {
|
56 |
field.val(val);
|
@@ -65,7 +67,9 @@ jQuery(document).ready(function($) {
|
|
65 |
//checkbox
|
66 |
if ( val != '' && val.length > 0 ) {
|
67 |
$.each(val, function(i, v){
|
68 |
-
checkbox_field.filter(
|
|
|
|
|
69 |
});
|
70 |
}
|
71 |
}
|
@@ -178,3 +182,42 @@ Storage.prototype.getObject = function(key) {
|
|
178 |
var value = this.getItem(key);
|
179 |
return value && JSON.parse(value);
|
180 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
var checkbox_field = cf7_form.find('input[name="' + key + '[]"]:not([data-cf7msm-previous])'); //value is this or this or tihs
|
51 |
if (field.length > 0) {
|
52 |
if ( field.prop('type') == 'radio' || field.prop('type') == 'checkbox' ) {
|
53 |
+
field.filter(function(){
|
54 |
+
return $(this).val() == val;
|
55 |
+
}).prop('checked', true);
|
56 |
}
|
57 |
else {
|
58 |
field.val(val);
|
67 |
//checkbox
|
68 |
if ( val != '' && val.length > 0 ) {
|
69 |
$.each(val, function(i, v){
|
70 |
+
checkbox_field.filter(function(){
|
71 |
+
return $(this).val() == v;
|
72 |
+
}).prop('checked', true);
|
73 |
});
|
74 |
}
|
75 |
}
|
182 |
var value = this.getItem(key);
|
183 |
return value && JSON.parse(value);
|
184 |
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Escape values when inserting into HTML attributes
|
188 |
+
* From SO: https://stackoverflow.com/questions/7753448/how-do-i-escape-quotes-in-html-attribute-values
|
189 |
+
*/
|
190 |
+
function quoteattr(s, preserveCR) {
|
191 |
+
preserveCR = preserveCR ? ' ' : '\n';
|
192 |
+
return ('' + s) /* Forces the conversion to string. */
|
193 |
+
.replace(/&/g, '&') /* This MUST be the 1st replacement. */
|
194 |
+
.replace(/'/g, ''') /* The 4 other predefined entities, required. */
|
195 |
+
.replace(/"/g, '"')
|
196 |
+
.replace(/</g, '<')
|
197 |
+
.replace(/>/g, '>')
|
198 |
+
/*
|
199 |
+
You may add other replacements here for HTML only
|
200 |
+
(but it's not necessary).
|
201 |
+
Or for XML, only if the named entities are defined in its DTD.
|
202 |
+
*/
|
203 |
+
.replace(/\r\n/g, preserveCR) /* Must be before the next replacement. */
|
204 |
+
.replace(/[\r\n]/g, preserveCR);
|
205 |
+
;
|
206 |
+
}
|
207 |
+
/**
|
208 |
+
* Escape values when using in javascript first.
|
209 |
+
* From SO: https://stackoverflow.com/questions/7753448/how-do-i-escape-quotes-in-html-attribute-values
|
210 |
+
*/
|
211 |
+
function escapeattr(s) {
|
212 |
+
return ('' + s) /* Forces the conversion to string. */
|
213 |
+
.replace(/\\/g, '\\\\') /* This MUST be the 1st replacement. */
|
214 |
+
.replace(/\t/g, '\\t') /* These 2 replacements protect whitespaces. */
|
215 |
+
.replace(/\n/g, '\\n')
|
216 |
+
.replace(/\u00A0/g, '\\u00A0') /* Useful but not absolutely necessary. */
|
217 |
+
.replace(/&/g, '\\x26') /* These 5 replacements protect from HTML/XML. */
|
218 |
+
.replace(/'/g, '\\x27')
|
219 |
+
.replace(/"/g, '\\x22')
|
220 |
+
.replace(/</g, '\\x3C')
|
221 |
+
.replace(/>/g, '\\x3E')
|
222 |
+
;
|
223 |
+
}
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: webheadllc
|
|
3 |
Donate Link: https://webheadcoder.com/donate-cf7-multi-step-forms
|
4 |
Tags: contact form 7, multistep form, form, multiple pages, store form, contact, multi, step
|
5 |
Requires at least: 4.7
|
6 |
-
Tested up to: 4.9.
|
7 |
-
Stable tag: 3.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -101,6 +101,10 @@ The `multistep` form tag is a hidden field and tries not to add any spacing to y
|
|
101 |
|
102 |
== Changelog ==
|
103 |
|
|
|
|
|
|
|
|
|
104 |
= 3.0.1 =
|
105 |
fixed session storage not clearing after final step was submitted.
|
106 |
fixed form not hiding after final step was submitted. Thanks to @tschodde.
|
3 |
Donate Link: https://webheadcoder.com/donate-cf7-multi-step-forms
|
4 |
Tags: contact form 7, multistep form, form, multiple pages, store form, contact, multi, step
|
5 |
Requires at least: 4.7
|
6 |
+
Tested up to: 4.9.3
|
7 |
+
Stable tag: 3.0.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
101 |
|
102 |
== Changelog ==
|
103 |
|
104 |
+
= 3.0.2 =
|
105 |
+
fixed quotes in values causing errors.
|
106 |
+
added plugin action links.
|
107 |
+
|
108 |
= 3.0.1 =
|
109 |
fixed session storage not clearing after final step was submitted.
|
110 |
fixed form not hiding after final step was submitted. Thanks to @tschodde.
|
resources/cf7msm.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function cf7msm_uniqueArray(e,
|
1 |
+
function cf7msm_uniqueArray(e,t){for(h={},n=[],a=2;a--;e=t)e.map(function(e){h[e]=h[e]||n.push(e)});return n}function cf7msm_hasSS(){var e="test";try{return sessionStorage.setItem(e,e),sessionStorage.removeItem(e),!0}catch(e){return!1}}function quoteattr(e,t){return t=t?" ":"\n",(""+e).replace(/&/g,"&").replace(/'/g,"'").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">").replace(/\r\n/g,t).replace(/[\r\n]/g,t)}function escapeattr(e){return(""+e).replace(/\\/g,"\\\\").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\u00A0/g,"\\u00A0").replace(/&/g,"\\x26").replace(/'/g,"\\x27").replace(/"/g,"\\x22").replace(/</g,"\\x3C").replace(/>/g,"\\x3E")}var cf7msm_ss;jQuery(document).ready(function($){var e=cf7msm_posted_data,t=$("input[name='cf7msm-step']");if(0!=t.length){if(cf7msm_hasSS()){if(null!=(cf7msm_ss=sessionStorage.getObject("cf7msm"))&&t.length>0){var s=$(t[0].form);$.each(cf7msm_ss,function(e,n){"cf7msm_prev_urls"==e&&s.find(".wpcf7-back, .wpcf7-previous").click(function(e){window.location.href=n[t.val()],e.preventDefault()})})}}else $("input[name='cf7msm-no-ss']").val(1),$(".wpcf7-previous").hide();if(e){var s=$(t[0].form);$.each(e,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){var n=s.find('*[name="'+e+'"]:not([data-cf7msm-previous])'),r=s.find('input[name="'+e+'[]"]:not([data-cf7msm-previous])');n.length>0?"radio"==n.prop("type")||"checkbox"==n.prop("type")?n.filter(function(){return $(this).val()==t}).prop("checked",!0):n.val(t):r.length>0&&t.constructor===Array&&""!=t&&t.length>0&&$.each(t,function(e,t){r.filter(function(){return $(this).val()==t}).prop("checked",!0)})}})}document.addEventListener("wpcf7mailsent",function(e){if(cf7msm_hasSS()){var t=0,s=0,n=[],r={};cf7msm_ss=sessionStorage.getObject("cf7msm"),cf7msm_ss||(cf7msm_ss={}),$.each(e.detail.inputs,function(c){var a=e.detail.inputs[c].name,f=e.detail.inputs[c].value;if(a.indexOf("[]")===a.length-2?(-1===$.inArray(a,n)&&(r[a]=[]),r[a].push(f)):r[a]=f,"cf7msm-step"===a){if(-1!==f.indexOf("-")){var i={};cf7msm_ss&&cf7msm_ss.cf7msm_prev_urls&&(i=cf7msm_ss.cf7msm_prev_urls);var m=f.split("-");if(t=parseInt(m[0]),s=parseInt(m[1]),nextUrl=m[2],t<s){var o=1+parseInt(t)+"-"+s;i[o]=window.location.href,$("#"+e.detail.unitTag).find("div.wpcf7-mail-sent-ok").remove()}else t===s&&$("#"+e.detail.unitTag+" form").children().not("div.wpcf7-response-output").hide();cf7msm_ss.cf7msm_prev_urls=i}}else n.push(a)}),0!=t&&t===s&&(cf7msm_ss={}),sessionStorage.setObject("cf7msm",cf7msm_ss)}},!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)};
|