Conditional Fields for Contact Form 7 - Version 1.9.1

Version Description

Download this release

Release Info

Developer Jules Colle
Plugin Icon 128x128 Conditional Fields for Contact Form 7
Version 1.9.1
Comparing to
See all releases

Code changes from version 1.9 to 1.9.1

trunk/Wpcf7cfMailParser.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ //require_once __DIR__.'/init.php';
4
+
5
+ class Wpcf7cfMailParser {
6
+ private $mail_body;
7
+ private $visible_groups;
8
+ private $hidden_groups;
9
+ private $repeaters;
10
+ private $posted_data;
11
+
12
+ function __construct($mail_body, $visible_groups, $hidden_groups, $repeaters, $posted_data) {
13
+ $this->mail_body = $mail_body;
14
+ $this->visible_groups = $visible_groups;
15
+ $this->hidden_groups = $hidden_groups;
16
+ $this->repeaters = $repeaters;
17
+ $this->posted_data = $posted_data;
18
+ }
19
+
20
+ public function getParsedMail() {
21
+ return preg_replace_callback(WPCF7CF_REGEX_MAIL_GROUP, array($this, 'hide_hidden_mail_fields_regex_callback'), $this->mail_body );
22
+ }
23
+
24
+ function hide_hidden_mail_fields_regex_callback ( $matches ) {
25
+ $name = $matches[1];
26
+
27
+ $name_parts = explode('__', $name);
28
+
29
+ $name_root = array_shift($name_parts);
30
+ $name_suffix = implode('__',$name_parts);
31
+
32
+ $content = $matches[2];
33
+ if ( in_array( $name, $this->hidden_groups ) ) {
34
+
35
+ // The tag name represents a hidden group, so replace everything from [tagname] to [/tagname] with nothing
36
+ return '';
37
+
38
+ } elseif ( in_array( $name, $this->visible_groups ) ) {
39
+
40
+ // The tag name represents a visible group, so remove the tags themselves, but return everything else
41
+ // ( instead of just returning the $content, return the preg_replaced content )
42
+ return preg_replace_callback(WPCF7CF_REGEX_MAIL_GROUP, array($this, 'hide_hidden_mail_fields_regex_callback'), $content );
43
+
44
+ } elseif ( $this->repeaters !== null && in_array( $name, $this->repeaters ) ) {
45
+
46
+ $original_name = explode('__',$name)[0];
47
+
48
+ $inner_template = $content;
49
+
50
+ ob_start();
51
+
52
+ $num_subs = $this->posted_data[$name.'_count'];
53
+
54
+ for ($i=1; $i<=$num_subs; $i++) {
55
+ $str = preg_replace(["/\[{$original_name}\:index[^\]]*?\]/"],$i,$inner_template);
56
+ //echo str_replace(']','__'.$i.']',$str);
57
+ echo preg_replace("/\[([^\s^\]]*?)([\s\]]+)([^\]]*?)/", "[$1__{$i}$2",$str);
58
+ }
59
+
60
+ $underscored_content = ob_get_clean();
61
+
62
+ return preg_replace_callback(WPCF7CF_REGEX_MAIL_GROUP, array($this, 'hide_hidden_mail_fields_regex_callback'), $underscored_content );
63
+
64
+ }else {
65
+
66
+ // The tag name doesn't represent a group that was used in the form. Leave it alone (return the entire match).
67
+ return $matches[0];
68
+
69
+ }
70
+ }
71
+ }
trunk/admin-style.css ADDED
@@ -0,0 +1,226 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #wpcf7cf-new-entry {
2
+ display: inline-block;
3
+ display: none; }
4
+
5
+ #wpcf7cf-delete-button {
6
+ display: none; }
7
+
8
+ #wpcf7cf-settings-text {
9
+ width: 100%;
10
+ height: 280px;
11
+ font-family: "Courier New", Courier, monospace; }
12
+
13
+ #wpcf7cf-conditional-panel {
14
+ overflow-x: auto; }
15
+ #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .label, #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .field, #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .description {
16
+ padding: 10px;
17
+ display: inline-block;
18
+ vertical-align: middle;
19
+ width: 10%; }
20
+ #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .field {
21
+ width: 20%; }
22
+ #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .description {
23
+ width: 40%;
24
+ vertical-align: top; }
25
+ #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line {
26
+ border-bottom: 1px solid #dddddd;
27
+ background-color: #f9f9f9;
28
+ padding: 0 10px; }
29
+ #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line:nth-child(2n) {
30
+ background-color: #e9e9e9; }
31
+ #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line input, #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line select {
32
+ width: 100%; }
33
+ #wpcf7cf-conditional-panel .ui-autocomplete-term {
34
+ font-weight: bold; }
35
+ #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line > .label.editable {
36
+ position: relative; }
37
+ #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line > .label.editable input {
38
+ background-color: transparent;
39
+ border-width: 0;
40
+ outline: none;
41
+ box-shadow: none;
42
+ padding: 0; }
43
+ #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line > .label.editable input:after {
44
+ content: "edit";
45
+ display: block;
46
+ width: 10px;
47
+ right: 0;
48
+ position: absolute; }
49
+ #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line > .label.editable input:focus {
50
+ background: #fff;
51
+ box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.07);
52
+ border: 1px solid #ddd;
53
+ padding: 2px; }
54
+ #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line > .label.editable input:focus:after {
55
+ content: ""; }
56
+ #wpcf7cf-conditional-panel .wpcf7cf-and {
57
+ display: inline-block; }
58
+ #wpcf7cf-conditional-panel .wpcf7cf-and-rules, #wpcf7cf-conditional-panel .wpcf7cf-if {
59
+ display: inline-block;
60
+ vertical-align: top; }
61
+ #wpcf7cf-conditional-panel #wpcf7cf-entries input, #wpcf7cf-conditional-panel #wpcf7cf-entries select, #wpcf7cf-conditional-panel .and-button, #wpcf7cf-conditional-panel .delete-button, #wpcf7cf-conditional-panel #wpcf7cf-entries .if-txt, #wpcf7cf-conditional-panel #wpcf7cf-entries .label, #wpcf7cf-conditional-panel #wpcf7cf-add-button {
62
+ position: relative;
63
+ display: inline-block;
64
+ vertical-align: bottom;
65
+ margin: 2px;
66
+ padding: 3px;
67
+ background: #fefefe;
68
+ border: 1px solid #bababa;
69
+ box-shadow: none;
70
+ height: 22px;
71
+ line-height: 22px;
72
+ box-sizing: content-box; }
73
+ #wpcf7cf-conditional-panel #wpcf7cf-entries .label {
74
+ background-color: transparent;
75
+ border: none; }
76
+ #wpcf7cf-conditional-panel .and-button, #wpcf7cf-conditional-panel .delete-button, #wpcf7cf-conditional-panel #wpcf7cf-add-button {
77
+ border: 1px solid #4ed521;
78
+ color: #007b04;
79
+ cursor: pointer;
80
+ font-size: 11px;
81
+ font-weight: bold;
82
+ -webkit-touch-callout: none;
83
+ /* iOS Safari */
84
+ -webkit-user-select: none;
85
+ /* Safari */
86
+ -khtml-user-select: none;
87
+ /* Konqueror HTML */
88
+ -moz-user-select: none;
89
+ /* Firefox */
90
+ -ms-user-select: none;
91
+ /* Internet Explorer/Edge */
92
+ user-select: none;
93
+ /* Non-prefixed version, currently */
94
+ background-color: rgba(75, 169, 61, 0.11); }
95
+ #wpcf7cf-conditional-panel #wpcf7cf-add-button {
96
+ margin-top: 10px;
97
+ text-align: center;
98
+ padding-left: 20px;
99
+ padding-right: 20px; }
100
+ #wpcf7cf-conditional-panel .and-button:hover {
101
+ background-color: rgba(75, 169, 61, 0.2); }
102
+ #wpcf7cf-conditional-panel .delete-button {
103
+ border: 1px solid #bababa;
104
+ color: #858585;
105
+ background-color: transparent;
106
+ margin-left: 42px; }
107
+ #wpcf7cf-conditional-panel .delete-button:hover {
108
+ background-color: rgba(133, 133, 133, 0.11); }
109
+ #wpcf7cf-conditional-panel .and-button {
110
+ display: none;
111
+ width: 30px;
112
+ text-align: center; }
113
+ #wpcf7cf-conditional-panel .wpcf7cf-and-rule:first-child .and-button {
114
+ display: inline-block;
115
+ vertical-align: top;
116
+ height: 22px;
117
+ position: absolute;
118
+ line-height: 22px;
119
+ right: 50px;
120
+ top: 0; }
121
+ #wpcf7cf-conditional-panel .wpcf7cf-and-rule {
122
+ margin-bottom: 4px;
123
+ height: 30px; }
124
+ #wpcf7cf-conditional-panel .wpcf7cf-and-rule .if-txt, #wpcf7cf-conditional-panel .wpcf7cf-if > .label {
125
+ cursor: n-resize; }
126
+ #wpcf7cf-conditional-panel .wpcf7cf-and-rule .if-txt:before {
127
+ content: 'and';
128
+ position: absolute;
129
+ width: 30px;
130
+ text-align: right;
131
+ left: -34px; }
132
+ #wpcf7cf-conditional-panel .wpcf7cf-and-rule:first-child .if-txt:before {
133
+ display: none; }
134
+ #wpcf7cf-conditional-panel .wpcf7cf-inner-container {
135
+ min-width: 800px; }
136
+ #wpcf7cf-conditional-panel .entry {
137
+ box-sizing: border-box;
138
+ display: flex; }
139
+ #wpcf7cf-conditional-panel .entry .wpcf7cf-if {
140
+ width: 188px; }
141
+ #wpcf7cf-conditional-panel .then-field-select {
142
+ width: 130px; }
143
+ #wpcf7cf-conditional-panel .entry .wpcf7cf-and-rules {
144
+ flex: 1;
145
+ position: relative; }
146
+ #wpcf7cf-conditional-panel .wpcf7cf-and-rule {
147
+ display: flex; }
148
+ #wpcf7cf-conditional-panel .if-txt {
149
+ width: 14px;
150
+ text-align: center; }
151
+ #wpcf7cf-conditional-panel .operator {
152
+ /*width:140px;*/ }
153
+ #wpcf7cf-conditional-panel .if-value {
154
+ flex: 1;
155
+ margin-right: 3px !important; }
156
+
157
+ .wpcf7cf-list li {
158
+ list-style: disc;
159
+ margin-left: 20px; }
160
+
161
+ /* The switch - the box around the slider */
162
+ .wpcf7cf-switch {
163
+ position: absolute;
164
+ display: block;
165
+ top: 20px;
166
+ right: 20px; }
167
+ .wpcf7cf-switch .label {
168
+ margin-right: 4px;
169
+ display: inline-block;
170
+ vertical-align: top; }
171
+ .wpcf7cf-switch .switch {
172
+ position: relative;
173
+ display: inline-block;
174
+ width: 30px;
175
+ height: 17px;
176
+ /* Hide default HTML checkbox */
177
+ /* The slider */
178
+ /* Rounded sliders */ }
179
+ .wpcf7cf-switch .switch input {
180
+ opacity: 0;
181
+ width: 0;
182
+ height: 0; }
183
+ .wpcf7cf-switch .switch .slider {
184
+ position: absolute;
185
+ cursor: pointer;
186
+ top: 0;
187
+ left: 0;
188
+ right: 0;
189
+ bottom: 0;
190
+ background-color: #ccc;
191
+ -webkit-transition: .4s;
192
+ transition: .4s; }
193
+ .wpcf7cf-switch .switch .slider:before {
194
+ position: absolute;
195
+ content: "";
196
+ height: 13px;
197
+ width: 13px;
198
+ left: 2px;
199
+ bottom: 2px;
200
+ background-color: white;
201
+ -webkit-transition: .4s;
202
+ transition: .3s; }
203
+ .wpcf7cf-switch .switch input:checked + .slider {
204
+ background-color: #1e8cbe; }
205
+ .wpcf7cf-switch .switch input:focus + .slider {
206
+ box-shadow: 0 0 1px #1e8cbe; }
207
+ .wpcf7cf-switch .switch input:checked + .slider:before {
208
+ -webkit-transform: translateX(13px);
209
+ -ms-transform: translateX(13px);
210
+ transform: translateX(13px); }
211
+ .wpcf7cf-switch .switch .slider.round {
212
+ border-radius: 17px; }
213
+ .wpcf7cf-switch .switch .slider.round:before {
214
+ border-radius: 50%; }
215
+
216
+ #wpcf7cf-conditional-panel {
217
+ position: relative; }
218
+
219
+ .wpcf7cf-notice {
220
+ background: #fff;
221
+ border: 1px solid #ccd0d4;
222
+ border-left-width: 4px;
223
+ border-left-color: #ffb900;
224
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
225
+ margin: 5px 0 2px;
226
+ padding: 1px 12px; }
trunk/admin-style.css.map ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ {
2
+ "version": 3,
3
+ "mappings": "AAAA,kBAAmB;EAAE,OAAO,EAAE,YAAY;EAAE,OAAO,EAAC,IAAI;;AACxD,sBAAuB;EAAE,OAAO,EAAE,IAAI;;AACtC,sBAAuB;EAAE,KAAK,EAAE,IAAI;EAAE,MAAM,EAAE,KAAK;EAAE,WAAW,EAAE,iCAAiC;;AAEnG,0BAA2B;EAoHvB,UAAU,EAAE,IAAI;EAlHhB,yKAAyF;IACrF,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,YAAY;IACrB,cAAc,EAAE,MAAM;IACtB,KAAK,EAAE,GAAG;EAEd,qDAA2B;IACvB,KAAK,EAAE,GAAG;EAEd,2DAAiC;IAC7B,KAAK,EAAE,GAAG;IACV,cAAc,EAAE,GAAG;EAIvB,2DAAiC;IAC7B,aAAa,EAAE,iBAAiB;IAChC,gBAAgB,EAAE,OAAO;IACzB,OAAO,EAAE,MAAM;EAGnB,yEAA+C;IAC3C,gBAAgB,EAAE,OAAO;EAG7B,qIAAgF;IAC5E,KAAK,EAAE,IAAI;EAGf,gDAAsB;IAClB,WAAW,EAAE,IAAI;EAGrB,6EAAmD;IAC/C,QAAQ,EAAE,QAAQ;EAGtB,mFAAyD;IACrD,gBAAgB,EAAE,WAAW;IAC7B,YAAY,EAAE,CAAC;IACf,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,CAAC;EAGd,yFAA+D;IAC3D,OAAO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W,EAAE,IAAI",
4
+ "sources": ["admin-style.scss"],
5
+ "names": [],
6
+ "file": "admin-style.css"
7
+ }
trunk/admin-style.scss ADDED
@@ -0,0 +1,314 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #wpcf7cf-new-entry { display: inline-block; display:none; }
2
+ #wpcf7cf-delete-button { display: none; }
3
+ #wpcf7cf-settings-text { width: 100%; height: 280px; font-family: "Courier New", Courier, monospace; }
4
+
5
+ #wpcf7cf-conditional-panel {
6
+
7
+ .wpcf7cf-admin-wrap .label, .wpcf7cf-admin-wrap .field, .wpcf7cf-admin-wrap .description {
8
+ padding: 10px;
9
+ display: inline-block;
10
+ vertical-align: middle;
11
+ width: 10%;
12
+ }
13
+ .wpcf7cf-admin-wrap .field {
14
+ width: 20%;
15
+ }
16
+ .wpcf7cf-admin-wrap .description {
17
+ width: 40%;
18
+ vertical-align: top;
19
+
20
+ }
21
+
22
+ .wpcf7cf-admin-wrap .option-line {
23
+ border-bottom: 1px solid #dddddd;
24
+ background-color: #f9f9f9;
25
+ padding: 0 10px;
26
+ }
27
+
28
+ .wpcf7cf-admin-wrap .option-line:nth-child(2n) {
29
+ background-color: #e9e9e9;
30
+ }
31
+
32
+ .wpcf7cf-admin-wrap .option-line input, .wpcf7cf-admin-wrap .option-line select {
33
+ width: 100%;
34
+ }
35
+
36
+ .ui-autocomplete-term {
37
+ font-weight: bold;
38
+ }
39
+
40
+ .wpcf7cf-admin-wrap .option-line > .label.editable {
41
+ position: relative;
42
+ }
43
+
44
+ .wpcf7cf-admin-wrap .option-line > .label.editable input {
45
+ background-color: transparent;
46
+ border-width: 0;
47
+ outline: none;
48
+ box-shadow: none;
49
+ padding: 0;
50
+ }
51
+
52
+ .wpcf7cf-admin-wrap .option-line > .label.editable input:after {
53
+ content: "edit";
54
+ display: block;
55
+ width: 10px;
56
+ right:0;
57
+ position: absolute;
58
+ }
59
+
60
+ .wpcf7cf-admin-wrap .option-line > .label.editable input:focus {
61
+ background: #fff;
62
+ box-shadow: inset 0 1px 2px rgba(0,0,0,.07) ;
63
+ border: 1px solid #ddd;
64
+ padding: 2px;
65
+ }
66
+
67
+ .wpcf7cf-admin-wrap .option-line > .label.editable input:focus:after {
68
+ content: "";
69
+ }
70
+
71
+ .wpcf7cf-and {
72
+ display: inline-block;
73
+ }
74
+
75
+ .wpcf7cf-and-rules, .wpcf7cf-if {
76
+ display: inline-block;
77
+ vertical-align: top;
78
+ }
79
+
80
+ #wpcf7cf-entries input, #wpcf7cf-entries select, .and-button, .delete-button, #wpcf7cf-entries .if-txt, #wpcf7cf-entries .label, #wpcf7cf-add-button {
81
+ position:relative;
82
+ display: inline-block;
83
+ vertical-align: bottom;
84
+ margin:2px;
85
+ padding: 3px;
86
+ background: #fefefe;
87
+ border: 1px solid #bababa;
88
+ box-shadow: none;
89
+ height: 22px;
90
+ line-height: 22px;
91
+ box-sizing: content-box;
92
+ }
93
+
94
+ #wpcf7cf-entries .label {
95
+ background-color: transparent;
96
+ border: none;
97
+ }
98
+
99
+ .and-button, .delete-button, #wpcf7cf-add-button {
100
+ border: 1px solid #4ed521;
101
+ color: #007b04;
102
+ cursor: pointer;
103
+ font-size: 11px;
104
+ font-weight: bold;
105
+ -webkit-touch-callout: none; /* iOS Safari */
106
+ -webkit-user-select: none; /* Safari */
107
+ -khtml-user-select: none; /* Konqueror HTML */
108
+ -moz-user-select: none; /* Firefox */
109
+ -ms-user-select: none; /* Internet Explorer/Edge */
110
+ user-select: none; /* Non-prefixed version, currently */
111
+ background-color: rgba(75, 169, 61, 0.11);
112
+ }
113
+
114
+ #wpcf7cf-add-button {
115
+ margin-top: 10px;
116
+ text-align: center;
117
+ padding-left: 20px;
118
+ padding-right:20px;
119
+ }
120
+
121
+ overflow-x: auto;
122
+
123
+ .and-button:hover {
124
+ background-color: rgba(75, 169, 61, 0.2);
125
+ }
126
+
127
+ .delete-button {
128
+ border: 1px solid #bababa;
129
+ color: #858585;
130
+ background-color: transparent;
131
+ margin-left: 42px;
132
+ }
133
+
134
+ .delete-button:hover {
135
+ background-color: rgba(133, 133, 133, 0.11);
136
+
137
+ }
138
+
139
+ .and-button {
140
+ display:none;
141
+ width: 30px;
142
+ text-align: center;
143
+ }
144
+ .wpcf7cf-and-rule:first-child .and-button {
145
+ display: inline-block;
146
+ vertical-align: top;
147
+ height: 22px;
148
+ position: absolute;
149
+ line-height: 22px;
150
+ right: 50px;
151
+ top: 0;
152
+ }
153
+
154
+ .wpcf7cf-and-rule {
155
+ margin-bottom: 4px;
156
+ height: 30px;
157
+ }
158
+
159
+ .wpcf7cf-and-rule .if-txt, .wpcf7cf-if > .label {
160
+ cursor: n-resize;
161
+ }
162
+
163
+
164
+
165
+ .wpcf7cf-and-rule .if-txt:before {
166
+ content: 'and';
167
+ position: absolute;
168
+ width: 30px;
169
+ text-align: right;
170
+ left: -34px;
171
+ }
172
+
173
+ .wpcf7cf-and-rule:first-child .if-txt:before {
174
+ display:none;
175
+ }
176
+
177
+ .wpcf7cf-inner-container {
178
+ min-width: 800px;
179
+ }
180
+
181
+ .entry {
182
+ box-sizing: border-box;
183
+ display:flex;
184
+ }
185
+
186
+ .entry .wpcf7cf-if {
187
+ width: 188px;
188
+ }
189
+
190
+ .then-field-select {
191
+ width: 130px;
192
+ }
193
+
194
+
195
+ .entry .wpcf7cf-and-rules {
196
+ flex:1;
197
+ position:relative;
198
+
199
+ }
200
+ .wpcf7cf-and-rule {
201
+ display:flex;
202
+ }
203
+ .if-txt {
204
+ width: 14px;
205
+ text-align: center;
206
+ }
207
+
208
+ .operator {
209
+ /*width:140px;*/
210
+ }
211
+
212
+ .if-value {
213
+ flex:1;
214
+ margin-right:3px !important;
215
+ }
216
+ }
217
+
218
+ .wpcf7cf-list li {
219
+ list-style: disc;
220
+ margin-left: 20px;
221
+ }
222
+
223
+ /* The switch - the box around the slider */
224
+
225
+
226
+ .wpcf7cf-switch {
227
+ position: absolute;
228
+ display: block;
229
+ top: 20px;
230
+ right: 20px;
231
+
232
+ .label {
233
+ margin-right: 4px;
234
+ display: inline-block;
235
+ vertical-align: top;
236
+ }
237
+
238
+ .switch {
239
+ position: relative;
240
+ display: inline-block;
241
+ width: 30px;
242
+ height: 17px;
243
+
244
+ /* Hide default HTML checkbox */
245
+ input {
246
+ opacity: 0;
247
+ width: 0;
248
+ height: 0;
249
+ }
250
+
251
+ /* The slider */
252
+ .slider {
253
+ position: absolute;
254
+ cursor: pointer;
255
+ top: 0;
256
+ left: 0;
257
+ right: 0;
258
+ bottom: 0;
259
+ background-color: #ccc;
260
+ -webkit-transition: .4s;
261
+ transition: .4s;
262
+ }
263
+
264
+ .slider:before {
265
+ position: absolute;
266
+ content: "";
267
+ height: 13px;
268
+ width: 13px;
269
+ left: 2px;
270
+ bottom: 2px;
271
+ background-color: white;
272
+ -webkit-transition: .4s;
273
+ transition: .3s;
274
+ }
275
+
276
+ input:checked + .slider {
277
+ background-color: #1e8cbe;
278
+ }
279
+
280
+ input:focus + .slider {
281
+ box-shadow: 0 0 1px #1e8cbe;
282
+ }
283
+
284
+ input:checked + .slider:before {
285
+ -webkit-transform: translateX(13px);
286
+ -ms-transform: translateX(13px);
287
+ transform: translateX(13px);
288
+ }
289
+
290
+ /* Rounded sliders */
291
+ .slider.round {
292
+ border-radius: 17px;
293
+ }
294
+
295
+ .slider.round:before {
296
+ border-radius: 50%;
297
+ }
298
+
299
+ }
300
+ }
301
+
302
+ #wpcf7cf-conditional-panel {
303
+ position: relative;
304
+ }
305
+
306
+ .wpcf7cf-notice {
307
+ background: #fff;
308
+ border: 1px solid #ccd0d4;
309
+ border-left-width: 4px;
310
+ border-left-color: #ffb900;
311
+ box-shadow: 0 1px 1px rgba(0,0,0,.04);
312
+ margin: 5px 0 2px;
313
+ padding: 1px 12px;
314
+ }
trunk/admin.php ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ add_action( 'admin_enqueue_scripts', 'wpcf7cf_admin_enqueue_scripts', 11 ); // set priority so scripts and styles get loaded later.
4
+
5
+ function wpcf7cf_admin_enqueue_scripts( $hook_suffix ) {
6
+ if ( false === strpos( $hook_suffix, 'wpcf7' ) ) {
7
+ return; //don't load styles and scripts if this isn't a CF7 page.
8
+ }
9
+
10
+ wp_enqueue_script('cf7cf-scripts-admin', wpcf7cf_plugin_url( 'js/scripts_admin.js' ),array('jquery-ui-autocomplete', 'jquery-ui-sortable'), WPCF7CF_VERSION,true);
11
+ wp_localize_script('cf7cf-scripts-admin', 'wpcf7cf_options_0', get_option(WPCF7CF_OPTIONS));
12
+
13
+ }
14
+
15
+ add_filter('wpcf7_editor_panels', 'add_conditional_panel');
16
+
17
+ function add_conditional_panel($panels) {
18
+ if ( current_user_can( 'wpcf7_edit_contact_form' ) ) {
19
+ $panels['wpcf7cf-conditional-panel'] = array(
20
+ 'title' => __( 'Conditional fields', 'wpcf7cf' ),
21
+ 'callback' => 'wpcf7cf_editor_panel_conditional'
22
+ );
23
+ }
24
+ return $panels;
25
+ }
26
+
27
+ function wpcf7cf_all_field_options($post, $selected = '-1') {
28
+ $all_fields = $post->scan_form_tags();
29
+ ?>
30
+ <option value="-1" <?php echo $selected == '-1'?'selected':'' ?>>-- Select field --</option>
31
+ <?php
32
+ foreach ($all_fields as $tag) {
33
+ if ($tag['type'] == 'group' || $tag['name'] == '') continue;
34
+ ?>
35
+ <option value="<?php echo $tag['name']; ?>" <?php echo $selected == $tag['name']?'selected':'' ?>><?php echo $tag['name']; ?></option>
36
+ <?php
37
+ }
38
+ }
39
+
40
+ function wpcf7cf_all_group_options($post, $selected = '-1') {
41
+ $all_groups = $post->scan_form_tags(array('type'=>'group'));
42
+
43
+ ?>
44
+ <option value="-1" <?php echo $selected == '-1'?'selected':'' ?>>-- Select group --</option>
45
+ <?php
46
+ foreach ($all_groups as $tag) {
47
+ ?>
48
+ <option value="<?php echo $tag['name']; ?>" <?php echo $selected == $tag['name']?'selected':'' ?>><?php echo $tag['name']; ?></option>
49
+ <?php
50
+ }
51
+ }
52
+
53
+ if (!function_exists('all_operator_options')) {
54
+ function all_operator_options($selected = 'equals') {
55
+ $all_options = array('equals', 'not equals');
56
+ $all_options = apply_filters('wpcf7cf_get_operators', $all_options);
57
+ foreach($all_options as $option) {
58
+ // backwards compat
59
+ $selected = $selected == '≤' ? 'less than or equals' : $selected;
60
+ $selected = $selected == '≥' ? 'greater than or equals' : $selected;
61
+ $selected = $selected == '>' ? 'greater than' : $selected;
62
+ $selected = $selected == '<' ? 'less than' : $selected;
63
+
64
+ ?>
65
+ <option value="<?php echo htmlentities($option) ?>" <?php echo $selected == $option?'selected':'' ?>><?php echo htmlentities($option) ?></option>
66
+ <?php
67
+ }
68
+ }
69
+ }
70
+
71
+ function wpcf7cf_editor_panel_conditional($form) {
72
+
73
+ $settings = wpcf7cf_get_settings();
74
+ $is_text_only = $settings['conditions_ui'] === 'text_only';
75
+
76
+ // print_r($settings);
77
+
78
+ $form_id = isset($_GET['post']) ? $_GET['post'] : false;
79
+
80
+ if ($form_id === false) {
81
+ ?>
82
+ <div class="wpcf7cf-inner-container">
83
+ <h2><?php echo esc_html( __( 'Conditional fields', 'wpcf7cf' ) ); ?></h2>
84
+ <p>You need to save your form, before you can start adding conditions.</p>
85
+ </div>
86
+ <?php
87
+ return;
88
+ }
89
+
90
+ $wpcf7cf_entries = CF7CF::getConditions($form_id);
91
+
92
+ if (!is_array($wpcf7cf_entries)) $wpcf7cf_entries = array();
93
+
94
+ $wpcf7cf_entries = array_values($wpcf7cf_entries);
95
+
96
+ ?>
97
+ <div class="wpcf7cf-inner-container">
98
+
99
+ <label class="wpcf7cf-switch" id="wpcf7cf-text-only-switch">
100
+ <span class="label">Text mode</span>
101
+ <span class="switch">
102
+ <input type="checkbox" id="wpcf7cf-text-only-checkbox" name="wpcf7cf-text-only-checkbox" value="text_only" <?php echo $is_text_only ? 'checked':''; ?>>
103
+ <span class="slider round"></span>
104
+ </span>
105
+ </label>
106
+
107
+ <h2><?php echo esc_html( __( 'Conditional fields', 'wpcf7cf' ) ); ?></h2>
108
+
109
+ <div id="wpcf7cf-entries-ui" style="display:none">
110
+ <?php
111
+ print_entries_html($form);
112
+ ?>
113
+ <div id="wpcf7cf-entries">
114
+ <?php
115
+ //print_entries_html($form, $wpcf7cf_entries);
116
+ ?>
117
+ </div>
118
+
119
+ <span id="wpcf7cf-add-button" title="add new rule">+ add new conditional rule</span>
120
+
121
+ <div id="wpcf7cf-a-lot-of-conditions" class="wpcf7cf-notice notice-warning" style="display:none;">
122
+ <p>
123
+ <strong>Wow, That's a lot of conditions!</strong><br>
124
+ You can only add up to <?php echo WPCF7CF_MAX_RECOMMENDED_CONDITIONS ?> conditions using this interface.
125
+ Please switch to <strong>Text mode</strong> if you want to add more than <?php echo WPCF7CF_MAX_RECOMMENDED_CONDITIONS ?> conditions.
126
+ </p>
127
+ </div>
128
+
129
+ </div>
130
+
131
+ <div id="wpcf7cf-text-entries">
132
+ <div id="wpcf7cf-settings-text-wrap">
133
+
134
+ <textarea id="wpcf7cf-settings-text" name="wpcf7cf-settings-text"><?php echo CF7CF::serializeConditions($wpcf7cf_entries) ?></textarea>
135
+ <br>
136
+ </div>
137
+ </div>
138
+ </div>
139
+ <?php
140
+ }
141
+
142
+ // duplicate conditions on duplicate form part 1.
143
+ add_filter('wpcf7_copy','wpcf7cf_copy', 10, 2);
144
+ function wpcf7cf_copy($new_form,$current_form) {
145
+
146
+ $id = $current_form->id();
147
+ $props = $new_form->get_properties();
148
+ $props['messages']['wpcf7cf_copied'] = $id;
149
+ $new_form->set_properties($props);
150
+
151
+ return $new_form;
152
+ }
153
+
154
+ // duplicate conditions on duplicate form part 2.
155
+ add_action('wpcf7_after_save','wpcf7cf_after_save',10,1);
156
+ function wpcf7cf_after_save($contact_form) {
157
+ $props = $contact_form->get_properties();
158
+ $original_id = isset($props['messages']['wpcf7cf_copied']) ? $props['messages']['wpcf7cf_copied'] : 0;
159
+ if ($original_id !== 0) {
160
+ $post_id = $contact_form->id();
161
+ unset($props['messages']['wpcf7cf_copied']);
162
+ $contact_form->set_properties($props);
163
+ CF7CF::setConditions($post_id, CF7CF::getConditions($original_id));
164
+ return;
165
+ }
166
+ }
167
+
168
+ // wpcf7_save_contact_form callback
169
+ add_action( 'wpcf7_save_contact_form', 'wpcf7cf_save_contact_form', 10, 1 );
170
+ function wpcf7cf_save_contact_form( $contact_form )
171
+ {
172
+
173
+ if ( ! isset( $_POST ) || empty( $_POST ) || ! isset( $_POST['wpcf7cf-settings-text'] ) ) {
174
+ return;
175
+ }
176
+ $post_id = $contact_form->id();
177
+ if ( ! $post_id )
178
+ return;
179
+
180
+ // unset($_POST['wpcf7cf_options']['{id}']); // remove the dummy entry
181
+
182
+ // TODO: only save the one import/export field.
183
+ $conditions_string = stripslashes(sanitize_textarea_field($_POST['wpcf7cf-settings-text']));
184
+
185
+ $conditions = CF7CF::parse_conditions($conditions_string);
186
+
187
+ CF7CF::setConditions($post_id, $conditions);
188
+
189
+ if (isset($_POST['wpcf7cf-summary-template'])) {
190
+ WPCF7CF_Summary::saveSummaryTemplate($_POST['wpcf7cf-summary-template'],$post_id);
191
+ }
192
+
193
+ return;
194
+
195
+ };
196
+
197
+ function wpcf7cf_sanitize_options($options) {
198
+ //$options = array_values($options);
199
+ $sanitized_options = [];
200
+ foreach ($options as $option_entry) {
201
+ $sanitized_option = [];
202
+ $sanitized_option['then_field'] = sanitize_text_field($option_entry['then_field']);
203
+ foreach ($option_entry['and_rules'] as $and_rule) {
204
+ $sanitized_option['and_rules'][] = [
205
+ 'if_field' => sanitize_text_field($and_rule['if_field']),
206
+ 'operator' => $and_rule['operator'],
207
+ 'if_value' => sanitize_text_field($and_rule['if_value']),
208
+ ];
209
+ }
210
+
211
+ $sanitized_options[] = $sanitized_option;
212
+ }
213
+ return $sanitized_options;
214
+ }
215
+
216
+ function print_entries_html($form, $wpcf7cf_entries = false) {
217
+
218
+ $is_dummy = !$wpcf7cf_entries;
219
+
220
+ if ($is_dummy) {
221
+ $wpcf7cf_entries = array(
222
+ '{id}' => array(
223
+ 'then_field' => '-1',
224
+ 'and_rules' => array(
225
+ 0 => array(
226
+ 'if_field' => '-1',
227
+ 'operator' => 'equals',
228
+ 'if_value' => ''
229
+ )
230
+ )
231
+ )
232
+ );
233
+ }
234
+
235
+ foreach($wpcf7cf_entries as $i => $entry) {
236
+
237
+ // check for backwards compatibility ( < 2.0 )
238
+ if (!key_exists('and_rules', $wpcf7cf_entries[$i]) || !is_array($wpcf7cf_entries[$i]['and_rules'])) {
239
+ $wpcf7cf_entries[$i]['and_rules'][0] = $wpcf7cf_entries[$i];
240
+ }
241
+
242
+ $and_entries = array_values($wpcf7cf_entries[$i]['and_rules']);
243
+
244
+ if ($is_dummy) {
245
+ echo '<div id="wpcf7cf-new-entry">';
246
+ } else {
247
+ echo '<div class="entry">';
248
+ }
249
+ ?>
250
+ <div class="wpcf7cf-if">
251
+ <span class="label">Show</span>
252
+ <select class="then-field-select"><?php wpcf7cf_all_group_options($form, $entry['then_field']); ?></select>
253
+ </div>
254
+ <div class="wpcf7cf-and-rules" data-next-index="<?php echo count($and_entries) ?>">
255
+ <?php
256
+
257
+
258
+
259
+ foreach($and_entries as $and_i => $and_entry) {
260
+ ?>
261
+ <div class="wpcf7cf-and-rule">
262
+ <span class="rule-part if-txt label">if</span>
263
+ <select class="rule-part if-field-select"><?php wpcf7cf_all_field_options( $form, $and_entry['if_field'] ); ?></select>
264
+ <select class="rule-part operator"><?php all_operator_options( $and_entry['operator'] ) ?></select>
265
+ <input class="rule-part if-value" type="text"
266
+ placeholder="value" value="<?php echo $and_entry['if_value'] ?>">
267
+ <span class="and-button">And</span>
268
+ <span title="delete rule" class="rule-part delete-button">remove</span>
269
+ </div>
270
+ <?php
271
+ }
272
+ ?>
273
+ </div>
274
+ <?php
275
+ echo '</div>';
276
+ }
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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class CF7CF {
4
+ private $hidden_fields = array();
5
+ private $visible_groups = array();
6
+ private $hidden_groups = array();
7
+ private $repeaters = array();
8
+
9
+ function __construct() {
10
+
11
+ // can't use wpcf7_enqueue_scripts hook, because it's possible that people
12
+ // want to disable the CF7 scripts. but in this case Conditional fields should still work.
13
+ // add_action('wpcf7_enqueue_scripts', array(__CLASS__, 'enqueue_js')); // <-- don't use this
14
+
15
+ // Enqueue_scripts moved to function outside class.
16
+
17
+ // add_action('wp_enqueue_scripts', array(__CLASS__, 'enqueue_js'), 20);
18
+ // add_action('wpcf7_enqueue_styles', array(__CLASS__, 'enqueue_css'));
19
+
20
+ // Register shortcodes
21
+ add_action('wpcf7_init', array(__CLASS__, 'add_shortcodes'));
22
+
23
+ // Tag generator
24
+ add_action('admin_init', array(__CLASS__, 'tag_generator'), 590);
25
+
26
+ // compatibility with CF7 multi-step forms by Webhead LLC.
27
+ add_filter( 'wpcf7_posted_data', array($this,'cf7msm_merge_post_with_cookie'), 8, 1 );
28
+
29
+ // compatibility with CF7 Multi Step by NinjaTeam https://wordpress.org/plugins/cf7-multi-step/
30
+ add_action('wp_ajax_cf7mls_validation', array($this,'cf7mls_validation_callback'),9);
31
+ add_action('wp_ajax_nopriv_cf7mls_validation', array($this,'cf7mls_validation_callback'),9);
32
+
33
+ // check which fields are hidden during form submission and change some stuff accordingly
34
+ add_filter( 'wpcf7_posted_data', array($this, 'remove_hidden_post_data') );
35
+
36
+ add_filter( 'wpcf7_validate', array($this, 'skip_validation_for_hidden_fields'), 2, 2 );
37
+
38
+ // validation messages
39
+ add_action('wpcf7_config_validator_validate', array($this,'wpcf7cf_config_validator_validate'));
40
+
41
+
42
+ add_action("wpcf7_before_send_mail", [$this, 'hide_hidden_mail_fields'], 10, 3);
43
+
44
+ register_activation_hook(__FILE__, array($this, 'activate'));
45
+
46
+ if (is_admin()) {
47
+ require_once dirname(__FILE__) . '/admin.php';
48
+ }
49
+ }
50
+
51
+
52
+
53
+ /**
54
+ * Suppress invalid mailbox syntax errors on fields that contain existing conditional
55
+ */
56
+ function wpcf7cf_config_validator_validate(WPCF7_ConfigValidator $wpcf7_config_validator) {
57
+
58
+ // TODO: For now we kill every syntax error once a [groupname] tag is detected.
59
+ // Ideally, this function should check each string inside the group for invalid syntax.
60
+ // TODO 2: ajax validation not working yet, because $cf->scan_form_tags() does not seem to contain group tags if it's an ajax request. Need to investigate.
61
+
62
+ $cf = $wpcf7_config_validator->contact_form();
63
+ $all_group_tags = $cf->scan_form_tags();
64
+
65
+ foreach ($wpcf7_config_validator->collect_error_messages() as $err_type => $err) {
66
+
67
+ // print_r($err_type);
68
+
69
+ $parts = explode('.',$err_type);
70
+
71
+ $property = $parts[0];
72
+
73
+ if ($property == 'form') continue; // the 'form' field can be safely validated by CF7. No need to suppress it.
74
+
75
+ $sub_prop = $parts[1];
76
+ $prop_val = $cf->prop($property)[$sub_prop];
77
+
78
+
79
+ // TODO 2: Dirty hack. Because of TODO 2 we are just going to kill the error message if we detect the string '[/'
80
+ // Start removing here.
81
+ if (strpos($prop_val, '[/') !== false) {
82
+ $wpcf7_config_validator->remove_error($err_type, WPCF7_ConfigValidator::error_invalid_mailbox_syntax);
83
+ continue;
84
+ }
85
+ // TODO 2: Stop removing here. and uncomment code below.
86
+
87
+ // foreach ($all_group_tags as $form_tag) {
88
+ // if (strpos($prop_val, '['.$form_tag->name.']') !== false) {
89
+ // $wpcf7_config_validator->remove_error($err_type, WPCF7_ConfigValidator::error_invalid_mailbox_syntax);
90
+ // }
91
+ // }
92
+
93
+ }
94
+
95
+ return new WPCF7_ConfigValidator($wpcf7_config_validator->contact_form());
96
+ }
97
+
98
+ function activate() {
99
+ //add options with add_option and stuff
100
+ }
101
+
102
+ public static function add_shortcodes() {
103
+ if (function_exists('wpcf7_add_form_tag'))
104
+ wpcf7_add_form_tag('group', array(__CLASS__, 'shortcode_handler'), true);
105
+ else if (function_exists('wpcf7_add_shortcode')) {
106
+ wpcf7_add_shortcode('group', array(__CLASS__, 'shortcode_handler'), true);
107
+ } else {
108
+ throw new Exception('functions wpcf7_add_form_tag and wpcf7_add_shortcode not found.');
109
+ }
110
+ }
111
+
112
+ function group_shortcode_handler( $atts, $content = "" ) {
113
+ return $content;
114
+ }
115
+
116
+ public static function shortcode_handler($tag) {
117
+ //$tag = new WPCF7_Shortcode($tag);
118
+ $tag = new WPCF7_FormTag($tag);
119
+ //ob_start();
120
+ //print_r($tag);
121
+ //return print_r($tag, true);
122
+ return $tag->content;
123
+ }
124
+
125
+
126
+ public static function tag_generator() {
127
+ if (! function_exists( 'wpcf7_add_tag_generator'))
128
+ return;
129
+
130
+ wpcf7_add_tag_generator('group',
131
+ __('Conditional Fields Group', 'wpcf7cf'),
132
+ 'wpcf7-tg-pane-group',
133
+ array(__CLASS__, 'tg_pane')
134
+ );
135
+
136
+ do_action('wpcf7cf_tag_generator');
137
+ }
138
+
139
+ static function tg_pane( $contact_form, $args = '' ) {
140
+ $args = wp_parse_args( $args, array() );
141
+ $type = 'group';
142
+
143
+ $description = __( "Generate a group tag to group form elements that can be shown conditionally.", 'cf7cf' );
144
+
145
+ include 'tg_pane_group.php';
146
+ }
147
+
148
+ /**
149
+ * Remove validation requirements for fields that are hidden at the time of form submission.
150
+ * Called using add_filter( 'wpcf7_validate_[tag_type]', array($this, 'skip_validation_for_hidden_fields'), 2, 2 );
151
+ * where the priority of 2 causes this to kill any validations with a priority higher than 2
152
+ *
153
+ * @param $result
154
+ * @param $tag
155
+ *
156
+ * @return mixed
157
+ */
158
+ function skip_validation_for_hidden_fields($result, $tags) {
159
+
160
+ if(isset($_POST)) {
161
+ $this->set_hidden_fields_arrays($_POST);
162
+ }
163
+
164
+ $invalid_fields = $result->get_invalid_fields();
165
+ $return_result = new WPCF7_Validation();
166
+
167
+ if (count($this->hidden_fields) == 0 || !is_array($invalid_fields) || count($invalid_fields) == 0) {
168
+ $return_result = $result;
169
+ } else {
170
+ foreach ($invalid_fields as $invalid_field_key => $invalid_field_data) {
171
+ if (!in_array($invalid_field_key, $this->hidden_fields)) {
172
+ // the invalid field is not a hidden field, so we'll add it to the final validation result
173
+ $return_result->invalidate($invalid_field_key, $invalid_field_data['reason']);
174
+ }
175
+ }
176
+ }
177
+
178
+ return apply_filters('wpcf7cf_validate', $return_result, $tags);
179
+
180
+ }
181
+
182
+
183
+ /**
184
+ * When a CF7 form is posted, check the form for hidden fields, then remove those fields from the post data
185
+ *
186
+ * @param $posted_data
187
+ *
188
+ * @return mixed
189
+ */
190
+ function remove_hidden_post_data($posted_data) {
191
+ $this->set_hidden_fields_arrays($posted_data);
192
+
193
+ // TODO: activating the code below will change the behaviour of the plugin, as all hidden fields will not be POSTed.
194
+ // We might consider activating this based on a setting in the future. But for now, we're not gonna use it.
195
+
196
+ // foreach( $this->hidden_fields as $name => $value ) {
197
+ // unset( $posted_data[$value] ); // Yes, it should be $value, not $name. https://github.com/pwkip/contact-form-7-conditional-fields/pull/17
198
+ // }
199
+
200
+ return $posted_data;
201
+ }
202
+
203
+ function cf7msm_merge_post_with_cookie($posted_data) {
204
+
205
+ if (!function_exists('cf7msm_get') || !key_exists('cf7msm_posted_data',$_COOKIE)) return $posted_data;
206
+
207
+ if (!$posted_data) {
208
+ $posted_data = WPCF7_Submission::get_instance()->get_posted_data();
209
+ }
210
+
211
+ // this will temporarily set the hidden fields data to the posted_data.
212
+ // later this function will be called again with the updated posted_data
213
+ $this->set_hidden_fields_arrays($posted_data);
214
+
215
+ // get cookie data
216
+ $cookie_data = cf7msm_get('cf7msm_posted_data');
217
+ $cookie_data_hidden_group_fields = json_decode(stripslashes($cookie_data['_wpcf7cf_hidden_group_fields']));
218
+ $cookie_data_hidden_groups = json_decode(stripslashes($cookie_data['_wpcf7cf_hidden_groups']));
219
+ $cookie_data_visible_groups = json_decode(stripslashes($cookie_data['_wpcf7cf_visible_groups']));
220
+
221
+ // remove all the currently posted data from the cookie data (we don't wanna add it twice)
222
+ $cookie_data_hidden_group_fields = array_diff($cookie_data_hidden_group_fields, array_keys($posted_data));
223
+ $cookie_data_hidden_groups = array_diff((array) $cookie_data_hidden_groups, $this->hidden_groups, $this->visible_groups);
224
+ $cookie_data_visible_groups = array_diff((array) $cookie_data_visible_groups, $this->hidden_groups, $this->visible_groups);
225
+
226
+ // update current post data with cookie data
227
+ $posted_data['_wpcf7cf_hidden_group_fields'] = addslashes(json_encode(array_merge((array) $cookie_data_hidden_group_fields, $this->hidden_fields)));
228
+ $posted_data['_wpcf7cf_hidden_groups'] = addslashes(json_encode(array_merge((array) $cookie_data_hidden_groups, $this->hidden_groups)));
229
+ $posted_data['_wpcf7cf_visible_groups'] = addslashes(json_encode(array_merge((array) $cookie_data_visible_groups, $this->visible_groups)));
230
+
231
+ return $posted_data;
232
+ }
233
+
234
+ // compatibility with CF7 Multi Step by NinjaTeam https://wordpress.org/plugins/cf7-multi-step/
235
+ function cf7mls_validation_callback() {
236
+ $this->set_hidden_fields_arrays($_POST);
237
+ }
238
+
239
+ /**
240
+ * Finds the currently submitted form and set the hidden_fields variables accoringly
241
+ *
242
+ * @param bool|array $posted_data
243
+ */
244
+ function set_hidden_fields_arrays($posted_data = false) {
245
+
246
+ if (!$posted_data) {
247
+ $posted_data = WPCF7_Submission::get_instance()->get_posted_data();
248
+ }
249
+
250
+ $hidden_fields = json_decode(stripslashes($posted_data['_wpcf7cf_hidden_group_fields']));
251
+ if (is_array($hidden_fields) && count($hidden_fields) > 0) {
252
+ foreach ($hidden_fields as $field) {
253
+ $this->hidden_fields[] = $field;
254
+ if (wpcf7cf_endswith($field, '[]')) {
255
+ $this->hidden_fields[] = substr($field,0,strlen($field)-2);
256
+ }
257
+ }
258
+ }
259
+ $this->hidden_groups = json_decode(stripslashes($posted_data['_wpcf7cf_hidden_groups']));
260
+ $this->visible_groups = json_decode(stripslashes($posted_data['_wpcf7cf_visible_groups']));
261
+ $this->repeaters = json_decode(stripslashes($posted_data['_wpcf7cf_repeaters']));
262
+ $this->steps = json_decode(stripslashes($posted_data['_wpcf7cf_steps']));
263
+ }
264
+
265
+ function hide_hidden_mail_fields($form,$abort,$submission) {
266
+ $props = $form->get_properties();
267
+ $mails = ['mail','mail_2','messages'];
268
+ foreach ($mails as $mail) {
269
+ foreach ($props[$mail] as $key=>$val) {
270
+
271
+ $parser = new Wpcf7cfMailParser($val, $this->visible_groups, $this->hidden_groups, $this->repeaters, $_POST);
272
+
273
+ // $props[$mail][$key] = preg_replace_callback(WPCF7CF_REGEX_MAIL_GROUP, array($this, 'hide_hidden_mail_fields_regex_callback'), $val );
274
+ $props[$mail][$key] = $parser->getParsedMail();
275
+ }
276
+ }
277
+ //$props['mail']['body'] = 'xxx';
278
+ $form->set_properties($props);
279
+ }
280
+
281
+ function hide_hidden_mail_fields_regex_callback ( $matches ) {
282
+ $name = $matches[1];
283
+ $content = $matches[2];
284
+ if ( in_array( $name, $this->hidden_groups ) ) {
285
+ // The tag name represents a hidden group, so replace everything from [tagname] to [/tagname] with nothing
286
+ return '';
287
+ } elseif ( in_array( $name, $this->visible_groups ) ) {
288
+ // The tag name represents a visible group, so remove the tags themselves, but return everything else
289
+ // instead of just returning the $content, return the preg_replaced content :)
290
+ return preg_replace_callback(WPCF7CF_REGEX_MAIL_GROUP, array($this, 'hide_hidden_mail_fields_regex_callback'), $content );
291
+ } else {
292
+ // The tag name doesn't represent a group that was used in the form. Leave it alone (return the entire match).
293
+ return $matches[0];
294
+ }
295
+ }
296
+
297
+ public static function parse_conditions($string, $format='array') {
298
+ // Parse stuff like "show [g1] if [field] equals 2" to Array
299
+
300
+ preg_match_all(WPCF7CF_REGEX_CONDITIONS, $string, $matches);
301
+
302
+ $conditions = [];
303
+
304
+ $prev_then_field = '';
305
+ foreach ($matches[0] as $i=>$line) {
306
+ $then_field = $matches[1][$i];
307
+ $if_field = $matches[2][$i];
308
+ $operator = $matches[3][$i];
309
+ $if_value = $matches[4][$i];
310
+
311
+ $index = count($conditions);
312
+
313
+ if ($then_field == '') {
314
+ $index = $index -1;
315
+ $then_field = $prev_then_field;
316
+ } else {
317
+ $conditions[$index]['then_field'] = $then_field;
318
+ }
319
+
320
+ $conditions[$index]['and_rules'][] = [
321
+ 'if_field' => $if_field,
322
+ 'operator' => $operator,
323
+ 'if_value' => $if_value,
324
+ ];
325
+
326
+ $prev_then_field = $then_field;
327
+
328
+ }
329
+
330
+ $conditions = array_values($conditions);
331
+
332
+ if ($format == 'array') {
333
+ return $conditions;
334
+ } else if ($format == 'json') {
335
+ return json_encode($conditions);
336
+ }
337
+ }
338
+
339
+ /**
340
+ * load the conditions from the form's post_meta
341
+ *
342
+ * @param string $form_id
343
+ * @return void
344
+ */
345
+ public static function getConditions($form_id) {
346
+ // make sure conditions are an array.
347
+ $options = get_post_meta($form_id,'wpcf7cf_options',true);
348
+ return is_array($options) ? $options : array(); // the meta key 'wpcf7cf_options' is a bit misleading at this point, because it only holds the form's conditions, no other options/settings
349
+ }
350
+
351
+ /**
352
+ * load the conditions from the form's post_meta as plain text
353
+ *
354
+ * @param string $form_id
355
+ * @return void
356
+ */
357
+ public static function getConditionsPlainText($form_id) {
358
+ return CF7CF::serializeConditions(CF7CF::getConditions($form_id));
359
+ }
360
+
361
+ public static function serializeConditions($array) {
362
+
363
+ $lines = [];
364
+
365
+ foreach ($array as $entry) {
366
+ $then_field = $entry['then_field'];
367
+ $and_rules = $entry['and_rules'];
368
+ $indent = strlen($then_field) + 4;
369
+ foreach ($and_rules as $i => $rule) {
370
+ $if_field = $rule['if_field'];
371
+ $operator = $rule['operator'];
372
+ $if_value = $rule['if_value'];
373
+
374
+ if ($i == 0) {
375
+ $lines[] = "show [${then_field}] if [${if_field}] ${operator} \"${if_value}\"";
376
+ } else {
377
+ $lines[] = str_repeat(' ',$indent)."and if [${if_field}] ${operator} \"${if_value}\"";
378
+ }
379
+ }
380
+ }
381
+
382
+ return implode("\n", $lines);
383
+ }
384
+
385
+ /**
386
+ * save the conditions to the form's post_meta
387
+ *
388
+ * @param string $form_id
389
+ * @return void
390
+ */
391
+ public static function setConditions($form_id, $conditions) {
392
+ return update_post_meta($form_id,'wpcf7cf_options',$conditions); // the meta key 'wpcf7cf_options' is a bit misleading at this point, because it only holds the form's conditions, no other options/settings
393
+ }
394
+ }
395
+
396
+ new CF7CF;
397
+
398
+ add_filter( 'wpcf7_contact_form_properties', 'wpcf7cf_properties', 10, 2 );
399
+
400
+ function wpcf7cf_properties($properties, $wpcf7form) {
401
+ // TODO: This function is called serveral times. The problem is that the filter is called each time we call get_properties() on a contact form.
402
+ // TODO: I haven't found a better way to solve this problem yet, any suggestions or push requests are welcome. (same problem in PRO/repeater.php)
403
+ if (!is_admin() || (defined('DOING_AJAX') && DOING_AJAX)) { // TODO: kind of hacky. maybe find a better solution. Needed because otherwise the group tags will be replaced in the editor as well.
404
+ $form = $properties['form'];
405
+
406
+ $form_parts = preg_split('/(\[\/?group(?:\]|\s.*?\]))/',$form, -1,PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
407
+
408
+ ob_start();
409
+
410
+ $stack = array();
411
+
412
+ foreach ($form_parts as $form_part) {
413
+ if (substr($form_part,0,7) == '[group ') {
414
+ $tag_parts = explode(' ',rtrim($form_part,']'));
415
+
416
+ array_shift($tag_parts);
417
+
418
+ $tag_id = $tag_parts[0];
419
+ $tag_html_type = 'div';
420
+ $tag_html_data = array();
421
+
422
+ foreach ($tag_parts as $i => $tag_part) {
423
+ if ($i==0) continue;
424
+ else if ($tag_part == 'inline') $tag_html_type = 'span';
425
+ else if ($tag_part == 'clear_on_hide') $tag_html_data[] = 'data-clear_on_hide';
426
+ }
427
+
428
+ array_push($stack,$tag_html_type);
429
+
430
+ echo '<'.$tag_html_type.' data-id="'.$tag_id.'" data-orig_data_id="'.$tag_id.'" '.implode(' ',$tag_html_data).' data-class="wpcf7cf_group">';
431
+ } else if ($form_part == '[/group]') {
432
+ echo '</'.array_pop($stack).'>';
433
+ } else {
434
+ echo $form_part;
435
+ }
436
+ }
437
+
438
+ $properties['form'] = ob_get_clean();
439
+ }
440
+ return $properties;
441
+ }
442
+
443
+ add_action('wpcf7_form_hidden_fields', 'wpcf7cf_form_hidden_fields',10,1);
444
+
445
+ function wpcf7cf_form_hidden_fields($hidden_fields) {
446
+
447
+ $current_form = wpcf7_get_current_contact_form();
448
+ $current_form_id = $current_form->id();
449
+
450
+ $options = array(
451
+ 'form_id' => $current_form_id,
452
+ 'conditions' => CF7CF::getConditions($current_form_id),
453
+ 'settings' => get_option(WPCF7CF_OPTIONS)
454
+ );
455
+
456
+ unset($options['settings']['license_key']); // don't show license key in the source code duh.
457
+
458
+ return array_merge($hidden_fields, array(
459
+ '_wpcf7cf_hidden_group_fields' => '',
460
+ '_wpcf7cf_hidden_groups' => '',
461
+ '_wpcf7cf_visible_groups' => '',
462
+ '_wpcf7cf_repeaters' => '[]',
463
+ '_wpcf7cf_steps' => '{}',
464
+ '_wpcf7cf_options' => ''.json_encode($options),
465
+ ));
466
+ }
467
+
468
+ function wpcf7cf_endswith($string, $test) {
469
+ $strlen = strlen($string);
470
+ $testlen = strlen($test);
471
+ if ($testlen > $strlen) return false;
472
+ return substr_compare($string, $test, $strlen - $testlen, $testlen) === 0;
473
+ }
474
+
475
+ add_filter( 'wpcf7_form_tag_data_option', 'wpcf7cf_form_tag_data_option', 10, 3 );
476
+
477
+ function wpcf7cf_form_tag_data_option($output, $args, $nog) {
478
+ $data = array();
479
+ return $data;
480
+ }
481
+
482
+ /* Scripts & Styles */
483
+
484
+ function wpcf7cf_load_js() {
485
+ return apply_filters( 'wpcf7cf_load_js', WPCF7CF_LOAD_JS );
486
+ }
487
+
488
+ function wpcf7cf_load_css() {
489
+ return apply_filters( 'wpcf7cf_load_css', WPCF7CF_LOAD_CSS );
490
+ }
491
+
492
+ add_action( 'wp_enqueue_scripts', 'wpcf7cf_do_enqueue_scripts', 20, 0 );
493
+
494
+ function wpcf7cf_do_enqueue_scripts() {
495
+ if ( wpcf7cf_load_js() ) {
496
+ wpcf7cf_enqueue_scripts();
497
+ }
498
+
499
+ if ( wpcf7cf_load_css() ) {
500
+ wpcf7cf_enqueue_styles();
501
+ }
502
+ }
503
+
504
+ function wpcf7cf_enqueue_scripts() {
505
+ if (is_admin()) return;
506
+ wp_enqueue_script('wpcf7cf-scripts', plugins_url('js/scripts.js', __FILE__), array('jquery'), WPCF7CF_VERSION, true);
507
+ wp_localize_script('wpcf7cf-scripts', 'wpcf7cf_global_settings',
508
+ array(
509
+ 'ajaxurl' => admin_url('admin-ajax.php'),
510
+ )
511
+ );
512
+
513
+ }
514
+
515
+ function wpcf7cf_enqueue_styles() {
516
+ if (is_admin()) return;
517
+ wp_enqueue_style('cf7cf-style', plugins_url('style.css', __FILE__), array(), WPCF7CF_VERSION);
518
+ }
trunk/contact-form-7-conditional-fields.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ Plugin Name: Contact Form 7 Conditional Fields
4
+ Plugin URI: http://bdwm.be/
5
+ Description: Adds support for conditional fields to Contact Form 7. This plugin depends on Contact Form 7.
6
+ Author: Jules Colle
7
+ Version: 1.9
8
+ Author URI: http://bdwm.be/
9
+ */
10
+
11
+ /**
12
+ * This program is free software; you can redistribute it and/or modify
13
+ * it under the terms of the GNU General Public License as published by
14
+ * the Free Software Foundation; either version 2 of the License, or
15
+ * (at your option) any later version.
16
+ *
17
+ * This program is distributed in the hope that it will be useful,
18
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ * GNU General Public License for more details.
21
+ *
22
+ * You should have received a copy of the GNU General Public License
23
+ * along with this program; if not, write to the Free Software
24
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
+ */
26
+
27
+
28
+ if ( function_exists( 'wpcf7cf_pro_deactivate_free_version_notice' ) ) {
29
+ add_action( 'admin_notices', 'wpcf7cf_pro_deactivate_free_version_notice' );
30
+ } else {
31
+
32
+ function wpcf7cf_pro_deactivate_free_version_notice() {
33
+ ?>
34
+ <div class="notice notice-error is-dismissible">
35
+ <p><?php echo sprintf( __( '<strong>Contact Form 7 - Conditional Fields PRO</strong> needs to %sdeactivate the free plugin%s', 'wpcf7cf' ), '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=cf7-conditional-fields%2Fcontact-form-7-conditional-fields.php&amp;plugin_status=all&amp;paged=1&amp;s=', 'deactivate-plugin_cf7-conditional-fields/contact-form-7-conditional-fields.php' ) . '">', '</a>' ); ?></p>
36
+ </div>
37
+ <?php
38
+ }
39
+
40
+ require_once __DIR__.'/init.php';
41
+
42
+ }
trunk/init.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('WPCF7CF_VERSION')) define( 'WPCF7CF_VERSION', '1.9' );
4
+ if (!defined('WPCF7CF_REQUIRED_WP_VERSION')) define( 'WPCF7CF_REQUIRED_WP_VERSION', '4.1' );
5
+ if (!defined('WPCF7CF_PLUGIN')) define( 'WPCF7CF_PLUGIN', __FILE__ );
6
+ if (!defined('WPCF7CF_PLUGIN_BASENAME')) define( 'WPCF7CF_PLUGIN_BASENAME', plugin_basename( WPCF7CF_PLUGIN ) );
7
+ if (!defined('WPCF7CF_PLUGIN_NAME')) define( 'WPCF7CF_PLUGIN_NAME', trim( dirname( WPCF7CF_PLUGIN_BASENAME ), '/' ) );
8
+ if (!defined('WPCF7CF_PLUGIN_DIR')) define( 'WPCF7CF_PLUGIN_DIR', untrailingslashit( dirname( WPCF7CF_PLUGIN ) ) );
9
+
10
+ if (!defined('WPCF7CF_LOAD_JS')) define('WPCF7CF_LOAD_JS', true);
11
+ if (!defined('WPCF7CF_LOAD_CSS')) define('WPCF7CF_LOAD_CSS', true);
12
+
13
+ if (!defined('WPCF7CF_REGEX_MAIL_GROUP')) define( 'WPCF7CF_REGEX_MAIL_GROUP', '@\[[\s]*([a-zA-Z_][0-9a-zA-Z:._-]*)[\s]*\](.*?)\[[\s]*/[\s]*\1[\s]*\]@s');
14
+ if (!defined('WPCF7CF_REGEX_CONDITIONS')) define( 'WPCF7CF_REGEX_CONDITIONS', '/(?:show \[([^\]]*?)\]|and) if \[([^\]]*?)\] (?:(equals \(regex\)|not equals \(regex\)|equals|not equals|greater than or equals|greater than|less than or equals|less than|is empty|not empty|function)(?: \"(.*)\")?)/m');
15
+
16
+ if (!defined('WPCF7CF_MAX_RECOMMENDED_CONDITIONS')) define( 'WPCF7CF_MAX_RECOMMENDED_CONDITIONS', 50 );
17
+
18
+ if(file_exists(WPCF7CF_PLUGIN_DIR.'/pro/pro-functions.php')) {
19
+ if (!defined('WPCF7CF_IS_PRO')) define( 'WPCF7CF_IS_PRO', true );
20
+ } else {
21
+ if (!defined('WPCF7CF_IS_PRO')) define( 'WPCF7CF_IS_PRO', false );
22
+ }
23
+
24
+ if(file_exists(WPCF7CF_PLUGIN_DIR.'/tests/init.php')) {
25
+ require_once WPCF7CF_PLUGIN_DIR.'/tests/init.php';
26
+ if (!defined('WPCF7CF_TESTMODE')) define( 'WPCF7CF_TESTMODE', true );
27
+ }
28
+
29
+ function wpcf7cf_plugin_path( $path = '' ) {
30
+ return path_join( WPCF7CF_PLUGIN_DIR, trim( $path, '/' ) );
31
+ }
32
+
33
+ function wpcf7cf_plugin_url( $path = '' ) {
34
+ $url = plugins_url( $path, WPCF7CF_PLUGIN );
35
+ if ( is_ssl() && 'http:' == substr( $url, 0, 5 ) ) {
36
+ $url = 'https:' . substr( $url, 5 );
37
+ }
38
+ return $url;
39
+ }
40
+
41
+ require_once WPCF7CF_PLUGIN_DIR.'/Wpcf7cfMailParser.php';
42
+
43
+ if (WPCF7CF_IS_PRO) {
44
+ require_once WPCF7CF_PLUGIN_DIR.'/pro/pro-functions.php';
45
+ }
46
+
47
+ require_once WPCF7CF_PLUGIN_DIR.'/cf7cf.php';
48
+ require_once WPCF7CF_PLUGIN_DIR.'/wpcf7cf-options.php';
49
+
50
+ if (WPCF7CF_IS_PRO) {
51
+ require_once WPCF7CF_PLUGIN_DIR.'/pro/update.php';
52
+ }
trunk/js/scripts.js ADDED
@@ -0,0 +1,1836 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /******/ (function(modules) { // webpackBootstrap
2
+ /******/ // The module cache
3
+ /******/ var installedModules = {};
4
+ /******/
5
+ /******/ // The require function
6
+ /******/ function __webpack_require__(moduleId) {
7
+ /******/
8
+ /******/ // Check if module is in cache
9
+ /******/ if(installedModules[moduleId]) {
10
+ /******/ return installedModules[moduleId].exports;
11
+ /******/ }
12
+ /******/ // Create a new module (and put it into the cache)
13
+ /******/ var module = installedModules[moduleId] = {
14
+ /******/ i: moduleId,
15
+ /******/ l: false,
16
+ /******/ exports: {}
17
+ /******/ };
18
+ /******/
19
+ /******/ // Execute the module function
20
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
+ /******/
22
+ /******/ // Flag the module as loaded
23
+ /******/ module.l = true;
24
+ /******/
25
+ /******/ // Return the exports of the module
26
+ /******/ return module.exports;
27
+ /******/ }
28
+ /******/
29
+ /******/
30
+ /******/ // expose the modules object (__webpack_modules__)
31
+ /******/ __webpack_require__.m = modules;
32
+ /******/
33
+ /******/ // expose the module cache
34
+ /******/ __webpack_require__.c = installedModules;
35
+ /******/
36
+ /******/ // define getter function for harmony exports
37
+ /******/ __webpack_require__.d = function(exports, name, getter) {
38
+ /******/ if(!__webpack_require__.o(exports, name)) {
39
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
40
+ /******/ }
41
+ /******/ };
42
+ /******/
43
+ /******/ // define __esModule on exports
44
+ /******/ __webpack_require__.r = function(exports) {
45
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47
+ /******/ }
48
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
49
+ /******/ };
50
+ /******/
51
+ /******/ // create a fake namespace object
52
+ /******/ // mode & 1: value is a module id, require it
53
+ /******/ // mode & 2: merge all properties of value into the ns
54
+ /******/ // mode & 4: return value when already ns object
55
+ /******/ // mode & 8|1: behave like require
56
+ /******/ __webpack_require__.t = function(value, mode) {
57
+ /******/ if(mode & 1) value = __webpack_require__(value);
58
+ /******/ if(mode & 8) return value;
59
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60
+ /******/ var ns = Object.create(null);
61
+ /******/ __webpack_require__.r(ns);
62
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64
+ /******/ return ns;
65
+ /******/ };
66
+ /******/
67
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
68
+ /******/ __webpack_require__.n = function(module) {
69
+ /******/ var getter = module && module.__esModule ?
70
+ /******/ function getDefault() { return module['default']; } :
71
+ /******/ function getModuleExports() { return module; };
72
+ /******/ __webpack_require__.d(getter, 'a', getter);
73
+ /******/ return getter;
74
+ /******/ };
75
+ /******/
76
+ /******/ // Object.prototype.hasOwnProperty.call
77
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78
+ /******/
79
+ /******/ // __webpack_public_path__
80
+ /******/ __webpack_require__.p = "";
81
+ /******/
82
+ /******/
83
+ /******/ // Load entry module and return exports
84
+ /******/ return __webpack_require__(__webpack_require__.s = "./js/scripts_es6.js");
85
+ /******/ })
86
+ /************************************************************************/
87
+ /******/ ({
88
+
89
+ /***/ "./js/scripts_es6.js":
90
+ /*!***************************!*\
91
+ !*** ./js/scripts_es6.js ***!
92
+ \***************************/
93
+ /*! no exports provided */
94
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
95
+
96
+ "use strict";
97
+ __webpack_require__.r(__webpack_exports__);
98
+ /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
99
+ /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
100
+ /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js");
101
+ /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);
102
+
103
+
104
+
105
+
106
+ var cf7signature_resized = 0; // for compatibility with contact-form-7-signature-addon
107
+
108
+ var wpcf7cf_timeout;
109
+ var wpcf7cf_change_time_ms = 100;
110
+
111
+ if (window.wpcf7cf_running_tests) {
112
+ jQuery('input[name="_wpcf7cf_options"]').each(function (e) {
113
+ var $input = jQuery(this);
114
+ var opt = JSON.parse($input.val());
115
+ opt.settings.animation_intime = 0;
116
+ opt.settings.animation_outtime = 0;
117
+ $input.val(JSON.stringify(opt));
118
+ });
119
+ wpcf7cf_change_time_ms = 0;
120
+ }
121
+
122
+ var wpcf7cf_show_animation = {
123
+ "height": "show",
124
+ "marginTop": "show",
125
+ "marginBottom": "show",
126
+ "paddingTop": "show",
127
+ "paddingBottom": "show"
128
+ };
129
+ var wpcf7cf_hide_animation = {
130
+ "height": "hide",
131
+ "marginTop": "hide",
132
+ "marginBottom": "hide",
133
+ "paddingTop": "hide",
134
+ "paddingBottom": "hide"
135
+ };
136
+ var wpcf7cf_show_step_animation = {
137
+ "opacity": "show"
138
+ };
139
+ var wpcf7cf_hide_step_animation = {
140
+ "opacity": "hide"
141
+ };
142
+ var wpcf7cf_change_events = 'input.wpcf7cf paste.wpcf7cf change.wpcf7cf click.wpcf7cf propertychange.wpcf7cf';
143
+ var wpcf7cf_forms = [];
144
+ window.wpcf7cf_dom = {};
145
+
146
+ var wpcf7cf_reload_dom = function wpcf7cf_reload_dom($form) {
147
+ wpcf7cf_dom = wpcf7cf.get_simplified_dom_model($form);
148
+ };
149
+
150
+ var wpcf7cf_getFieldsByOriginalName = function wpcf7cf_getFieldsByOriginalName(originalName) {
151
+ return Object.values(wpcf7cf_dom).filter(function (inputField) {
152
+ return inputField.original_name === originalName || inputField.original_name === originalName + '[]';
153
+ });
154
+ };
155
+
156
+ var wpcf7cf_getFieldByName = function wpcf7cf_getFieldByName(name) {
157
+ return wpcf7cf_dom[name] || wpcf7cf_dom[name + '[]'];
158
+ }; // endsWith polyfill
159
+
160
+
161
+ if (!String.prototype.endsWith) {
162
+ String.prototype.endsWith = function (search, this_len) {
163
+ if (this_len === undefined || this_len > this.length) {
164
+ this_len = this.length;
165
+ }
166
+
167
+ return this.substring(this_len - search.length, this_len) === search;
168
+ };
169
+ }
170
+
171
+ var Wpcf7cfForm = function Wpcf7cfForm($form) {
172
+ var options_element = $form.find('input[name="_wpcf7cf_options"]').eq(0);
173
+
174
+ if (!options_element.length || !options_element.val()) {
175
+ // doesn't look like a CF7 form created with conditional fields plugin enabled.
176
+ return false;
177
+ }
178
+
179
+ var form = this;
180
+ var form_options = JSON.parse(options_element.val());
181
+ form.$form = $form;
182
+ form.$input_hidden_group_fields = $form.find('[name="_wpcf7cf_hidden_group_fields"]');
183
+ form.$input_hidden_groups = $form.find('[name="_wpcf7cf_hidden_groups"]');
184
+ form.$input_visible_groups = $form.find('[name="_wpcf7cf_visible_groups"]');
185
+ form.$input_repeaters = $form.find('[name="_wpcf7cf_repeaters"]');
186
+ form.$input_steps = $form.find('[name="_wpcf7cf_steps"]');
187
+ form.unit_tag = $form.closest('.wpcf7').attr('id');
188
+ form.conditions = form_options['conditions']; // Wrapper around jQuery(selector, form.$form)
189
+
190
+ form.get = function (selector) {
191
+ // TODO: implement some caching here.
192
+ return jQuery(selector, form.$form);
193
+ }; // compatibility with conditional forms created with older versions of the plugin ( < 1.4 )
194
+
195
+
196
+ for (var i = 0; i < form.conditions.length; i++) {
197
+ var condition = form.conditions[i];
198
+
199
+ if (!('and_rules' in condition)) {
200
+ condition.and_rules = [{
201
+ 'if_field': condition.if_field,
202
+ 'if_value': condition.if_value,
203
+ 'operator': condition.operator
204
+ }];
205
+ }
206
+ }
207
+
208
+ form.initial_conditions = form.conditions;
209
+ form.settings = form_options['settings'];
210
+ form.$groups = jQuery(); // empty jQuery set
211
+
212
+ form.repeaters = [];
213
+ form.multistep = null;
214
+ form.fields = [];
215
+ form.settings.animation_intime = parseInt(form.settings.animation_intime);
216
+ form.settings.animation_outtime = parseInt(form.settings.animation_outtime);
217
+
218
+ if (form.settings.animation === 'no') {
219
+ form.settings.animation_intime = 0;
220
+ form.settings.animation_outtime = 0;
221
+ }
222
+
223
+ form.updateGroups();
224
+ form.updateEventListeners();
225
+ form.displayFields(); // bring form in initial state if the reset event is fired on it.
226
+
227
+ form.$form.on('reset.wpcf7cf', form, function (e) {
228
+ var form = e.data;
229
+ setTimeout(function () {
230
+ form.displayFields();
231
+ form.resetRepeaters();
232
+
233
+ if (form.multistep != null) {
234
+ form.multistep.moveToStep(1);
235
+ }
236
+ }, 200);
237
+ }); // PRO ONLY
238
+
239
+ form.get('.wpcf7cf_repeater:not(.wpcf7cf_repeater .wpcf7cf_repeater)').each(function () {
240
+ form.repeaters.push(new Wpcf7cfRepeater(jQuery(this), form));
241
+ });
242
+ form.$input_repeaters.val(JSON.stringify(form.repeaters.map(function (item) {
243
+ return item.params.$repeater.id;
244
+ })));
245
+ var $multistep = form.get('.wpcf7cf_multistep');
246
+
247
+ if ($multistep.length) {
248
+ form.multistep = new Wpcf7cfMultistep($multistep, form); // window.wpcf7cf.updateMultistepState(form.multistep);
249
+ } // END PRO ONLY
250
+
251
+ };
252
+ /**
253
+ * reset initial number of subs for each repeater.
254
+ * (does not clear values)
255
+ */
256
+
257
+
258
+ Wpcf7cfForm.prototype.resetRepeaters = function () {
259
+ var form = this;
260
+ form.repeaters.forEach(function (repeater) {
261
+ repeater.updateSubs(repeater.params.$repeater.initial_subs);
262
+ });
263
+ };
264
+
265
+ Wpcf7cfForm.prototype.displayFields = function () {
266
+ var form = this;
267
+ var wpcf7cf_conditions = this.conditions;
268
+ var wpcf7cf_settings = this.settings; //for compatibility with contact-form-7-signature-addon
269
+
270
+ if (cf7signature_resized === 0 && typeof signatures !== 'undefined' && signatures.constructor === Array && signatures.length > 0) {
271
+ for (var i = 0; i < signatures.length; i++) {
272
+ if (signatures[i].canvas.width === 0) {
273
+ var $sig_canvas = jQuery(".wpcf7-form-control-signature-body>canvas");
274
+ var $sig_wrap = jQuery(".wpcf7-form-control-signature-wrap");
275
+ $sig_canvas.eq(i).attr('width', $sig_wrap.width());
276
+ $sig_canvas.eq(i).attr('height', $sig_wrap.height());
277
+ cf7signature_resized = 1;
278
+ }
279
+ }
280
+ }
281
+
282
+ form.$groups.addClass('wpcf7cf-hidden');
283
+ wpcf7cf_reload_dom(form.$form);
284
+
285
+ for (var i = 0; i < wpcf7cf_conditions.length; i++) {
286
+ var condition = wpcf7cf_conditions[i];
287
+ var show_group = window.wpcf7cf.should_group_be_shown(condition, form);
288
+
289
+ if (show_group) {
290
+ form.get('[data-id="' + condition.then_field + '"]').removeClass('wpcf7cf-hidden');
291
+ }
292
+ }
293
+
294
+ var animation_intime = wpcf7cf_settings.animation_intime;
295
+ var animation_outtime = wpcf7cf_settings.animation_outtime;
296
+ form.$groups.each(function (index) {
297
+ var $group = jQuery(this);
298
+ if ($group.is(':animated')) $group.finish(); // stop any current animations on the group
299
+
300
+ if ($group.css('display') === 'none' && !$group.hasClass('wpcf7cf-hidden')) {
301
+ if ($group.prop('tagName') === 'SPAN') {
302
+ $group.show().trigger('wpcf7cf_show_group');
303
+ } else {
304
+ $group.animate(wpcf7cf_show_animation, animation_intime).trigger('wpcf7cf_show_group'); // show
305
+ }
306
+ } else if ($group.css('display') !== 'none' && $group.hasClass('wpcf7cf-hidden')) {
307
+ if ($group.attr('data-clear_on_hide') !== undefined) {
308
+ var $inputs = jQuery(':input', $group).not(':button, :submit, :reset, :hidden');
309
+ $inputs.each(function () {
310
+ var $this = jQuery(this);
311
+ $this.val(this.defaultValue);
312
+ $this.prop('checked', this.defaultChecked);
313
+ });
314
+ jQuery('option', $group).each(function () {
315
+ this.selected = this.defaultSelected;
316
+ });
317
+ jQuery('select', $group).each(function () {
318
+ var $select = jQuery(this);
319
+
320
+ if ($select.val() === null) {
321
+ $select.val(jQuery("option:first", $select).val());
322
+ }
323
+ });
324
+ $inputs.change(); //display_fields();
325
+ }
326
+
327
+ if ($group.prop('tagName') === 'SPAN') {
328
+ $group.hide().trigger('wpcf7cf_hide_group');
329
+ } else {
330
+ $group.animate(wpcf7cf_hide_animation, animation_outtime).trigger('wpcf7cf_hide_group'); // hide
331
+ }
332
+ }
333
+ });
334
+ form.updateHiddenFields();
335
+ form.updateSummaryFields();
336
+ };
337
+
338
+ Wpcf7cfForm.prototype.updateSummaryFields = function () {
339
+ var form = this;
340
+ var $summary = form.get('.wpcf7cf-summary');
341
+ if ($summary.length == 0 || !$summary.is(':visible')) return;
342
+ var fd = new FormData();
343
+ var formdata = form.$form.serializeArray();
344
+ jQuery.each(formdata, function (key, input) {
345
+ fd.append(input.name, input.value);
346
+ }); // Make sure to add file fields to FormData
347
+
348
+ jQuery.each(form.$form.find('input[type="file"]'), function (index, el) {
349
+ if (!el.files.length) return false;
350
+ var file = el.files[0];
351
+ var fieldName = el.name;
352
+ fd.append(fieldName, new Blob(), file.name);
353
+ }); // add file fields to form-data
354
+
355
+ jQuery.ajax({
356
+ url: wpcf7cf_global_settings.ajaxurl + '?action=wpcf7cf_get_summary',
357
+ type: 'POST',
358
+ data: fd,
359
+ processData: false,
360
+ contentType: false,
361
+ dataType: 'json',
362
+ success: function success(json) {
363
+ $summary.html(json.summaryHtml);
364
+ }
365
+ });
366
+ };
367
+
368
+ Wpcf7cfForm.prototype.updateHiddenFields = function () {
369
+ var form = this;
370
+ var hidden_fields = [];
371
+ var hidden_groups = [];
372
+ var visible_groups = [];
373
+ form.$groups.each(function () {
374
+ var $this = jQuery(this);
375
+
376
+ if ($this.hasClass('wpcf7cf-hidden')) {
377
+ hidden_groups.push($this.data('id'));
378
+ $this.find('input,select,textarea').each(function () {
379
+ hidden_fields.push(jQuery(this).attr('name'));
380
+ });
381
+ } else {
382
+ visible_groups.push($this.data('id'));
383
+ }
384
+ });
385
+ form.hidden_fields = hidden_fields;
386
+ form.hidden_groups = hidden_groups;
387
+ form.visible_groups = visible_groups;
388
+ form.$input_hidden_group_fields.val(JSON.stringify(hidden_fields));
389
+ form.$input_hidden_groups.val(JSON.stringify(hidden_groups));
390
+ form.$input_visible_groups.val(JSON.stringify(visible_groups));
391
+ return true;
392
+ };
393
+
394
+ Wpcf7cfForm.prototype.updateGroups = function () {
395
+ var form = this;
396
+ form.$groups = form.$form.find('[data-class="wpcf7cf_group"]');
397
+ form.conditions = window.wpcf7cf.get_nested_conditions(form.initial_conditions, form.$form);
398
+ };
399
+
400
+ Wpcf7cfForm.prototype.updateEventListeners = function () {
401
+ var form = this; // monitor input changes, and call displayFields() if something has changed
402
+
403
+ form.get('input, select, textarea, button').not('.wpcf7cf_add, .wpcf7cf_remove').off(wpcf7cf_change_events).on(wpcf7cf_change_events, form, function (e) {
404
+ var form = e.data;
405
+ clearTimeout(wpcf7cf_timeout);
406
+ wpcf7cf_timeout = setTimeout(function () {
407
+ form.displayFields();
408
+ }, wpcf7cf_change_time_ms);
409
+ }); // PRO ONLY
410
+
411
+ form.get('.wpcf7cf-togglebutton').off('click.toggle_wpcf7cf').on('click.toggle_wpcf7cf', function () {
412
+ var $this = jQuery(this);
413
+
414
+ if ($this.text() === $this.data('val-1')) {
415
+ $this.text($this.data('val-2'));
416
+ $this.val($this.data('val-2'));
417
+ } else {
418
+ $this.text($this.data('val-1'));
419
+ $this.val($this.data('val-1'));
420
+ }
421
+ }); // END PRO ONLY
422
+ }; // PRO ONLY
423
+
424
+
425
+ function Wpcf7cfRepeater($repeater, form) {
426
+ var $ = jQuery;
427
+ var repeater = this;
428
+ var wpcf7cf_settings = form.settings;
429
+ repeater.form = form;
430
+ $repeater.num_subs = 0;
431
+ $repeater.id = $repeater.data('id');
432
+ $repeater.orig_id = $repeater.data('orig_data_id');
433
+ $repeater.min = typeof $repeater.data('min') !== 'undefined' ? parseInt($repeater.data('min')) : 1;
434
+ $repeater.max = typeof $repeater.data('max') !== 'undefined' ? parseInt($repeater.data('max')) : 200;
435
+ $repeater.initial_subs = typeof $repeater.data('initial') !== 'undefined' ? parseInt($repeater.data('initial')) : $repeater.min;
436
+ if ($repeater.initial_subs > $repeater.max) $repeater.initial_subs = $repeater.max;
437
+ var $repeater_sub = $repeater.children('.wpcf7cf_repeater_sub').eq(0);
438
+ var $repeater_controls = $repeater.children('.wpcf7cf_repeater_controls').eq(0);
439
+ var $repeater_sub_clone = $repeater_sub.clone();
440
+ $repeater_sub_clone.find('.wpcf7cf_repeater_sub').addBack('.wpcf7cf_repeater_sub').each(function () {
441
+ var $this = jQuery(this);
442
+ var prev_suffix = $this.attr('data-repeater_sub_suffix');
443
+ var new_suffix = prev_suffix + '__{{repeater_sub_suffix}}';
444
+ $this.attr('data-repeater_sub_suffix', new_suffix);
445
+ });
446
+ $repeater_sub_clone.find('[name]').each(function () {
447
+ var $this = jQuery(this);
448
+ var prev_name = $this.attr('name');
449
+ var orig_name = $this.attr('data-orig_name') != null ? $this.attr('data-orig_name') : prev_name;
450
+ var new_name = prev_name + '__{{repeater_sub_suffix}}';
451
+
452
+ if (prev_name.endsWith('_count')) {
453
+ new_name = prev_name.replace('_count', '__{{repeater_sub_suffix}}_count');
454
+ }
455
+
456
+ $this.attr('name', new_name);
457
+ $this.attr('data-orig_name', orig_name);
458
+ $this.closest('.wpcf7-form-control-wrap').addClass(new_name);
459
+ });
460
+ $repeater_sub_clone.find('.wpcf7cf_repeater,[data-class="wpcf7cf_group"]').each(function () {
461
+ var $this = jQuery(this);
462
+ var prev_data_id = $this.attr('data-id');
463
+ var orig_data_id = $this.attr('data-orig_data_id') != null ? $this.attr('data-orig_data_id') : prev_data_id;
464
+ var new_data_id = prev_data_id + '__{{repeater_sub_suffix}}';
465
+
466
+ if (prev_data_id.endsWith('_count')) {
467
+ new_data_id = prev_data_id.replace('_count', '__{{repeater_sub_suffix}}_count');
468
+ }
469
+
470
+ $this.attr('data-id', new_data_id);
471
+ $this.attr('data-orig_data_id', orig_data_id);
472
+ $this.closest('.wpcf7-form-control-wrap').addClass(new_data_id);
473
+ });
474
+ $repeater_sub_clone.find('[id]').each(function () {
475
+ var $this = jQuery(this);
476
+ var prev_id = $this.attr('id');
477
+ var orig_id = $this.attr('data-orig_id') != null ? $this.attr('data-orig_id') : prev_id;
478
+ var new_id = prev_id + '__{{repeater_sub_suffix}}';
479
+ $this.attr('id', new_id);
480
+ $this.attr('data-orig_id', orig_id);
481
+ $this.closest('.wpcf7-form-control-wrap').addClass(new_id);
482
+ });
483
+ $repeater_sub_clone.find('[for]').each(function () {
484
+ var $this = jQuery(this);
485
+ var prev_for = $this.attr('for');
486
+ var orig_for = $this.attr('data-orig_for') != null ? $this.attr('data-orig_for') : prev_for;
487
+ var new_for = prev_for + '__{{repeater_sub_suffix}}';
488
+ $this.attr('for', new_for);
489
+ $this.attr('data-orig_for', orig_for);
490
+ $this.closest('.wpcf7-form-control-wrap').addClass(new_for);
491
+ });
492
+ var repeater_sub_html = $repeater_sub_clone[0].outerHTML;
493
+ var $repeater_count_field = $repeater.find('[name=' + $repeater.id + '_count]').eq(0);
494
+ var $button_add = $repeater_controls.find('.wpcf7cf_add').eq(0);
495
+ var $button_remove = $repeater_controls.find('.wpcf7cf_remove').eq(0);
496
+ var params = {
497
+ $repeater: $repeater,
498
+ $repeater_count_field: $repeater_count_field,
499
+ repeater_sub_html: repeater_sub_html,
500
+ $repeater_controls: $repeater_controls,
501
+ $button_add: $button_add,
502
+ $button_remove: $button_remove,
503
+ wpcf7cf_settings: wpcf7cf_settings
504
+ };
505
+ this.params = params;
506
+ $button_add.on('click', null, repeater, function (e) {
507
+ var repeater = e.data;
508
+ repeater.updateSubs(params.$repeater.num_subs + 1);
509
+ });
510
+ $button_remove.on('click', null, repeater, function (e) {
511
+ var repeater = e.data;
512
+ repeater.updateSubs(params.$repeater.num_subs - 1);
513
+ });
514
+ jQuery('> .wpcf7cf_repeater_sub', params.$repeater).eq(0).remove(); // remove the first sub, it's just a template.
515
+
516
+ repeater.updateSubs($repeater.initial_subs);
517
+ }
518
+
519
+ Wpcf7cfRepeater.prototype.updateSubs = function (subs_to_show) {
520
+ var repeater = this;
521
+ var params = repeater.params;
522
+ var subs_to_add = subs_to_show - params.$repeater.num_subs;
523
+
524
+ if (subs_to_add < 0) {
525
+ repeater.removeSubs(-subs_to_add);
526
+ } else if (subs_to_add > 0) {
527
+ repeater.addSubs(subs_to_add);
528
+ }
529
+
530
+ var showButtonRemove = false;
531
+ var showButtonAdd = false;
532
+
533
+ if (params.$repeater.num_subs < params.$repeater.max) {
534
+ showButtonAdd = true;
535
+ }
536
+
537
+ if (params.$repeater.num_subs > params.$repeater.min) {
538
+ showButtonRemove = true;
539
+ }
540
+
541
+ if (showButtonAdd) {
542
+ params.$button_add.show();
543
+ } else {
544
+ params.$button_add.hide();
545
+ }
546
+
547
+ if (showButtonRemove) {
548
+ params.$button_remove.show();
549
+ } else {
550
+ params.$button_remove.hide();
551
+ }
552
+
553
+ params.$repeater_count_field.val(subs_to_show);
554
+ };
555
+
556
+ Wpcf7cfRepeater.prototype.addSubs = function (subs_to_add) {
557
+ var $ = jQuery;
558
+ var params = this.params;
559
+ var repeater = this;
560
+ var form = repeater.form;
561
+ var $repeater = params.$repeater;
562
+ var $repeater_controls = params.$repeater_controls; //jQuery(params.repeater_sub_html.replace(/name="(.*?)"/g,'name="wpcf7cf_repeater['+$repeater.id+']['+$repeater.num_subs+'][$1]" data-original-name="$1"')).hide().insertBefore($repeater_controls).animate(wpcf7cf_show_animation, params.wpcf7cf_settings.animation_intime);
563
+
564
+ var html_str = '';
565
+
566
+ for (var i = 1; i <= subs_to_add; i++) {
567
+ var sub_suffix = $repeater.num_subs + i;
568
+ html_str += params.repeater_sub_html.replace(/\{\{repeater_sub_suffix\}\}/g, sub_suffix).replace(new RegExp('\{\{' + $repeater.orig_id + '_index\}\}', 'g'), sub_suffix);
569
+ }
570
+
571
+ var $html = jQuery(html_str); // Add the newly created fields to the form
572
+
573
+ $html.hide().insertBefore($repeater_controls).animate(wpcf7cf_show_animation, params.wpcf7cf_settings.animation_intime).trigger('wpcf7cf_repeater_added');
574
+ jQuery('.wpcf7cf_repeater', $html).each(function () {
575
+ form.repeaters.push(new Wpcf7cfRepeater(jQuery(this), form));
576
+ });
577
+ form.$input_repeaters.val(JSON.stringify(form.repeaters.map(function (item) {
578
+ return item.params.$repeater.id;
579
+ })));
580
+ $repeater.num_subs += subs_to_add;
581
+ window.wpcf7cf.updateMultistepState(form.multistep);
582
+ form.updateGroups();
583
+ form.updateEventListeners();
584
+ form.displayFields(); // Exclusive Checkbox
585
+
586
+ $html.on('click', '.wpcf7-exclusive-checkbox input:checkbox', function () {
587
+ var name = $(this).attr('name');
588
+ $html.find('input:checkbox[name="' + name + '"]').not(this).prop('checked', false);
589
+ }); //basic compatibility with material-design-for-contact-form-7
590
+
591
+ if (typeof window.cf7mdInit === "function") {
592
+ window.cf7mdInit();
593
+ }
594
+
595
+ return false;
596
+ };
597
+
598
+ Wpcf7cfRepeater.prototype.removeSubs = function (num_subs) {
599
+ var $ = jQuery;
600
+ var params = this.params;
601
+ var form = this.form;
602
+ params.$repeater.num_subs -= num_subs;
603
+ jQuery('> .wpcf7cf_repeater_sub', params.$repeater).slice(-num_subs).animate(wpcf7cf_hide_animation, {
604
+ duration: params.wpcf7cf_settings.animation_intime,
605
+ done: function done() {
606
+ var $this = jQuery(this); //remove the actual fields from the form
607
+
608
+ $this.remove();
609
+ params.$repeater.trigger('wpcf7cf_repeater_removed');
610
+ window.wpcf7cf.updateMultistepState(form.multistep);
611
+ form.updateGroups();
612
+ form.updateEventListeners();
613
+ form.displayFields();
614
+ }
615
+ });
616
+ return false;
617
+ };
618
+
619
+ function Wpcf7cfMultistep($multistep, form) {
620
+ var multistep = this;
621
+ multistep.$multistep = $multistep;
622
+ multistep.form = form;
623
+ multistep.$steps = $multistep.find('.wpcf7cf_step');
624
+ multistep.$btn_next = $multistep.find('.wpcf7cf_next');
625
+ multistep.$btn_prev = $multistep.find('.wpcf7cf_prev');
626
+ multistep.$dots = $multistep.find('.wpcf7cf_steps-dots');
627
+ multistep.currentStep = 0;
628
+ multistep.numSteps = multistep.$steps.length;
629
+ multistep.$dots.html('');
630
+
631
+ for (var i = 1; i <= multistep.numSteps; i++) {
632
+ multistep.$dots.append("\n <div class=\"dot\" data-step=\"".concat(i, "\">\n <div class=\"step-index\">").concat(i, "</div>\n <div class=\"step-title\">").concat(multistep.$steps.eq(i - 1).data('title'), "</div>\n </div>\n "));
633
+ }
634
+
635
+ multistep.$btn_next.on('click.wpcf7cf_step', /*#__PURE__*/_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() {
636
+ var result;
637
+ return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) {
638
+ while (1) {
639
+ switch (_context.prev = _context.next) {
640
+ case 0:
641
+ _context.next = 2;
642
+ return multistep.validateStep(multistep.currentStep);
643
+
644
+ case 2:
645
+ result = _context.sent;
646
+
647
+ if (result === 'success') {
648
+ multistep.moveToStep(multistep.currentStep + 1);
649
+ }
650
+
651
+ case 4:
652
+ case "end":
653
+ return _context.stop();
654
+ }
655
+ }
656
+ }, _callee);
657
+ }))); // If form is submitted (by pressing Enter for example), and if we are not on the last step,
658
+ // then trigger click event on the $btn_next button instead.
659
+
660
+ multistep.form.$form.on('submit.wpcf7cf_step', function (e) {
661
+ if (multistep.currentStep !== multistep.numSteps) {
662
+ multistep.$btn_next.trigger('click.wpcf7cf_step');
663
+ e.stopImmediatePropagation();
664
+ return false;
665
+ }
666
+ });
667
+ multistep.$btn_prev.on('click', function () {
668
+ multistep.moveToStep(multistep.currentStep - 1);
669
+ });
670
+ multistep.moveToStep(1);
671
+ }
672
+
673
+ jQuery(document).ajaxComplete(function (e, xhr, settings) {
674
+ if (xhr.hasOwnProperty('responseJSON') && xhr.responseJSON != null && xhr.responseJSON.hasOwnProperty('status') && xhr.responseJSON.hasOwnProperty('into') && xhr.responseJSON.status === "mail_success") {
675
+ jQuery(xhr.responseJSON.into).trigger('reset.wpcf7cf');
676
+ }
677
+ });
678
+
679
+ Wpcf7cfMultistep.prototype.validateStep = function (step_index) {
680
+ var multistep = this;
681
+ var $multistep = multistep.$multistep;
682
+ var $form = multistep.form.$form;
683
+ var form = multistep.form;
684
+ $form.find('.wpcf7-response-output').addClass('wpcf7-display-none');
685
+ return new Promise(function (resolve) {
686
+ var fd = new FormData(); // Make sure to add file fields to FormData
687
+
688
+ jQuery.each($form.find('[data-id="step-' + step_index + '"] input[type="file"]'), function (index, el) {
689
+ if (!el.files.length) return false;
690
+ var file = el.files[0];
691
+ var fieldName = el.name;
692
+ fd.append(fieldName, file);
693
+ });
694
+ var formdata = $form.serializeArray();
695
+ jQuery.each(formdata, function (key, input) {
696
+ fd.append(input.name, input.value);
697
+ });
698
+ jQuery.ajax({
699
+ url: wpcf7cf_global_settings.ajaxurl + '?action=wpcf7cf_validate_step',
700
+ type: 'POST',
701
+ data: fd,
702
+ processData: false,
703
+ contentType: false,
704
+ dataType: 'json'
705
+ }).done(function (json) {
706
+ $multistep.find('.wpcf7-form-control-wrap .wpcf7-not-valid-tip').remove();
707
+ $multistep.find('.wpcf7-not-valid').removeClass('wpcf7-not-valid');
708
+ $multistep.find('.wpcf7-response-output').remove();
709
+ $multistep.find('.wpcf7-response-output.wpcf7-validation-errors').removeClass('wpcf7-validation-errors');
710
+
711
+ if (!json.success) {
712
+ var checkError = 0;
713
+ jQuery.each(json.invalid_fields, function (index, el) {
714
+ if ($multistep.find('input[name="' + index + '"]').length || $multistep.find('input[name="' + index + '[]"]').length || $multistep.find('select[name="' + index + '"]').length || $multistep.find('select[name="' + index + '[]"]').length || $multistep.find('textarea[name="' + index + '"]').length || $multistep.find('textarea[name="' + index + '[]"]').length) {
715
+ checkError = checkError + 1;
716
+ var controlWrap = form.get('.wpcf7-form-control-wrap.' + index);
717
+ controlWrap.find('input').addClass('wpcf7-not-valid');
718
+ controlWrap.find('span.wpcf7-not-valid-tip').remove();
719
+ controlWrap.append('<span role="alert" class="wpcf7-not-valid-tip">' + el.reason + '</span>');
720
+ }
721
+ });
722
+ resolve('failed');
723
+ $multistep.parent().find('.wpcf7-response-output').removeClass('wpcf7-display-none').html(json.message);
724
+ } else if (json.success) {
725
+ resolve('success');
726
+ return false;
727
+ }
728
+ }).fail(function () {
729
+ resolve('error');
730
+ }).always(function () {// do nothing
731
+ });
732
+ });
733
+ };
734
+
735
+ Wpcf7cfMultistep.prototype.moveToStep = function (step_index) {
736
+ var multistep = this;
737
+ var previousStep = multistep.currentStep;
738
+ multistep.currentStep = step_index > multistep.numSteps ? multistep.numSteps : step_index < 1 ? 1 : step_index; // ANIMATION DISABLED FOR NOW cause it's ugly
739
+ // multistep.$steps.animate(wpcf7cf_hide_step_animation, multistep.form.settings.animation_outtime);
740
+ // multistep.$steps.eq(multistep.currentStep-1).animate(wpcf7cf_show_step_animation, multistep.form.settings.animation_intime);
741
+
742
+ multistep.$multistep.attr('data-current_step', multistep.currentStep);
743
+ multistep.$steps.hide();
744
+ multistep.$steps.eq(multistep.currentStep - 1).show().trigger('wpcf7cf_change_step', [previousStep, multistep.currentStep]);
745
+ var formEl = multistep.form.$form[0];
746
+ var topOffset = formEl.getBoundingClientRect().top;
747
+
748
+ if (topOffset < 0 && previousStep > 0) {
749
+ formEl.scrollIntoView({
750
+ behavior: "smooth"
751
+ });
752
+ }
753
+
754
+ multistep.form.updateSummaryFields();
755
+ window.wpcf7cf.updateMultistepState(multistep);
756
+ };
757
+
758
+ Wpcf7cfMultistep.prototype.getFieldsInStep = function (step_index) {
759
+ wpcf7cf_reload_dom(this.form.$form);
760
+ var inStep = false;
761
+ return Object.values(wpcf7cf_dom).filter(function (item, i) {
762
+ if (item.type == 'step') {
763
+ inStep = item.val == step_index + '';
764
+ }
765
+
766
+ return inStep && item.type == 'input';
767
+ }).map(function (item) {
768
+ return item.name;
769
+ });
770
+ }; // END PRO ONLY
771
+
772
+
773
+ window.wpcf7cf = {
774
+ // keep this for backwards compatibility
775
+ initForm: function initForm($form) {
776
+ wpcf7cf_forms.push(new Wpcf7cfForm($form));
777
+ },
778
+ get_nested_conditions: function get_nested_conditions(conditions, $current_form) {
779
+ //loop trough conditions. Then loop trough the dom, and each repeater we pass we should update all sub_values we encounter with __index
780
+ wpcf7cf_reload_dom($current_form);
781
+ var groups = Object.values(wpcf7cf_dom).filter(function (item, i) {
782
+ return item.type === 'group';
783
+ });
784
+ var sub_conditions = [];
785
+
786
+ for (var i = 0; i < groups.length; i++) {
787
+ var g = groups[i];
788
+ var relevant_conditions = conditions.filter(function (condition, i) {
789
+ return condition.then_field === g.original_name;
790
+ });
791
+ var relevant_conditions = relevant_conditions.map(function (item, i) {
792
+ return {
793
+ then_field: g.name,
794
+ and_rules: item.and_rules.map(function (and_rule, i) {
795
+ return {
796
+ if_field: and_rule.if_field + g.suffix,
797
+ if_value: and_rule.if_value,
798
+ operator: and_rule.operator
799
+ };
800
+ })
801
+ };
802
+ });
803
+ sub_conditions = sub_conditions.concat(relevant_conditions);
804
+ }
805
+
806
+ return sub_conditions;
807
+ },
808
+ get_simplified_dom_model: function get_simplified_dom_model($current_form) {
809
+ var currentNode;
810
+ var ni = document.createNodeIterator($current_form[0], NodeFilter.SHOW_ELEMENT, null, false); //, NodeFilter.SHOW_ELEMENT, function(){ return NodeFilter.FILTER_ACCEPT; }
811
+
812
+ var simplified_dom = {};
813
+
814
+ while (currentNode = ni.nextNode()) {
815
+ var type = currentNode.classList.contains('wpcf7cf_repeater') ? 'repeater' : currentNode.dataset["class"] == 'wpcf7cf_group' ? 'group' : currentNode.className == 'wpcf7cf_step' ? 'step' : currentNode.hasAttribute('name') ? 'input' : false;
816
+
817
+ if (!type) {
818
+ continue;
819
+ }
820
+
821
+ var name = type === 'input' ? currentNode.getAttribute('name') : currentNode.dataset.id; // skip _wpcf7 hidden fields
822
+
823
+ if (name.substring(0, 6) === '_wpcf7') continue;
824
+ var original_name = type === 'repeater' || type === 'group' ? currentNode.dataset.orig_data_id : type === 'input' ? currentNode.getAttribute('data-orig_name') || name : name;
825
+ var val = type === 'step' ? [currentNode.dataset.id.substring(5)] : [];
826
+ var original_name_length = original_name == null ? name.length : original_name.length;
827
+ var suffix = name.substring(original_name_length);
828
+
829
+ if (!simplified_dom[name]) {
830
+ // init entry
831
+ simplified_dom[name] = {
832
+ name: name,
833
+ type: type,
834
+ original_name: original_name,
835
+ suffix: suffix,
836
+ val: val
837
+ };
838
+ }
839
+
840
+ if (type === 'input') {
841
+ // skip unchecked checkboxes and radiobuttons
842
+ if ((currentNode.type === 'checkbox' || currentNode.type === 'radio') && !currentNode.checked) continue; // if multiselect, make sure to add all the values
843
+
844
+ if (currentNode.multiple) {
845
+ simplified_dom[name].val = Object.values(currentNode.options).filter(function (o) {
846
+ return o.selected;
847
+ }).map(function (o) {
848
+ return o.value;
849
+ });
850
+ } else {
851
+ simplified_dom[name].val.push(currentNode.value);
852
+ }
853
+ }
854
+ }
855
+
856
+ return simplified_dom;
857
+ },
858
+ updateMultistepState: function updateMultistepState(multistep) {
859
+ if (multistep == null) return; // update hidden input field
860
+
861
+ var stepsData = {
862
+ currentStep: multistep.currentStep,
863
+ numSteps: multistep.numSteps,
864
+ fieldsInCurrentStep: multistep.getFieldsInStep(multistep.currentStep)
865
+ };
866
+ multistep.form.$input_steps.val(JSON.stringify(stepsData)); // update Buttons
867
+
868
+ multistep.$btn_prev.removeClass('disabled').attr('disabled', false);
869
+ multistep.$btn_next.removeClass('disabled').attr('disabled', false);
870
+
871
+ if (multistep.currentStep == multistep.numSteps) {
872
+ multistep.$btn_next.addClass('disabled').attr('disabled', true);
873
+ }
874
+
875
+ if (multistep.currentStep == 1) {
876
+ multistep.$btn_prev.addClass('disabled').attr('disabled', true);
877
+ } // replace next button with submit button on last step.
878
+ // TODO: make this depend on a setting
879
+
880
+
881
+ var $submit_button = multistep.form.$form.find('input[type="submit"]').eq(0);
882
+ var $ajax_loader = multistep.form.$form.find('.ajax-loader').eq(0);
883
+
884
+ if (multistep.currentStep == multistep.numSteps) {
885
+ multistep.$btn_next.hide();
886
+ $ajax_loader.detach().appendTo(multistep.$btn_next.parent());
887
+ $submit_button.detach().appendTo(multistep.$btn_next.parent());
888
+ $submit_button.show();
889
+ } else {
890
+ $submit_button.hide();
891
+ multistep.$btn_next.show();
892
+ } // update dots
893
+
894
+
895
+ var $dots = multistep.$dots.find('.dot');
896
+ $dots.removeClass('active').removeClass('completed');
897
+
898
+ for (var step = 1; step <= multistep.numSteps; step++) {
899
+ if (step < multistep.currentStep) {
900
+ $dots.eq(step - 1).addClass('completed');
901
+ } else if (step == multistep.currentStep) {
902
+ $dots.eq(step - 1).addClass('active');
903
+ }
904
+ }
905
+ },
906
+ should_group_be_shown: function should_group_be_shown(condition) {
907
+ var show_group = true;
908
+
909
+ for (var and_rule_i = 0; and_rule_i < condition.and_rules.length; and_rule_i++) {
910
+ var condition_ok = false;
911
+ var condition_and_rule = condition.and_rules[and_rule_i];
912
+ var inputField = wpcf7cf_getFieldByName(condition_and_rule.if_field);
913
+ var if_val = condition_and_rule.if_value;
914
+ var operator = condition_and_rule.operator; //backwards compat
915
+
916
+ operator = operator === '≤' ? 'less than or equals' : operator;
917
+ operator = operator === '≥' ? 'greater than or equals' : operator;
918
+ operator = operator === '>' ? 'greater than' : operator;
919
+ operator = operator === '<' ? 'less than' : operator;
920
+ condition_ok = this.isConditionTrue(inputField.val, operator, if_val);
921
+ show_group = show_group && condition_ok;
922
+ }
923
+
924
+ return show_group;
925
+ },
926
+ isConditionTrue: function isConditionTrue(values, operator) {
927
+ var testValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
928
+ var $field = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : jQuery();
929
+
930
+ if (!Array.isArray(values)) {
931
+ values = [values];
932
+ }
933
+
934
+ var condition_ok = false; // start by assuming that the condition is not met
935
+ // Considered EMPTY: [] [''] [null] ['',null] [,,'']
936
+ // Considered NOT EMPTY: [0] ['ab','c'] ['',0,null]
937
+
938
+ var valuesAreEmpty = values.length === 0 || values.every(function (v) {
939
+ return !v && v !== 0;
940
+ }); // 0 is not considered empty
941
+ // special cases: [] equals '' => TRUE; [] not equals '' => FALSE
942
+
943
+ if (operator === 'equals' && testValue === '' && valuesAreEmpty) {
944
+ return true;
945
+ }
946
+
947
+ if (operator === 'not equals' && testValue === '' && valuesAreEmpty) {
948
+ return false;
949
+ }
950
+
951
+ if (valuesAreEmpty) {
952
+ if (operator === 'is empty') {
953
+ condition_ok = true;
954
+ }
955
+ } else {
956
+ if (operator === 'not empty') {
957
+ condition_ok = true;
958
+ }
959
+ }
960
+
961
+ var testValueNumber = isFinite(parseFloat(testValue)) ? parseFloat(testValue) : NaN;
962
+
963
+ if (operator === 'not equals' || operator === 'not equals (regex)') {
964
+ // start by assuming that the condition is met
965
+ condition_ok = true;
966
+ }
967
+
968
+ if (operator === 'function' && typeof window[testValue] == 'function' && window[testValue]($field) // here we call the actual user defined function
969
+ ) {
970
+ condition_ok = true;
971
+ }
972
+
973
+ var regex_patt = /.*/i; // fallback regex pattern
974
+
975
+ var isValidRegex = true;
976
+
977
+ if (operator === 'equals (regex)' || operator === 'not equals (regex)') {
978
+ try {
979
+ regex_patt = new RegExp(testValue, 'i');
980
+ } catch (e) {
981
+ isValidRegex = false;
982
+ }
983
+ }
984
+
985
+ for (var i = 0; i < values.length; i++) {
986
+ var value = values[i];
987
+ var valueNumber = isFinite(parseFloat(value)) ? parseFloat(value) : NaN;
988
+ var valsAreNumbers = !isNaN(valueNumber) && !isNaN(testValueNumber);
989
+
990
+ if (operator === 'equals' && value === testValue || operator === 'equals (regex)' && regex_patt.test(value) || operator === 'greater than' && valsAreNumbers && valueNumber > testValueNumber || operator === 'less than' && valsAreNumbers && valueNumber < testValueNumber || operator === 'greater than or equals' && valsAreNumbers && valueNumber >= testValueNumber || operator === 'less than or equals' && valsAreNumbers && valueNumber <= testValueNumber) {
991
+ condition_ok = true;
992
+ break;
993
+ } else if (operator === 'not equals' && value === testValue || operator === 'not equals (regex)' && regex_patt.test(value)) {
994
+ condition_ok = false;
995
+ break;
996
+ }
997
+ }
998
+
999
+ return condition_ok;
1000
+ }
1001
+ };
1002
+ jQuery('.wpcf7-form').each(function () {
1003
+ wpcf7cf_forms.push(new Wpcf7cfForm(jQuery(this)));
1004
+ }); // Call displayFields again on all forms
1005
+ // Necessary in case some theme or plugin changed a form value by the time the entire page is fully loaded.
1006
+
1007
+ jQuery('document').ready(function () {
1008
+ wpcf7cf_forms.forEach(function (f) {
1009
+ f.displayFields();
1010
+ });
1011
+ }); // fix for exclusive checkboxes in IE (this will call the change-event again after all other checkboxes are unchecked, triggering the display_fields() function)
1012
+
1013
+ var old_wpcf7ExclusiveCheckbox = jQuery.fn.wpcf7ExclusiveCheckbox;
1014
+
1015
+ jQuery.fn.wpcf7ExclusiveCheckbox = function () {
1016
+ return this.find('input:checkbox').on('click', function () {
1017
+ var name = jQuery(this).attr('name');
1018
+ jQuery(this).closest('form').find('input:checkbox[name="' + name + '"]').not(this).prop('checked', false).eq(0).change();
1019
+ });
1020
+ };
1021
+
1022
+ /***/ }),
1023
+
1024
+ /***/ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js":
1025
+ /*!*****************************************************************!*\
1026
+ !*** ./node_modules/@babel/runtime/helpers/asyncToGenerator.js ***!
1027
+ \*****************************************************************/
1028
+ /*! no static exports found */
1029
+ /***/ (function(module, exports) {
1030
+
1031
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1032
+ try {
1033
+ var info = gen[key](arg);
1034
+ var value = info.value;
1035
+ } catch (error) {
1036
+ reject(error);
1037
+ return;
1038
+ }
1039
+
1040
+ if (info.done) {
1041
+ resolve(value);
1042
+ } else {
1043
+ Promise.resolve(value).then(_next, _throw);
1044
+ }
1045
+ }
1046
+
1047
+ function _asyncToGenerator(fn) {
1048
+ return function () {
1049
+ var self = this,
1050
+ args = arguments;
1051
+ return new Promise(function (resolve, reject) {
1052
+ var gen = fn.apply(self, args);
1053
+
1054
+ function _next(value) {
1055
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1056
+ }
1057
+
1058
+ function _throw(err) {
1059
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1060
+ }
1061
+
1062
+ _next(undefined);
1063
+ });
1064
+ };
1065
+ }
1066
+
1067
+ module.exports = _asyncToGenerator;
1068
+
1069
+ /***/ }),
1070
+
1071
+ /***/ "./node_modules/@babel/runtime/regenerator/index.js":
1072
+ /*!**********************************************************!*\
1073
+ !*** ./node_modules/@babel/runtime/regenerator/index.js ***!
1074
+ \**********************************************************/
1075
+ /*! no static exports found */
1076
+ /***/ (function(module, exports, __webpack_require__) {
1077
+
1078
+ module.exports = __webpack_require__(/*! regenerator-runtime */ "./node_modules/regenerator-runtime/runtime.js");
1079
+
1080
+ /***/ }),
1081
+
1082
+ /***/ "./node_modules/regenerator-runtime/runtime.js":
1083
+ /*!*****************************************************!*\
1084
+ !*** ./node_modules/regenerator-runtime/runtime.js ***!
1085
+ \*****************************************************/
1086
+ /*! no static exports found */
1087
+ /***/ (function(module, exports, __webpack_require__) {
1088
+
1089
+ /* WEBPACK VAR INJECTION */(function(module) {function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1090
+
1091
+ /**
1092
+ * Copyright (c) 2014-present, Facebook, Inc.
1093
+ *
1094
+ * This source code is licensed under the MIT license found in the
1095
+ * LICENSE file in the root directory of this source tree.
1096
+ */
1097
+ var runtime = function (exports) {
1098
+ "use strict";
1099
+
1100
+ var Op = Object.prototype;
1101
+ var hasOwn = Op.hasOwnProperty;
1102
+ var undefined; // More compressible than void 0.
1103
+
1104
+ var $Symbol = typeof Symbol === "function" ? Symbol : {};
1105
+ var iteratorSymbol = $Symbol.iterator || "@@iterator";
1106
+ var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
1107
+ var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
1108
+
1109
+ function wrap(innerFn, outerFn, self, tryLocsList) {
1110
+ // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
1111
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
1112
+ var generator = Object.create(protoGenerator.prototype);
1113
+ var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
1114
+ // .throw, and .return methods.
1115
+
1116
+ generator._invoke = makeInvokeMethod(innerFn, self, context);
1117
+ return generator;
1118
+ }
1119
+
1120
+ exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
1121
+ // record like context.tryEntries[i].completion. This interface could
1122
+ // have been (and was previously) designed to take a closure to be
1123
+ // invoked without arguments, but in all the cases we care about we
1124
+ // already have an existing method we want to call, so there's no need
1125
+ // to create a new function object. We can even get away with assuming
1126
+ // the method takes exactly one argument, since that happens to be true
1127
+ // in every case, so we don't have to touch the arguments object. The
1128
+ // only additional allocation required is the completion record, which
1129
+ // has a stable shape and so hopefully should be cheap to allocate.
1130
+
1131
+ function tryCatch(fn, obj, arg) {
1132
+ try {
1133
+ return {
1134
+ type: "normal",
1135
+ arg: fn.call(obj, arg)
1136
+ };
1137
+ } catch (err) {
1138
+ return {
1139
+ type: "throw",
1140
+ arg: err
1141
+ };
1142
+ }
1143
+ }
1144
+
1145
+ var GenStateSuspendedStart = "suspendedStart";
1146
+ var GenStateSuspendedYield = "suspendedYield";
1147
+ var GenStateExecuting = "executing";
1148
+ var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
1149
+ // breaking out of the dispatch switch statement.
1150
+
1151
+ var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
1152
+ // .constructor.prototype properties for functions that return Generator
1153
+ // objects. For full spec compliance, you may wish to configure your
1154
+ // minifier not to mangle the names of these two functions.
1155
+
1156
+ function Generator() {}
1157
+
1158
+ function GeneratorFunction() {}
1159
+
1160
+ function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
1161
+ // don't natively support it.
1162
+
1163
+
1164
+ var IteratorPrototype = {};
1165
+
1166
+ IteratorPrototype[iteratorSymbol] = function () {
1167
+ return this;
1168
+ };
1169
+
1170
+ var getProto = Object.getPrototypeOf;
1171
+ var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
1172
+
1173
+ if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
1174
+ // This environment has a native %IteratorPrototype%; use it instead
1175
+ // of the polyfill.
1176
+ IteratorPrototype = NativeIteratorPrototype;
1177
+ }
1178
+
1179
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
1180
+ GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
1181
+ GeneratorFunctionPrototype.constructor = GeneratorFunction;
1182
+ GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction"; // Helper for defining the .next, .throw, and .return methods of the
1183
+ // Iterator interface in terms of a single ._invoke method.
1184
+
1185
+ function defineIteratorMethods(prototype) {
1186
+ ["next", "throw", "return"].forEach(function (method) {
1187
+ prototype[method] = function (arg) {
1188
+ return this._invoke(method, arg);
1189
+ };
1190
+ });
1191
+ }
1192
+
1193
+ exports.isGeneratorFunction = function (genFun) {
1194
+ var ctor = typeof genFun === "function" && genFun.constructor;
1195
+ return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
1196
+ // do is to check its .name property.
1197
+ (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
1198
+ };
1199
+
1200
+ exports.mark = function (genFun) {
1201
+ if (Object.setPrototypeOf) {
1202
+ Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
1203
+ } else {
1204
+ genFun.__proto__ = GeneratorFunctionPrototype;
1205
+
1206
+ if (!(toStringTagSymbol in genFun)) {
1207
+ genFun[toStringTagSymbol] = "GeneratorFunction";
1208
+ }
1209
+ }
1210
+
1211
+ genFun.prototype = Object.create(Gp);
1212
+ return genFun;
1213
+ }; // Within the body of any async function, `await x` is transformed to
1214
+ // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
1215
+ // `hasOwn.call(value, "__await")` to determine if the yielded value is
1216
+ // meant to be awaited.
1217
+
1218
+
1219
+ exports.awrap = function (arg) {
1220
+ return {
1221
+ __await: arg
1222
+ };
1223
+ };
1224
+
1225
+ function AsyncIterator(generator, PromiseImpl) {
1226
+ function invoke(method, arg, resolve, reject) {
1227
+ var record = tryCatch(generator[method], generator, arg);
1228
+
1229
+ if (record.type === "throw") {
1230
+ reject(record.arg);
1231
+ } else {
1232
+ var result = record.arg;
1233
+ var value = result.value;
1234
+
1235
+ if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) {
1236
+ return PromiseImpl.resolve(value.__await).then(function (value) {
1237
+ invoke("next", value, resolve, reject);
1238
+ }, function (err) {
1239
+ invoke("throw", err, resolve, reject);
1240
+ });
1241
+ }
1242
+
1243
+ return PromiseImpl.resolve(value).then(function (unwrapped) {
1244
+ // When a yielded Promise is resolved, its final value becomes
1245
+ // the .value of the Promise<{value,done}> result for the
1246
+ // current iteration.
1247
+ result.value = unwrapped;
1248
+ resolve(result);
1249
+ }, function (error) {
1250
+ // If a rejected Promise was yielded, throw the rejection back
1251
+ // into the async generator function so it can be handled there.
1252
+ return invoke("throw", error, resolve, reject);
1253
+ });
1254
+ }
1255
+ }
1256
+
1257
+ var previousPromise;
1258
+
1259
+ function enqueue(method, arg) {
1260
+ function callInvokeWithMethodAndArg() {
1261
+ return new PromiseImpl(function (resolve, reject) {
1262
+ invoke(method, arg, resolve, reject);
1263
+ });
1264
+ }
1265
+
1266
+ return previousPromise = // If enqueue has been called before, then we want to wait until
1267
+ // all previous Promises have been resolved before calling invoke,
1268
+ // so that results are always delivered in the correct order. If
1269
+ // enqueue has not been called before, then it is important to
1270
+ // call invoke immediately, without waiting on a callback to fire,
1271
+ // so that the async generator function has the opportunity to do
1272
+ // any necessary setup in a predictable way. This predictability
1273
+ // is why the Promise constructor synchronously invokes its
1274
+ // executor callback, and why async functions synchronously
1275
+ // execute code before the first await. Since we implement simple
1276
+ // async functions in terms of async generators, it is especially
1277
+ // important to get this right, even though it requires care.
1278
+ previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
1279
+ // invocations of the iterator.
1280
+ callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
1281
+ } // Define the unified helper method that is used to implement .next,
1282
+ // .throw, and .return (see defineIteratorMethods).
1283
+
1284
+
1285
+ this._invoke = enqueue;
1286
+ }
1287
+
1288
+ defineIteratorMethods(AsyncIterator.prototype);
1289
+
1290
+ AsyncIterator.prototype[asyncIteratorSymbol] = function () {
1291
+ return this;
1292
+ };
1293
+
1294
+ exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
1295
+ // AsyncIterator objects; they just return a Promise for the value of
1296
+ // the final result produced by the iterator.
1297
+
1298
+ exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
1299
+ if (PromiseImpl === void 0) PromiseImpl = Promise;
1300
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
1301
+ return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
1302
+ : iter.next().then(function (result) {
1303
+ return result.done ? result.value : iter.next();
1304
+ });
1305
+ };
1306
+
1307
+ function makeInvokeMethod(innerFn, self, context) {
1308
+ var state = GenStateSuspendedStart;
1309
+ return function invoke(method, arg) {
1310
+ if (state === GenStateExecuting) {
1311
+ throw new Error("Generator is already running");
1312
+ }
1313
+
1314
+ if (state === GenStateCompleted) {
1315
+ if (method === "throw") {
1316
+ throw arg;
1317
+ } // Be forgiving, per 25.3.3.3.3 of the spec:
1318
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
1319
+
1320
+
1321
+ return doneResult();
1322
+ }
1323
+
1324
+ context.method = method;
1325
+ context.arg = arg;
1326
+
1327
+ while (true) {
1328
+ var delegate = context.delegate;
1329
+
1330
+ if (delegate) {
1331
+ var delegateResult = maybeInvokeDelegate(delegate, context);
1332
+
1333
+ if (delegateResult) {
1334
+ if (delegateResult === ContinueSentinel) continue;
1335
+ return delegateResult;
1336
+ }
1337
+ }
1338
+
1339
+ if (context.method === "next") {
1340
+ // Setting context._sent for legacy support of Babel's
1341
+ // function.sent implementation.
1342
+ context.sent = context._sent = context.arg;
1343
+ } else if (context.method === "throw") {
1344
+ if (state === GenStateSuspendedStart) {
1345
+ state = GenStateCompleted;
1346
+ throw context.arg;
1347
+ }
1348
+
1349
+ context.dispatchException(context.arg);
1350
+ } else if (context.method === "return") {
1351
+ context.abrupt("return", context.arg);
1352
+ }
1353
+
1354
+ state = GenStateExecuting;
1355
+ var record = tryCatch(innerFn, self, context);
1356
+
1357
+ if (record.type === "normal") {
1358
+ // If an exception is thrown from innerFn, we leave state ===
1359
+ // GenStateExecuting and loop back for another invocation.
1360
+ state = context.done ? GenStateCompleted : GenStateSuspendedYield;
1361
+
1362
+ if (record.arg === ContinueSentinel) {
1363
+ continue;
1364
+ }
1365
+
1366
+ return {
1367
+ value: record.arg,
1368
+ done: context.done
1369
+ };
1370
+ } else if (record.type === "throw") {
1371
+ state = GenStateCompleted; // Dispatch the exception by looping back around to the
1372
+ // context.dispatchException(context.arg) call above.
1373
+
1374
+ context.method = "throw";
1375
+ context.arg = record.arg;
1376
+ }
1377
+ }
1378
+ };
1379
+ } // Call delegate.iterator[context.method](context.arg) and handle the
1380
+ // result, either by returning a { value, done } result from the
1381
+ // delegate iterator, or by modifying context.method and context.arg,
1382
+ // setting context.delegate to null, and returning the ContinueSentinel.
1383
+
1384
+
1385
+ function maybeInvokeDelegate(delegate, context) {
1386
+ var method = delegate.iterator[context.method];
1387
+
1388
+ if (method === undefined) {
1389
+ // A .throw or .return when the delegate iterator has no .throw
1390
+ // method always terminates the yield* loop.
1391
+ context.delegate = null;
1392
+
1393
+ if (context.method === "throw") {
1394
+ // Note: ["return"] must be used for ES3 parsing compatibility.
1395
+ if (delegate.iterator["return"]) {
1396
+ // If the delegate iterator has a return method, give it a
1397
+ // chance to clean up.
1398
+ context.method = "return";
1399
+ context.arg = undefined;
1400
+ maybeInvokeDelegate(delegate, context);
1401
+
1402
+ if (context.method === "throw") {
1403
+ // If maybeInvokeDelegate(context) changed context.method from
1404
+ // "return" to "throw", let that override the TypeError below.
1405
+ return ContinueSentinel;
1406
+ }
1407
+ }
1408
+
1409
+ context.method = "throw";
1410
+ context.arg = new TypeError("The iterator does not provide a 'throw' method");
1411
+ }
1412
+
1413
+ return ContinueSentinel;
1414
+ }
1415
+
1416
+ var record = tryCatch(method, delegate.iterator, context.arg);
1417
+
1418
+ if (record.type === "throw") {
1419
+ context.method = "throw";
1420
+ context.arg = record.arg;
1421
+ context.delegate = null;
1422
+ return ContinueSentinel;
1423
+ }
1424
+
1425
+ var info = record.arg;
1426
+
1427
+ if (!info) {
1428
+ context.method = "throw";
1429
+ context.arg = new TypeError("iterator result is not an object");
1430
+ context.delegate = null;
1431
+ return ContinueSentinel;
1432
+ }
1433
+
1434
+ if (info.done) {
1435
+ // Assign the result of the finished delegate to the temporary
1436
+ // variable specified by delegate.resultName (see delegateYield).
1437
+ context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
1438
+
1439
+ context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
1440
+ // exception, let the outer generator proceed normally. If
1441
+ // context.method was "next", forget context.arg since it has been
1442
+ // "consumed" by the delegate iterator. If context.method was
1443
+ // "return", allow the original .return call to continue in the
1444
+ // outer generator.
1445
+
1446
+ if (context.method !== "return") {
1447
+ context.method = "next";
1448
+ context.arg = undefined;
1449
+ }
1450
+ } else {
1451
+ // Re-yield the result returned by the delegate method.
1452
+ return info;
1453
+ } // The delegate iterator is finished, so forget it and continue with
1454
+ // the outer generator.
1455
+
1456
+
1457
+ context.delegate = null;
1458
+ return ContinueSentinel;
1459
+ } // Define Generator.prototype.{next,throw,return} in terms of the
1460
+ // unified ._invoke helper method.
1461
+
1462
+
1463
+ defineIteratorMethods(Gp);
1464
+ Gp[toStringTagSymbol] = "Generator"; // A Generator should always return itself as the iterator object when the
1465
+ // @@iterator function is called on it. Some browsers' implementations of the
1466
+ // iterator prototype chain incorrectly implement this, causing the Generator
1467
+ // object to not be returned from this call. This ensures that doesn't happen.
1468
+ // See https://github.com/facebook/regenerator/issues/274 for more details.
1469
+
1470
+ Gp[iteratorSymbol] = function () {
1471
+ return this;
1472
+ };
1473
+
1474
+ Gp.toString = function () {
1475
+ return "[object Generator]";
1476
+ };
1477
+
1478
+ function pushTryEntry(locs) {
1479
+ var entry = {
1480
+ tryLoc: locs[0]
1481
+ };
1482
+
1483
+ if (1 in locs) {
1484
+ entry.catchLoc = locs[1];
1485
+ }
1486
+
1487
+ if (2 in locs) {
1488
+ entry.finallyLoc = locs[2];
1489
+ entry.afterLoc = locs[3];
1490
+ }
1491
+
1492
+ this.tryEntries.push(entry);
1493
+ }
1494
+
1495
+ function resetTryEntry(entry) {
1496
+ var record = entry.completion || {};
1497
+ record.type = "normal";
1498
+ delete record.arg;
1499
+ entry.completion = record;
1500
+ }
1501
+
1502
+ function Context(tryLocsList) {
1503
+ // The root entry object (effectively a try statement without a catch
1504
+ // or a finally block) gives us a place to store values thrown from
1505
+ // locations where there is no enclosing try statement.
1506
+ this.tryEntries = [{
1507
+ tryLoc: "root"
1508
+ }];
1509
+ tryLocsList.forEach(pushTryEntry, this);
1510
+ this.reset(true);
1511
+ }
1512
+
1513
+ exports.keys = function (object) {
1514
+ var keys = [];
1515
+
1516
+ for (var key in object) {
1517
+ keys.push(key);
1518
+ }
1519
+
1520
+ keys.reverse(); // Rather than returning an object with a next method, we keep
1521
+ // things simple and return the next function itself.
1522
+
1523
+ return function next() {
1524
+ while (keys.length) {
1525
+ var key = keys.pop();
1526
+
1527
+ if (key in object) {
1528
+ next.value = key;
1529
+ next.done = false;
1530
+ return next;
1531
+ }
1532
+ } // To avoid creating an additional object, we just hang the .value
1533
+ // and .done properties off the next function object itself. This
1534
+ // also ensures that the minifier will not anonymize the function.
1535
+
1536
+
1537
+ next.done = true;
1538
+ return next;
1539
+ };
1540
+ };
1541
+
1542
+ function values(iterable) {
1543
+ if (iterable) {
1544
+ var iteratorMethod = iterable[iteratorSymbol];
1545
+
1546
+ if (iteratorMethod) {
1547
+ return iteratorMethod.call(iterable);
1548
+ }
1549
+
1550
+ if (typeof iterable.next === "function") {
1551
+ return iterable;
1552
+ }
1553
+
1554
+ if (!isNaN(iterable.length)) {
1555
+ var i = -1,
1556
+ next = function next() {
1557
+ while (++i < iterable.length) {
1558
+ if (hasOwn.call(iterable, i)) {
1559
+ next.value = iterable[i];
1560
+ next.done = false;
1561
+ return next;
1562
+ }
1563
+ }
1564
+
1565
+ next.value = undefined;
1566
+ next.done = true;
1567
+ return next;
1568
+ };
1569
+
1570
+ return next.next = next;
1571
+ }
1572
+ } // Return an iterator with no values.
1573
+
1574
+
1575
+ return {
1576
+ next: doneResult
1577
+ };
1578
+ }
1579
+
1580
+ exports.values = values;
1581
+
1582
+ function doneResult() {
1583
+ return {
1584
+ value: undefined,
1585
+ done: true
1586
+ };
1587
+ }
1588
+
1589
+ Context.prototype = {
1590
+ constructor: Context,
1591
+ reset: function reset(skipTempReset) {
1592
+ this.prev = 0;
1593
+ this.next = 0; // Resetting context._sent for legacy support of Babel's
1594
+ // function.sent implementation.
1595
+
1596
+ this.sent = this._sent = undefined;
1597
+ this.done = false;
1598
+ this.delegate = null;
1599
+ this.method = "next";
1600
+ this.arg = undefined;
1601
+ this.tryEntries.forEach(resetTryEntry);
1602
+
1603
+ if (!skipTempReset) {
1604
+ for (var name in this) {
1605
+ // Not sure about the optimal order of these conditions:
1606
+ if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
1607
+ this[name] = undefined;
1608
+ }
1609
+ }
1610
+ }
1611
+ },
1612
+ stop: function stop() {
1613
+ this.done = true;
1614
+ var rootEntry = this.tryEntries[0];
1615
+ var rootRecord = rootEntry.completion;
1616
+
1617
+ if (rootRecord.type === "throw") {
1618
+ throw rootRecord.arg;
1619
+ }
1620
+
1621
+ return this.rval;
1622
+ },
1623
+ dispatchException: function dispatchException(exception) {
1624
+ if (this.done) {
1625
+ throw exception;
1626
+ }
1627
+
1628
+ var context = this;
1629
+
1630
+ function handle(loc, caught) {
1631
+ record.type = "throw";
1632
+ record.arg = exception;
1633
+ context.next = loc;
1634
+
1635
+ if (caught) {
1636
+ // If the dispatched exception was caught by a catch block,
1637
+ // then let that catch block handle the exception normally.
1638
+ context.method = "next";
1639
+ context.arg = undefined;
1640
+ }
1641
+
1642
+ return !!caught;
1643
+ }
1644
+
1645
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1646
+ var entry = this.tryEntries[i];
1647
+ var record = entry.completion;
1648
+
1649
+ if (entry.tryLoc === "root") {
1650
+ // Exception thrown outside of any try block that could handle
1651
+ // it, so set the completion value of the entire function to
1652
+ // throw the exception.
1653
+ return handle("end");
1654
+ }
1655
+
1656
+ if (entry.tryLoc <= this.prev) {
1657
+ var hasCatch = hasOwn.call(entry, "catchLoc");
1658
+ var hasFinally = hasOwn.call(entry, "finallyLoc");
1659
+
1660
+ if (hasCatch && hasFinally) {
1661
+ if (this.prev < entry.catchLoc) {
1662
+ return handle(entry.catchLoc, true);
1663
+ } else if (this.prev < entry.finallyLoc) {
1664
+ return handle(entry.finallyLoc);
1665
+ }
1666
+ } else if (hasCatch) {
1667
+ if (this.prev < entry.catchLoc) {
1668
+ return handle(entry.catchLoc, true);
1669
+ }
1670
+ } else if (hasFinally) {
1671
+ if (this.prev < entry.finallyLoc) {
1672
+ return handle(entry.finallyLoc);
1673
+ }
1674
+ } else {
1675
+ throw new Error("try statement without catch or finally");
1676
+ }
1677
+ }
1678
+ }
1679
+ },
1680
+ abrupt: function abrupt(type, arg) {
1681
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1682
+ var entry = this.tryEntries[i];
1683
+
1684
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
1685
+ var finallyEntry = entry;
1686
+ break;
1687
+ }
1688
+ }
1689
+
1690
+ if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
1691
+ // Ignore the finally entry if control is not jumping to a
1692
+ // location outside the try/catch block.
1693
+ finallyEntry = null;
1694
+ }
1695
+
1696
+ var record = finallyEntry ? finallyEntry.completion : {};
1697
+ record.type = type;
1698
+ record.arg = arg;
1699
+
1700
+ if (finallyEntry) {
1701
+ this.method = "next";
1702
+ this.next = finallyEntry.finallyLoc;
1703
+ return ContinueSentinel;
1704
+ }
1705
+
1706
+ return this.complete(record);
1707
+ },
1708
+ complete: function complete(record, afterLoc) {
1709
+ if (record.type === "throw") {
1710
+ throw record.arg;
1711
+ }
1712
+
1713
+ if (record.type === "break" || record.type === "continue") {
1714
+ this.next = record.arg;
1715
+ } else if (record.type === "return") {
1716
+ this.rval = this.arg = record.arg;
1717
+ this.method = "return";
1718
+ this.next = "end";
1719
+ } else if (record.type === "normal" && afterLoc) {
1720
+ this.next = afterLoc;
1721
+ }
1722
+
1723
+ return ContinueSentinel;
1724
+ },
1725
+ finish: function finish(finallyLoc) {
1726
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1727
+ var entry = this.tryEntries[i];
1728
+
1729
+ if (entry.finallyLoc === finallyLoc) {
1730
+ this.complete(entry.completion, entry.afterLoc);
1731
+ resetTryEntry(entry);
1732
+ return ContinueSentinel;
1733
+ }
1734
+ }
1735
+ },
1736
+ "catch": function _catch(tryLoc) {
1737
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1738
+ var entry = this.tryEntries[i];
1739
+
1740
+ if (entry.tryLoc === tryLoc) {
1741
+ var record = entry.completion;
1742
+
1743
+ if (record.type === "throw") {
1744
+ var thrown = record.arg;
1745
+ resetTryEntry(entry);
1746
+ }
1747
+
1748
+ return thrown;
1749
+ }
1750
+ } // The context.catch method must only be called with a location
1751
+ // argument that corresponds to a known catch block.
1752
+
1753
+
1754
+ throw new Error("illegal catch attempt");
1755
+ },
1756
+ delegateYield: function delegateYield(iterable, resultName, nextLoc) {
1757
+ this.delegate = {
1758
+ iterator: values(iterable),
1759
+ resultName: resultName,
1760
+ nextLoc: nextLoc
1761
+ };
1762
+
1763
+ if (this.method === "next") {
1764
+ // Deliberately forget the last sent value so that we don't
1765
+ // accidentally pass it on to the delegate.
1766
+ this.arg = undefined;
1767
+ }
1768
+
1769
+ return ContinueSentinel;
1770
+ }
1771
+ }; // Regardless of whether this script is executing as a CommonJS module
1772
+ // or not, return the runtime object so that we can declare the variable
1773
+ // regeneratorRuntime in the outer scope, which allows this module to be
1774
+ // injected easily by `bin/regenerator --include-runtime script.js`.
1775
+
1776
+ return exports;
1777
+ }( // If this script is executing as a CommonJS module, use module.exports
1778
+ // as the regeneratorRuntime namespace. Otherwise create a new empty
1779
+ // object. Either way, the resulting object will be used to initialize
1780
+ // the regeneratorRuntime variable at the top of this file.
1781
+ ( false ? undefined : _typeof(module)) === "object" ? module.exports : {});
1782
+
1783
+ try {
1784
+ regeneratorRuntime = runtime;
1785
+ } catch (accidentalStrictMode) {
1786
+ // This module should not be running in strict mode, so the above
1787
+ // assignment should always work unless something is misconfigured. Just
1788
+ // in case runtime.js accidentally runs in strict mode, we can escape
1789
+ // strict mode using a global Function call. This could conceivably fail
1790
+ // if a Content Security Policy forbids using Function, but in that case
1791
+ // the proper solution is to fix the accidental strict mode problem. If
1792
+ // you've misconfigured your bundler to force strict mode and applied a
1793
+ // CSP to forbid Function, and you're not willing to fix either of those
1794
+ // problems, please detail your unique predicament in a GitHub issue.
1795
+ Function("r", "regeneratorRuntime = r")(runtime);
1796
+ }
1797
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
1798
+
1799
+ /***/ }),
1800
+
1801
+ /***/ "./node_modules/webpack/buildin/module.js":
1802
+ /*!***********************************!*\
1803
+ !*** (webpack)/buildin/module.js ***!
1804
+ \***********************************/
1805
+ /*! no static exports found */
1806
+ /***/ (function(module, exports) {
1807
+
1808
+ module.exports = function (module) {
1809
+ if (!module.webpackPolyfill) {
1810
+ module.deprecate = function () {};
1811
+
1812
+ module.paths = []; // module.parent = undefined by default
1813
+
1814
+ if (!module.children) module.children = [];
1815
+ Object.defineProperty(module, "loaded", {
1816
+ enumerable: true,
1817
+ get: function get() {
1818
+ return module.l;
1819
+ }
1820
+ });
1821
+ Object.defineProperty(module, "id", {
1822
+ enumerable: true,
1823
+ get: function get() {
1824
+ return module.i;
1825
+ }
1826
+ });
1827
+ module.webpackPolyfill = 1;
1828
+ }
1829
+
1830
+ return module;
1831
+ };
1832
+
1833
+ /***/ })
1834
+
1835
+ /******/ });
1836
+ //# sourceMappingURL=scripts.js.map
trunk/js/scripts.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./js/scripts_es6.js","webpack:///./node_modules/@babel/runtime/helpers/asyncToGenerator.js","webpack:///./node_modules/@babel/runtime/regenerator/index.js","webpack:///./node_modules/regenerator-runtime/runtime.js","webpack:///(webpack)/buildin/module.js"],"names":["cf7signature_resized","wpcf7cf_timeout","wpcf7cf_change_time_ms","window","wpcf7cf_running_tests","jQuery","each","e","$input","opt","JSON","parse","val","settings","animation_intime","animation_outtime","stringify","wpcf7cf_show_animation","wpcf7cf_hide_animation","wpcf7cf_show_step_animation","wpcf7cf_hide_step_animation","wpcf7cf_change_events","wpcf7cf_forms","wpcf7cf_dom","wpcf7cf_reload_dom","$form","wpcf7cf","get_simplified_dom_model","wpcf7cf_getFieldsByOriginalName","originalName","Object","values","filter","inputField","original_name","wpcf7cf_getFieldByName","name","String","prototype","endsWith","search","this_len","undefined","length","substring","Wpcf7cfForm","options_element","find","eq","form","form_options","$input_hidden_group_fields","$input_hidden_groups","$input_visible_groups","$input_repeaters","$input_steps","unit_tag","closest","attr","conditions","get","selector","i","condition","and_rules","if_field","if_value","operator","initial_conditions","$groups","repeaters","multistep","fields","parseInt","animation","updateGroups","updateEventListeners","displayFields","on","data","setTimeout","resetRepeaters","moveToStep","push","Wpcf7cfRepeater","map","item","params","$repeater","id","$multistep","Wpcf7cfMultistep","forEach","repeater","updateSubs","initial_subs","wpcf7cf_conditions","wpcf7cf_settings","signatures","constructor","Array","canvas","width","$sig_canvas","$sig_wrap","height","addClass","show_group","should_group_be_shown","then_field","removeClass","index","$group","is","finish","css","hasClass","prop","show","trigger","animate","$inputs","not","$this","defaultValue","defaultChecked","selected","defaultSelected","$select","change","hide","updateHiddenFields","updateSummaryFields","$summary","fd","FormData","formdata","serializeArray","key","input","append","value","el","files","file","fieldName","Blob","ajax","url","wpcf7cf_global_settings","ajaxurl","type","processData","contentType","dataType","success","json","html","summaryHtml","hidden_fields","hidden_groups","visible_groups","get_nested_conditions","off","clearTimeout","text","$","num_subs","orig_id","min","max","$repeater_sub","children","$repeater_controls","$repeater_sub_clone","clone","addBack","prev_suffix","new_suffix","prev_name","orig_name","new_name","replace","prev_data_id","orig_data_id","new_data_id","prev_id","new_id","prev_for","orig_for","new_for","repeater_sub_html","outerHTML","$repeater_count_field","$button_add","$button_remove","remove","subs_to_show","subs_to_add","removeSubs","addSubs","showButtonRemove","showButtonAdd","html_str","sub_suffix","RegExp","$html","insertBefore","updateMultistepState","cf7mdInit","slice","duration","done","$steps","$btn_next","$btn_prev","$dots","currentStep","numSteps","validateStep","result","stopImmediatePropagation","document","ajaxComplete","xhr","hasOwnProperty","responseJSON","status","into","step_index","Promise","resolve","checkError","invalid_fields","controlWrap","reason","parent","message","fail","always","previousStep","formEl","topOffset","getBoundingClientRect","top","scrollIntoView","behavior","getFieldsInStep","inStep","initForm","$current_form","groups","sub_conditions","g","relevant_conditions","and_rule","suffix","concat","currentNode","ni","createNodeIterator","NodeFilter","SHOW_ELEMENT","simplified_dom","nextNode","classList","contains","dataset","className","hasAttribute","getAttribute","original_name_length","checked","multiple","options","o","stepsData","fieldsInCurrentStep","$submit_button","$ajax_loader","detach","appendTo","step","and_rule_i","condition_ok","condition_and_rule","if_val","isConditionTrue","testValue","$field","isArray","valuesAreEmpty","every","v","testValueNumber","isFinite","parseFloat","NaN","regex_patt","isValidRegex","valueNumber","valsAreNumbers","isNaN","test","ready","f","old_wpcf7ExclusiveCheckbox","fn","wpcf7ExclusiveCheckbox","asyncGeneratorStep","gen","reject","_next","_throw","arg","info","error","then","_asyncToGenerator","self","args","arguments","apply","err","module","exports","require","runtime","Op","hasOwn","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","wrap","innerFn","outerFn","tryLocsList","protoGenerator","Generator","generator","create","context","Context","_invoke","makeInvokeMethod","tryCatch","obj","call","GenStateSuspendedStart","GenStateSuspendedYield","GenStateExecuting","GenStateCompleted","ContinueSentinel","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","Gp","displayName","defineIteratorMethods","method","isGeneratorFunction","genFun","ctor","mark","setPrototypeOf","__proto__","awrap","__await","AsyncIterator","PromiseImpl","invoke","record","unwrapped","previousPromise","enqueue","callInvokeWithMethodAndArg","async","iter","next","state","Error","doneResult","delegate","delegateResult","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","TypeError","resultName","nextLoc","toString","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","keys","object","reverse","pop","iterable","iteratorMethod","skipTempReset","prev","charAt","stop","rootEntry","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","thrown","delegateYield","regeneratorRuntime","accidentalStrictMode","Function","webpackPolyfill","deprecate","paths","defineProperty","enumerable","l"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAAA;AAAA;AAAa;;;;AAEb,IAAIA,oBAAoB,GAAG,CAA3B,C,CAA8B;;AAE9B,IAAIC,eAAJ;AACA,IAAIC,sBAAsB,GAAG,GAA7B;;AAEA,IAAIC,MAAM,CAACC,qBAAX,EAAkC;AAC9BC,QAAM,CAAC,gCAAD,CAAN,CAAyCC,IAAzC,CAA8C,UAASC,CAAT,EAAY;AACtD,QAAIC,MAAM,GAAGH,MAAM,CAAC,IAAD,CAAnB;AACA,QAAII,GAAG,GAAGC,IAAI,CAACC,KAAL,CAAWH,MAAM,CAACI,GAAP,EAAX,CAAV;AACAH,OAAG,CAACI,QAAJ,CAAaC,gBAAb,GAAgC,CAAhC;AACAL,OAAG,CAACI,QAAJ,CAAaE,iBAAb,GAAiC,CAAjC;AACAP,UAAM,CAACI,GAAP,CAAWF,IAAI,CAACM,SAAL,CAAe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IADuB;AAEnC9X,SAAG,EAAE,eAAW;AACf,eAAOwQ,MAAM,CAACtQ,CAAd;AACA;AAJkC,KAApC;AAMAsQ,UAAM,CAACkH,eAAP,GAAyB,CAAzB;AACA;;AACD,SAAOlH,MAAP;AACA,CArBD,C","file":"scripts.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./js/scripts_es6.js\");\n","\"use strict\";\n\nvar cf7signature_resized = 0; // for compatibility with contact-form-7-signature-addon\n\nvar wpcf7cf_timeout;\nvar wpcf7cf_change_time_ms = 100;\n\nif (window.wpcf7cf_running_tests) {\n jQuery('input[name=\"_wpcf7cf_options\"]').each(function(e) {\n var $input = jQuery(this);\n var opt = JSON.parse($input.val());\n opt.settings.animation_intime = 0;\n opt.settings.animation_outtime = 0;\n $input.val(JSON.stringify(opt));\n });\n wpcf7cf_change_time_ms = 0;\n}\n\nvar wpcf7cf_show_animation = { \"height\": \"show\", \"marginTop\": \"show\", \"marginBottom\": \"show\", \"paddingTop\": \"show\", \"paddingBottom\": \"show\" };\nvar wpcf7cf_hide_animation = { \"height\": \"hide\", \"marginTop\": \"hide\", \"marginBottom\": \"hide\", \"paddingTop\": \"hide\", \"paddingBottom\": \"hide\" };\n\nvar wpcf7cf_show_step_animation = { \"opacity\": \"show\" };\nvar wpcf7cf_hide_step_animation = { \"opacity\": \"hide\" };\n\nvar wpcf7cf_change_events = 'input.wpcf7cf paste.wpcf7cf change.wpcf7cf click.wpcf7cf propertychange.wpcf7cf';\n\nvar wpcf7cf_forms = [];\n\nwindow.wpcf7cf_dom = {};\n\nconst wpcf7cf_reload_dom = function($form) {\n wpcf7cf_dom = wpcf7cf.get_simplified_dom_model($form);\n}\n\nconst wpcf7cf_getFieldsByOriginalName = function(originalName) {\n return Object.values(wpcf7cf_dom).filter(function (inputField) {\n return inputField.original_name === originalName || inputField.original_name === originalName+'[]';\n });\n}\n\nconst wpcf7cf_getFieldByName = function(name) {\n return wpcf7cf_dom[name] || wpcf7cf_dom[name+'[]'];\n}\n\n// endsWith polyfill\nif (!String.prototype.endsWith) {\n\tString.prototype.endsWith = function(search, this_len) {\n\t\tif (this_len === undefined || this_len > this.length) {\n\t\t\tthis_len = this.length;\n\t\t}\n\t\treturn this.substring(this_len - search.length, this_len) === search;\n\t};\n}\n\nvar Wpcf7cfForm = function($form) {\n\n var options_element = $form.find('input[name=\"_wpcf7cf_options\"]').eq(0);\n if (!options_element.length || !options_element.val()) {\n // doesn't look like a CF7 form created with conditional fields plugin enabled.\n return false;\n }\n\n var form = this;\n\n var form_options = JSON.parse(options_element.val());\n\n form.$form = $form;\n form.$input_hidden_group_fields = $form.find('[name=\"_wpcf7cf_hidden_group_fields\"]');\n form.$input_hidden_groups = $form.find('[name=\"_wpcf7cf_hidden_groups\"]');\n form.$input_visible_groups = $form.find('[name=\"_wpcf7cf_visible_groups\"]');\n form.$input_repeaters = $form.find('[name=\"_wpcf7cf_repeaters\"]');\n form.$input_steps = $form.find('[name=\"_wpcf7cf_steps\"]');\n\n form.unit_tag = $form.closest('.wpcf7').attr('id');\n form.conditions = form_options['conditions'];\n\n // Wrapper around jQuery(selector, form.$form)\n form.get = function (selector) {\n // TODO: implement some caching here.\n return jQuery(selector, form.$form);\n }\n\n // compatibility with conditional forms created with older versions of the plugin ( < 1.4 )\n for (var i=0; i < form.conditions.length; i++) {\n var condition = form.conditions[i];\n if (!('and_rules' in condition)) {\n condition.and_rules = [{'if_field':condition.if_field,'if_value':condition.if_value,'operator':condition.operator}];\n }\n }\n\n form.initial_conditions = form.conditions;\n form.settings = form_options['settings'];\n\n form.$groups = jQuery(); // empty jQuery set\n form.repeaters = [];\n form.multistep = null;\n form.fields = [];\n\n form.settings.animation_intime = parseInt(form.settings.animation_intime);\n form.settings.animation_outtime = parseInt(form.settings.animation_outtime);\n\n if (form.settings.animation === 'no') {\n form.settings.animation_intime = 0;\n form.settings.animation_outtime = 0;\n }\n\n form.updateGroups();\n form.updateEventListeners();\n form.displayFields();\n\n // bring form in initial state if the reset event is fired on it.\n form.$form.on('reset.wpcf7cf', form, function(e) {\n var form = e.data;\n setTimeout(function(){\n form.displayFields();\n form.resetRepeaters();\n if (form.multistep != null) {\n form.multistep.moveToStep(1); \n }\n },200);\n });\n\n // PRO ONLY\n\n form.get('.wpcf7cf_repeater:not(.wpcf7cf_repeater .wpcf7cf_repeater)').each(function(){\n form.repeaters.push(new Wpcf7cfRepeater(jQuery(this),form));\n });\n\n form.$input_repeaters.val(JSON.stringify(form.repeaters.map((item)=>item.params.$repeater.id)));\n\n var $multistep = form.get('.wpcf7cf_multistep');\n\n if ($multistep.length) {\n form.multistep = new Wpcf7cfMultistep($multistep, form);\n // window.wpcf7cf.updateMultistepState(form.multistep);\n }\n\n // END PRO ONLY\n\n}\n\n/**\n * reset initial number of subs for each repeater.\n * (does not clear values)\n */\nWpcf7cfForm.prototype.resetRepeaters = function() {\n var form = this;\n form.repeaters.forEach(repeater => {\n repeater.updateSubs( repeater.params.$repeater.initial_subs );\n });\n}\n\nWpcf7cfForm.prototype.displayFields = function() {\n\n var form = this;\n\n var wpcf7cf_conditions = this.conditions;\n var wpcf7cf_settings = this.settings;\n\n //for compatibility with contact-form-7-signature-addon\n if (cf7signature_resized === 0 && typeof signatures !== 'undefined' && signatures.constructor === Array && signatures.length > 0 ) {\n for (var i = 0; i < signatures.length; i++) {\n if (signatures[i].canvas.width === 0) {\n\n var $sig_canvas = jQuery(\".wpcf7-form-control-signature-body>canvas\");\n var $sig_wrap = jQuery(\".wpcf7-form-control-signature-wrap\");\n $sig_canvas.eq(i).attr('width', $sig_wrap.width());\n $sig_canvas.eq(i).attr('height', $sig_wrap.height());\n\n cf7signature_resized = 1;\n }\n }\n }\n\n form.$groups.addClass('wpcf7cf-hidden');\n\n wpcf7cf_reload_dom(form.$form);\n\n for (var i=0; i < wpcf7cf_conditions.length; i++) {\n\n var condition = wpcf7cf_conditions[i];\n\n var show_group = window.wpcf7cf.should_group_be_shown(condition, form);\n\n if (show_group) {\n form.get('[data-id=\"'+condition.then_field+'\"]').removeClass('wpcf7cf-hidden');\n }\n }\n\n\n var animation_intime = wpcf7cf_settings.animation_intime;\n var animation_outtime = wpcf7cf_settings.animation_outtime;\n\n form.$groups.each(function (index) {\n var $group = jQuery(this);\n if ($group.is(':animated')) $group.finish(); // stop any current animations on the group\n if ($group.css('display') === 'none' && !$group.hasClass('wpcf7cf-hidden')) {\n if ($group.prop('tagName') === 'SPAN') {\n $group.show().trigger('wpcf7cf_show_group');\n } else {\n $group.animate(wpcf7cf_show_animation, animation_intime).trigger('wpcf7cf_show_group'); // show\n }\n } else if ($group.css('display') !== 'none' && $group.hasClass('wpcf7cf-hidden')) {\n\n if ($group.attr('data-clear_on_hide') !== undefined) {\n var $inputs = jQuery(':input', $group).not(':button, :submit, :reset, :hidden');\n\n $inputs.each(function(){\n var $this = jQuery(this);\n $this.val(this.defaultValue);\n $this.prop('checked', this.defaultChecked);\n });\n\n jQuery('option', $group).each(function() {\n this.selected = this.defaultSelected;\n });\n\n jQuery('select', $group).each(function() {\n const $select = jQuery(this);\n if ($select.val() === null) {\n $select.val(jQuery(\"option:first\",$select).val());\n }\n });\n\n $inputs.change();\n //display_fields();\n }\n\n if ($group.prop('tagName') === 'SPAN') {\n $group.hide().trigger('wpcf7cf_hide_group');\n } else {\n $group.animate(wpcf7cf_hide_animation, animation_outtime).trigger('wpcf7cf_hide_group'); // hide\n }\n\n }\n });\n\n form.updateHiddenFields();\n form.updateSummaryFields();\n};\n\nWpcf7cfForm.prototype.updateSummaryFields = function() {\n const form = this;\n var $summary = form.get('.wpcf7cf-summary');\n\n if ($summary.length == 0 || !$summary.is(':visible')) return;\n\n var fd = new FormData();\n\n var formdata = form.$form.serializeArray();\n jQuery.each(formdata,function(key, input){\n fd.append(input.name, input.value);\n });\n\n // Make sure to add file fields to FormData\n jQuery.each(form.$form.find('input[type=\"file\"]'), function(index, el) {\n if (! el.files.length) return false;\n const file = el.files[0];\n const fieldName = el.name;\n fd.append(fieldName, new Blob() ,file.name);\n });\n\n // add file fields to form-data\n\n jQuery.ajax({\n url: wpcf7cf_global_settings.ajaxurl + '?action=wpcf7cf_get_summary',\n type: 'POST',\n data: fd,\n processData: false,\n contentType: false,\n dataType: 'json',\n success: function(json) {\n $summary.html(json.summaryHtml);\n }\n });\n};\n\nWpcf7cfForm.prototype.updateHiddenFields = function() {\n\n var form = this;\n\n var hidden_fields = [];\n var hidden_groups = [];\n var visible_groups = [];\n\n form.$groups.each(function () {\n var $this = jQuery(this);\n if ($this.hasClass('wpcf7cf-hidden')) {\n hidden_groups.push($this.data('id'));\n $this.find('input,select,textarea').each(function () {\n hidden_fields.push(jQuery(this).attr('name'));\n });\n } else {\n visible_groups.push($this.data('id'));\n }\n });\n\n form.hidden_fields = hidden_fields;\n form.hidden_groups = hidden_groups;\n form.visible_groups = visible_groups;\n\n form.$input_hidden_group_fields.val(JSON.stringify(hidden_fields));\n form.$input_hidden_groups.val(JSON.stringify(hidden_groups));\n form.$input_visible_groups.val(JSON.stringify(visible_groups));\n\n return true;\n};\nWpcf7cfForm.prototype.updateGroups = function() {\n var form = this;\n form.$groups = form.$form.find('[data-class=\"wpcf7cf_group\"]');\n\n form.conditions = window.wpcf7cf.get_nested_conditions(form.initial_conditions, form.$form);\n\n};\nWpcf7cfForm.prototype.updateEventListeners = function() {\n\n var form = this;\n\n // monitor input changes, and call displayFields() if something has changed\n form.get('input, select, textarea, button').not('.wpcf7cf_add, .wpcf7cf_remove').off(wpcf7cf_change_events).on(wpcf7cf_change_events,form, function(e) {\n var form = e.data;\n clearTimeout(wpcf7cf_timeout);\n wpcf7cf_timeout = setTimeout(function() {\n form.displayFields();\n }, wpcf7cf_change_time_ms);\n });\n\n // PRO ONLY\n form.get('.wpcf7cf-togglebutton').off('click.toggle_wpcf7cf').on('click.toggle_wpcf7cf',function() {\n var $this = jQuery(this);\n if ($this.text() === $this.data('val-1')) {\n $this.text($this.data('val-2'));\n $this.val($this.data('val-2'));\n } else {\n $this.text($this.data('val-1'));\n $this.val($this.data('val-1'));\n }\n });\n // END PRO ONLY\n};\n\n// PRO ONLY\nfunction Wpcf7cfRepeater($repeater, form) {\n var $ = jQuery;\n\n var repeater = this;\n\n var wpcf7cf_settings = form.settings;\n\n repeater.form = form;\n\n $repeater.num_subs = 0;\n $repeater.id = $repeater.data('id');\n $repeater.orig_id = $repeater.data('orig_data_id');\n $repeater.min = typeof( $repeater.data('min')) !== 'undefined' ? parseInt($repeater.data('min')) : 1;\n $repeater.max = typeof( $repeater.data('max')) !== 'undefined' ? parseInt($repeater.data('max')) : 200;\n $repeater.initial_subs = typeof( $repeater.data('initial')) !== 'undefined' ? parseInt($repeater.data('initial')) : $repeater.min;\n if ($repeater.initial_subs > $repeater.max) $repeater.initial_subs = $repeater.max;\n var $repeater_sub = $repeater.children('.wpcf7cf_repeater_sub').eq(0);\n var $repeater_controls = $repeater.children('.wpcf7cf_repeater_controls').eq(0);\n\n var $repeater_sub_clone = $repeater_sub.clone();\n\n $repeater_sub_clone.find('.wpcf7cf_repeater_sub').addBack('.wpcf7cf_repeater_sub').each(function() {\n var $this = jQuery(this);\n var prev_suffix = $this.attr('data-repeater_sub_suffix');\n var new_suffix = prev_suffix+'__{{repeater_sub_suffix}}';\n $this.attr('data-repeater_sub_suffix', new_suffix);\n });\n\n $repeater_sub_clone.find('[name]').each(function() {\n var $this = jQuery(this);\n var prev_name = $this.attr('name');\n var orig_name = $this.attr('data-orig_name') != null ? $this.attr('data-orig_name') : prev_name;\n var new_name = prev_name+'__{{repeater_sub_suffix}}';\n\n if(prev_name.endsWith('_count')) {\n new_name = prev_name.replace('_count','__{{repeater_sub_suffix}}_count');\n }\n\n $this.attr('name', new_name);\n $this.attr('data-orig_name', orig_name);\n $this.closest('.wpcf7-form-control-wrap').addClass(new_name);\n });\n\n $repeater_sub_clone.find('.wpcf7cf_repeater,[data-class=\"wpcf7cf_group\"]').each(function() {\n var $this = jQuery(this);\n var prev_data_id = $this.attr('data-id');\n var orig_data_id = $this.attr('data-orig_data_id') != null ? $this.attr('data-orig_data_id') : prev_data_id;\n var new_data_id = prev_data_id+'__{{repeater_sub_suffix}}';\n\n if(prev_data_id.endsWith('_count')) {\n new_data_id = prev_data_id.replace('_count','__{{repeater_sub_suffix}}_count');\n }\n\n $this.attr('data-id', new_data_id);\n $this.attr('data-orig_data_id', orig_data_id);\n $this.closest('.wpcf7-form-control-wrap').addClass(new_data_id);\n });\n\n $repeater_sub_clone.find('[id]').each(function() {\n var $this = jQuery(this);\n var prev_id = $this.attr('id');\n var orig_id = $this.attr('data-orig_id') != null ? $this.attr('data-orig_id') : prev_id;\n var new_id = prev_id+'__{{repeater_sub_suffix}}';\n\n $this.attr('id', new_id);\n $this.attr('data-orig_id', orig_id);\n $this.closest('.wpcf7-form-control-wrap').addClass(new_id);\n });\n\n $repeater_sub_clone.find('[for]').each(function() {\n var $this = jQuery(this);\n var prev_for = $this.attr('for');\n var orig_for = $this.attr('data-orig_for') != null ? $this.attr('data-orig_for') : prev_for;\n var new_for = prev_for+'__{{repeater_sub_suffix}}';\n\n $this.attr('for', new_for);\n $this.attr('data-orig_for', orig_for);\n $this.closest('.wpcf7-form-control-wrap').addClass(new_for);\n });\n\n var repeater_sub_html = $repeater_sub_clone[0].outerHTML;\n\n var $repeater_count_field = $repeater.find('[name='+$repeater.id+'_count]').eq(0);\n var $button_add = $repeater_controls.find('.wpcf7cf_add').eq(0);\n var $button_remove = $repeater_controls.find('.wpcf7cf_remove').eq(0);\n\n var params = {\n $repeater: $repeater,\n $repeater_count_field: $repeater_count_field,\n repeater_sub_html: repeater_sub_html,\n $repeater_controls: $repeater_controls,\n $button_add: $button_add,\n $button_remove: $button_remove,\n wpcf7cf_settings: wpcf7cf_settings\n };\n \n this.params = params;\n\n $button_add.on('click', null, repeater, function(e) {\n var repeater = e.data;\n repeater.updateSubs(params.$repeater.num_subs+1);\n });\n\n $button_remove.on('click', null, repeater,function(e) {\n var repeater = e.data;\n repeater.updateSubs(params.$repeater.num_subs-1);\n });\n\n jQuery('> .wpcf7cf_repeater_sub',params.$repeater).eq(0).remove(); // remove the first sub, it's just a template.\n\n repeater.updateSubs($repeater.initial_subs); \n\n}\n\n\n\nWpcf7cfRepeater.prototype.updateSubs = function(subs_to_show) {\n var repeater = this;\n var params = repeater.params;\n var subs_to_add = subs_to_show - params.$repeater.num_subs;\n\n if (subs_to_add < 0) {\n repeater.removeSubs(-subs_to_add);\n } else if (subs_to_add > 0) {\n repeater.addSubs(subs_to_add);\n }\n\n var showButtonRemove = false;\n var showButtonAdd = false;\n\n if (params.$repeater.num_subs < params.$repeater.max) {\n showButtonAdd = true;\n }\n if (params.$repeater.num_subs > params.$repeater.min) {\n showButtonRemove = true;\n }\n\n if (showButtonAdd) {\n params.$button_add.show();\n } else {\n params.$button_add.hide();\n\n }\n\n if (showButtonRemove) {\n params.$button_remove.show();\n } else {\n params.$button_remove.hide();\n }\n\n params.$repeater_count_field.val(subs_to_show);\n\n};\nWpcf7cfRepeater.prototype.addSubs = function(subs_to_add) {\n var $ = jQuery;\n var params = this.params;\n var repeater = this;\n var form = repeater.form;\n\n\n var $repeater = params.$repeater; \n var $repeater_controls = params.$repeater_controls;\n\n //jQuery(params.repeater_sub_html.replace(/name=\"(.*?)\"/g,'name=\"wpcf7cf_repeater['+$repeater.id+']['+$repeater.num_subs+'][$1]\" data-original-name=\"$1\"')).hide().insertBefore($repeater_controls).animate(wpcf7cf_show_animation, params.wpcf7cf_settings.animation_intime);\n\n var html_str = '';\n\n for(var i=1; i<=subs_to_add; i++) {\n var sub_suffix = $repeater.num_subs+i;\n html_str += params.repeater_sub_html.replace(/\\{\\{repeater_sub_suffix\\}\\}/g,sub_suffix)\n .replace(new RegExp('\\{\\{'+$repeater.orig_id+'_index\\}\\}','g'),sub_suffix);\n }\n\n\n var $html = jQuery(html_str);\n\n // Add the newly created fields to the form\n $html.hide().insertBefore($repeater_controls).animate(wpcf7cf_show_animation, params.wpcf7cf_settings.animation_intime).trigger('wpcf7cf_repeater_added');\n\n jQuery('.wpcf7cf_repeater', $html).each(function(){\n form.repeaters.push(new Wpcf7cfRepeater(jQuery(this),form));\n });\n form.$input_repeaters.val(JSON.stringify(form.repeaters.map((item)=>item.params.$repeater.id)));\n\n $repeater.num_subs+= subs_to_add;\n\n window.wpcf7cf.updateMultistepState(form.multistep);\n form.updateGroups();\n form.updateEventListeners();\n form.displayFields();\n\n // Exclusive Checkbox\n $html.on( 'click', '.wpcf7-exclusive-checkbox input:checkbox', function() {\n var name = $( this ).attr( 'name' );\n $html.find( 'input:checkbox[name=\"' + name + '\"]' ).not( this ).prop( 'checked', false );\n } );\n\n //basic compatibility with material-design-for-contact-form-7\n if (typeof window.cf7mdInit === \"function\") {\n window.cf7mdInit();\n }\n\n return false;\n};\nWpcf7cfRepeater.prototype.removeSubs = function(num_subs) {\n var $ = jQuery;\n var params = this.params;\n var form = this.form;\n\n params.$repeater.num_subs-= num_subs;\n\n jQuery('> .wpcf7cf_repeater_sub',params.$repeater).slice(-num_subs).animate(wpcf7cf_hide_animation, {duration:params.wpcf7cf_settings.animation_intime, done:function() {\n var $this = jQuery(this);\n //remove the actual fields from the form\n $this.remove();\n params.$repeater.trigger('wpcf7cf_repeater_removed');\n window.wpcf7cf.updateMultistepState(form.multistep);\n form.updateGroups();\n form.updateEventListeners();\n form.displayFields();\n }});\n\n return false;\n};\n\nfunction Wpcf7cfMultistep($multistep, form) {\n var multistep = this;\n multistep.$multistep = $multistep;\n multistep.form = form;\n multistep.$steps = $multistep.find('.wpcf7cf_step');\n multistep.$btn_next = $multistep.find('.wpcf7cf_next');\n multistep.$btn_prev = $multistep.find('.wpcf7cf_prev');\n multistep.$dots = $multistep.find('.wpcf7cf_steps-dots');\n multistep.currentStep = 0;\n multistep.numSteps = multistep.$steps.length;\n\n\n multistep.$dots.html('');\n for (var i = 1; i <= multistep.numSteps; i++) {\n multistep.$dots.append(`\n <div class=\"dot\" data-step=\"${i}\">\n <div class=\"step-index\">${i}</div>\n <div class=\"step-title\">${multistep.$steps.eq(i-1).data('title')}</div>\n </div>\n `);\n }\n\n multistep.$btn_next.on('click.wpcf7cf_step', async function() {\n \n var result = await multistep.validateStep(multistep.currentStep);\n if (result === 'success') {\n multistep.moveToStep(multistep.currentStep+1); \n }\n\n });\n\n // If form is submitted (by pressing Enter for example), and if we are not on the last step,\n // then trigger click event on the $btn_next button instead.\n multistep.form.$form.on('submit.wpcf7cf_step', function(e) {\n\n if (multistep.currentStep !== multistep.numSteps) {\n multistep.$btn_next.trigger('click.wpcf7cf_step');\n\n e.stopImmediatePropagation();\n return false;\n }\n });\n\n multistep.$btn_prev.on( 'click', function() {\n multistep.moveToStep(multistep.currentStep-1);\n });\n\n multistep.moveToStep(1);\n}\n\njQuery(document).ajaxComplete(function(e, xhr, settings){\n if (\n xhr.hasOwnProperty('responseJSON') &&\n xhr.responseJSON != null &&\n xhr.responseJSON.hasOwnProperty('status') &&\n xhr.responseJSON.hasOwnProperty('into') &&\n xhr.responseJSON.status === \"mail_success\"\n ) {\n jQuery( xhr.responseJSON.into ).trigger('reset.wpcf7cf');\n }\n});\n\nWpcf7cfMultistep.prototype.validateStep = function(step_index) {\n\n var multistep = this;\n var $multistep = multistep.$multistep;\n var $form = multistep.form.$form;\n var form = multistep.form;\n\n $form.find('.wpcf7-response-output').addClass('wpcf7-display-none');\n\n return new Promise(resolve => {\n\n var fd = new FormData();\n\n // Make sure to add file fields to FormData\n jQuery.each($form.find('[data-id=\"step-'+step_index+'\"] input[type=\"file\"]'), function(index, el) {\n if (! el.files.length) return false;\n const file = el.files[0];\n const fieldName = el.name;\n fd.append(fieldName, file);\n });\n\n var formdata = $form.serializeArray();\n jQuery.each(formdata,function(key, input){\n fd.append(input.name, input.value);\n });\n\n jQuery.ajax({\n url: wpcf7cf_global_settings.ajaxurl + '?action=wpcf7cf_validate_step',\n type: 'POST',\n data: fd,\n processData: false,\n contentType: false,\n dataType: 'json',\n }).done(function(json) {\n\n $multistep.find('.wpcf7-form-control-wrap .wpcf7-not-valid-tip').remove();\n $multistep.find('.wpcf7-not-valid').removeClass('wpcf7-not-valid');\n $multistep.find('.wpcf7-response-output').remove();\n $multistep.find('.wpcf7-response-output.wpcf7-validation-errors').removeClass('wpcf7-validation-errors');\n\n if (!json.success) {\n var checkError = 0;\n\n jQuery.each(json.invalid_fields, function(index, el) {\n if ($multistep.find('input[name=\"'+index+'\"]').length ||\n $multistep.find('input[name=\"'+index+'[]\"]').length ||\n $multistep.find('select[name=\"'+index+'\"]').length ||\n $multistep.find('select[name=\"'+index+'[]\"]').length ||\n $multistep.find('textarea[name=\"'+index+'\"]').length ||\n $multistep.find('textarea[name=\"'+index+'[]\"]').length\n ) {\n checkError = checkError + 1;\n\n var controlWrap = form.get('.wpcf7-form-control-wrap.' + index);\n controlWrap.find('input').addClass('wpcf7-not-valid');\n controlWrap.find('span.wpcf7-not-valid-tip').remove();\n controlWrap.append('<span role=\"alert\" class=\"wpcf7-not-valid-tip\">' + el.reason + '</span>');\n\n }\n });\n\n resolve('failed');\n\n $multistep.parent().find('.wpcf7-response-output').removeClass('wpcf7-display-none').html(json.message);\n\n } else if (json.success) {\n resolve('success');\n return false;\n }\n\n }).fail(function() {\n resolve('error');\n }).always(function() {\n // do nothing\n });\n });\n\n};\nWpcf7cfMultistep.prototype.moveToStep = function(step_index) {\n var multistep = this;\n var previousStep = multistep.currentStep;\n\n multistep.currentStep = step_index > multistep.numSteps ? multistep.numSteps\n : step_index < 1 ? 1\n : step_index;\n\n // ANIMATION DISABLED FOR NOW cause it's ugly\n // multistep.$steps.animate(wpcf7cf_hide_step_animation, multistep.form.settings.animation_outtime);\n // multistep.$steps.eq(multistep.currentStep-1).animate(wpcf7cf_show_step_animation, multistep.form.settings.animation_intime);\n\n multistep.$multistep.attr('data-current_step', multistep.currentStep);\n multistep.$steps.hide();\n multistep.$steps\n .eq(multistep.currentStep-1)\n .show()\n .trigger('wpcf7cf_change_step', [previousStep, multistep.currentStep]);\n\n const formEl = multistep.form.$form[0];\n const topOffset = formEl.getBoundingClientRect().top;\n if (topOffset < 0 && previousStep > 0) {\n formEl.scrollIntoView({behavior: \"smooth\"});\n }\n\n multistep.form.updateSummaryFields();\n\n window.wpcf7cf.updateMultistepState(multistep);\n};\n\nWpcf7cfMultistep.prototype.getFieldsInStep = function(step_index) {\n wpcf7cf_reload_dom(this.form.$form);\n var inStep = false;\n return Object.values(wpcf7cf_dom).filter(function(item, i) {\n if(item.type == 'step') {\n inStep = item.val == step_index+'';\n }\n return inStep && item.type == 'input';\n }).map(function(item) {\n return item.name;\n });\n};\n\n// END PRO ONLY\n\nwindow.wpcf7cf = {\n\n // keep this for backwards compatibility\n initForm : function($form) {\n wpcf7cf_forms.push(new Wpcf7cfForm($form));\n },\n\n get_nested_conditions : function(conditions, $current_form) {\n //loop trough conditions. Then loop trough the dom, and each repeater we pass we should update all sub_values we encounter with __index\n wpcf7cf_reload_dom($current_form);\n var groups = Object.values(wpcf7cf_dom).filter(function(item, i) {\n return item.type==='group';\n });\n\n var sub_conditions = [];\n\n for(var i = 0; i < groups.length; i++) {\n var g = groups[i];\n var relevant_conditions = conditions.filter(function(condition, i) {\n return condition.then_field === g.original_name;\n });\n \n var relevant_conditions = relevant_conditions.map(function(item,i) {\n return {\n then_field : g.name,\n and_rules : item.and_rules.map(function(and_rule, i) {\n return {\n if_field : and_rule.if_field+g.suffix,\n if_value : and_rule.if_value,\n operator : and_rule.operator\n };\n })\n }\n });\n\n sub_conditions = sub_conditions.concat(relevant_conditions);\n }\n return sub_conditions;\n },\n\n get_simplified_dom_model : function($current_form) {\n\n var currentNode;\n var ni = document.createNodeIterator($current_form[0], NodeFilter.SHOW_ELEMENT, null, false); //, NodeFilter.SHOW_ELEMENT, function(){ return NodeFilter.FILTER_ACCEPT; }\n\n var simplified_dom = {};\n\n while(currentNode = ni.nextNode()) {\n\n const type = currentNode.classList.contains('wpcf7cf_repeater') ? 'repeater' :\n currentNode.dataset.class == 'wpcf7cf_group' ? 'group' :\n currentNode.className == 'wpcf7cf_step' ? 'step' :\n currentNode.hasAttribute('name') ? 'input' : false;\n\n if (!type) {\n continue;\n } \n\n const name = type === 'input' ? currentNode.getAttribute('name') : currentNode.dataset.id;\n\n // skip _wpcf7 hidden fields\n if (name.substring(0,6) === '_wpcf7') continue;\n\n const original_name = type === 'repeater' || type === 'group' ? currentNode.dataset.orig_data_id\n : type === 'input' ? (currentNode.getAttribute('data-orig_name') || name)\n : name;\n\n const val = type === 'step' ? [currentNode.dataset.id.substring(5)] : [];\n\n const original_name_length = original_name == null ? name.length : original_name.length;\n const suffix = name.substring(original_name_length);\n\n if (!simplified_dom[name]) {\n // init entry\n simplified_dom[name] = {name, type, original_name, suffix, val}\n }\n\n if (type === 'input') {\n\n // skip unchecked checkboxes and radiobuttons\n if ( (currentNode.type === 'checkbox' || currentNode.type === 'radio') && !currentNode.checked ) continue;\n\n // if multiselect, make sure to add all the values\n if ( currentNode.multiple ) {\n simplified_dom[name].val = Object.values(currentNode.options).filter(o => o.selected).map(o => o.value)\n } else {\n simplified_dom[name].val.push(currentNode.value);\n }\n }\n\n }\n\n return simplified_dom;\n },\n\n updateMultistepState: function (multistep) {\n if (multistep == null) return;\n\n // update hidden input field\n\n var stepsData = {\n currentStep : multistep.currentStep,\n numSteps : multistep.numSteps,\n fieldsInCurrentStep : multistep.getFieldsInStep(multistep.currentStep)\n };\n multistep.form.$input_steps.val(JSON.stringify(stepsData));\n\n // update Buttons\n multistep.$btn_prev.removeClass('disabled').attr('disabled', false);\n multistep.$btn_next.removeClass('disabled').attr('disabled', false);\n if (multistep.currentStep == multistep.numSteps) {\n multistep.$btn_next.addClass('disabled').attr('disabled', true);\n }\n if (multistep.currentStep == 1) {\n multistep.$btn_prev.addClass('disabled').attr('disabled', true);\n }\n\n // replace next button with submit button on last step.\n // TODO: make this depend on a setting\n var $submit_button = multistep.form.$form.find('input[type=\"submit\"]').eq(0);\n var $ajax_loader = multistep.form.$form.find('.ajax-loader').eq(0);\n if (multistep.currentStep == multistep.numSteps) {\n multistep.$btn_next.hide();\n $ajax_loader.detach().appendTo(multistep.$btn_next.parent());\n $submit_button.detach().appendTo(multistep.$btn_next.parent());\n $submit_button.show();\n } else {\n $submit_button.hide();\n multistep.$btn_next.show();\n }\n\n // update dots\n var $dots = multistep.$dots.find('.dot');\n $dots.removeClass('active').removeClass('completed');\n for(var step = 1; step <= multistep.numSteps; step++) {\n if (step < multistep.currentStep) {\n $dots.eq(step-1).addClass('completed');\n } else if (step == multistep.currentStep) {\n $dots.eq(step-1).addClass('active');\n }\n }\n\n },\n\n should_group_be_shown : function(condition) {\n\n var show_group = true;\n\n for (var and_rule_i = 0; and_rule_i < condition.and_rules.length; and_rule_i++) {\n\n var condition_ok = false;\n\n var condition_and_rule = condition.and_rules[and_rule_i];\n\n var inputField = wpcf7cf_getFieldByName(condition_and_rule.if_field);\n\n var if_val = condition_and_rule.if_value;\n var operator = condition_and_rule.operator;\n\n //backwards compat\n operator = operator === '≤' ? 'less than or equals' : operator;\n operator = operator === '≥' ? 'greater than or equals' : operator;\n operator = operator === '>' ? 'greater than' : operator;\n operator = operator === '<' ? 'less than' : operator;\n\n condition_ok = this.isConditionTrue(inputField.val,operator,if_val);\n\n show_group = show_group && condition_ok;\n }\n\n return show_group;\n\n },\n isConditionTrue(values, operator, testValue='', $field=jQuery()) {\n\n if (!Array.isArray(values)) {\n values = [values];\n }\n\n let condition_ok = false; // start by assuming that the condition is not met\n\n // Considered EMPTY: [] [''] [null] ['',null] [,,'']\n // Considered NOT EMPTY: [0] ['ab','c'] ['',0,null]\n const valuesAreEmpty = values.length === 0 || values.every((v) => !v&&v!==0); // 0 is not considered empty\n\n // special cases: [] equals '' => TRUE; [] not equals '' => FALSE\n if (operator === 'equals' && testValue === '' && valuesAreEmpty) {\n return true;\n }\n if (operator === 'not equals' && testValue === '' && valuesAreEmpty) {\n return false;\n }\n\n if (valuesAreEmpty) {\n if (operator === 'is empty') {\n condition_ok = true;\n }\n } else {\n if (operator === 'not empty') {\n condition_ok = true;\n }\n }\n\n const testValueNumber = isFinite(parseFloat(testValue)) ? parseFloat(testValue) : NaN;\n\n\n if (operator === 'not equals' || operator === 'not equals (regex)') {\n // start by assuming that the condition is met\n condition_ok = true;\n }\n\n if (\n operator === 'function'\n && typeof window[testValue] == 'function'\n && window[testValue]($field) // here we call the actual user defined function\n ) {\n condition_ok = true;\n }\n\n let regex_patt = /.*/i; // fallback regex pattern\n let isValidRegex = true;\n if (operator === 'equals (regex)' || operator === 'not equals (regex)') {\n try {\n regex_patt = new RegExp(testValue, 'i');\n } catch(e) {\n isValidRegex = false;\n }\n }\n\n\n for(let i = 0; i < values.length; i++) {\n\n const value = values[i];\n\n const valueNumber = isFinite(parseFloat(value)) ? parseFloat(value) : NaN;\n const valsAreNumbers = !isNaN(valueNumber) && !isNaN(testValueNumber);\n\n if (\n\n operator === 'equals' && value === testValue ||\n operator === 'equals (regex)' && regex_patt.test(value) ||\n operator === 'greater than' && valsAreNumbers && valueNumber > testValueNumber ||\n operator === 'less than' && valsAreNumbers && valueNumber < testValueNumber ||\n operator === 'greater than or equals' && valsAreNumbers && valueNumber >= testValueNumber ||\n operator === 'less than or equals' && valsAreNumbers && valueNumber <= testValueNumber\n \n ) {\n\n condition_ok = true;\n break;\n\n } else if (\n\n operator === 'not equals' && value === testValue ||\n operator === 'not equals (regex)' && regex_patt.test(value)\n\n ) {\n\n condition_ok = false;\n break;\n\n }\n }\n\n return condition_ok;\n\n }\n\n};\n\njQuery('.wpcf7-form').each(function(){\n wpcf7cf_forms.push(new Wpcf7cfForm(jQuery(this)));\n});\n\n// Call displayFields again on all forms\n// Necessary in case some theme or plugin changed a form value by the time the entire page is fully loaded.\njQuery('document').ready(function() {\n wpcf7cf_forms.forEach(function(f){\n f.displayFields();\n });\n});\n\n// fix for exclusive checkboxes in IE (this will call the change-event again after all other checkboxes are unchecked, triggering the display_fields() function)\nvar old_wpcf7ExclusiveCheckbox = jQuery.fn.wpcf7ExclusiveCheckbox;\njQuery.fn.wpcf7ExclusiveCheckbox = function() {\n return this.find('input:checkbox').on('click', function() {\n var name = jQuery(this).attr('name');\n jQuery(this).closest('form').find('input:checkbox[name=\"' + name + '\"]').not(this).prop('checked', false).eq(0).change();\n });\n};\n\n","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nfunction _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}\n\nmodule.exports = _asyncToGenerator;","module.exports = require(\"regenerator-runtime\");\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n IteratorPrototype[iteratorSymbol] = function () {\n return this;\n };\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\n GeneratorFunctionPrototype.constructor = GeneratorFunction;\n GeneratorFunctionPrototype[toStringTagSymbol] =\n GeneratorFunction.displayName = \"GeneratorFunction\";\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n prototype[method] = function(arg) {\n return this._invoke(method, arg);\n };\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n if (!(toStringTagSymbol in genFun)) {\n genFun[toStringTagSymbol] = \"GeneratorFunction\";\n }\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n AsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n };\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n Gp[toStringTagSymbol] = \"Generator\";\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n Gp[iteratorSymbol] = function() {\n return this;\n };\n\n Gp.toString = function() {\n return \"[object Generator]\";\n };\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n}\n","module.exports = function(module) {\n\tif (!module.webpackPolyfill) {\n\t\tmodule.deprecate = function() {};\n\t\tmodule.paths = [];\n\t\t// module.parent = undefined by default\n\t\tif (!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\n};\n"],"sourceRoot":""}
trunk/js/scripts_admin.js ADDED
@@ -0,0 +1,447 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * These scripts are part of the Conditional Fields for Contact Form 7 plugin.
3
+ * Should only be loaded when editing a form in the WP backend.
4
+ */
5
+
6
+
7
+ var wpcf7cf = {};
8
+
9
+ wpcf7cf.MAX_CONDITIONS = 50;
10
+
11
+ wpcf7cf.$newEntry = jQuery('#wpcf7cf-new-entry').eq(0);
12
+ wpcf7cf.$textView = jQuery('#wpcf7cf-settings-text').eq(0);
13
+ wpcf7cf.$textOnlyCheckbox = jQuery('#wpcf7cf-text-only-checkbox').eq(0);
14
+ wpcf7cf.$entriesUi = jQuery('#wpcf7cf-entries-ui').eq(0);
15
+ wpcf7cf.$addButton = jQuery('#wpcf7cf-add-button').eq(0);
16
+ wpcf7cf.$maxReachedWarning = jQuery('#wpcf7cf-a-lot-of-conditions').eq(0);
17
+ wpcf7cf.$formEditorForm = jQuery('#wpcf7-admin-form-element').eq(0);
18
+
19
+ wpcf7cf.$if_values = jQuery('.if-value'); // gets updated now and then
20
+
21
+ wpcf7cf.regexCondition = /(?:show \[([^\]]*?)\]) if \[([^\]]*?)\] (?:(equals \(regex\)|not equals \(regex\)|equals|not equals|greater than or equals|greater than|less than or equals|less than|is empty|not empty|function)(?: \"(.*)\")?)/g;
22
+ wpcf7cf.regexConditionAnd = /and if \[([^\]]*?)\] (?:(equals \(regex\)|not equals \(regex\)|equals|not equals|greater than or equals|greater than|less than or equals|less than|is empty|not empty|function)(?: \"(.*)\")?)/g;
23
+
24
+
25
+ // HTML templates
26
+ wpcf7cf.template_for_condition_fields_with_one_and_rule = wpcf7cf.$newEntry.html();
27
+ wpcf7cf.template_for_and_rule = wpcf7cf.$newEntry.find('.wpcf7cf-and-rule')[0] ? wpcf7cf.$newEntry.find('.wpcf7cf-and-rule')[0].outerHTML : '';
28
+ // remove and-rules from dom
29
+ wpcf7cf.$newEntry.find('.wpcf7cf-and-rules').eq(0).html('');
30
+ wpcf7cf.template_for_condition_fields_without_and_rules = wpcf7cf.$newEntry.html();
31
+
32
+ wpcf7cf.transformConditionsFromStringToArrayOfObjects = function(str) {
33
+
34
+ if (!str) str = '';
35
+
36
+ var conditionsAsStrings = str.split(/\r?\n(?=show)/);
37
+ var conditionsAsObjects = [];
38
+ for (var i = 0; i<conditionsAsStrings.length; i++) {
39
+
40
+ var lines = conditionsAsStrings[i].split(/\r?\n/);
41
+
42
+ wpcf7cf.regexCondition.lastIndex = 0;
43
+ var line1Match = wpcf7cf.regexCondition.exec(lines[0]);
44
+
45
+ if (line1Match != null) {
46
+
47
+ var conditionObject = {
48
+ then_field:line1Match[1],
49
+ and_rules: [
50
+ {
51
+ if_field: line1Match[2],
52
+ operator: line1Match[3],
53
+ if_value: line1Match[4],
54
+ },
55
+ ],
56
+ };
57
+
58
+ for(var and_i = 1; and_i < lines.length; and_i++) {
59
+ wpcf7cf.regexConditionAnd.lastIndex = 0;
60
+ lineMatch = wpcf7cf.regexConditionAnd.exec(lines[and_i]);
61
+ if (lineMatch != null) {
62
+ conditionObject.and_rules.push({
63
+ if_field: lineMatch[1],
64
+ operator: lineMatch[2],
65
+ if_value: lineMatch[3],
66
+ });
67
+ }
68
+ }
69
+
70
+ conditionsAsObjects.push(conditionObject);
71
+
72
+ }
73
+ }
74
+ return conditionsAsObjects;
75
+ }
76
+
77
+ wpcf7cf.getnumberOfTextEntries = function () {
78
+ const textConditions = wpcf7cf.transformConditionsFromStringToArrayOfObjects(wpcf7cf.$textView.val());
79
+ return textConditions.length;
80
+ }
81
+
82
+ wpcf7cf.getnumberOfFieldEntries = function () {
83
+ return wpcf7cf.$entriesUi.find('.entry').length;
84
+ }
85
+
86
+ wpcf7cf.transformConditionsFromArrayOfObjectsToString = function(conditions) {
87
+ return conditions.map(function(condition){
88
+ var indent = ' '.repeat(condition.then_field.length + 4);
89
+ return `show [${condition.then_field}] `+condition.and_rules.map(function(rule, i){
90
+ return ( i>0 ? indent+'and ':'' ) + `if [${rule.if_field}] ${rule.operator} "${rule.if_value}"`
91
+ }).join('\n');
92
+ }).join('\n');
93
+ }
94
+
95
+ /**
96
+ * Tranform an array of conditions (Objects) to HTML fields
97
+ * @param Array conditions
98
+ * @returns jQuery
99
+ */
100
+ wpcf7cf.transformConditionsFromArrayOfObjectsToFieldElements = function(conditions) {
101
+
102
+ if ( wpcf7cf.MAX_CONDITIONS < conditions.length ) {
103
+ jQuery('#wpcf7cf-entries').html('');
104
+ wpcf7cf.maybeDisableAddButton();
105
+ return;
106
+ }
107
+
108
+ var entries = [];
109
+
110
+ for (var c_i = 0; c_i<conditions.length; c_i++) {
111
+
112
+ var condition = conditions[c_i];
113
+ var id=0;
114
+
115
+ // setup then_field
116
+ var $entry = jQuery( '<div class="entry">' + wpcf7cf.template_for_condition_fields_without_and_rules + '</div>' );
117
+ jQuery('.then-field-select', $entry).val(condition.then_field);
118
+
119
+ for (var a_i = 0; a_i < condition.and_rules.length; a_i++) {
120
+ var and_rule = condition.and_rules[a_i];
121
+
122
+ $rule = jQuery(wpcf7cf.template_for_and_rule);
123
+
124
+ jQuery('.if-field-select', $rule).val(and_rule.if_field);
125
+ jQuery('.operator', $rule).val(and_rule.operator);
126
+ jQuery('.if-value', $rule).val(and_rule.if_value);
127
+
128
+ jQuery('.wpcf7cf-and-rules', $entry).eq(0).append($rule);
129
+
130
+ }
131
+
132
+ entries.push($entry);
133
+ }
134
+
135
+ jQuery('#wpcf7cf-entries').html(entries);
136
+
137
+ update_entries();
138
+
139
+ }
140
+
141
+ wpcf7cf.maybeDisableAddButton = function() {
142
+ if (wpcf7cf.getnumberOfTextEntries() >= wpcf7cf.MAX_CONDITIONS && wpcf7cf.getnumberOfFieldEntries() == 0 ||
143
+ wpcf7cf.getnumberOfFieldEntries() >= wpcf7cf.MAX_CONDITIONS
144
+ ) {
145
+ wpcf7cf.$addButton.hide();
146
+ wpcf7cf.$maxReachedWarning.show();
147
+ } else {
148
+ wpcf7cf.$addButton.show();
149
+ wpcf7cf.$maxReachedWarning.hide();
150
+ }
151
+ }
152
+
153
+ wpcf7cf.maybeDisableAddButton();
154
+
155
+ wpcf7cf.transformConditionsFromFieldsToArrayOfObjects = function($entries) {
156
+
157
+ if (!$entries) {
158
+ $entries = jQuery('#wpcf7cf-entries .entry');
159
+ }
160
+
161
+ var conditionsAsObjects = [];
162
+
163
+ $entries.each(function() {
164
+
165
+ var $entry = jQuery(this);
166
+ var then_field = $entry.find('.then-field-select').val();
167
+
168
+ var conditionObject = {
169
+ then_field: then_field,
170
+ and_rules: [],
171
+ };
172
+
173
+ $entry.find('.wpcf7cf-and-rule').each(function(i) {
174
+ const $and_rule = jQuery(this);
175
+ conditionObject.and_rules.push({
176
+ operator : $and_rule.find('.operator').val(),
177
+ if_field : $and_rule.find('.if-field-select').val(),
178
+ if_value : $and_rule.find('.if-value').val(),
179
+ });
180
+ });
181
+
182
+ conditionsAsObjects.push(conditionObject);
183
+
184
+ });
185
+
186
+ return conditionsAsObjects;
187
+ }
188
+
189
+
190
+ wpcf7cf.copyTextToFields = function() {
191
+ var str = wpcf7cf.$textView.val();
192
+ var obj = wpcf7cf.transformConditionsFromStringToArrayOfObjects(str);
193
+ wpcf7cf.transformConditionsFromArrayOfObjectsToFieldElements(obj);
194
+ }
195
+
196
+ wpcf7cf.copyFieldsToText = function() {
197
+ var obj = wpcf7cf.transformConditionsFromFieldsToArrayOfObjects();
198
+ var str = wpcf7cf.transformConditionsFromArrayOfObjectsToString(obj);
199
+ wpcf7cf.$textView.val(str);
200
+ }
201
+
202
+ var regexes = [
203
+ { label: wpcf7cf_options_0.regex_email_label, desc: wpcf7cf_options_0.regex_email },
204
+ { label: wpcf7cf_options_0.regex_numeric_label, desc: wpcf7cf_options_0.regex_numeric },
205
+ { label: wpcf7cf_options_0.regex_alphanumeric_label, desc: wpcf7cf_options_0.regex_alphanumeric },
206
+ { label: wpcf7cf_options_0.regex_alphabetic_label, desc: wpcf7cf_options_0.regex_alphabetic },
207
+ { label: wpcf7cf_options_0.regex_date_label, desc: wpcf7cf_options_0.regex_date },
208
+ { label: wpcf7cf_options_0.regex_custom_1_label, desc: wpcf7cf_options_0.regex_custom_1 },
209
+ { label: wpcf7cf_options_0.regex_custom_2_label, desc: wpcf7cf_options_0.regex_custom_2 },
210
+ { label: wpcf7cf_options_0.regex_custom_3_label, desc: wpcf7cf_options_0.regex_custom_3 },
211
+ { label: wpcf7cf_options_0.regex_custom_4_label, desc: wpcf7cf_options_0.regex_custom_4 },
212
+ { label: wpcf7cf_options_0.regex_custom_5_label, desc: wpcf7cf_options_0.regex_custom_5 },
213
+ ];
214
+
215
+ var i = regexes.length;
216
+ while (i--) {
217
+ if (null == regexes[i].label || null == regexes[i].desc || regexes[i].label == '' || regexes[i].desc == '') {
218
+ regexes.splice(i,1);
219
+ }
220
+ }
221
+
222
+ var termTemplate = "<span class='ui-autocomplete-term'>%s</span>";
223
+
224
+ jQuery('#wpcf7cf-entries').sortable();
225
+
226
+ var index = jQuery('#wpcf7cf-entries .entry').length;
227
+ var index_and = 0;
228
+
229
+ wpcf7cf.$addButton.click(function(){
230
+ add_condition_fields();
231
+ });
232
+
233
+ function add_condition_fields() {
234
+ $c = jQuery('<div class="entry">'+wpcf7cf.template_for_condition_fields_with_one_and_rule+'</div>')
235
+ $c.appendTo('#wpcf7cf-entries');
236
+ update_entries();
237
+ }
238
+
239
+ function update_entries() {
240
+ wpcf7cf.$if_values = jQuery('.if-value');
241
+ init_autocomplete();
242
+ wpcf7cf.$if_values.css({'visibility':'visible'});
243
+ wpcf7cf.$if_values.autocomplete( "disable" );
244
+
245
+ jQuery('#wpcf7cf-entries .wpcf7cf-and-rule').each(function() {
246
+ var $and_rule = jQuery(this);
247
+ var $operatorField = $and_rule.find('.operator').eq(0);
248
+ var operator = $operatorField.val() || 'equals';
249
+ if ($and_rule.find('.operator').eq(0).val() === 'is empty' || $and_rule.find('.operator').eq(0).val() === 'not empty') {
250
+ $and_rule.find('.if-value').eq(0).css({'visibility':'hidden'});
251
+ } else if (operator.endsWith('(regex)')) {
252
+ $and_rule.find('.if-value').eq(0).autocomplete( "enable" );
253
+ }
254
+ });
255
+
256
+ scale_and_button();
257
+
258
+ set_events();
259
+
260
+ wpcf7cf.maybeDisableAddButton();
261
+ }
262
+
263
+ function init_autocomplete() {
264
+
265
+ wpcf7cf.$if_values.autocomplete({
266
+ disabled: true,
267
+ source: function(request, response) {
268
+ var matcher = new RegExp(jQuery.ui.autocomplete.escapeRegex(request.term), "i");
269
+ response(jQuery.grep(regexes, function(value) {
270
+ return matcher.test(value.label || value.value || value) || matcher.test(value.desc);
271
+ }));
272
+ },
273
+ focus: function( event, ui ) {
274
+ jQuery( event.target ).val( ui.item.desc );
275
+ return false;
276
+ },
277
+ select: function( event, ui ) {
278
+ jQuery( event.target ).val( ui.item.desc );
279
+ return false;
280
+ },
281
+ open: function(e,ui) {
282
+ $el = jQuery(e.target);
283
+ var styledTerm = termTemplate.replace('%s', $el.val());
284
+
285
+ jQuery('.ui-autocomplete').find('em').each(function() {
286
+ var me = jQuery(this);
287
+ me.html( me.text().replace($el.val(), styledTerm) );
288
+ });
289
+ },
290
+ minLength: 0
291
+ }).each(function() {
292
+ jQuery(this).autocomplete( "instance" )._renderItem = function( ul, item ) {
293
+ return jQuery("<li>")
294
+ .append("<div><em>" + item.label + "</em><br><em>" + item.desc + "</em></div>")
295
+ .appendTo(ul);
296
+ }
297
+ });
298
+ wpcf7cf.$if_values.on('focus', function() {
299
+ jQuery(this).autocomplete("search");
300
+ });
301
+ }
302
+
303
+ function set_events() { // called at the end of update_entries
304
+
305
+ jQuery('.wpcf7cf-and-rules').sortable();
306
+
307
+ jQuery('.and-button').off('click').click(function() {
308
+ $this = jQuery(this);
309
+ $andblock = $this.closest('.wpcf7cf-and-rule');
310
+ $andblocks_container = $this.closest('.wpcf7cf-and-rules');
311
+ next_index = $andblocks_container.data('next-index');
312
+ $andblocks_container.data('next-index',next_index+1);
313
+ var and_i = next_index;
314
+ clone_html = $andblock.get(0).outerHTML.replace(/wpcf7cf_options\[([0-9]*)\]\[and_rules\]\[([0-9]*)\]/g, 'wpcf7cf_options[$1][and_rules]['+and_i+']');
315
+ $andblock.after(clone_html);
316
+ //update_settings_textarea();
317
+ update_entries();
318
+ return false;
319
+ });
320
+
321
+ jQuery('.delete-button').off('click').click(function(){
322
+ $and_rule = jQuery(this).closest('.wpcf7cf-and-rule');
323
+ if ($and_rule.siblings().length > 0) {
324
+ $and_rule.remove();
325
+ } else {
326
+ $and_rule[0].closest('.entry').remove();
327
+ }
328
+
329
+ //update_settings_textarea();
330
+ update_entries();
331
+
332
+ return false;
333
+ });
334
+
335
+ jQuery('.operator').off('change').change(function() {
336
+ update_entries();
337
+ return false;
338
+ });
339
+ }
340
+
341
+ function scale_and_button() {
342
+ jQuery('.wpcf7cf-and-rule:first-child .and-button').each(function(){
343
+ $and_button = jQuery(this);
344
+ num_and_rules = $and_button.closest('.wpcf7cf-and-rule').siblings().length+1;
345
+ var height = (34*num_and_rules-12)+'px';
346
+ $and_button.css({'height':height,'line-height':height});
347
+ });
348
+ }
349
+
350
+ // ------------------------------------
351
+ // TOOGGLE UI MODE
352
+ // ------------------------------------
353
+
354
+ function setUiMode(is_text_only) {
355
+ if (is_text_only) {
356
+ wpcf7cf.currentMode = 'text';
357
+ wpcf7cf.$entriesUi.hide();
358
+ wpcf7cf.$textView.show();
359
+ if (wpcf7cf.getnumberOfFieldEntries() > 0) {
360
+ wpcf7cf.copyFieldsToText();
361
+ }
362
+ } else {
363
+ wpcf7cf.currentMode = 'normal';
364
+ wpcf7cf.$entriesUi.show();
365
+ wpcf7cf.$textView.hide();
366
+ wpcf7cf.copyTextToFields();
367
+ }
368
+ }
369
+
370
+ wpcf7cf.$textOnlyCheckbox.on('change', function() {
371
+ setUiMode(wpcf7cf.$textOnlyCheckbox.is(':checked'));
372
+ });
373
+
374
+ setUiMode(wpcf7cf.$textOnlyCheckbox.is(':checked'));
375
+
376
+ wpcf7cf.$formEditorForm.on('submit', function() {
377
+ wpcf7cf.currentMode = 'normal';
378
+ if (wpcf7cf.getnumberOfFieldEntries() > 0) {
379
+ wpcf7cf.copyFieldsToText();
380
+ }
381
+ });
382
+
383
+
384
+ // ------------------------------------
385
+ // OPTIONS PAGE
386
+ // ------------------------------------
387
+
388
+ jQuery(document).ready(function() {
389
+
390
+ jQuery('.wpcf7cf-options-notice .notice-dismiss-2').click(function () {
391
+ jQuery('.wpcf7cf-options-notice .notice-dismiss').click();
392
+ });
393
+
394
+ jQuery('.wpcf7cf-options-notice .notice-dismiss').click(function () {
395
+ wpcf7cf_dismiss_notice();
396
+ });
397
+
398
+ function wpcf7cf_dismiss_notice() {
399
+
400
+ jQuery('input[name="wpcf7cf_options[notice_dismissed]"]').val('true');
401
+
402
+ jQuery.post(ajaxurl, {action:'wpcf7cf_dismiss_notice'}, function(response) {
403
+ // nothing to do. dismiss_notice option should be set to TRUE server side by now.
404
+ });
405
+
406
+ }
407
+
408
+ });
409
+
410
+ // ------------------------------------
411
+ // CF7 TAG GENERATOR OVERRIDE
412
+ // ------------------------------------
413
+
414
+ if (_wpcf7 == null) { var _wpcf7 = wpcf7}; // wpcf7 4.8 fix
415
+ var old_compose = _wpcf7.taggen.compose;
416
+ // ...before overwriting the jQuery extension point
417
+ _wpcf7.taggen.compose = function(tagType, $form)
418
+ {
419
+
420
+ jQuery('#tag-generator-panel-group-style-hidden').val(jQuery('#tag-generator-panel-group-style').val());
421
+
422
+ // original behavior - use function.apply to preserve context
423
+ var ret = old_compose.apply(this, arguments);
424
+ //tagType = arguments[0];
425
+ //$form = arguments[1];
426
+
427
+ // START: code here will be executed after the _wpcf7.taggen.update function
428
+ if (tagType== 'group') ret += "[/group]";
429
+ if (tagType== 'repeater') ret += "[/repeater]";
430
+ // END
431
+
432
+ if (tagType== 'togglebutton') {
433
+ $val1 = jQuery('#tag-generator-panel-togglebutton-value-1');
434
+ $val2 = jQuery('#tag-generator-panel-togglebutton-value-2');
435
+ var val1 = $val1.val();
436
+ var val2 = $val2.val();
437
+
438
+ if (val1 == "") val1 = $val1.data('default');
439
+ if (val2 == "") val2 = $val2.data('default');
440
+
441
+ str_val = ' "'+val1+'" "'+val2+'"';
442
+
443
+ ret = ret.replace(']', str_val+']');
444
+ }
445
+
446
+ return ret;
447
+ };
trunk/js/scripts_es6.js ADDED
@@ -0,0 +1,1043 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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100;
7
+
8
+ if (window.wpcf7cf_running_tests) {
9
+ jQuery('input[name="_wpcf7cf_options"]').each(function(e) {
10
+ var $input = jQuery(this);
11
+ var opt = JSON.parse($input.val());
12
+ opt.settings.animation_intime = 0;
13
+ opt.settings.animation_outtime = 0;
14
+ $input.val(JSON.stringify(opt));
15
+ });
16
+ wpcf7cf_change_time_ms = 0;
17
+ }
18
+
19
+ var wpcf7cf_show_animation = { "height": "show", "marginTop": "show", "marginBottom": "show", "paddingTop": "show", "paddingBottom": "show" };
20
+ var wpcf7cf_hide_animation = { "height": "hide", "marginTop": "hide", "marginBottom": "hide", "paddingTop": "hide", "paddingBottom": "hide" };
21
+
22
+ var wpcf7cf_show_step_animation = { "opacity": "show" };
23
+ var wpcf7cf_hide_step_animation = { "opacity": "hide" };
24
+
25
+ var wpcf7cf_change_events = 'input.wpcf7cf paste.wpcf7cf change.wpcf7cf click.wpcf7cf propertychange.wpcf7cf';
26
+
27
+ var wpcf7cf_forms = [];
28
+
29
+ window.wpcf7cf_dom = {};
30
+
31
+ const wpcf7cf_reload_dom = function($form) {
32
+ wpcf7cf_dom = wpcf7cf.get_simplified_dom_model($form);
33
+ }
34
+
35
+ const wpcf7cf_getFieldsByOriginalName = function(originalName) {
36
+ return Object.values(wpcf7cf_dom).filter(function (inputField) {
37
+ return inputField.original_name === originalName || inputField.original_name === originalName+'[]';
38
+ });
39
+ }
40
+
41
+ const wpcf7cf_getFieldByName = function(name) {
42
+ return wpcf7cf_dom[name] || wpcf7cf_dom[name+'[]'];
43
+ }
44
+
45
+ // endsWith polyfill
46
+ if (!String.prototype.endsWith) {
47
+ String.prototype.endsWith = function(search, this_len) {
48
+ if (this_len === undefined || this_len > this.length) {
49
+ this_len = this.length;
50
+ }
51
+ return this.substring(this_len - search.length, this_len) === search;
52
+ };
53
+ }
54
+
55
+ var Wpcf7cfForm = function($form) {
56
+
57
+ var options_element = $form.find('input[name="_wpcf7cf_options"]').eq(0);
58
+ if (!options_element.length || !options_element.val()) {
59
+ // doesn't look like a CF7 form created with conditional fields plugin enabled.
60
+ return false;
61
+ }
62
+
63
+ var form = this;
64
+
65
+ var form_options = JSON.parse(options_element.val());
66
+
67
+ form.$form = $form;
68
+ form.$input_hidden_group_fields = $form.find('[name="_wpcf7cf_hidden_group_fields"]');
69
+ form.$input_hidden_groups = $form.find('[name="_wpcf7cf_hidden_groups"]');
70
+ form.$input_visible_groups = $form.find('[name="_wpcf7cf_visible_groups"]');
71
+ form.$input_repeaters = $form.find('[name="_wpcf7cf_repeaters"]');
72
+ form.$input_steps = $form.find('[name="_wpcf7cf_steps"]');
73
+
74
+ form.unit_tag = $form.closest('.wpcf7').attr('id');
75
+ form.conditions = form_options['conditions'];
76
+
77
+ // Wrapper around jQuery(selector, form.$form)
78
+ form.get = function (selector) {
79
+ // TODO: implement some caching here.
80
+ return jQuery(selector, form.$form);
81
+ }
82
+
83
+ // compatibility with conditional forms created with older versions of the plugin ( < 1.4 )
84
+ for (var i=0; i < form.conditions.length; i++) {
85
+ var condition = form.conditions[i];
86
+ if (!('and_rules' in condition)) {
87
+ condition.and_rules = [{'if_field':condition.if_field,'if_value':condition.if_value,'operator':condition.operator}];
88
+ }
89
+ }
90
+
91
+ form.initial_conditions = form.conditions;
92
+ form.settings = form_options['settings'];
93
+
94
+ form.$groups = jQuery(); // empty jQuery set
95
+ form.repeaters = [];
96
+ form.multistep = null;
97
+ form.fields = [];
98
+
99
+ form.settings.animation_intime = parseInt(form.settings.animation_intime);
100
+ form.settings.animation_outtime = parseInt(form.settings.animation_outtime);
101
+
102
+ if (form.settings.animation === 'no') {
103
+ form.settings.animation_intime = 0;
104
+ form.settings.animation_outtime = 0;
105
+ }
106
+
107
+ form.updateGroups();
108
+ form.updateEventListeners();
109
+ form.displayFields();
110
+
111
+ // bring form in initial state if the reset event is fired on it.
112
+ form.$form.on('reset.wpcf7cf', form, function(e) {
113
+ var form = e.data;
114
+ setTimeout(function(){
115
+ form.displayFields();
116
+ form.resetRepeaters();
117
+ if (form.multistep != null) {
118
+ form.multistep.moveToStep(1);
119
+ }
120
+ },200);
121
+ });
122
+
123
+ // PRO ONLY
124
+
125
+ form.get('.wpcf7cf_repeater:not(.wpcf7cf_repeater .wpcf7cf_repeater)').each(function(){
126
+ form.repeaters.push(new Wpcf7cfRepeater(jQuery(this),form));
127
+ });
128
+
129
+ form.$input_repeaters.val(JSON.stringify(form.repeaters.map((item)=>item.params.$repeater.id)));
130
+
131
+ var $multistep = form.get('.wpcf7cf_multistep');
132
+
133
+ if ($multistep.length) {
134
+ form.multistep = new Wpcf7cfMultistep($multistep, form);
135
+ // window.wpcf7cf.updateMultistepState(form.multistep);
136
+ }
137
+
138
+ // END PRO ONLY
139
+
140
+ }
141
+
142
+ /**
143
+ * reset initial number of subs for each repeater.
144
+ * (does not clear values)
145
+ */
146
+ Wpcf7cfForm.prototype.resetRepeaters = function() {
147
+ var form = this;
148
+ form.repeaters.forEach(repeater => {
149
+ repeater.updateSubs( repeater.params.$repeater.initial_subs );
150
+ });
151
+ }
152
+
153
+ Wpcf7cfForm.prototype.displayFields = function() {
154
+
155
+ var form = this;
156
+
157
+ var wpcf7cf_conditions = this.conditions;
158
+ var wpcf7cf_settings = this.settings;
159
+
160
+ //for compatibility with contact-form-7-signature-addon
161
+ if (cf7signature_resized === 0 && typeof signatures !== 'undefined' && signatures.constructor === Array && signatures.length > 0 ) {
162
+ for (var i = 0; i < signatures.length; i++) {
163
+ if (signatures[i].canvas.width === 0) {
164
+
165
+ var $sig_canvas = jQuery(".wpcf7-form-control-signature-body>canvas");
166
+ var $sig_wrap = jQuery(".wpcf7-form-control-signature-wrap");
167
+ $sig_canvas.eq(i).attr('width', $sig_wrap.width());
168
+ $sig_canvas.eq(i).attr('height', $sig_wrap.height());
169
+
170
+ cf7signature_resized = 1;
171
+ }
172
+ }
173
+ }
174
+
175
+ form.$groups.addClass('wpcf7cf-hidden');
176
+
177
+ wpcf7cf_reload_dom(form.$form);
178
+
179
+ for (var i=0; i < wpcf7cf_conditions.length; i++) {
180
+
181
+ var condition = wpcf7cf_conditions[i];
182
+
183
+ var show_group = window.wpcf7cf.should_group_be_shown(condition, form);
184
+
185
+ if (show_group) {
186
+ form.get('[data-id="'+condition.then_field+'"]').removeClass('wpcf7cf-hidden');
187
+ }
188
+ }
189
+
190
+
191
+ var animation_intime = wpcf7cf_settings.animation_intime;
192
+ var animation_outtime = wpcf7cf_settings.animation_outtime;
193
+
194
+ form.$groups.each(function (index) {
195
+ var $group = jQuery(this);
196
+ if ($group.is(':animated')) $group.finish(); // stop any current animations on the group
197
+ if ($group.css('display') === 'none' && !$group.hasClass('wpcf7cf-hidden')) {
198
+ if ($group.prop('tagName') === 'SPAN') {
199
+ $group.show().trigger('wpcf7cf_show_group');
200
+ } else {
201
+ $group.animate(wpcf7cf_show_animation, animation_intime).trigger('wpcf7cf_show_group'); // show
202
+ }
203
+ } else if ($group.css('display') !== 'none' && $group.hasClass('wpcf7cf-hidden')) {
204
+
205
+ if ($group.attr('data-clear_on_hide') !== undefined) {
206
+ var $inputs = jQuery(':input', $group).not(':button, :submit, :reset, :hidden');
207
+
208
+ $inputs.each(function(){
209
+ var $this = jQuery(this);
210
+ $this.val(this.defaultValue);
211
+ $this.prop('checked', this.defaultChecked);
212
+ });
213
+
214
+ jQuery('option', $group).each(function() {
215
+ this.selected = this.defaultSelected;
216
+ });
217
+
218
+ jQuery('select', $group).each(function() {
219
+ const $select = jQuery(this);
220
+ if ($select.val() === null) {
221
+ $select.val(jQuery("option:first",$select).val());
222
+ }
223
+ });
224
+
225
+ $inputs.change();
226
+ //display_fields();
227
+ }
228
+
229
+ if ($group.prop('tagName') === 'SPAN') {
230
+ $group.hide().trigger('wpcf7cf_hide_group');
231
+ } else {
232
+ $group.animate(wpcf7cf_hide_animation, animation_outtime).trigger('wpcf7cf_hide_group'); // hide
233
+ }
234
+
235
+ }
236
+ });
237
+
238
+ form.updateHiddenFields();
239
+ form.updateSummaryFields();
240
+ };
241
+
242
+ Wpcf7cfForm.prototype.updateSummaryFields = function() {
243
+ const form = this;
244
+ var $summary = form.get('.wpcf7cf-summary');
245
+
246
+ if ($summary.length == 0 || !$summary.is(':visible')) return;
247
+
248
+ var fd = new FormData();
249
+
250
+ var formdata = form.$form.serializeArray();
251
+ jQuery.each(formdata,function(key, input){
252
+ fd.append(input.name, input.value);
253
+ });
254
+
255
+ // Make sure to add file fields to FormData
256
+ jQuery.each(form.$form.find('input[type="file"]'), function(index, el) {
257
+ if (! el.files.length) return false;
258
+ const file = el.files[0];
259
+ const fieldName = el.name;
260
+ fd.append(fieldName, new Blob() ,file.name);
261
+ });
262
+
263
+ // add file fields to form-data
264
+
265
+ jQuery.ajax({
266
+ url: wpcf7cf_global_settings.ajaxurl + '?action=wpcf7cf_get_summary',
267
+ type: 'POST',
268
+ data: fd,
269
+ processData: false,
270
+ contentType: false,
271
+ dataType: 'json',
272
+ success: function(json) {
273
+ $summary.html(json.summaryHtml);
274
+ }
275
+ });
276
+ };
277
+
278
+ Wpcf7cfForm.prototype.updateHiddenFields = function() {
279
+
280
+ var form = this;
281
+
282
+ var hidden_fields = [];
283
+ var hidden_groups = [];
284
+ var visible_groups = [];
285
+
286
+ form.$groups.each(function () {
287
+ var $this = jQuery(this);
288
+ if ($this.hasClass('wpcf7cf-hidden')) {
289
+ hidden_groups.push($this.data('id'));
290
+ $this.find('input,select,textarea').each(function () {
291
+ hidden_fields.push(jQuery(this).attr('name'));
292
+ });
293
+ } else {
294
+ visible_groups.push($this.data('id'));
295
+ }
296
+ });
297
+
298
+ form.hidden_fields = hidden_fields;
299
+ form.hidden_groups = hidden_groups;
300
+ form.visible_groups = visible_groups;
301
+
302
+ form.$input_hidden_group_fields.val(JSON.stringify(hidden_fields));
303
+ form.$input_hidden_groups.val(JSON.stringify(hidden_groups));
304
+ form.$input_visible_groups.val(JSON.stringify(visible_groups));
305
+
306
+ return true;
307
+ };
308
+ Wpcf7cfForm.prototype.updateGroups = function() {
309
+ var form = this;
310
+ form.$groups = form.$form.find('[data-class="wpcf7cf_group"]');
311
+
312
+ form.conditions = window.wpcf7cf.get_nested_conditions(form.initial_conditions, form.$form);
313
+
314
+ };
315
+ Wpcf7cfForm.prototype.updateEventListeners = function() {
316
+
317
+ var form = this;
318
+
319
+ // monitor input changes, and call displayFields() if something has changed
320
+ form.get('input, select, textarea, button').not('.wpcf7cf_add, .wpcf7cf_remove').off(wpcf7cf_change_events).on(wpcf7cf_change_events,form, function(e) {
321
+ var form = e.data;
322
+ clearTimeout(wpcf7cf_timeout);
323
+ wpcf7cf_timeout = setTimeout(function() {
324
+ form.displayFields();
325
+ }, wpcf7cf_change_time_ms);
326
+ });
327
+
328
+ // PRO ONLY
329
+ form.get('.wpcf7cf-togglebutton').off('click.toggle_wpcf7cf').on('click.toggle_wpcf7cf',function() {
330
+ var $this = jQuery(this);
331
+ if ($this.text() === $this.data('val-1')) {
332
+ $this.text($this.data('val-2'));
333
+ $this.val($this.data('val-2'));
334
+ } else {
335
+ $this.text($this.data('val-1'));
336
+ $this.val($this.data('val-1'));
337
+ }
338
+ });
339
+ // END PRO ONLY
340
+ };
341
+
342
+ // PRO ONLY
343
+ function Wpcf7cfRepeater($repeater, form) {
344
+ var $ = jQuery;
345
+
346
+ var repeater = this;
347
+
348
+ var wpcf7cf_settings = form.settings;
349
+
350
+ repeater.form = form;
351
+
352
+ $repeater.num_subs = 0;
353
+ $repeater.id = $repeater.data('id');
354
+ $repeater.orig_id = $repeater.data('orig_data_id');
355
+ $repeater.min = typeof( $repeater.data('min')) !== 'undefined' ? parseInt($repeater.data('min')) : 1;
356
+ $repeater.max = typeof( $repeater.data('max')) !== 'undefined' ? parseInt($repeater.data('max')) : 200;
357
+ $repeater.initial_subs = typeof( $repeater.data('initial')) !== 'undefined' ? parseInt($repeater.data('initial')) : $repeater.min;
358
+ if ($repeater.initial_subs > $repeater.max) $repeater.initial_subs = $repeater.max;
359
+ var $repeater_sub = $repeater.children('.wpcf7cf_repeater_sub').eq(0);
360
+ var $repeater_controls = $repeater.children('.wpcf7cf_repeater_controls').eq(0);
361
+
362
+ var $repeater_sub_clone = $repeater_sub.clone();
363
+
364
+ $repeater_sub_clone.find('.wpcf7cf_repeater_sub').addBack('.wpcf7cf_repeater_sub').each(function() {
365
+ var $this = jQuery(this);
366
+ var prev_suffix = $this.attr('data-repeater_sub_suffix');
367
+ var new_suffix = prev_suffix+'__{{repeater_sub_suffix}}';
368
+ $this.attr('data-repeater_sub_suffix', new_suffix);
369
+ });
370
+
371
+ $repeater_sub_clone.find('[name]').each(function() {
372
+ var $this = jQuery(this);
373
+ var prev_name = $this.attr('name');
374
+ var orig_name = $this.attr('data-orig_name') != null ? $this.attr('data-orig_name') : prev_name;
375
+ var new_name = prev_name+'__{{repeater_sub_suffix}}';
376
+
377
+ if(prev_name.endsWith('_count')) {
378
+ new_name = prev_name.replace('_count','__{{repeater_sub_suffix}}_count');
379
+ }
380
+
381
+ $this.attr('name', new_name);
382
+ $this.attr('data-orig_name', orig_name);
383
+ $this.closest('.wpcf7-form-control-wrap').addClass(new_name);
384
+ });
385
+
386
+ $repeater_sub_clone.find('.wpcf7cf_repeater,[data-class="wpcf7cf_group"]').each(function() {
387
+ var $this = jQuery(this);
388
+ var prev_data_id = $this.attr('data-id');
389
+ var orig_data_id = $this.attr('data-orig_data_id') != null ? $this.attr('data-orig_data_id') : prev_data_id;
390
+ var new_data_id = prev_data_id+'__{{repeater_sub_suffix}}';
391
+
392
+ if(prev_data_id.endsWith('_count')) {
393
+ new_data_id = prev_data_id.replace('_count','__{{repeater_sub_suffix}}_count');
394
+ }
395
+
396
+ $this.attr('data-id', new_data_id);
397
+ $this.attr('data-orig_data_id', orig_data_id);
398
+ $this.closest('.wpcf7-form-control-wrap').addClass(new_data_id);
399
+ });
400
+
401
+ $repeater_sub_clone.find('[id]').each(function() {
402
+ var $this = jQuery(this);
403
+ var prev_id = $this.attr('id');
404
+ var orig_id = $this.attr('data-orig_id') != null ? $this.attr('data-orig_id') : prev_id;
405
+ var new_id = prev_id+'__{{repeater_sub_suffix}}';
406
+
407
+ $this.attr('id', new_id);
408
+ $this.attr('data-orig_id', orig_id);
409
+ $this.closest('.wpcf7-form-control-wrap').addClass(new_id);
410
+ });
411
+
412
+ $repeater_sub_clone.find('[for]').each(function() {
413
+ var $this = jQuery(this);
414
+ var prev_for = $this.attr('for');
415
+ var orig_for = $this.attr('data-orig_for') != null ? $this.attr('data-orig_for') : prev_for;
416
+ var new_for = prev_for+'__{{repeater_sub_suffix}}';
417
+
418
+ $this.attr('for', new_for);
419
+ $this.attr('data-orig_for', orig_for);
420
+ $this.closest('.wpcf7-form-control-wrap').addClass(new_for);
421
+ });
422
+
423
+ var repeater_sub_html = $repeater_sub_clone[0].outerHTML;
424
+
425
+ var $repeater_count_field = $repeater.find('[name='+$repeater.id+'_count]').eq(0);
426
+ var $button_add = $repeater_controls.find('.wpcf7cf_add').eq(0);
427
+ var $button_remove = $repeater_controls.find('.wpcf7cf_remove').eq(0);
428
+
429
+ var params = {
430
+ $repeater: $repeater,
431
+ $repeater_count_field: $repeater_count_field,
432
+ repeater_sub_html: repeater_sub_html,
433
+ $repeater_controls: $repeater_controls,
434
+ $button_add: $button_add,
435
+ $button_remove: $button_remove,
436
+ wpcf7cf_settings: wpcf7cf_settings
437
+ };
438
+
439
+ this.params = params;
440
+
441
+ $button_add.on('click', null, repeater, function(e) {
442
+ var repeater = e.data;
443
+ repeater.updateSubs(params.$repeater.num_subs+1);
444
+ });
445
+
446
+ $button_remove.on('click', null, repeater,function(e) {
447
+ var repeater = e.data;
448
+ repeater.updateSubs(params.$repeater.num_subs-1);
449
+ });
450
+
451
+ jQuery('> .wpcf7cf_repeater_sub',params.$repeater).eq(0).remove(); // remove the first sub, it's just a template.
452
+
453
+ repeater.updateSubs($repeater.initial_subs);
454
+
455
+ }
456
+
457
+
458
+
459
+ Wpcf7cfRepeater.prototype.updateSubs = function(subs_to_show) {
460
+ var repeater = this;
461
+ var params = repeater.params;
462
+ var subs_to_add = subs_to_show - params.$repeater.num_subs;
463
+
464
+ if (subs_to_add < 0) {
465
+ repeater.removeSubs(-subs_to_add);
466
+ } else if (subs_to_add > 0) {
467
+ repeater.addSubs(subs_to_add);
468
+ }
469
+
470
+ var showButtonRemove = false;
471
+ var showButtonAdd = false;
472
+
473
+ if (params.$repeater.num_subs < params.$repeater.max) {
474
+ showButtonAdd = true;
475
+ }
476
+ if (params.$repeater.num_subs > params.$repeater.min) {
477
+ showButtonRemove = true;
478
+ }
479
+
480
+ if (showButtonAdd) {
481
+ params.$button_add.show();
482
+ } else {
483
+ params.$button_add.hide();
484
+
485
+ }
486
+
487
+ if (showButtonRemove) {
488
+ params.$button_remove.show();
489
+ } else {
490
+ params.$button_remove.hide();
491
+ }
492
+
493
+ params.$repeater_count_field.val(subs_to_show);
494
+
495
+ };
496
+ Wpcf7cfRepeater.prototype.addSubs = function(subs_to_add) {
497
+ var $ = jQuery;
498
+ var params = this.params;
499
+ var repeater = this;
500
+ var form = repeater.form;
501
+
502
+
503
+ var $repeater = params.$repeater;
504
+ var $repeater_controls = params.$repeater_controls;
505
+
506
+ //jQuery(params.repeater_sub_html.replace(/name="(.*?)"/g,'name="wpcf7cf_repeater['+$repeater.id+']['+$repeater.num_subs+'][$1]" data-original-name="$1"')).hide().insertBefore($repeater_controls).animate(wpcf7cf_show_animation, params.wpcf7cf_settings.animation_intime);
507
+
508
+ var html_str = '';
509
+
510
+ for(var i=1; i<=subs_to_add; i++) {
511
+ var sub_suffix = $repeater.num_subs+i;
512
+ html_str += params.repeater_sub_html.replace(/\{\{repeater_sub_suffix\}\}/g,sub_suffix)
513
+ .replace(new RegExp('\{\{'+$repeater.orig_id+'_index\}\}','g'),sub_suffix);
514
+ }
515
+
516
+
517
+ var $html = jQuery(html_str);
518
+
519
+ // Add the newly created fields to the form
520
+ $html.hide().insertBefore($repeater_controls).animate(wpcf7cf_show_animation, params.wpcf7cf_settings.animation_intime).trigger('wpcf7cf_repeater_added');
521
+
522
+ jQuery('.wpcf7cf_repeater', $html).each(function(){
523
+ form.repeaters.push(new Wpcf7cfRepeater(jQuery(this),form));
524
+ });
525
+ form.$input_repeaters.val(JSON.stringify(form.repeaters.map((item)=>item.params.$repeater.id)));
526
+
527
+ $repeater.num_subs+= subs_to_add;
528
+
529
+ window.wpcf7cf.updateMultistepState(form.multistep);
530
+ form.updateGroups();
531
+ form.updateEventListeners();
532
+ form.displayFields();
533
+
534
+ // Exclusive Checkbox
535
+ $html.on( 'click', '.wpcf7-exclusive-checkbox input:checkbox', function() {
536
+ var name = $( this ).attr( 'name' );
537
+ $html.find( 'input:checkbox[name="' + name + '"]' ).not( this ).prop( 'checked', false );
538
+ } );
539
+
540
+ //basic compatibility with material-design-for-contact-form-7
541
+ if (typeof window.cf7mdInit === "function") {
542
+ window.cf7mdInit();
543
+ }
544
+
545
+ return false;
546
+ };
547
+ Wpcf7cfRepeater.prototype.removeSubs = function(num_subs) {
548
+ var $ = jQuery;
549
+ var params = this.params;
550
+ var form = this.form;
551
+
552
+ params.$repeater.num_subs-= num_subs;
553
+
554
+ jQuery('> .wpcf7cf_repeater_sub',params.$repeater).slice(-num_subs).animate(wpcf7cf_hide_animation, {duration:params.wpcf7cf_settings.animation_intime, done:function() {
555
+ var $this = jQuery(this);
556
+ //remove the actual fields from the form
557
+ $this.remove();
558
+ params.$repeater.trigger('wpcf7cf_repeater_removed');
559
+ window.wpcf7cf.updateMultistepState(form.multistep);
560
+ form.updateGroups();
561
+ form.updateEventListeners();
562
+ form.displayFields();
563
+ }});
564
+
565
+ return false;
566
+ };
567
+
568
+ function Wpcf7cfMultistep($multistep, form) {
569
+ var multistep = this;
570
+ multistep.$multistep = $multistep;
571
+ multistep.form = form;
572
+ multistep.$steps = $multistep.find('.wpcf7cf_step');
573
+ multistep.$btn_next = $multistep.find('.wpcf7cf_next');
574
+ multistep.$btn_prev = $multistep.find('.wpcf7cf_prev');
575
+ multistep.$dots = $multistep.find('.wpcf7cf_steps-dots');
576
+ multistep.currentStep = 0;
577
+ multistep.numSteps = multistep.$steps.length;
578
+
579
+
580
+ multistep.$dots.html('');
581
+ for (var i = 1; i <= multistep.numSteps; i++) {
582
+ multistep.$dots.append(`
583
+ <div class="dot" data-step="${i}">
584
+ <div class="step-index">${i}</div>
585
+ <div class="step-title">${multistep.$steps.eq(i-1).data('title')}</div>
586
+ </div>
587
+ `);
588
+ }
589
+
590
+ multistep.$btn_next.on('click.wpcf7cf_step', async function() {
591
+
592
+ var result = await multistep.validateStep(multistep.currentStep);
593
+ if (result === 'success') {
594
+ multistep.moveToStep(multistep.currentStep+1);
595
+ }
596
+
597
+ });
598
+
599
+ // If form is submitted (by pressing Enter for example), and if we are not on the last step,
600
+ // then trigger click event on the $btn_next button instead.
601
+ multistep.form.$form.on('submit.wpcf7cf_step', function(e) {
602
+
603
+ if (multistep.currentStep !== multistep.numSteps) {
604
+ multistep.$btn_next.trigger('click.wpcf7cf_step');
605
+
606
+ e.stopImmediatePropagation();
607
+ return false;
608
+ }
609
+ });
610
+
611
+ multistep.$btn_prev.on( 'click', function() {
612
+ multistep.moveToStep(multistep.currentStep-1);
613
+ });
614
+
615
+ multistep.moveToStep(1);
616
+ }
617
+
618
+ jQuery(document).ajaxComplete(function(e, xhr, settings){
619
+ if (
620
+ xhr.hasOwnProperty('responseJSON') &&
621
+ xhr.responseJSON != null &&
622
+ xhr.responseJSON.hasOwnProperty('status') &&
623
+ xhr.responseJSON.hasOwnProperty('into') &&
624
+ xhr.responseJSON.status === "mail_success"
625
+ ) {
626
+ jQuery( xhr.responseJSON.into ).trigger('reset.wpcf7cf');
627
+ }
628
+ });
629
+
630
+ Wpcf7cfMultistep.prototype.validateStep = function(step_index) {
631
+
632
+ var multistep = this;
633
+ var $multistep = multistep.$multistep;
634
+ var $form = multistep.form.$form;
635
+ var form = multistep.form;
636
+
637
+ $form.find('.wpcf7-response-output').addClass('wpcf7-display-none');
638
+
639
+ return new Promise(resolve => {
640
+
641
+ var fd = new FormData();
642
+
643
+ // Make sure to add file fields to FormData
644
+ jQuery.each($form.find('[data-id="step-'+step_index+'"] input[type="file"]'), function(index, el) {
645
+ if (! el.files.length) return false;
646
+ const file = el.files[0];
647
+ const fieldName = el.name;
648
+ fd.append(fieldName, file);
649
+ });
650
+
651
+ var formdata = $form.serializeArray();
652
+ jQuery.each(formdata,function(key, input){
653
+ fd.append(input.name, input.value);
654
+ });
655
+
656
+ jQuery.ajax({
657
+ url: wpcf7cf_global_settings.ajaxurl + '?action=wpcf7cf_validate_step',
658
+ type: 'POST',
659
+ data: fd,
660
+ processData: false,
661
+ contentType: false,
662
+ dataType: 'json',
663
+ }).done(function(json) {
664
+
665
+ $multistep.find('.wpcf7-form-control-wrap .wpcf7-not-valid-tip').remove();
666
+ $multistep.find('.wpcf7-not-valid').removeClass('wpcf7-not-valid');
667
+ $multistep.find('.wpcf7-response-output').remove();
668
+ $multistep.find('.wpcf7-response-output.wpcf7-validation-errors').removeClass('wpcf7-validation-errors');
669
+
670
+ if (!json.success) {
671
+ var checkError = 0;
672
+
673
+ jQuery.each(json.invalid_fields, function(index, el) {
674
+ if ($multistep.find('input[name="'+index+'"]').length ||
675
+ $multistep.find('input[name="'+index+'[]"]').length ||
676
+ $multistep.find('select[name="'+index+'"]').length ||
677
+ $multistep.find('select[name="'+index+'[]"]').length ||
678
+ $multistep.find('textarea[name="'+index+'"]').length ||
679
+ $multistep.find('textarea[name="'+index+'[]"]').length
680
+ ) {
681
+ checkError = checkError + 1;
682
+
683
+ var controlWrap = form.get('.wpcf7-form-control-wrap.' + index);
684
+ controlWrap.find('input').addClass('wpcf7-not-valid');
685
+ controlWrap.find('span.wpcf7-not-valid-tip').remove();
686
+ controlWrap.append('<span role="alert" class="wpcf7-not-valid-tip">' + el.reason + '</span>');
687
+
688
+ }
689
+ });
690
+
691
+ resolve('failed');
692
+
693
+ $multistep.parent().find('.wpcf7-response-output').removeClass('wpcf7-display-none').html(json.message);
694
+
695
+ } else if (json.success) {
696
+ resolve('success');
697
+ return false;
698
+ }
699
+
700
+ }).fail(function() {
701
+ resolve('error');
702
+ }).always(function() {
703
+ // do nothing
704
+ });
705
+ });
706
+
707
+ };
708
+ Wpcf7cfMultistep.prototype.moveToStep = function(step_index) {
709
+ var multistep = this;
710
+ var previousStep = multistep.currentStep;
711
+
712
+ multistep.currentStep = step_index > multistep.numSteps ? multistep.numSteps
713
+ : step_index < 1 ? 1
714
+ : step_index;
715
+
716
+ // ANIMATION DISABLED FOR NOW cause it's ugly
717
+ // multistep.$steps.animate(wpcf7cf_hide_step_animation, multistep.form.settings.animation_outtime);
718
+ // multistep.$steps.eq(multistep.currentStep-1).animate(wpcf7cf_show_step_animation, multistep.form.settings.animation_intime);
719
+
720
+ multistep.$multistep.attr('data-current_step', multistep.currentStep);
721
+ multistep.$steps.hide();
722
+ multistep.$steps
723
+ .eq(multistep.currentStep-1)
724
+ .show()
725
+ .trigger('wpcf7cf_change_step', [previousStep, multistep.currentStep]);
726
+
727
+ const formEl = multistep.form.$form[0];
728
+ const topOffset = formEl.getBoundingClientRect().top;
729
+ if (topOffset < 0 && previousStep > 0) {
730
+ formEl.scrollIntoView({behavior: "smooth"});
731
+ }
732
+
733
+ multistep.form.updateSummaryFields();
734
+
735
+ window.wpcf7cf.updateMultistepState(multistep);
736
+ };
737
+
738
+ Wpcf7cfMultistep.prototype.getFieldsInStep = function(step_index) {
739
+ wpcf7cf_reload_dom(this.form.$form);
740
+ var inStep = false;
741
+ return Object.values(wpcf7cf_dom).filter(function(item, i) {
742
+ if(item.type == 'step') {
743
+ inStep = item.val == step_index+'';
744
+ }
745
+ return inStep && item.type == 'input';
746
+ }).map(function(item) {
747
+ return item.name;
748
+ });
749
+ };
750
+
751
+ // END PRO ONLY
752
+
753
+ window.wpcf7cf = {
754
+
755
+ // keep this for backwards compatibility
756
+ initForm : function($form) {
757
+ wpcf7cf_forms.push(new Wpcf7cfForm($form));
758
+ },
759
+
760
+ get_nested_conditions : function(conditions, $current_form) {
761
+ //loop trough conditions. Then loop trough the dom, and each repeater we pass we should update all sub_values we encounter with __index
762
+ wpcf7cf_reload_dom($current_form);
763
+ var groups = Object.values(wpcf7cf_dom).filter(function(item, i) {
764
+ return item.type==='group';
765
+ });
766
+
767
+ var sub_conditions = [];
768
+
769
+ for(var i = 0; i < groups.length; i++) {
770
+ var g = groups[i];
771
+ var relevant_conditions = conditions.filter(function(condition, i) {
772
+ return condition.then_field === g.original_name;
773
+ });
774
+
775
+ var relevant_conditions = relevant_conditions.map(function(item,i) {
776
+ return {
777
+ then_field : g.name,
778
+ and_rules : item.and_rules.map(function(and_rule, i) {
779
+ return {
780
+ if_field : and_rule.if_field+g.suffix,
781
+ if_value : and_rule.if_value,
782
+ operator : and_rule.operator
783
+ };
784
+ })
785
+ }
786
+ });
787
+
788
+ sub_conditions = sub_conditions.concat(relevant_conditions);
789
+ }
790
+ return sub_conditions;
791
+ },
792
+
793
+ get_simplified_dom_model : function($current_form) {
794
+
795
+ var currentNode;
796
+ var ni = document.createNodeIterator($current_form[0], NodeFilter.SHOW_ELEMENT, null, false); //, NodeFilter.SHOW_ELEMENT, function(){ return NodeFilter.FILTER_ACCEPT; }
797
+
798
+ var simplified_dom = {};
799
+
800
+ while(currentNode = ni.nextNode()) {
801
+
802
+ const type = currentNode.classList.contains('wpcf7cf_repeater') ? 'repeater' :
803
+ currentNode.dataset.class == 'wpcf7cf_group' ? 'group' :
804
+ currentNode.className == 'wpcf7cf_step' ? 'step' :
805
+ currentNode.hasAttribute('name') ? 'input' : false;
806
+
807
+ if (!type) {
808
+ continue;
809
+ }
810
+
811
+ const name = type === 'input' ? currentNode.getAttribute('name') : currentNode.dataset.id;
812
+
813
+ // skip _wpcf7 hidden fields
814
+ if (name.substring(0,6) === '_wpcf7') continue;
815
+
816
+ const original_name = type === 'repeater' || type === 'group' ? currentNode.dataset.orig_data_id
817
+ : type === 'input' ? (currentNode.getAttribute('data-orig_name') || name)
818
+ : name;
819
+
820
+ const val = type === 'step' ? [currentNode.dataset.id.substring(5)] : [];
821
+
822
+ const original_name_length = original_name == null ? name.length : original_name.length;
823
+ const suffix = name.substring(original_name_length);
824
+
825
+ if (!simplified_dom[name]) {
826
+ // init entry
827
+ simplified_dom[name] = {name, type, original_name, suffix, val}
828
+ }
829
+
830
+ if (type === 'input') {
831
+
832
+ // skip unchecked checkboxes and radiobuttons
833
+ if ( (currentNode.type === 'checkbox' || currentNode.type === 'radio') && !currentNode.checked ) continue;
834
+
835
+ // if multiselect, make sure to add all the values
836
+ if ( currentNode.multiple ) {
837
+ simplified_dom[name].val = Object.values(currentNode.options).filter(o => o.selected).map(o => o.value)
838
+ } else {
839
+ simplified_dom[name].val.push(currentNode.value);
840
+ }
841
+ }
842
+
843
+ }
844
+
845
+ return simplified_dom;
846
+ },
847
+
848
+ updateMultistepState: function (multistep) {
849
+ if (multistep == null) return;
850
+
851
+ // update hidden input field
852
+
853
+ var stepsData = {
854
+ currentStep : multistep.currentStep,
855
+ numSteps : multistep.numSteps,
856
+ fieldsInCurrentStep : multistep.getFieldsInStep(multistep.currentStep)
857
+ };
858
+ multistep.form.$input_steps.val(JSON.stringify(stepsData));
859
+
860
+ // update Buttons
861
+ multistep.$btn_prev.removeClass('disabled').attr('disabled', false);
862
+ multistep.$btn_next.removeClass('disabled').attr('disabled', false);
863
+ if (multistep.currentStep == multistep.numSteps) {
864
+ multistep.$btn_next.addClass('disabled').attr('disabled', true);
865
+ }
866
+ if (multistep.currentStep == 1) {
867
+ multistep.$btn_prev.addClass('disabled').attr('disabled', true);
868
+ }
869
+
870
+ // replace next button with submit button on last step.
871
+ // TODO: make this depend on a setting
872
+ var $submit_button = multistep.form.$form.find('input[type="submit"]').eq(0);
873
+ var $ajax_loader = multistep.form.$form.find('.ajax-loader').eq(0);
874
+ if (multistep.currentStep == multistep.numSteps) {
875
+ multistep.$btn_next.hide();
876
+ $ajax_loader.detach().appendTo(multistep.$btn_next.parent());
877
+ $submit_button.detach().appendTo(multistep.$btn_next.parent());
878
+ $submit_button.show();
879
+ } else {
880
+ $submit_button.hide();
881
+ multistep.$btn_next.show();
882
+ }
883
+
884
+ // update dots
885
+ var $dots = multistep.$dots.find('.dot');
886
+ $dots.removeClass('active').removeClass('completed');
887
+ for(var step = 1; step <= multistep.numSteps; step++) {
888
+ if (step < multistep.currentStep) {
889
+ $dots.eq(step-1).addClass('completed');
890
+ } else if (step == multistep.currentStep) {
891
+ $dots.eq(step-1).addClass('active');
892
+ }
893
+ }
894
+
895
+ },
896
+
897
+ should_group_be_shown : function(condition) {
898
+
899
+ var show_group = true;
900
+
901
+ for (var and_rule_i = 0; and_rule_i < condition.and_rules.length; and_rule_i++) {
902
+
903
+ var condition_ok = false;
904
+
905
+ var condition_and_rule = condition.and_rules[and_rule_i];
906
+
907
+ var inputField = wpcf7cf_getFieldByName(condition_and_rule.if_field);
908
+
909
+ var if_val = condition_and_rule.if_value;
910
+ var operator = condition_and_rule.operator;
911
+
912
+ //backwards compat
913
+ operator = operator === '≤' ? 'less than or equals' : operator;
914
+ operator = operator === '≥' ? 'greater than or equals' : operator;
915
+ operator = operator === '>' ? 'greater than' : operator;
916
+ operator = operator === '<' ? 'less than' : operator;
917
+
918
+ condition_ok = this.isConditionTrue(inputField.val,operator,if_val);
919
+
920
+ show_group = show_group && condition_ok;
921
+ }
922
+
923
+ return show_group;
924
+
925
+ },
926
+ isConditionTrue(values, operator, testValue='', $field=jQuery()) {
927
+
928
+ if (!Array.isArray(values)) {
929
+ values = [values];
930
+ }
931
+
932
+ let condition_ok = false; // start by assuming that the condition is not met
933
+
934
+ // Considered EMPTY: [] [''] [null] ['',null] [,,'']
935
+ // Considered NOT EMPTY: [0] ['ab','c'] ['',0,null]
936
+ const valuesAreEmpty = values.length === 0 || values.every((v) => !v&&v!==0); // 0 is not considered empty
937
+
938
+ // special cases: [] equals '' => TRUE; [] not equals '' => FALSE
939
+ if (operator === 'equals' && testValue === '' && valuesAreEmpty) {
940
+ return true;
941
+ }
942
+ if (operator === 'not equals' && testValue === '' && valuesAreEmpty) {
943
+ return false;
944
+ }
945
+
946
+ if (valuesAreEmpty) {
947
+ if (operator === 'is empty') {
948
+ condition_ok = true;
949
+ }
950
+ } else {
951
+ if (operator === 'not empty') {
952
+ condition_ok = true;
953
+ }
954
+ }
955
+
956
+ const testValueNumber = isFinite(parseFloat(testValue)) ? parseFloat(testValue) : NaN;
957
+
958
+
959
+ if (operator === 'not equals' || operator === 'not equals (regex)') {
960
+ // start by assuming that the condition is met
961
+ condition_ok = true;
962
+ }
963
+
964
+ if (
965
+ operator === 'function'
966
+ && typeof window[testValue] == 'function'
967
+ && window[testValue]($field) // here we call the actual user defined function
968
+ ) {
969
+ condition_ok = true;
970
+ }
971
+
972
+ let regex_patt = /.*/i; // fallback regex pattern
973
+ let isValidRegex = true;
974
+ if (operator === 'equals (regex)' || operator === 'not equals (regex)') {
975
+ try {
976
+ regex_patt = new RegExp(testValue, 'i');
977
+ } catch(e) {
978
+ isValidRegex = false;
979
+ }
980
+ }
981
+
982
+
983
+ for(let i = 0; i < values.length; i++) {
984
+
985
+ const value = values[i];
986
+
987
+ const valueNumber = isFinite(parseFloat(value)) ? parseFloat(value) : NaN;
988
+ const valsAreNumbers = !isNaN(valueNumber) && !isNaN(testValueNumber);
989
+
990
+ if (
991
+
992
+ operator === 'equals' && value === testValue ||
993
+ operator === 'equals (regex)' && regex_patt.test(value) ||
994
+ operator === 'greater than' && valsAreNumbers && valueNumber > testValueNumber ||
995
+ operator === 'less than' && valsAreNumbers && valueNumber < testValueNumber ||
996
+ operator === 'greater than or equals' && valsAreNumbers && valueNumber >= testValueNumber ||
997
+ operator === 'less than or equals' && valsAreNumbers && valueNumber <= testValueNumber
998
+
999
+ ) {
1000
+
1001
+ condition_ok = true;
1002
+ break;
1003
+
1004
+ } else if (
1005
+
1006
+ operator === 'not equals' && value === testValue ||
1007
+ operator === 'not equals (regex)' && regex_patt.test(value)
1008
+
1009
+ ) {
1010
+
1011
+ condition_ok = false;
1012
+ break;
1013
+
1014
+ }
1015
+ }
1016
+
1017
+ return condition_ok;
1018
+
1019
+ }
1020
+
1021
+ };
1022
+
1023
+ jQuery('.wpcf7-form').each(function(){
1024
+ wpcf7cf_forms.push(new Wpcf7cfForm(jQuery(this)));
1025
+ });
1026
+
1027
+ // Call displayFields again on all forms
1028
+ // Necessary in case some theme or plugin changed a form value by the time the entire page is fully loaded.
1029
+ jQuery('document').ready(function() {
1030
+ wpcf7cf_forms.forEach(function(f){
1031
+ f.displayFields();
1032
+ });
1033
+ });
1034
+
1035
+ // fix for exclusive checkboxes in IE (this will call the change-event again after all other checkboxes are unchecked, triggering the display_fields() function)
1036
+ var old_wpcf7ExclusiveCheckbox = jQuery.fn.wpcf7ExclusiveCheckbox;
1037
+ jQuery.fn.wpcf7ExclusiveCheckbox = function() {
1038
+ return this.find('input:checkbox').on('click', function() {
1039
+ var name = jQuery(this).attr('name');
1040
+ jQuery(this).closest('form').find('input:checkbox[name="' + name + '"]').not(this).prop('checked', false).eq(0).change();
1041
+ });
1042
+ };
1043
+
trunk/readme.txt ADDED
@@ -0,0 +1,419 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Contact Form 7 - Conditional Fields ===
2
+ Contributors: Jules Colle
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=j_colle%40hotmail%2ecom&lc=US&item_name=Jules%20Colle%20%2d%20WP%20plugins%20%2d%20Responsive%20Gallery%20Grid&item_number=rgg&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
4
+ Author: Jules Colle
5
+ Website: http://bdwm.be
6
+ Tags: wordpress, contact form 7, forms, conditional fields
7
+ Requires at least: 4.1
8
+ Tested up to: 5.4.1
9
+ Stable tag: 1.9
10
+ Requires PHP: 5.6
11
+ License: GPLv2 or later
12
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
+
14
+ Adds conditional logic to Contact Form 7.
15
+
16
+ == Description ==
17
+
18
+ This plugin adds conditional logic to [Contact Form 7](https://wordpress.org/plugins/contact-form-7/).
19
+
20
+ If you edit your CF7 form, you will see an additional tag called "Conditional fields Group". Everything you put between the start and end tag will be hidden by default.
21
+ After you have added the field group(s), click Save and go to the "Conditional fields" tab to create one or more conditions that will make the group(s) appear.
22
+
23
+ = How to use it =
24
+
25
+ [Follow this tutorial](https://conditional-fields-cf7.bdwm.be/conditional-fields-for-contact-form-7-tutorial/)
26
+
27
+ == Main/ New features ==
28
+
29
+ = Support for required fields =
30
+
31
+ Required fields can be used inside hidden groups without causing validation problems.
32
+
33
+ = Hide/show info in emails based on what groups are visible =
34
+
35
+ Conditional groups can now be added to the emails as well.
36
+ Just wrap the content with `[group-name] ... [/group-name]` tags.
37
+
38
+ = Groups can be nested =
39
+ Groups can be nested, both in the form and in the email
40
+
41
+ Example form:
42
+ `
43
+ [group group-1]
44
+ [group group-inside-1]
45
+ ...
46
+ [/group]
47
+ [/group]`
48
+
49
+ Example email:
50
+ `
51
+ [group-1]
52
+ [group-inside-1]
53
+ ...
54
+ [/group-inside-1]
55
+ [/group-1]`
56
+
57
+ = Advanced =
58
+
59
+ Advanced users can code up the conditions as plain text instead of using the select boxes, using the import/export feature.
60
+
61
+ == Installation ==
62
+
63
+ Please follow the [standard installation procedure for WordPress plugins](http://codex.wordpress.org/Managing_Plugins#Installing_Plugins).
64
+
65
+ Follow [this tutorial](https://conditional-fields-cf7.bdwm.be/conditional-fields-for-contact-form-7-tutorial/) if you are not sure how to use the plugin.
66
+
67
+ == Frequently Asked Questions ==
68
+
69
+ = Email message is not showing the correct values / Wrong values are submitted =
70
+
71
+ <strong>All field names should be unique</strong>
72
+
73
+ Even though your fields might never show up at the same time, it is still important to realize that WPCF7CF will not remove the fields, it merely hides them. So all fields will be submitted when the form is sent. Because of this no two fields can have the same name.
74
+
75
+ Incorrect form (2 input elements having the same name "a"):
76
+ `
77
+ [group group-1][select a "1" "2" "3"][/group]
78
+ [group group-2][select a "1" "2" "3"][/group]
79
+ `
80
+
81
+ Correct form (all groups and fields have unique names):
82
+ `
83
+ [group group-1][select a "1" "2" "3"][/group]
84
+ [group group-2][select b "1" "2" "3"][/group]
85
+ `
86
+
87
+ = All my groups show up all the time and never get hidden. =
88
+
89
+ <strong>Reason #1: Javascript error</strong>
90
+ Check your browser console (F12) for any javascript errors. WPCF7CF loads it's scripts at the bottom of the HTML page, so if some javascript error gets triggered before that, the code will not be executed in most browsers.
91
+ Before reaching out to the support forum try to determine which plugin or theme is causing the problem, by gradually disabling plugins and changing theme.
92
+
93
+ <strong>Reason #2: wp_footer() isn't loaded</strong>
94
+ Check if your theme is calling the `wp_footer()` function. Typically this function will be called in your theme's footer.php file.
95
+ The conditional fields javascript code is loaded during wp_footer, so a call to this function is crucial. If there is no such call in your theme, go to your theme's footer.php file and add this code right before the closing `</body>` tag:
96
+ `&lt;?php wp_footer(); ?&gt;`
97
+
98
+ == Screenshots ==
99
+
100
+ 1. Conditional fields in action
101
+ 2. Defining rules to show/hide groups of input elements in the backend interface
102
+
103
+ == Changelog ==
104
+
105
+ = 1.9 (2020-06-21) =
106
+ * Performance improvements
107
+ * Added extra setting: "Conditional Fields UI". If you have a lot of conditions, set this to "Text mode" for better performance in the admin interface.
108
+ * Improved styling on Conditional Fields Settings page
109
+ * Improved [docs](https://conditional-fields-cf7.bdwm.be/)
110
+ * Improved the [form tester](https://conditional-fields-cf7.bdwm.be/form-tester/)
111
+ * PRO: Multistep bug that was causing checkboxes and multiselect to not trigger validation errors
112
+ * PRO: Summary added support for files, checkboxes and multiselect
113
+ * Added test to ensure that normal view entries are always converted to text view correctly
114
+
115
+ = 1.8.7 (2020-06-01) =
116
+ * PRO: Change auto-update mechanism
117
+ * Some minor JS refactoring
118
+ * Improved on some edge cases with `equals ""` and `not equals ""`
119
+ * Improved test suites.
120
+
121
+ = 1.8.6 (2020-04-18) =
122
+ * Fixed: accidentally packed the entire jQuery library in scripts.js
123
+ * Cleaned up some console.logs that was still hanging around in the code.
124
+
125
+ = 1.8.5 (2020-04-17) =
126
+ * Tested with WP 5.4
127
+ * fix multiselect
128
+ * fix required file field inside mutistep
129
+ * allow group names to contain `.` and `:` (https://github.com/pwkip/contact-form-7-conditional-fields/issues/46)
130
+ * fix possible conflicts with require_once 'init.php' (https://wordpress.org/support/topic/conflict-with-theme-because-of-require_once/)
131
+ * Created some unit tests and integration tests, so hopefully no more regression bugs from now on! (next step: automated CI before publish)
132
+ * Got rid of warnings and notices when creating a new form.
133
+ * Fix small clear_on_hide bug with select field (https://github.com/pwkip/contact-form-7-conditional-fields/issues/51)
134
+ * PRO: fix "not empty" when using first_as_label in select field. (closes guthub issue #48)
135
+ * PRO: fix error with nested repeater buttons text
136
+ * PRO: new version of plugin_update_checker, compatible with PHP 7.3+
137
+
138
+ = 1.8.4 (2020-03-05) =
139
+ * PRO: Multistep: Improve autoscroll behavior (Tried to make it smoother and less annoying)
140
+ * PRO: Multistep: Add wpcf7-not-valid class to input fields as needed after step-validation. Removed some other useless classes.
141
+
142
+ = 1.8.3 (2020-03-01) =
143
+ * Fix JS error on submit (reported by [@wasi7186](https://wordpress.org/support/topic/js-uncaught-typeerror-when-form-is-submitted/))
144
+ * PRO multistep: On the last step of a multistep form, instead of cloning and hiding the submit button, we now simply move it to the next-step-container. This solves a compatibility issue with a third party recaptcha plugin (and probably some other plugins too)
145
+
146
+ = 1.8.2 (2020-02-27) =
147
+ * Small patch. Add a check in the ajaxComplete event, to make sure xhr.responseJSON is not null or undefined. (this caused a JS error on some websites)
148
+
149
+ = 1.8.1 (2020-02-23) =
150
+ * PRO: Bring form in initial state after submit, including going back to first step of multistep and resetting the initial number of sub-repeaters in each repeater.
151
+ * PRO: New field: [[summary]](https://conditional-fields-cf7.bdwm.be/summary/)
152
+ * PRO: Make form submission trigger next step (if not on last step)
153
+ * PRO: Multistep: automatically scroll to top of form after moving to a different step.
154
+ * PRO: Multistep: Replace h3 tag with div as step-title.
155
+ * PRO: Made some small changes to the default multistep styles, for basic mobile friendly behaviour.
156
+ * PRO: Make multistep compatibility with cf7-image-captcha plugin
157
+
158
+ = 1.8 (2020-02-03) =
159
+ * WPML compatibility: Force conditions to be an array. [link](https://wordpress.org/support/topic/wpml-conditional-fields-not-working-on-translations/#post-12390827)
160
+
161
+ = 1.7.9 (2020-01-22) =
162
+ * PRO (01-02-20) Added quick fix for problem with [_format_date "d m Y"] inside repeater. [link](https://github.com/pwkip/contact-form-7-conditional-fields/issues/38)
163
+ * (01-22-20) Fixed Ajax by adding global wpcf7cf variable to window.
164
+ * Changed min PHP version to 5.6 (might still be compatible with 5.4, but I suspect some edge case errors with older versions of PHP)
165
+
166
+ = 1.7.8 (2019-11-26) =
167
+ * Updated/added Javascript events for groups, repeaters and multistep + added [documentation](https://conditional-fields-cf7.bdwm.be/docs/examples/javascript-events/)
168
+ * Fixed bug where using invalid regex as a value would give a JS error [link](https://wordpress.org/support/topic/star-ratings-6/)
169
+ * PRO Multistep: Added attribute to multistep `data-current_step` which holds the current step index. (can be used as css selector like this: `div[data-current_step=1]`)
170
+ * PRO Repeater: The string `{{your-repeater_index}}` inside a repeater called `your-repeater` will be replaced with the index of the current sub repeater. [Check out the updated example](https://conditional-fields-cf7.bdwm.be/repeater/)
171
+
172
+ = 1.7.7 (2019-11-05) =
173
+ * PRO: Fix problem with parsing the "function" operator
174
+
175
+ = 1.7.6 (2019-11-01) =
176
+ * Fixed small compatibility problem with CF7 Smart Grid [link](https://wordpress.org/support/topic/problem-on-save-form-when-the-active-tabs-are-not-conditional-form/#post-12085173)
177
+ * Fixed some more porblems with parsing conditions (regex changes)
178
+ * Got rid of screen_icon notice on CF settings page
179
+
180
+ = 1.7.5 (2019-10-31) =
181
+ * Fixed bug in admin where settings got cleared if using some operators (mostly PRO operators)
182
+
183
+ = 1.7.4 (2019-10-29) =
184
+ * PRO: made repeater (80%) compatible with material-design-for-contact-form-7
185
+ * PRO: made exclusive checkbox work with repeater fields
186
+ * PRO: trigger events when a repeater adds fields: 'wpcf7cf_repeater_added' - and when a repeater removes fields: 'wpcf7cf_repeater_removed'. Can be called with `$('form').on('wpcf7cf_repeater_removed', function() { /*...*/ })`
187
+ * PRO: fixed bug with mutistep (formn did not work correctly if there were multiple forms on one page).
188
+
189
+ = 1.7.3 (2019-10-24) =
190
+ * removed @babel/polyfill. All seems to be working fine without it in IE11. JS file is now back to 25kb instead of 100kb.
191
+
192
+ = 1.7.2 (2019-10-24) =
193
+ * Bug fix: new javascript files where throwing errors. Should be okay now. (Also included JS source map for easier debugging)
194
+
195
+ = 1.7.1 (2019-10-23) =
196
+ * PRO: Added basic support for multistep. No options available yet. You can insert [step] tags inside your code. [More info](https://conditional-fields-cf7.bdwm.be/multistep/)
197
+ * Set up an NPM dev environment with babel and webpack. This means all the client side JS code will look super ugly, and it's also more bytes. But the plus side is that the plugin should also work fine in older browsers now.
198
+ * Tested with WP version 5.3
199
+
200
+ = 1.7 (2019-10-18) =
201
+ * code rewrite. Made code more testable by focusing more on a functional approach. Not completely finished yet, but getting there.
202
+ * FIXED clear_on_hide not working for multi select [github issue 35](https://github.com/pwkip/contact-form-7-conditional-fields/issues/35)
203
+ * PRO: FIXED [github issue 34](https://github.com/pwkip/contact-form-7-conditional-fields/issues/34) - A real nest fest is now possible. You can put groups inside repeaters inside repeaters inside groups ...
204
+ * FIXED make clear_on_hide restore initial values instead of clearing [github issue 31](https://github.com/pwkip/contact-form-7-conditional-fields/issues/31)
205
+ * WP-admin: Renamed "Import/Export" to "Text view". Conditions specified in the input fields are now semi-automatically synced with the text view.
206
+ * Internal change: When saving conditions, instead of posting all the input fields, the input fields are added to the "text view" textarea, and only the textarea will be sent. This is to prevent issues with PHP max_input_vars
207
+
208
+ = 1.6.5 (2019-10-15) =
209
+ * Patched a minor security issue. From now on, only users with the 'wpcf7_edit_contact_form' capability will be able to reset the Conditional Fields settings to their defaults. Big thanks to Chloe from Wordfence for pointing this out!
210
+ * Tested the plugin with WP version 5.2.4
211
+
212
+ = 1.6.4 (2019-07-04) =
213
+ * PRO: Repeater: Fixed invalid HTML for the remove button
214
+ * Free: Initialize form.$groups as a new jQuery object instead of an empty array, in order to prevent exotic bugs in case $groups aren't loaded by the time form.displayFields() is called. (https://wordpress.org/support/topic/typeerror-cannot-read-property-addclass-of-undefined-at-wpcf7cfform/)
215
+
216
+ = 1.6.3 (2019-07-04) =
217
+ * Removed the word "Pro" from the title in the free plugin
218
+
219
+ = 1.6.2 (2019-06-25) =
220
+ * Small changes to tag generator buttons
221
+ * Multistep bug fix. All group conditions are evaluated a second time after the page has fully loaded.
222
+ * PRO: added new operator 'function', allowing you to write custom javascript functions to determine whether or not a group should be shown. [link](https://conditional-fields-cf7.bdwm.be/advanced-conditional-logic-with-custom-javascript-functions/)
223
+ * PRO: fix bug with < (less than) operator
224
+
225
+ = 1.6.1 (2019-06-03) =
226
+ * JS refactoring and small compatibility fix after code rewrite.
227
+ * FREE: Added "Get PRO" button under Contact > Conditional Fields
228
+
229
+ = 1.6 (2019-06-01) =
230
+ * JS code rewrite
231
+ * PRO: allow groups inside repeater
232
+ * PRO: make plugin ready for PRO release.
233
+
234
+ = 1.5.5 (2019-05-20) =
235
+ * Fixed and explained how to disable loading of the styles and scripts and only enable it on certain pages. [More info](https://conditional-fields-cf7.bdwm.be/docs/faq/can-i-load-js-and-css-only-when-necessary/)
236
+ * Made sure default settings get set after activating plugin, without the need to visit the Contact > Conditional Fields page first.
237
+ * PRO: extended the repeater with min and max paramaters and the possibility to change the add and remove buttons texts
238
+ * PRO: enabling the pro plugin will show a notification to disable the free plugin, instead of throwing a PHP error.
239
+
240
+ = 1.5.4 (2019-05-06) =
241
+ * Make sure scripts get loaded late enough (wp_enqueue_scripts priority set to 20), because there was a problem with multistep where the multistep script was changing a value after the cf script ran. https://wordpress.org/support/topic/1-5-x-not-expanding-selected-hidden-groups-with-multi-step-on-previous-page/
242
+
243
+ = 1.5.3 (2019-05-03) =
244
+ * Refix the fix from version 1.4.3 that got unfixed in version 1.5 somehow 🙄
245
+
246
+ = 1.5.2 (2019-05-03) =
247
+ * by reverting changes in 1.5.1, the possibility to load forms via AJAX was destroyed. So, from now on the wpcf7cf scripts will be loaded in the 'wp_enqueue_scripts' hook. Analogous with the WPCF7_LOAD_JS constant, a new constant is defined called WPCF7CF_LOAD_JS wich is set to true by default.
248
+
249
+ = 1.5.1 (2019-05-02) =
250
+ * revert changes: enqueue scripts in 'wpcf7_contact_form' hook instead of 'wpcf7_enqueue_scripts', because loading it in the latter would cause problems with plugins that disable WPCF7_LOAD_JS (like for example contact-form-7-paypal-add-on).
251
+
252
+ = 1.5 (2019-04-21) =
253
+ * Make it possible to load forms with AJAX. [fixed github issue 25](https://github.com/pwkip/contact-form-7-conditional-fields/issues/25). [updated docs](https://conditional-fields-cf7.bdwm.be/docs/faq/how-to-initialize-the-conditional-logic-after-an-ajax-call/)
254
+ * Massive code reorganization in scripts.js
255
+ * Fixed bug that could appear after removing an AND condition.
256
+ * solve WPCF7_ADMIN_READ_WRITE_CAPABILITY - https://github.com/pwkip/contact-form-7-conditional-fields/pull/16
257
+ * disable part of the faulty remove_hidden_post_data function. - https://github.com/pwkip/contact-form-7-conditional-fields/pull/17
258
+ * Fix "Dismiss notice" on Conditional Fields Settings page
259
+ * use the "wpcf7_before_send_mail" hook instead of "wpcf7_mail_components" to hide mail groups. The wpcf7_before_send_mail hook is called earlier, so it allows to also hide groups in the attachment field and in messages.
260
+ * Allow conditional group tags in success and error messages. https://github.com/pwkip/contact-form-7-conditional-fields/issues/23
261
+ * duplicating a form will also duplicate conditions https://github.com/pwkip/contact-form-7-conditional-fields/issues/28
262
+
263
+ = 1.4.3 (2019-04-12) =
264
+ * Really fix clear_on_hide problem (https://wordpress.org/support/topic/clear_on_hide-still-not-working-right-after-1-4-2-update/)
265
+
266
+ = 1.4.2 (2019-04-10) =
267
+ * Disabled mailbox syntax errors if there are group tags present. (this is overkill, and should be changed if the necassary hooks become available) https://wordpress.org/support/topic/filter-detect_invalid_mailbox_syntax/
268
+ * Checked issue: https://github.com/pwkip/contact-form-7-conditional-fields/issues/26 (nothing changed, but turns out to be working fine)
269
+ * Fixed issue where mail_2 added extra lines in the email message. https://github.com/pwkip/contact-form-7-conditional-fields/issues/30
270
+ * Made the clear_on_hide property a bit more useful (https://github.com/pwkip/contact-form-7-conditional-fields/issues/27)
271
+ * Got rid of warning in PHP 7 (https://wordpress.org/support/topic/compatibility-warning-message-regarding-wpcf7_admin_read_write_capability/)
272
+ * Fixed some javascript errors that appeared on non-CF7CF subpages of CF7
273
+ * Tested WP version 5.1.1
274
+
275
+ = 1.4.1 (2018-08-21) =
276
+ * Fixed some CSS issues (https://wordpress.org/support/topic/crash-view-admin-the-list-of-posts-entry/)
277
+ * Dropped support for PHP version 5.2, now PHP 5.3+ is required to run the plugin. Let's push things forward!
278
+ * Added conditional group support to mail attachments field (https://github.com/pwkip/contact-form-7-conditional-fields/issues/22)
279
+ * Added repeater field to PRO version.
280
+
281
+ = 1.4 (2018-08-15) =
282
+ * Added basic drag and drop functionality to the back-end so conditional rules can be rearranged.
283
+ * Added possibility to create inline groups by adding the option inline. Example: `[group my-group inline] ... [/group]`
284
+ * Added property clear_on_hide to clear all fields within a group the moment the group gets hidden. Example: `[group my-group clear_on_hide] ... [/group]`
285
+ * Added AND conditions and added a bunch of other options in the PRO version (should be released very soon now)
286
+ * Bug fix thanks to Aurovrata Venet (@aurovrata) https://wordpress.org/support/topic/bug-plugin-overwrite-cf7-hidden-fields/
287
+ * Bug fix thanks to 972 creative (@toddedelman) https://wordpress.org/support/topic/conditional-fields-not-opening-using-radio-buttons/#post-10442923
288
+
289
+ = 1.3.4 =
290
+ * small fix (https://wordpress.org/support/topic/wpcf7_contactform-object-is-no-longer-accessible/)
291
+
292
+ = 1.3.3 =
293
+ * Changes tested with WP 4.7.5 and CF7 4.8
294
+ * Changed the inner mechanics a bit to make the plugin more edge-case proof and prepare for future ajax support
295
+ * Fix problems introduced by CF7 4.8 update
296
+ * Because the CF7 author, Takayuki Miyoshi, decided to get rid of the 'form-pre-serialize' javascript event, the hidden fields containing data about which groups are shown/hidden will now be updated when the form is loaded and each time a form value changes. This might make the plugin slightly slower, but it is the only solution I found so far.
297
+ * Small bug fix (https://wordpress.org/support/topic/php-depreciated-warning/#post-9151404)
298
+
299
+ = 1.3.2 =
300
+ * Removed a piece of code that was trying to load a non existing stylesheet
301
+ * Updated FAQ
302
+ * Code rearangement and additions for the upcomming Conditional Fields Pro plugin
303
+
304
+ = 1.3.1 =
305
+ * Fixed bug in 1.3 that broke everything
306
+
307
+ = 1.3 =
308
+ * Fixed small bug with integration with Contact Form 7 Multi-Step Forms
309
+ * Also trigger hiding/showing of groups while typing or pasting text in input fields
310
+ * Added support for input type="reset"
311
+ * Added animations
312
+ * Added settings page to wp-admin: Contact > Conditional Fields
313
+
314
+ = 1.2.3 =
315
+ * Make plugin compatible with CF7 Multi Step by NinjaTeam https://wordpress.org/plugins/cf7-multi-step/
316
+ * Improve compatibility with Signature Addon some more.
317
+
318
+ = 1.2.2 =
319
+ * Fix critical bug that was present in version 1.2 and 1.2.1
320
+
321
+ = 1.2.1 =
322
+ * Improve compatibility with <a href="https://wordpress.org/plugins/contact-form-7-signature-addon/">Contact Form 7 Signature Addon</a>: now allowing multiple hidden signature fields.
323
+
324
+ = 1.2 =
325
+ * Made compatible with <a href="https://wordpress.org/plugins/contact-form-7-multi-step-module/">Contact Form 7 Multi-Step Forms</a>
326
+ * Small bug fix by Manual from advantia.net: now only considering fields which are strictly inside hidden group tags with form submit. Important in some edge cases where form elements get hidden by other mechanisms, i.e. tabbed forms.
327
+ * Started work on WPCF7CF Pro, made some structural code modifications so the free plugin can function as the base for both plugins.
328
+ * Removed some debug code
329
+ * Updated readme file
330
+
331
+ = 1.1 =
332
+ * Added import feature
333
+ * Added support for nested groups in email
334
+ * Tested on WP version 4.7.2 with Contact Form 7 version 4.6.1
335
+
336
+ = 1.0 =
337
+ * I feel that at this point the plugin is stable enough in most cases, so it's about time to take it out of beta :)
338
+ * Update JS en CSS version numbers
339
+ * Fix PHP warning with forms that are not using conditional fields (https://wordpress.org/support/topic/conditional-formatting-error/)
340
+ * Tested on WP 4.7.1
341
+
342
+ = 0.2.9 =
343
+ * Re-added wpcf7_add_shortcode() function if wpcf7_add_form_tag() is not found, because some people claimed to get a "function not found" error for the wpcf7_add_form_tag function with the latest version of CF7 installed. (https://wordpress.org/support/topic/activation-issue-5/ and https://wordpress.org/support/topic/http-500-unable-to-handle-request-error-after-update/)
344
+ * Fixed some PHP notices (https://wordpress.org/support/topic/undefined-index-error-in-ajax-response/)
345
+ * Attempted to fix error with the CF7 success page redirects plugin (https://wordpress.org/support/topic/warning-invalid-argument-error-for-forms-without-conditional-fields/)
346
+
347
+ = 0.2.8 =
348
+ * forgot to update version number in 0.2.7, so changing version to 0.2.8 now.
349
+
350
+ = 0.2.7 =
351
+ * Added support for conditional fields in the email (2) field
352
+ * Got rid of some PHP warnings
353
+ * Saving a form only once, directly after adding or removing conditions, caused conditional logic not to work. This is fixed now. Thanks to @cpaprotna for pointing me in the right direction. (https://wordpress.org/support/topic/no-more-than-3-conditional-statements/)
354
+ * Fix validation error with hidden checkbox groups (https://wordpress.org/support/topic/hidden-group-required-field-is-showing-error/)
355
+
356
+ = 0.2.6 =
357
+ * Fixed problems with exclusive checkboxes in IE (https://wordpress.org/support/topic/internet-explorer-conditional-exclusive-checkboxes/)
358
+
359
+ = 0.2.5 =
360
+ * Changed deprecated function wpcf7_add_shortcode to wpcf7_add_form_tag as it was causing errors in debug mode. (https://wordpress.org/support/topic/wpcf7_add_shortcode-deprecated-notice-2/)
361
+ * Removed the hide option and fixed the not-equals option for single checkboxes
362
+
363
+ = 0.2.4 =
364
+ * Fixed bug that destroyed the conditional fields in email functionality
365
+
366
+ = 0.2.3 =
367
+ * Added support for conditional fields in the other email fields (subject, sender, recipient, additional_headers). Thanks @stevish!
368
+ * WP 4.7 broke the required conditional fields inside hidden groups, implemented in version 0.2. Thanks again to @stevish for pointing this out.
369
+ * Got rid of checking which groups are hidden both on the front-end (JS) and in the back-end (PHP). Now this is only done in the front-end.
370
+ * Tested the plugin with WP 4.7
371
+
372
+ = 0.2.2 =
373
+ * Prevent strict standards notice to appear while adding new group via the "Conditional Fields Group" popup.
374
+ * Only load cf7cf admin styles and scripts on cf7 pages.
375
+ * groups are now reset to their initial states after the form is successfully submitted.
376
+
377
+ = 0.2.1 =
378
+ * Bug fix: arrow kept spinning after submitting a form without conditional fields. (https://wordpress.org/support/topic/version-0-2-gives-a-continues-spinning-arrow-after-submitting/)
379
+ * Removed anonymous functions from code, so the plugin also works for PHP versions older than 5.3.
380
+ * Suppress errors generated if user uses invalid HTML markup in their form code. These errors could prevent form success message from appearing.
381
+
382
+ = 0.2 =
383
+ * Added support for required conditional fields inside hidden groups. A big thank you to @stevish for implementing this.
384
+ * Added support for conditional fields in the email messages. This one also goes entirely to @stevish. Thanks man!
385
+ * Added @stevish as a contributer to the project :)
386
+ * Fix form not working in widgets or other places outside of the loop. Thanks to @ciprianolaru for the solution (https://wordpress.org/support/topic/problem-with-unit_tag-when-not-in-the-loop-form-not-used-in-post-or-page/#post-8299801)
387
+
388
+ = 0.1.7 =
389
+ * Fix popup warning to leave page even tough no changes have been made. Thanks to @hhmaster2045 for reporting the bug. https://wordpress.org/support/topic/popup-warning-to-leave-page-even-though-no-changes-have-been-made
390
+ * Added export option for easier troubleshooting.
391
+ * Don't include front end javascript in backend.
392
+
393
+ = 0.1.6 =
394
+ * made compatible with wpcf7-form-control-signature-wrap plugin https://wordpress.org/support/topic/signature-add-on-not-working
395
+
396
+ = 0.1.5 =
397
+ * fixed PHP notice thanks to @natalia_c https://wordpress.org/support/topic/php-notice-80
398
+ * tested with WP 4.5.3
399
+
400
+ = 0.1.4 =
401
+ * Prevent conflicts between different forms on one page.
402
+ * Prevent conflicts between multiple instances of the same form on one page. (https://wordpress.org/support/topic/bug-153)
403
+ * Changed regex to convert \[group\] tags to &lt;div&gt; tags, as it was posing some conflicts with other plugins (https://wordpress.org/support/topic/plugin-influence-cf7-send-button-style)
404
+
405
+ = 0.1.3 =
406
+ * Removed fielset, id and class attributes for group tags, because they weren't used anyway and broke the shortcode
407
+ * If extra attributes are added to the group shortcode, this will no longer break functionality (even though no attributes are supported)
408
+
409
+ = 0.1.2 =
410
+ * Make code work with select element that allows multiple options.
411
+ * Only load javascript on pages that contain a CF7 form
412
+
413
+ = 0.1.1 =
414
+ Fixed bug with exclusive checkboxes (https://wordpress.org/support/topic/groups-not-showing)
415
+
416
+ = 0.1 =
417
+ First release
418
+
419
+
trunk/style.css ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* initially hide all groups (even before JS is loaded), so the page will never render them while loading */
2
+ [data-class="wpcf7cf_group"], .wpcf7cf_remove, .wpcf7cf_add {
3
+ display:none;
4
+ }
5
+
6
+ .wpcf7cf_repeater_sub {
7
+ margin-bottom: 20px;
8
+ }
9
+
10
+ .wpcf7cf_repeater_controls, .wpcf7cf_step_controls {
11
+ display: flex;
12
+ justify-content: space-between;
13
+ flex-wrap: wrap;
14
+ margin-top: 20px;
15
+ }
16
+
17
+ .wpcf7cf_multistep .wpcf7cf_step {
18
+ /* display:none; */
19
+ width: 100%;
20
+ }
21
+
22
+ .wpcf7cf_multistep .wpcf7cf_step .step-title {
23
+ display: none;
24
+ }
25
+
26
+ .wpcf7cf_multistep .wpcf7cf_steps-dots {
27
+ display: flex;
28
+ width: 100%;
29
+ margin-bottom: 20px;
30
+ flex-wrap: wrap;
31
+ }
32
+
33
+ .wpcf7cf_multistep .wpcf7cf_steps-dots .dot .step-index {
34
+ display: inline-block;
35
+ border-radius: 50%;
36
+ background: #dfdfdf;
37
+ color: #000000;
38
+ width: 40px;
39
+ height: 40px;
40
+ line-height: 40px;
41
+ text-align: center;
42
+ }
43
+
44
+ .wpcf7cf_multistep .wpcf7cf_steps-dots .dot {
45
+ border-bottom: 5px solid #dfdfdf;
46
+ text-align: center;
47
+ flex: 1;
48
+ padding: 15px;
49
+ min-width: 120px;
50
+ }
51
+ .wpcf7cf_multistep .wpcf7cf_steps-dots .dot.completed {
52
+ border-bottom: 5px solid #333;
53
+ }
54
+ .wpcf7cf_multistep .wpcf7cf_steps-dots .dot.active {
55
+ border-bottom: 5px solid #333;
56
+ font-weight: bold;
57
+ }
58
+
59
+ .wpcf7cf_multistep .wpcf7cf_steps-dots .dot.completed .step-index {
60
+ background-color: #333;
61
+ color: #ffffff;
62
+ }
63
+
64
+ .wpcf7cf_multistep .wpcf7cf_steps-dots .dot.active .step-index {
65
+ background-color: #333;
66
+ color: #ffffff;
67
+ }
68
+
69
+ .wpcf7cf_step_controls .disabled {
70
+ pointer-events: none;
71
+ cursor: default;
72
+ opacity: .5;
73
+ }
trunk/tg_pane_group.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="control-box">
2
+ <fieldset>
3
+ <legend><?php echo sprintf( esc_html( $description ) ); ?></legend>
4
+
5
+ <table class="form-table">
6
+ <tbody>
7
+
8
+ <tr>
9
+ <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-name' ); ?>"><?php echo esc_html( __( 'Name', 'contact-form-7' ) ); ?></label></th>
10
+ <td><input type="text" name="name" class="tg-name oneline" id="<?php echo esc_attr( $args['content'] . '-name' ); ?>" /></td>
11
+ </tr>
12
+
13
+ <tr>
14
+ <th scope="row"><label for="clear_on_hide"><?php echo esc_html( __( 'Clear on hide', 'contact-form-7' ) ); ?></label></th>
15
+ <td><input type="checkbox" name="clear_on_hide" class="option" id="clear_on_hide" /></td>
16
+ </tr>
17
+
18
+ <tr>
19
+ <th scope="row"><label for="inline"><?php echo esc_html( __( 'Inline', 'contact-form-7' ) ); ?></label></th>
20
+ <td><input type="checkbox" name="inline" class="option" id="inline" /></td>
21
+ </tr>
22
+
23
+ </tbody>
24
+ </table>
25
+ </fieldset>
26
+ </div>
27
+
28
+ <div class="insert-box">
29
+ <input type="text" name="<?php echo $type; ?>" class="tag code" readonly="readonly" onfocus="this.select()" />
30
+
31
+ <div class="submitbox">
32
+ <input type="button" class="button button-primary insert-tag" value="<?php echo esc_attr( __( 'Insert Tag', 'contact-form-7' ) ); ?>" />
33
+ </div>
34
+
35
+ <br class="clear" />
36
+ </div>
trunk/wpcf7cf-options.php ADDED
@@ -0,0 +1,286 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ define('WPCF7CF_SLUG', 'wpcf7cf');
4
+ define('WPCF7CF_OPTIONS', WPCF7CF_SLUG.'_options');
5
+ define('WPCF7CF_TEXT_DOMAIN', WPCF7CF_SLUG.'_text_domain');
6
+
7
+ define('WPCF7CF_DEFAULT_ANIMATION', 'yes');
8
+ define('WPCF7CF_DEFAULT_ANIMATION_INTIME', 200);
9
+ define('WPCF7CF_DEFAULT_ANIMATION_OUTTIME', 200);
10
+ define('WPCF7CF_DEFAULT_CONDITIONS_UI', 'normal');
11
+ define('WPCF7CF_DEFAULT_NOTICE_DISMISSED', false);
12
+
13
+ if ( ! defined( 'WPCF7_ADMIN_READ_WRITE_CAPABILITY' ) ) {
14
+ define( 'WPCF7_ADMIN_READ_WRITE_CAPABILITY', 'publish_pages' );
15
+ }
16
+
17
+ global $wpcf7cf_default_settings_glob;
18
+ $wpcf7cf_default_settings_glob = false;
19
+ function wpcf7cf_get_default_settings() {
20
+ global $wpcf7cf_default_settings_glob;
21
+ if ($wpcf7cf_default_settings_glob) return $wpcf7cf_default_settings_glob;
22
+
23
+ $wpcf7cf_default_settings_glob = array(
24
+ 'animation' => WPCF7CF_DEFAULT_ANIMATION,
25
+ 'animation_intime' => WPCF7CF_DEFAULT_ANIMATION_INTIME,
26
+ 'animation_outtime' => WPCF7CF_DEFAULT_ANIMATION_OUTTIME,
27
+ 'conditions_ui' => WPCF7CF_DEFAULT_CONDITIONS_UI,
28
+ 'notice_dismissed' => WPCF7CF_DEFAULT_NOTICE_DISMISSED
29
+ );
30
+ $wpcf7cf_default_settings_glob = apply_filters('wpcf7cf_default_options', $wpcf7cf_default_settings_glob);
31
+ return $wpcf7cf_default_settings_glob;
32
+ }
33
+
34
+ global $wpcf7cf_settings_glob;
35
+ $wpcf7cf_settings_glob = false;
36
+ function wpcf7cf_get_settings() {
37
+ global $wpcf7cf_settings_glob;
38
+ if ($wpcf7cf_settings_glob) {
39
+ return $wpcf7cf_settings_glob;
40
+ }
41
+
42
+ //get options from DB
43
+ $wpcf7cf_settings_glob = get_option(WPCF7CF_OPTIONS);
44
+
45
+ // if options have not been saved by the user yet, load the default options.
46
+ if ( !is_array($wpcf7cf_settings_glob) ) {
47
+ $wpcf7cf_settings_glob = wpcf7cf_get_default_settings();
48
+ }
49
+
50
+ return $wpcf7cf_settings_glob;
51
+ }
52
+
53
+ function wpcf7cf_set_options($settings) {
54
+ global $wpcf7cf_settings_glob;
55
+ $wpcf7cf_settings_glob = $settings;
56
+ update_option(WPCF7CF_OPTIONS, $wpcf7cf_settings_glob);
57
+ }
58
+
59
+ function wpcf7cf_reset_options() {
60
+ delete_option(WPCF7CF_OPTIONS);
61
+ }
62
+
63
+ add_action( 'admin_enqueue_scripts', 'wpcf7cf_load_page_options_wp_admin_style' );
64
+ function wpcf7cf_load_page_options_wp_admin_style() {
65
+ wp_register_style( 'wpcf7cf_admin_css', plugins_url('admin-style.css',__FILE__), false, WPCF7CF_VERSION );
66
+ wp_enqueue_style( 'wpcf7cf_admin_css' );
67
+ }
68
+
69
+
70
+ add_action('admin_menu', 'wpcf7cf_admin_add_page');
71
+ function wpcf7cf_admin_add_page() {
72
+ add_submenu_page('wpcf7', 'Conditional Fields', 'Conditional Fields', WPCF7_ADMIN_READ_WRITE_CAPABILITY, 'wpcf7cf', 'wpcf7cf_options_page' );
73
+ }
74
+
75
+ function wpcf7cf_options_page() {
76
+ $settings = wpcf7cf_get_settings();
77
+
78
+ if (isset($_POST['reset'])) {
79
+ echo '<div id="message" class="updated fade"><p><strong>Settings restored to defaults</strong></p></div>';
80
+ } else if (isset($_REQUEST['settings-updated'])) {
81
+ echo '<div id="message" class="updated fade"><p><strong>Settings updated</strong></p></div>';
82
+ }
83
+
84
+ ?>
85
+
86
+ <div class="wrap wpcf7cf-admin-wrap">
87
+ <h2>Contact Form 7 - Conditional Fields Settings</h2>
88
+ <?php if (!$settings['notice_dismissed']) { ?>
89
+ <div class="wpcf7cf-options-notice notice notice-warning is-dismissible"><div style="padding: 10px 0;"><strong>Notice</strong>: These are global settings for Contact Form 7 - Conditional Fields. <br><br><strong>How to create/edit conditional fields?</strong>
90
+ <ol>
91
+ <li>Create a new Contact Form or edit an existing one</li>
92
+ <li>Create at least one [group] inside the form</li>
93
+ <li>Save the Contact Form</li>
94
+ <li>go to the <strong><em>Conditional Fields</em></strong> Tab</li>
95
+ </ol>
96
+ <a href="https://conditional-fields-cf7.bdwm.be/conditional-fields-for-contact-form-7-tutorial/" target="_blank">Show me an example</a> | <a class="notice-dismiss-2" href="#">Dismiss notice</a>
97
+ </div></div>
98
+ <?php } ?>
99
+ <form action="options.php" method="post">
100
+ <?php settings_fields(WPCF7CF_OPTIONS); ?>
101
+
102
+ <input type="hidden" name="<?php echo WPCF7CF_OPTIONS.'[notice_dismissed]' ?>" value="<?php echo $settings['notice_dismissed'] ?>" />
103
+
104
+ <?php
105
+
106
+ echo '<h3>Default animation Settings</h3>';
107
+ wpcf7cf_input_fields_wrapper_start();
108
+
109
+ wpcf7cf_input_select('animation', array(
110
+ 'label' => 'Animation',
111
+ 'description' => 'Use animations while showing/hiding groups',
112
+ 'select_options' => array('yes' => 'Enabled', 'no'=> 'Disabled')
113
+ ));
114
+
115
+ wpcf7cf_input_field('animation_intime', array(
116
+ 'label' => 'Animation In time',
117
+ 'description' => 'A positive integer value indicating the time, in milliseconds, it will take for each group to show.',
118
+ ));
119
+
120
+ wpcf7cf_input_field('animation_outtime', array(
121
+ 'label' => 'Animation Out Time',
122
+ 'description' => 'A positive integer value indicating the time, in milliseconds, it will take for each group to hide.',
123
+ ));
124
+
125
+ wpcf7cf_input_fields_wrapper_end();
126
+ submit_button();
127
+
128
+ if (!WPCF7CF_IS_PRO) {
129
+ ?>
130
+ <h3>Conditional Fields PRO</h3>
131
+ Get conditional Fields PRO to unlock the full potential of CF7
132
+ <ul class="wpcf7cf-list">
133
+ <li>Repeaters</li>
134
+ <li>Regular expressions</li>
135
+ <li>Togglebuttons</li>
136
+ <li>Additional operators <code>&lt;</code> <code>&gt;</code> <code>&le;</code> <code>&ge;</code> <code>is empty</code></li>
137
+ <li>Multistep (with Summary)</li>
138
+ <li>More comming soon (Calculated Fields, ...)</li>
139
+ </ul>
140
+ <p><a target="_blank" class="button button-primary" href="https://conditional-fields-cf7.bdwm.be/contact-form-7-conditional-fields-pro/">Get PRO</a></p>
141
+ <?php
142
+ }
143
+ do_action('wpcf7cf_after_animation_settings');
144
+
145
+ echo '<h3>Advanced Settings</h3>';
146
+ wpcf7cf_input_fields_wrapper_start();
147
+
148
+ wpcf7cf_input_select('conditions_ui', array(
149
+ 'label' => 'Conditonal Fields UI',
150
+ 'description' => 'If you want to add more than '.WPCF7CF_MAX_RECOMMENDED_CONDITIONS.' conditions, it\'s recommended to switch to <strong>Text mode</strong> mode for better performance.',
151
+ 'select_options' => array('normal'=> 'Normal', 'text_only' => 'Text mode')
152
+ ));
153
+
154
+ wpcf7cf_input_fields_wrapper_end();
155
+
156
+ submit_button();
157
+
158
+ ?>
159
+
160
+ </form></div>
161
+
162
+ <h3>Restore Default Settings</h3>
163
+ <form method="post" id="reset-form" action="">
164
+ <p class="submit">
165
+ <input name="reset" class="button button-secondary" type="submit" value="Restore defaults" >
166
+ <input type="hidden" name="action" value="reset" />
167
+ </p>
168
+ </form>
169
+ <script>
170
+ (function($){
171
+ $('#reset-form').submit(function() {
172
+ return confirm('Are you sure you want to reset the plugin settings to the default values? All changes you have previously made will be lost.');
173
+ });
174
+ }(jQuery))
175
+ </script>
176
+
177
+ <?php
178
+ }
179
+
180
+ function wpcf7cf_input_fields_wrapper_start() {
181
+ echo '<table class="form-table" role="presentation"><tbody>';
182
+ }
183
+ function wpcf7cf_input_fields_wrapper_end() {
184
+ echo '</tbody></table>';
185
+ }
186
+
187
+ function wpcf7cf_input_field($slug, $args) {
188
+ $settings = wpcf7cf_get_settings();
189
+
190
+ $defaults = array(
191
+ 'label'=>'',
192
+ 'desription' => '',
193
+ 'default' => wpcf7cf_get_default_settings()[$slug],
194
+ 'label_editable' => false
195
+ );
196
+
197
+ $args = wp_parse_args( $args, $defaults );
198
+ extract($args);
199
+
200
+ $label; $description; $default; $label_editable;
201
+
202
+ if (!key_exists($slug, $settings)) {
203
+ $settings[$slug] = $default;
204
+ $settings[$slug.'_label'] = $label;
205
+ }
206
+
207
+ ?>
208
+
209
+ <tr>
210
+ <th scope="row">
211
+
212
+ <?php if ($label_editable) { ?>
213
+ <span class="label editable"><input type="text" data-default-value="<?php echo $label ?>" value="<?php echo $settings[$slug.'_label'] ?>" id="<?php echo WPCF7CF_OPTIONS.'_'.$slug.'_label' ?>" name="<?php echo WPCF7CF_OPTIONS.'['.$slug.'_label]' ?>"></span>
214
+ <?php } else { ?>
215
+ <label for="<?php echo WPCF7CF_OPTIONS.'_'.$slug ?>"><?php echo $label ?></label>
216
+ <?php } ?>
217
+
218
+ </th>
219
+ <td>
220
+ <input type="text" data-default-value="<?php echo $default ?>" value="<?php echo $settings[$slug] ?>" id="<?php echo WPCF7CF_OPTIONS.'_'.$slug ?>" name="<?php echo WPCF7CF_OPTIONS.'['.$slug.']' ?>">
221
+ <p class="description" id="<?php echo WPCF7CF_OPTIONS.'_'.$slug ?>-description">
222
+ <?php echo $description ?><?php if (!empty($default)) echo ' (Default: '.$default.')' ?>
223
+ </p>
224
+ </td>
225
+ </tr>
226
+
227
+ <?php
228
+
229
+ }
230
+
231
+ function wpcf7cf_input_select($slug, $args) {
232
+ $settings = wpcf7cf_get_settings();
233
+
234
+ $defaults = array(
235
+ 'label'=>'',
236
+ 'desription' => '',
237
+ 'select_options' => array(), // array($name => $value)
238
+ 'default' => wpcf7cf_get_default_settings()[$slug],
239
+ );
240
+
241
+ $args = wp_parse_args( $args, $defaults );
242
+ extract($args);
243
+
244
+ $label; $description; $select_options; $default;
245
+
246
+ if (!key_exists($slug, $settings)) {
247
+ $settings[$slug] = $default;
248
+ }
249
+
250
+ ?>
251
+ <tr>
252
+ <th scope="row"><label for="<?php echo WPCF7CF_OPTIONS.'_'.$slug ?>"><?php echo $label ?></label></th>
253
+ <td>
254
+ <select id="<?php echo WPCF7CF_OPTIONS.'_'.$slug ?>" data-default-value="<?php echo $default ?>" name="<?php echo WPCF7CF_OPTIONS.'['.$slug.']' ?>">
255
+ <?php foreach($select_options as $value => $text) { ?>
256
+ <option value="<?php echo $value ?>" <?php echo $settings[$slug]==$value?'selected':'' ?>><?php echo $text ?></option>
257
+ <?php } ?>
258
+ </select>
259
+ <p class="description" id="<?php echo WPCF7CF_OPTIONS.'_'.$slug ?>-description">
260
+ <?php echo $description ?><?php if (!empty($default)) echo ' (Default: '.$select_options[$default].')' ?>
261
+ </p>
262
+ </td>
263
+ </tr>
264
+ <?php
265
+ }
266
+
267
+ add_action('admin_init', 'wpcf7cf_admin_init');
268
+ function wpcf7cf_admin_init(){
269
+
270
+ if(isset($_POST['reset']) && current_user_can( 'wpcf7_edit_contact_form' ) ) {
271
+ wpcf7cf_reset_options();
272
+ }
273
+
274
+ register_setting( WPCF7CF_OPTIONS, WPCF7CF_OPTIONS, 'wpcf7cf_options_sanitize' );
275
+ }
276
+
277
+ function wpcf7cf_options_sanitize($input) {
278
+ return $input;
279
+ }
280
+
281
+ add_action( 'wp_ajax_wpcf7cf_dismiss_notice', 'wpcf7cf_dismiss_notice' );
282
+ function wpcf7cf_dismiss_notice() {
283
+ $settings = wpcf7cf_get_settings();
284
+ $settings['notice_dismissed'] = true;
285
+ wpcf7cf_set_options($settings);
286
+ }