Visual Form Builder - Version 2.7.8

Version Description

Add settings page. Update CSS enqueue to only load when form exists on the page

Download this release

Release Info

Developer mmuro
Plugin Icon 128x128 Visual Form Builder
Version 2.7.8
Comparing to
See all releases

Code changes from version 2.7.7 to 2.7.8

css/visual-form-builder.css CHANGED
@@ -1,23 +1,38 @@
1
  form.visual-form-builder{
2
- font-family:inherit;
3
  margin:20px 0;
4
  background: none;
5
  list-style:none;
6
- list-style-image: none;
7
  list-style-type: none;
8
- position: relative;
9
  text-shadow: none;
 
10
  }
11
 
12
  form.visual-form-builder li{
 
13
  width:auto !important;
14
  background: none;
15
  list-style: none;
16
- list-style-image: none;
17
  list-style-type: none;
18
- margin: 0;
 
19
  }
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  /* Hide br tags for themes that auto add them */
22
  .visual-form-builder br {
23
  display: none;
@@ -32,44 +47,58 @@ form.visual-form-builder li{
32
  .entry-content .visual-form-builder ul,
33
  .comment-content .visual-form-builder ul,
34
  .mu_register .visual-form-builder ul {
 
 
35
  background: none;
36
  list-style: none;
37
- list-style-image: none;
38
  list-style-type: none;
39
- margin:0 14px;
40
- padding:0;
41
  font-size:12px;
42
  line-height: inherit;
43
  }
44
 
45
  .visual-form-builder ul li {
 
46
  background: none;
47
  list-style: none;
48
- list-style-image: none;
49
  list-style-type: none;
50
- margin: 0;
51
  }
52
 
 
 
 
 
53
  .visual-form-builder li,
54
  .entry-content .visual-form-builder li,
55
  .comment-content .visual-form-builder li,
56
  .mu_register .visual-form-builder li {
57
- background: none;
58
- list-style: none;
59
- list-style-image: none;
60
- list-style-type: none;
61
  clear: both;
62
  margin: 0;
63
  padding: 6px 1% 9px;
64
  width: 64%;
 
 
 
 
65
  }
66
 
 
 
 
 
 
 
 
 
67
  .visual-form-builder li div span.vfb-span,
 
68
  span.vfb-full input,
69
  span.vfb-full input[type="text"].vfb-medium,
70
  span.vfb-full select{
71
  display:block;
72
  float:left;
 
73
  width:100%;
74
  }
75
 
@@ -105,34 +134,34 @@ span.vfb-full select{
105
 
106
  .visual-form-builder li div label,
107
  .visual-form-builder li span label {
108
- font-size: 90%;
109
  margin: 0;
 
110
  }
111
 
112
  /* !Fieldset */
113
  .visual-form-builder fieldset{
114
- background-color:#eeeeee;
115
- border-radius:3px;
116
- border:1px solid #D3D3D3;
117
  margin:15px 0;
118
  padding: 0;
119
- clear:both;
 
 
120
  }
121
 
122
  /* !Legend */
123
  .visual-form-builder .vfb-legend{
124
  margin:5px 14px;
125
  padding:0 6px;
126
- color:#990000;
127
  border-bottom:1px solid #CCCCCC;
 
128
  font-size:inherit;
129
  }
130
 
131
  .visual-form-builder .vfb-legend h3 {
132
- font-size:20px;
133
- line-height: 2.0em;
134
  margin:0;
135
  padding:0;
 
 
136
  }
137
 
138
  /* !Description */
@@ -171,11 +200,11 @@ label.vfb-desc{
171
  }
172
 
173
  .visual-form-builder label.vfb-choice{
174
- font-size:100%;
175
- line-height:150%;
176
  margin:-16px 0 0 23px;
177
  padding:0 0 5px;
178
  width:88%;
 
 
179
  }
180
 
181
  .rtl .visual-form-builder label.vfb-choice {
@@ -183,11 +212,11 @@ label.vfb-desc{
183
  }
184
 
185
  .visual-form-builder label .vfb-required-asterisk {
186
- color: #BC1212;
187
- font-weight: bold;
188
  margin: 0;
189
  padding: 0;
 
190
  vertical-align: baseline;
 
191
  }
192
 
193
  /* !Input, Textarea, and Select */
@@ -197,10 +226,10 @@ input[type="tel"].vfb-text,
197
  input[type="email"].vfb-text,
198
  input[type="url"].vfb-text,
199
  textarea.vfb-textarea {
200
- background: none repeat scroll 0 0 #FAFAFA;
201
  border: 1px solid #DDDDDD;
202
  border-radius: 3px;
203
- padding: 3px 0;
204
 
205
  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
206
  -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
@@ -217,10 +246,10 @@ textarea.vfb-textarea {
217
  input[type="email"].vfb-text:focus,
218
  input[type="url"].vfb-text:focus,
219
  textarea.vfb-textarea:focus {
220
- border-color: rgba(82, 168, 236, 0.8);
221
  outline: 0;
222
  outline: thin dotted \9;
223
  /* IE6-9 */
 
224
 
225
  -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);
226
  -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);
@@ -247,16 +276,16 @@ input[type="email"].vfb-text,
247
  input[type="url"].vfb-text,
248
  textarea.vfb-textarea,
249
  select.vfb-select {
 
 
 
250
  font-size:100%;
251
  font-family:inherit;
252
  line-height: normal;
253
- height: auto;
254
- color: #373737;
255
- margin: 0 0 5px 0;
256
  }
257
 
258
  select.vfb-select{
259
- padding:2px 0;
260
  }
261
 
262
  input.vfb-small,
@@ -310,11 +339,11 @@ input.vfb-checkbox,
310
  input[type="checkbox"].vfb-checkbox,
311
  input.vfb-radio,
312
  input[type="radio"].vfb-radio {
313
- font-size:1.1em;
314
  display:block;
315
- height:13px;
316
- width:13px;
317
  margin:4px 0 0;
 
 
 
318
  }
319
 
320
  input.vfb-other,
@@ -341,20 +370,20 @@ input[type="text"].vfb-other {
341
  .visual-form-builder li.vfb-left-half,
342
  .visual-form-builder li.vfb-left-third,
343
  .visual-form-builder li.vfb-left-two-thirds{
344
- clear:left;
345
  float:left;
 
346
  }
347
 
348
  .visual-form-builder li.vfb-right-half,
349
  .visual-form-builder li.vfb-right-third,
350
  .visual-form-builder li.vfb-right-two-thirds{
351
- clear:none;
352
  float:right;
 
353
  }
354
 
355
  .visual-form-builder li.vfb-middle-third{
356
- clear:none;
357
  float:left;
 
358
  margin-left:2%;
359
  }
360
 
@@ -425,46 +454,48 @@ p#form_success,
425
 
426
  /* !Instructions */
427
  .vfb-item-instructions{
428
- background-color:#e3e3e3;
429
  border-radius:3px;
 
430
  }
431
 
432
  .vfb-item-instructions ul,
433
  .vfb-item-instructions ul li {
434
- list-style: disc;
435
  padding-bottom: 0;
 
436
  }
437
 
438
  .vfb-item-instructions ol,
439
  .vfb-item-instructions ol li {
440
- list-style: decimal;
441
  padding-bottom: 0;
 
442
  }
443
 
444
  /* !Sections */
445
  .vfb-section-div {
446
- background-color:#D4D4D4;
447
- border-radius:3px;
448
- padding:10px;
449
- margin:10px 0;
450
  float:left;
 
 
451
  width:97%;
 
 
452
  }
453
 
454
  .visual-form-builder .vfb-section-div h4 {
455
- font-size:16px;
456
- border-bottom:1px solid #BABABA;
457
  margin: 0;
 
 
 
 
458
  }
459
 
460
  /* !Clearing */
461
  .vfb-clear{
462
- clear:both;
463
  display:block;
464
- height:0;
465
- width:0;
466
- overflow:hidden;
467
  visibility:hidden;
 
 
 
 
468
  }
469
 
470
  /* !Conditional Field */
1
  form.visual-form-builder{
2
+ position: relative;
3
  margin:20px 0;
4
  background: none;
5
  list-style:none;
 
6
  list-style-type: none;
7
+ list-style-image: none;
8
  text-shadow: none;
9
+ font-family:inherit;
10
  }
11
 
12
  form.visual-form-builder li{
13
+ margin: 0;
14
  width:auto !important;
15
  background: none;
16
  list-style: none;
 
17
  list-style-type: none;
18
+ list-style-image: none;
19
+ clear: both;
20
  }
21
 
22
+ form.visual-form-builder li:before {
23
+ content: none;
24
+ }
25
+
26
+ form.visual-form-builder ul:after,
27
+ form.visual-form-builder li:after,
28
+ form.visual-form-builder li div:after {
29
+ clear: both;
30
+ content: '.';
31
+ display: block;
32
+ height: 0;
33
+ visibility: hidden;
34
+ }
35
+
36
  /* Hide br tags for themes that auto add them */
37
  .visual-form-builder br {
38
  display: none;
47
  .entry-content .visual-form-builder ul,
48
  .comment-content .visual-form-builder ul,
49
  .mu_register .visual-form-builder ul {
50
+ margin:0 14px;
51
+ padding:0;
52
  background: none;
53
  list-style: none;
 
54
  list-style-type: none;
55
+ list-style-image: none;
 
56
  font-size:12px;
57
  line-height: inherit;
58
  }
59
 
60
  .visual-form-builder ul li {
61
+ margin: 0;
62
  background: none;
63
  list-style: none;
 
64
  list-style-type: none;
65
+ list-style-image: none;
66
  }
67
 
68
+ .visual-form-builder ul li:before {
69
+ content: none;
70
+ }
71
+
72
  .visual-form-builder li,
73
  .entry-content .visual-form-builder li,
74
  .comment-content .visual-form-builder li,
75
  .mu_register .visual-form-builder li {
 
 
 
 
76
  clear: both;
77
  margin: 0;
78
  padding: 6px 1% 9px;
79
  width: 64%;
80
+ background: none;
81
+ list-style: none;
82
+ list-style-type: none;
83
+ list-style-image: none;
84
  }
85
 
86
+ .visual-form-builder li:before,
87
+ .entry-content .visual-form-builder li:before,
88
+ .comment-content .visual-form-builder li:before,
89
+ .mu_register .visual-form-builder li:before {
90
+ content: none;
91
+ }
92
+
93
+ .vfb-span,
94
  .visual-form-builder li div span.vfb-span,
95
+ .visual-form-builder [class*="vfb-span"],
96
  span.vfb-full input,
97
  span.vfb-full input[type="text"].vfb-medium,
98
  span.vfb-full select{
99
  display:block;
100
  float:left;
101
+ margin: 0;
102
  width:100%;
103
  }
104
 
134
 
135
  .visual-form-builder li div label,
136
  .visual-form-builder li span label {
 
137
  margin: 0;
138
+ font-size: 90%;
139
  }
140
 
141
  /* !Fieldset */
142
  .visual-form-builder fieldset{
143
+ clear:both;
 
 
144
  margin:15px 0;
145
  padding: 0;
146
+ border:1px solid #D3D3D3;
147
+ border-radius:3px;
148
+ background-color:#eeeeee;
149
  }
150
 
151
  /* !Legend */
152
  .visual-form-builder .vfb-legend{
153
  margin:5px 14px;
154
  padding:0 6px;
 
155
  border-bottom:1px solid #CCCCCC;
156
+ color:#990000;
157
  font-size:inherit;
158
  }
159
 
160
  .visual-form-builder .vfb-legend h3 {
 
 
161
  margin:0;
162
  padding:0;
163
+ font-size:20px;
164
+ line-height: 2.0em;
165
  }
166
 
167
  /* !Description */
200
  }
201
 
202
  .visual-form-builder label.vfb-choice{
 
 
203
  margin:-16px 0 0 23px;
204
  padding:0 0 5px;
205
  width:88%;
206
+ font-size:100%;
207
+ line-height:150%;
208
  }
209
 
210
  .rtl .visual-form-builder label.vfb-choice {
212
  }
213
 
214
  .visual-form-builder label .vfb-required-asterisk {
 
 
215
  margin: 0;
216
  padding: 0;
217
+ color: #BC1212;
218
  vertical-align: baseline;
219
+ font-weight: bold;
220
  }
221
 
222
  /* !Input, Textarea, and Select */
226
  input[type="email"].vfb-text,
227
  input[type="url"].vfb-text,
228
  textarea.vfb-textarea {
229
+ padding: 3px 0;
230
  border: 1px solid #DDDDDD;
231
  border-radius: 3px;
232
+ background: none repeat scroll 0 0 #FAFAFA;
233
 
234
  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
235
  -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
246
  input[type="email"].vfb-text:focus,
247
  input[type="url"].vfb-text:focus,
248
  textarea.vfb-textarea:focus {
 
249
  outline: 0;
250
  outline: thin dotted \9;
251
  /* IE6-9 */
252
+ border-color: rgba(82, 168, 236, 0.8);
253
 
254
  -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);
255
  -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);
276
  input[type="url"].vfb-text,
277
  textarea.vfb-textarea,
278
  select.vfb-select {
279
+ margin: 0 0 5px 0;
280
+ height: auto;
281
+ color: #373737;
282
  font-size:100%;
283
  font-family:inherit;
284
  line-height: normal;
 
 
 
285
  }
286
 
287
  select.vfb-select{
288
+ padding: 1px 0 0;
289
  }
290
 
291
  input.vfb-small,
339
  input[type="checkbox"].vfb-checkbox,
340
  input.vfb-radio,
341
  input[type="radio"].vfb-radio {
 
342
  display:block;
 
 
343
  margin:4px 0 0;
344
+ width:13px;
345
+ height:13px;
346
+ font-size:1.1em;
347
  }
348
 
349
  input.vfb-other,
370
  .visual-form-builder li.vfb-left-half,
371
  .visual-form-builder li.vfb-left-third,
372
  .visual-form-builder li.vfb-left-two-thirds{
 
373
  float:left;
374
+ clear:left;
375
  }
376
 
377
  .visual-form-builder li.vfb-right-half,
378
  .visual-form-builder li.vfb-right-third,
379
  .visual-form-builder li.vfb-right-two-thirds{
 
380
  float:right;
381
+ clear:none;
382
  }
383
 
384
  .visual-form-builder li.vfb-middle-third{
 
385
  float:left;
386
+ clear:none;
387
  margin-left:2%;
388
  }
389
 
454
 
455
  /* !Instructions */
456
  .vfb-item-instructions{
 
457
  border-radius:3px;
458
+ background-color:#e3e3e3;
459
  }
460
 
461
  .vfb-item-instructions ul,
462
  .vfb-item-instructions ul li {
 
463
  padding-bottom: 0;
464
+ list-style: disc;
465
  }
466
 
467
  .vfb-item-instructions ol,
468
  .vfb-item-instructions ol li {
 
469
  padding-bottom: 0;
470
+ list-style: decimal;
471
  }
472
 
473
  /* !Sections */
474
  .vfb-section-div {
 
 
 
 
475
  float:left;
476
+ margin:10px 0;
477
+ padding:10px;
478
  width:97%;
479
+ border-radius:3px;
480
+ background-color:#D4D4D4;
481
  }
482
 
483
  .visual-form-builder .vfb-section-div h4 {
 
 
484
  margin: 0;
485
+ padding: 0;
486
+ border-bottom:1px solid #BABABA;
487
+ font-size:16px;
488
+ line-height: inherit;
489
  }
490
 
491
  /* !Clearing */
492
  .vfb-clear{
 
493
  display:block;
 
 
 
494
  visibility:hidden;
495
+ clear:both;
496
+ overflow:hidden;
497
+ width:0;
498
+ height:0;
499
  }
500
 
501
  /* !Conditional Field */
css/visual-form-builder.min.css CHANGED
@@ -1 +1 @@
1
- form.visual-form-builder{font-family:inherit;margin:20px 0;background:0;list-style:none;list-style-image:none;list-style-type:none;position:relative;text-shadow:none}form.visual-form-builder li{width:auto!important;background:0;list-style:none;list-style-image:none;list-style-type:none;margin:0}.visual-form-builder br{display:none}form.visual-form-builder .vfb-item-instructions br{display:inline}.visual-form-builder ul,.entry-content .visual-form-builder ul,.comment-content .visual-form-builder ul,.mu_register .visual-form-builder ul{background:0;list-style:none;list-style-image:none;list-style-type:none;margin:0 14px;padding:0;font-size:12px;line-height:inherit}.visual-form-builder ul li{background:0;list-style:none;list-style-image:none;list-style-type:none;margin:0}.visual-form-builder li,.entry-content .visual-form-builder li,.comment-content .visual-form-builder li,.mu_register .visual-form-builder li{background:0;list-style:none;list-style-image:none;list-style-type:none;clear:both;margin:0;padding:6px 1% 9px;width:64%}.visual-form-builder li div span.vfb-span,span.vfb-full input,span.vfb-full input[type="text"].vfb-medium,span.vfb-full select{display:block;float:left;width:100%}.visual-form-builder span.vfb-left{float:left;width:48%}.visual-form-builder span.vfb-right{float:right;width:48%}.visual-form-builder span.vfb-right input,.visual-form-builder span.vfb-right input[type="text"],.visual-form-builder span.vfb-right select,.visual-form-builder span.vfb-left input,.visual-form-builder span.vfb-left input[type="text"],.visual-form-builder span.vfb-left select{width:100%}.visual-form-builder span.vfb-time{float:left;margin:0 .3em 0 0}.rtl .visual-form-builder span.vfb-time{float:right;margin:0 0 0 .3em}.visual-form-builder li div label,.visual-form-builder li span label{font-size:90%;margin:0}.visual-form-builder fieldset{background-color:#eee;border-radius:3px;border:1px solid #d3d3d3;margin:15px 0;padding:0;clear:both}.visual-form-builder .vfb-legend{margin:5px 14px;padding:0 6px;color:#900;border-bottom:1px solid #ccc;font-size:inherit}.visual-form-builder .vfb-legend h3{font-size:20px;line-height:2.0em;margin:0;padding:0}.visual-form-builder label,label.vfb-desc{display:block;margin:0;padding:0 0 3px 0;color:#000}label.vfb-desc{font-weight:bold}.visual-form-builder.left-label .vfb-desc,.visual-form-builder.right-label .vfb-desc{float:left;margin:0 15px 0 0;width:20%}.visual-form-builder.right-label .vfb-desc{padding-top:2px;text-align:right}.visual-form-builder li div{margin:0;padding:0}.visual-form-builder.left-label li div,.visual-form-builder.right-label li div{float:left;width:65%}.visual-form-builder label.vfb-choice{font-size:100%;line-height:150%;margin:-16px 0 0 23px;padding:0 0 5px;width:88%}.rtl .visual-form-builder label.vfb-choice{margin:-16px 23px 0 0}.visual-form-builder label .vfb-required-asterisk{color:#bc1212;font-weight:bold;margin:0;padding:0;vertical-align:baseline}input.vfb-text,input[type="text"].vfb-text,input[type="tel"].vfb-text,input[type="email"].vfb-text,input[type="url"].vfb-text,textarea.vfb-textarea{background:none repeat scroll 0 0 #fafafa;border:1px solid #ddd;border-radius:3px;padding:3px 0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border linear .2s,box-shadow linear .2s;-moz-transition:border linear .2s,box-shadow linear .2s;-o-transition:border linear .2s,box-shadow linear .2s;transition:border linear .2s,box-shadow linear .2s}input.vfb-text:focus,input[type="text"].vfb-text:focus,input[type="tel"].vfb-text:focus,input[type="email"].vfb-text:focus,input[type="url"].vfb-text:focus,textarea.vfb-textarea:focus{border-color:rgba(82,168,236,0.8);outline:0;outline:thin dotted \9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.6);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.6)}input.vfb-text.error:focus,input[type="text"].vfb-text.error:focus,input[type="tel"].vfb-text.error:focus,input[type="email"].vfb-text.error:focus,input[type="url"].vfb-text.error:focus,textarea.vfb-textarea.error:focus{border-color:rgba(238,83,83,0.8);-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(238,83,83,.6);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(238,83,83,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(238,83,83,.6)}input.vfb-text,input[type="text"].vfb-text,input[type="tel"].vfb-text,input[type="email"].vfb-text,input[type="url"].vfb-text,textarea.vfb-textarea,select.vfb-select{font-size:100%;font-family:inherit;line-height:normal;height:auto;color:#373737;margin:0 0 5px 0}select.vfb-select{padding:2px 0}input.vfb-small,input[type="text"].vfb-small,input[type="tel"].vfb-small,input[type="email"].vfb-small,input[type="url"].vfb-small,select.vfb-small{width:25%}input.vfb-medium,input[type="text"].vfb-medium,input[type="tel"].vfb-medium,input[type="email"].vfb-medium,input[type="url"].vfb-medium,select.vfb-medium{width:50%}input.vfb-large,input[type="text"].vfb-large,input[type="tel"].vfb-large,input[type="email"].vfb-large,input[type="url"].vfb-large,select.vfb-large,textarea.vfb-textarea{width:100%}textarea.vfb-medium{height:5.5em}textarea.vfb-medium{height:10em}textarea.vfb-large{height:20em}.vfb-submit,input[type="submit"].vfb-submit{font-size:1.1em}input.vfb-checkbox,input[type="checkbox"].vfb-checkbox,input.vfb-radio,input[type="radio"].vfb-radio{font-size:1.1em;display:block;height:13px;width:13px;margin:4px 0 0}input.vfb-other,input[type="text"].vfb-other{margin:0 0 8px 25px}.visual-form-builder li.vfb-two-column div span,.visual-form-builder li.vfb-three-column div span,.visual-form-builder li.vfb-auto-column div span{margin:0 5px 0 0;width:48%}.visual-form-builder li.vfb-three-column div span{width:30%}.visual-form-builder li.vfb-auto-column div span{width:auto}.visual-form-builder li.vfb-left-half,.visual-form-builder li.vfb-left-third,.visual-form-builder li.vfb-left-two-thirds{clear:left;float:left}.visual-form-builder li.vfb-right-half,.visual-form-builder li.vfb-right-third,.visual-form-builder li.vfb-right-two-thirds{clear:none;float:right}.visual-form-builder li.vfb-middle-third{clear:none;float:left;margin-left:2%}.visual-form-builder li.vfb-left-half,.visual-form-builder li.vfb-right-half{width:47%!important}.visual-form-builder li.vfb-left-third,.visual-form-builder li.vfb-middle-third,.visual-form-builder li.vfb-right-third{width:30%!important}.visual-form-builder li.vfb-left-two-thirds,.visual-form-builder li.vfb-right-two-thirds{width:64%!important}li.vfb-left-half .vfb-small,li.vfb-left-half .vfb-medium,li.vfb-left-half .vfb-large,li.vfb-right-half .vfb-small,li.vfb-right-half .vfb-medium,li.vfb-right-half .vfb-large,li.vfb-left-third .vfb-small,li.vfb-left-third .vfb-medium,li.vfb-left-third .vfb-large,li.vfb-middle-third .vfb-small,li.vfb-middle-third .vfb-medium,li.vfb-middle-third .vfb-large,li.vfb-right-third .vfb-small,li.vfb-right-third .vfb-medium,li.vfb-right-third .vfb-large,.visual-form-builder li.vfb-left-two-thirds .vfb-small,.visual-form-builder li.vfb-left-two-thirds .vfb-medium,.visual-form-builder li.vfb-left-two-thirds .vfb-large,.visual-form-builder li.vfb-right-two-thirds .vfb-small,.visual-form-builder li.vfb-right-two-thirds .vfb-medium,.visual-form-builder li.vfb-right-two-thirds .vfb-large{width:100%}label.error{color:red;font-weight:bold;font-size:90%}input.error,select.error,textarea.error{border:1px solid red}p#form_success,.vfb-form-success{color:green;font-weight:bold}#ui-datepicker-div{display:none;font-size:12px}.vfb-item-instructions{background-color:#e3e3e3;border-radius:3px}.vfb-item-instructions ul,.vfb-item-instructions ul li{list-style:disc;padding-bottom:0}.vfb-item-instructions ol,.vfb-item-instructions ol li{list-style:decimal;padding-bottom:0}.vfb-section-div{background-color:#d4d4d4;border-radius:3px;padding:10px;margin:10px 0;float:left;width:97%}.visual-form-builder .vfb-section-div h4{font-size:16px;border-bottom:1px solid #bababa;margin:0}.vfb-clear{clear:both;display:block;height:0;width:0;overflow:hidden;visibility:hidden}.vfb-conditional-hide{display:none}
1
+ form.visual-form-builder{position:relative;margin:20px 0;background:0;list-style:none;list-style-type:none;list-style-image:none;text-shadow:none;font-family:inherit}form.visual-form-builder li{margin:0;width:auto!important;background:0;list-style:none;list-style-type:none;list-style-image:none;clear:both}form.visual-form-builder li:before{content:none}form.visual-form-builder ul:after,form.visual-form-builder li:after,form.visual-form-builder li div:after{clear:both;content:'.';display:block;height:0;visibility:hidden}.visual-form-builder br{display:none}form.visual-form-builder .vfb-item-instructions br{display:inline}.visual-form-builder ul,.entry-content .visual-form-builder ul,.comment-content .visual-form-builder ul,.mu_register .visual-form-builder ul{margin:0 14px;padding:0;background:0;list-style:none;list-style-type:none;list-style-image:none;font-size:12px;line-height:inherit}.visual-form-builder ul li{margin:0;background:0;list-style:none;list-style-type:none;list-style-image:none}.visual-form-builder ul li:before{content:none}.visual-form-builder li,.entry-content .visual-form-builder li,.comment-content .visual-form-builder li,.mu_register .visual-form-builder li{clear:both;margin:0;padding:6px 1% 9px;width:64%;background:0;list-style:none;list-style-type:none;list-style-image:none}.visual-form-builder li:before,.entry-content .visual-form-builder li:before,.comment-content .visual-form-builder li:before,.mu_register .visual-form-builder li:before{content:none}.vfb-span,.visual-form-builder li div span.vfb-span,.visual-form-builder [class*="vfb-span"],span.vfb-full input,span.vfb-full input[type="text"].vfb-medium,span.vfb-full select{display:block;float:left;margin:0;width:100%}.visual-form-builder span.vfb-left{float:left;width:48%}.visual-form-builder span.vfb-right{float:right;width:48%}.visual-form-builder span.vfb-right input,.visual-form-builder span.vfb-right input[type="text"],.visual-form-builder span.vfb-right select,.visual-form-builder span.vfb-left input,.visual-form-builder span.vfb-left input[type="text"],.visual-form-builder span.vfb-left select{width:100%}.visual-form-builder span.vfb-time{float:left;margin:0 .3em 0 0}.rtl .visual-form-builder span.vfb-time{float:right;margin:0 0 0 .3em}.visual-form-builder li div label,.visual-form-builder li span label{margin:0;font-size:90%}.visual-form-builder fieldset{clear:both;margin:15px 0;padding:0;border:1px solid #d3d3d3;border-radius:3px;background-color:#eee}.visual-form-builder .vfb-legend{margin:5px 14px;padding:0 6px;border-bottom:1px solid #ccc;color:#900;font-size:inherit}.visual-form-builder .vfb-legend h3{margin:0;padding:0;font-size:20px;line-height:2.0em}.visual-form-builder label,label.vfb-desc{display:block;margin:0;padding:0 0 3px 0;color:#000}label.vfb-desc{font-weight:bold}.visual-form-builder.left-label .vfb-desc,.visual-form-builder.right-label .vfb-desc{float:left;margin:0 15px 0 0;width:20%}.visual-form-builder.right-label .vfb-desc{padding-top:2px;text-align:right}.visual-form-builder li div{margin:0;padding:0}.visual-form-builder.left-label li div,.visual-form-builder.right-label li div{float:left;width:65%}.visual-form-builder label.vfb-choice{margin:-16px 0 0 23px;padding:0 0 5px;width:88%;font-size:100%;line-height:150%}.rtl .visual-form-builder label.vfb-choice{margin:-16px 23px 0 0}.visual-form-builder label .vfb-required-asterisk{margin:0;padding:0;color:#bc1212;vertical-align:baseline;font-weight:bold}input.vfb-text,input[type="text"].vfb-text,input[type="tel"].vfb-text,input[type="email"].vfb-text,input[type="url"].vfb-text,textarea.vfb-textarea{padding:3px 0;border:1px solid #ddd;border-radius:3px;background:none repeat scroll 0 0 #fafafa;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border linear .2s,box-shadow linear .2s;-moz-transition:border linear .2s,box-shadow linear .2s;-o-transition:border linear .2s,box-shadow linear .2s;transition:border linear .2s,box-shadow linear .2s}input.vfb-text:focus,input[type="text"].vfb-text:focus,input[type="tel"].vfb-text:focus,input[type="email"].vfb-text:focus,input[type="url"].vfb-text:focus,textarea.vfb-textarea:focus{outline:0;outline:thin dotted \9;border-color:rgba(82,168,236,0.8);-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.6);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.6)}input.vfb-text.error:focus,input[type="text"].vfb-text.error:focus,input[type="tel"].vfb-text.error:focus,input[type="email"].vfb-text.error:focus,input[type="url"].vfb-text.error:focus,textarea.vfb-textarea.error:focus{border-color:rgba(238,83,83,0.8);-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(238,83,83,.6);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(238,83,83,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(238,83,83,.6)}input.vfb-text,input[type="text"].vfb-text,input[type="tel"].vfb-text,input[type="email"].vfb-text,input[type="url"].vfb-text,textarea.vfb-textarea,select.vfb-select{margin:0 0 5px 0;height:auto;color:#373737;font-size:100%;font-family:inherit;line-height:normal}select.vfb-select{padding:1px 0 0}input.vfb-small,input[type="text"].vfb-small,input[type="tel"].vfb-small,input[type="email"].vfb-small,input[type="url"].vfb-small,select.vfb-small{width:25%}input.vfb-medium,input[type="text"].vfb-medium,input[type="tel"].vfb-medium,input[type="email"].vfb-medium,input[type="url"].vfb-medium,select.vfb-medium{width:50%}input.vfb-large,input[type="text"].vfb-large,input[type="tel"].vfb-large,input[type="email"].vfb-large,input[type="url"].vfb-large,select.vfb-large,textarea.vfb-textarea{width:100%}textarea.vfb-medium{height:5.5em}textarea.vfb-medium{height:10em}textarea.vfb-large{height:20em}.vfb-submit,input[type="submit"].vfb-submit{font-size:1.1em}input.vfb-checkbox,input[type="checkbox"].vfb-checkbox,input.vfb-radio,input[type="radio"].vfb-radio{display:block;margin:4px 0 0;width:13px;height:13px;font-size:1.1em}input.vfb-other,input[type="text"].vfb-other{margin:0 0 8px 25px}.visual-form-builder li.vfb-two-column div span,.visual-form-builder li.vfb-three-column div span,.visual-form-builder li.vfb-auto-column div span{margin:0 5px 0 0;width:48%}.visual-form-builder li.vfb-three-column div span{width:30%}.visual-form-builder li.vfb-auto-column div span{width:auto}.visual-form-builder li.vfb-left-half,.visual-form-builder li.vfb-left-third,.visual-form-builder li.vfb-left-two-thirds{float:left;clear:left}.visual-form-builder li.vfb-right-half,.visual-form-builder li.vfb-right-third,.visual-form-builder li.vfb-right-two-thirds{float:right;clear:none}.visual-form-builder li.vfb-middle-third{float:left;clear:none;margin-left:2%}.visual-form-builder li.vfb-left-half,.visual-form-builder li.vfb-right-half{width:47%!important}.visual-form-builder li.vfb-left-third,.visual-form-builder li.vfb-middle-third,.visual-form-builder li.vfb-right-third{width:30%!important}.visual-form-builder li.vfb-left-two-thirds,.visual-form-builder li.vfb-right-two-thirds{width:64%!important}li.vfb-left-half .vfb-small,li.vfb-left-half .vfb-medium,li.vfb-left-half .vfb-large,li.vfb-right-half .vfb-small,li.vfb-right-half .vfb-medium,li.vfb-right-half .vfb-large,li.vfb-left-third .vfb-small,li.vfb-left-third .vfb-medium,li.vfb-left-third .vfb-large,li.vfb-middle-third .vfb-small,li.vfb-middle-third .vfb-medium,li.vfb-middle-third .vfb-large,li.vfb-right-third .vfb-small,li.vfb-right-third .vfb-medium,li.vfb-right-third .vfb-large,.visual-form-builder li.vfb-left-two-thirds .vfb-small,.visual-form-builder li.vfb-left-two-thirds .vfb-medium,.visual-form-builder li.vfb-left-two-thirds .vfb-large,.visual-form-builder li.vfb-right-two-thirds .vfb-small,.visual-form-builder li.vfb-right-two-thirds .vfb-medium,.visual-form-builder li.vfb-right-two-thirds .vfb-large{width:100%}label.error{color:red;font-weight:bold;font-size:90%}input.error,select.error,textarea.error{border:1px solid red}p#form_success,.vfb-form-success{color:green;font-weight:bold}#ui-datepicker-div{display:none;font-size:12px}.vfb-item-instructions{border-radius:3px;background-color:#e3e3e3}.vfb-item-instructions ul,.vfb-item-instructions ul li{padding-bottom:0;list-style:disc}.vfb-item-instructions ol,.vfb-item-instructions ol li{padding-bottom:0;list-style:decimal}.vfb-section-div{float:left;margin:10px 0;padding:10px;width:97%;border-radius:3px;background-color:#d4d4d4}.visual-form-builder .vfb-section-div h4{margin:0;padding:0;border-bottom:1px solid #bababa;font-size:16px;line-height:inherit}.vfb-clear{display:block;visibility:hidden;clear:both;overflow:hidden;width:0;height:0}.vfb-conditional-hide{display:none}
includes/admin-field-options.php CHANGED
@@ -52,15 +52,93 @@ foreach ( $fields as $field ) :
52
  </dl>
53
 
54
  <div id="form-item-settings-<?php echo $field->field_id; ?>" class="menu-item-settings field-type-<?php echo $field->field_type; ?>" style="display: none;">
55
- <?php if ( in_array( $field->field_type, array( 'fieldset', 'section', 'verification' ) ) ) : ?>
56
-
57
- <p class="description description-wide">
58
- <label for="edit-form-item-name-<?php echo $field->field_id; ?>"><?php echo ( in_array( $field->field_type, array( 'fieldset', 'verification' ) ) ) ? 'Legend' : 'Name'; ?>
59
- <span class="vfb-tooltip" rel="<?php esc_attr_e( 'For Fieldsets, a Legend is simply the name of that group. Use general terms that describe the fields included in this Fieldset.', 'visual-form-builder' ); ?>" title="<?php esc_attr_e( 'About Legend', 'visual-form-builder' ); ?>">(?)</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  <br />
61
  <input type="text" value="<?php echo stripslashes( esc_attr( $field->field_name ) ); ?>" name="field_name-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-name-<?php echo $field->field_id; ?>" maxlength="255" />
62
- </label>
63
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  <p class="description description-wide">
65
  <label for="edit-form-item-css-<?php echo $field->field_id; ?>">
66
  <?php _e( 'CSS Classes' , 'visual-form-builder'); ?>
@@ -69,320 +147,279 @@ foreach ( $fields as $field ) :
69
  <input type="text" value="<?php echo stripslashes( esc_attr( $field->field_css ) ); ?>" name="field_css-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-css-<?php echo $field->field_id; ?>" />
70
  </label>
71
  </p>
72
-
73
- <?php elseif( $field->field_type == 'instructions' ) : ?>
74
- <!-- Instructions -->
75
- <p class="description description-wide">
76
- <label for="edit-form-item-name-<?php echo $field->field_id; ?>">
77
- <?php _e( 'Name' , 'visual-form-builder'); ?>
78
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Name', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( "A field's name is the most visible and direct way to describe what that field is for.", 'visual-form-builder' ); ?>">(?)</span>
79
- <br />
80
- <input type="text" value="<?php echo stripslashes( esc_attr( $field->field_name ) ); ?>" name="field_name-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-name-<?php echo $field->field_id; ?>" maxlength="255" />
81
- </label>
82
- </p>
83
  <p class="description description-wide">
84
  <label for="edit-form-item-description-<?php echo $field->field_id; ?>">
85
- <?php _e( 'Description (HTML tags allowed)', 'visual-form-builder' ); ?>
86
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Instructions Description', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'The Instructions field allows for long form explanations, typically seen at the beginning of Fieldsets or Sections. HTML tags are allowed.', 'visual-form-builder' ); ?>">(?)</span>
87
  <br />
88
  <textarea name="field_description-<?php echo $field->field_id; ?>" class="widefat edit-menu-item-description" cols="20" rows="3" id="edit-form-item-description-<?php echo $field->field_id; ?>" /><?php echo stripslashes( $field->field_description ); ?></textarea>
89
  </label>
90
  </p>
91
 
92
- <?php else: ?>
93
-
94
- <!-- Name -->
95
- <p class="description description-wide">
96
- <label for="edit-form-item-name-<?php echo $field->field_id; ?>">
97
- <?php _e( 'Name' , 'visual-form-builder'); ?>
98
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Name', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( "A field's name is the most visible and direct way to describe what that field is for.", 'visual-form-builder' ); ?>">(?)</span>
99
- <br />
100
- <input type="text" value="<?php echo stripslashes( esc_attr( $field->field_name ) ); ?>" name="field_name-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-name-<?php echo $field->field_id; ?>" maxlength="255" />
101
- </label>
102
- </p>
103
- <?php if ( $field->field_type == 'submit' ) : ?>
104
- <!-- CSS Classes -->
105
- <p class="description description-wide">
106
- <label for="edit-form-item-css-<?php echo $field->field_id; ?>">
107
- <?php _e( 'CSS Classes' , 'visual-form-builder'); ?>
108
- <span class="vfb-tooltip" rel="<?php esc_attr_e( 'For each field, you can insert your own CSS class names which can be used in your own stylesheets.', 'visual-form-builder' ); ?>" title="<?php esc_attr_e( 'About CSS Classes', 'visual-form-builder' ); ?>">(?)</span>
109
- <br />
110
- <input type="text" value="<?php echo stripslashes( esc_attr( $field->field_css ) ); ?>" name="field_css-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-css-<?php echo $field->field_id; ?>" />
111
- </label>
112
- </p>
113
- <?php elseif ( $field->field_type !== 'submit' ) : ?>
114
- <!-- Description -->
115
  <p class="description description-wide">
116
- <label for="edit-form-item-description-<?php echo $field->field_id; ?>">
117
- <?php _e( 'Description' , 'visual-form-builder'); ?>
118
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Description', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'A description is an optional piece of text that further explains the meaning of this field. Descriptions are displayed below the field. HTML tags are allowed.', 'visual-form-builder' ); ?>">(?)</span>
119
- <br />
120
- <textarea name="field_description-<?php echo $field->field_id; ?>" class="widefat edit-menu-item-description" cols="20" rows="3" id="edit-form-item-description-<?php echo $field->field_id; ?>" /><?php echo stripslashes( $field->field_description ); ?></textarea>
121
- </label>
122
- </p>
123
-
124
  <?php
125
- // Display the Options input only for radio, checkbox, and select fields
126
- if ( in_array( $field->field_type, array( 'radio', 'checkbox', 'select' ) ) ) : ?>
127
- <!-- Options -->
128
- <p class="description description-wide">
129
- <?php _e( 'Options' , 'visual-form-builder'); ?>
130
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Options', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'This property allows you to set predefined options to be selected by the user. Use the plus and minus buttons to add and delete options. At least one option must exist.', 'visual-form-builder' ); ?>">(?)</span>
131
- <br />
132
- <?php
133
- // If the options field isn't empty, unserialize and build array
134
- if ( !empty( $field->field_options ) ) {
135
- if ( is_serialized( $field->field_options ) )
136
- $opts_vals = ( is_array( unserialize( $field->field_options ) ) ) ? unserialize( $field->field_options ) : explode( ',', unserialize( $field->field_options ) );
137
- }
138
- // Otherwise, present some default options
139
- else
140
- $opts_vals = array( 'Option 1', 'Option 2', 'Option 3' );
141
-
142
- // Basic count to keep track of multiple options
143
- $count = 1;
144
  ?>
145
- <div class="vfb-cloned-options">
146
- <?php foreach ( $opts_vals as $options ) : ?>
147
- <div id="clone-<?php echo $field->field_id . '-' . $count; ?>" class="option">
148
- <label for="edit-form-item-options-<?php echo $field->field_id . "-$count"; ?>" class="clonedOption">
149
- <input type="radio" value="<?php echo esc_attr( $count ); ?>" name="field_default-<?php echo $field->field_id; ?>" <?php checked( $field->field_default, $count ); ?> />
150
- <input type="text" value="<?php echo stripslashes( esc_attr( $options ) ); ?>" name="field_options-<?php echo $field->field_id; ?>[]" class="widefat" id="edit-form-item-options-<?php echo $field->field_id . "-$count"; ?>" />
151
- </label>
152
-
153
- <a href="#" class="deleteOption vfb-interface-icon vfb-interface-minus" title="Delete Option">
154
- <?php _e( 'Delete', 'visual-form-builder' ); ?>
155
- </a>
156
- <span class="vfb-interface-icon vfb-interface-sort" title="<?php esc_attr_e( 'Drag and Drop to Sort Options', 'visual-form-builder-pro' ); ?>"></span>
157
- </div>
158
- <?php
159
- $count++;
160
- endforeach;
161
- ?>
162
 
163
- </div> <!-- .vfb-cloned-options -->
164
- <div class="clear"></div>
165
- <div class="vfb-add-options-group">
166
- <a href="#" class="vfb-button vfb-add-option" title="Add Option">
167
- <?php _e( 'Add Option', 'visual-form-builder' ); ?>
168
- <span class="vfb-interface-icon vfb-interface-plus"></span>
169
- </a>
170
- </div>
171
- </p>
172
  <?php
173
- // Unset the options for any following radio, checkboxes, or selects
174
- unset( $opts_vals );
175
- endif;
176
  ?>
177
 
178
- <?php if ( in_array( $field->field_type, array( 'file-upload' ) ) ) : ?>
179
- <!-- File Upload Accepts -->
180
- <p class="description description-wide">
181
- <?php
182
- $opts_vals = array( '' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
 
184
- // If the options field isn't empty, unserialize and build array
185
- if ( !empty( $field->field_options ) ) {
186
- if ( is_serialized( $field->field_options ) )
187
- $opts_vals = ( is_array( unserialize( $field->field_options ) ) ) ? unserialize( $field->field_options ) : unserialize( $field->field_options );
188
- }
189
 
190
- // Loop through the options
191
- foreach ( $opts_vals as $options ) {
192
- ?>
193
- <label for="edit-form-item-options-<?php echo $field->field_id; ?>">
194
- <?php _e( 'Accepted File Extensions' , 'visual-form-builder'); ?>
195
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Accepted File Extensions', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Control the types of files allowed. Enter extensions without periods and separate multiples using the pipe character ( | ).', 'visual-form-builder' ); ?>">(?)</span>
196
- <br />
197
- <input type="text" value="<?php echo stripslashes( esc_attr( $options ) ); ?>" name="field_options-<?php echo $field->field_id; ?>[]" class="widefat" id="edit-form-item-options-<?php echo $field->field_id; ?>" />
198
- </label>
199
- </p>
200
- <?php
201
- }
202
- // Unset the options for any following radio, checkboxes, or selects
203
- unset( $opts_vals );
204
- endif;
205
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
 
207
- <?php if ( in_array( $field->field_type, array( 'date' ) ) ) : ?>
208
- <!-- Date Format -->
209
- <p class="description description-wide">
210
- <?php
211
- $opts_vals = maybe_unserialize( $field->field_options );
212
- $dateFormat = ( isset( $opts_vals['dateFormat'] ) ) ? $opts_vals['dateFormat'] : 'mm/dd/yy';
213
- ?>
214
- <label for="edit-form-item-date-dateFormat-<?php echo $field->field_id; ?>">
215
- <?php _e( 'Date Format', 'visual-form-builder' ); ?>
216
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Date Format', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Set the date format for each date picker.', 'visual-form-builder' ); ?>">(?)</span>
217
- <br />
218
- <input type="text" value="<?php echo esc_attr( $dateFormat ); ?>" name="field_options-<?php echo $field->field_id; ?>[dateFormat]" class="widefat" id="edit-form-item-date-dateFormat-<?php echo $field->field_id; ?>" />
219
- </label>
220
- </p>
221
- <?php
222
- // Unset the options for any following radio, checkboxes, or selects
223
- unset( $opts_vals );
224
- endif;
225
- ?>
226
- <!-- Validation -->
227
- <p class="description description-thin">
228
- <label for="edit-form-item-validation">
229
- <?php _e( 'Validation' , 'visual-form-builder'); ?>
230
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Validation', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Ensures user-entered data is formatted properly. For more information on Validation, refer to the Help tab at the top of this page.', 'visual-form-builder' ); ?>">(?)</span>
231
- <br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
 
233
- <?php if ( in_array( $field->field_type , array( 'text', 'time', 'number' ) ) ) : ?>
234
- <select name="field_validation-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-validation-<?php echo $field->field_id; ?>">
235
- <?php if ( $field->field_type == 'time' ) : ?>
236
- <option value="time-12" <?php selected( $field->field_validation, 'time-12' ); ?>><?php _e( '12 Hour Format' , 'visual-form-builder'); ?></option>
237
- <option value="time-24" <?php selected( $field->field_validation, 'time-24' ); ?>><?php _e( '24 Hour Format' , 'visual-form-builder'); ?></option>
238
- <?php elseif ( in_array( $field->field_type, array( 'number' ) ) ) : ?>
239
- <option value="number" <?php selected( $field->field_validation, 'number' ); ?>><?php _e( 'Number' , 'visual-form-builder'); ?></option>
240
- <option value="digits" <?php selected( $field->field_validation, 'digits' ); ?>><?php _e( 'Digits' , 'visual-form-builder'); ?></option>
241
- <?php else : ?>
242
- <option value="" <?php selected( $field->field_validation, '' ); ?>><?php _e( 'None' , 'visual-form-builder'); ?></option>
243
- <option value="email" <?php selected( $field->field_validation, 'email' ); ?>><?php _e( 'Email' , 'visual-form-builder'); ?></option>
244
- <option value="url" <?php selected( $field->field_validation, 'url' ); ?>><?php _e( 'URL' , 'visual-form-builder'); ?></option>
245
- <option value="date" <?php selected( $field->field_validation, 'date' ); ?>><?php _e( 'Date' , 'visual-form-builder'); ?></option>
246
- <option value="number" <?php selected( $field->field_validation, 'number' ); ?>><?php _e( 'Number' , 'visual-form-builder'); ?></option>
247
- <option value="digits" <?php selected( $field->field_validation, 'digits' ); ?>><?php _e( 'Digits' , 'visual-form-builder'); ?></option>
248
- <option value="phone" <?php selected( $field->field_validation, 'phone' ); ?>><?php _e( 'Phone' , 'visual-form-builder'); ?></option>
249
- <?php endif; ?>
250
- </select>
251
- <?php else :
252
- $field_validation = '';
253
-
254
- switch ( $field->field_type ) {
255
- case 'email' :
256
- case 'url' :
257
- case 'phone' :
258
- $field_validation = $field->field_type;
259
- break;
260
-
261
- case 'currency' :
262
- $field_validation = 'number';
263
- break;
264
-
265
- case 'number' :
266
- $field_validation = 'digits';
267
- break;
268
- }
269
-
270
- ?>
271
- <input type="text" class="widefat" name="field_validation-<?php echo $field->field_id; ?>" value="<?php echo $field_validation; ?>" readonly="readonly" />
272
- <?php endif; ?>
273
 
274
- </label>
275
- </p>
 
 
 
 
 
 
 
 
 
 
276
 
277
- <!-- Required -->
278
- <p class="field-link-target description description-thin">
279
- <label for="edit-form-item-required">
280
- <?php _e( 'Required' , 'visual-form-builder'); ?>
281
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Required', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Requires the field to be completed before the form is submitted. By default, all fields are set to No.', 'visual-form-builder' ); ?>">(?)</span>
 
282
  <br />
283
- <select name="field_required-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-required-<?php echo $field->field_id; ?>">
284
- <option value="no" <?php selected( $field->field_required, 'no' ); ?>><?php _e( 'No' , 'visual-form-builder'); ?></option>
285
- <option value="yes" <?php selected( $field->field_required, 'yes' ); ?>><?php _e( 'Yes' , 'visual-form-builder'); ?></option>
 
286
  </select>
287
  </label>
288
  </p>
289
 
290
- <?php if ( !in_array( $field->field_type, array( 'radio', 'checkbox', 'time' ) ) ) : ?>
291
- <!-- Size -->
292
- <p class="description description-thin">
293
- <label for="edit-form-item-size">
294
- <?php _e( 'Size' , 'visual-form-builder'); ?>
295
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Size', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Control the size of the field. By default, all fields are set to Medium.', 'visual-form-builder' ); ?>">(?)</span>
296
- <br />
297
- <select name="field_size-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-size-<?php echo $field->field_id; ?>">
298
- <option value="small" <?php selected( $field->field_size, 'small' ); ?>><?php _e( 'Small' , 'visual-form-builder'); ?></option>
299
- <option value="medium" <?php selected( $field->field_size, 'medium' ); ?>><?php _e( 'Medium' , 'visual-form-builder'); ?></option>
300
- <option value="large" <?php selected( $field->field_size, 'large' ); ?>><?php _e( 'Large' , 'visual-form-builder'); ?></option>
301
- </select>
302
- </label>
303
- </p>
304
-
305
- <?php elseif ( in_array( $field->field_type, array( 'radio', 'checkbox', 'time' ) ) ) : ?>
306
- <!-- Options Layout -->
307
- <p class="description description-thin">
308
- <label for="edit-form-item-size">
309
- <?php _e( 'Options Layout' , 'visual-form-builder'); ?>
310
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Options Layout', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Control the layout of radio buttons or checkboxes. By default, options are arranged in One Column.', 'visual-form-builder' ); ?>">(?)</span>
311
- <br />
312
- <select name="field_size-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-size-<?php echo $field->field_id; ?>"<?php echo ( $field->field_type == 'time' ) ? ' disabled="disabled"' : ''; ?>>
313
- <option value="" <?php selected( $field->field_size, '' ); ?>><?php _e( 'One Column' , 'visual-form-builder'); ?></option>
314
- <option value="two-column" <?php selected( $field->field_size, 'two-column' ); ?>><?php _e( 'Two Columns' , 'visual-form-builder'); ?></option>
315
- <option value="three-column" <?php selected( $field->field_size, 'three-column' ); ?>><?php _e( 'Three Columns' , 'visual-form-builder'); ?></option>
316
- <option value="auto-column" <?php selected( $field->field_size, 'auto-column' ); ?>><?php _e( 'Auto Width' , 'visual-form-builder'); ?></option>
317
- </select>
318
- </label>
319
- </p>
320
-
321
- <?php endif; ?>
322
- <!-- Field Layout -->
323
- <p class="description description-thin">
324
- <label for="edit-form-item-layout">
325
- <?php _e( 'Field Layout' , 'visual-form-builder'); ?>
326
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Field Layout', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Used to create advanced layouts. Align fields side by side in various configurations.', 'visual-form-builder' ); ?>">(?)</span>
327
- <br />
328
- <select name="field_layout-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-layout-<?php echo $field->field_id; ?>">
329
-
330
- <option value="" <?php selected( $field->field_layout, '' ); ?>><?php _e( 'Default' , 'visual-form-builder'); ?></option>
331
- <optgroup label="------------">
332
- <option value="left-half" <?php selected( $field->field_layout, 'left-half' ); ?>><?php _e( 'Left Half' , 'visual-form-builder'); ?></option>
333
- <option value="right-half" <?php selected( $field->field_layout, 'right-half' ); ?>><?php _e( 'Right Half' , 'visual-form-builder'); ?></option>
334
- </optgroup>
335
- <optgroup label="------------">
336
- <option value="left-third" <?php selected( $field->field_layout, 'left-third' ); ?>><?php _e( 'Left Third' , 'visual-form-builder'); ?></option>
337
- <option value="middle-third" <?php selected( $field->field_layout, 'middle-third' ); ?>><?php _e( 'Middle Third' , 'visual-form-builder'); ?></option>
338
- <option value="right-third" <?php selected( $field->field_layout, 'right-third' ); ?>><?php _e( 'Right Third' , 'visual-form-builder'); ?></option>
339
- </optgroup>
340
- <optgroup label="------------">
341
- <option value="left-two-thirds" <?php selected( $field->field_layout, 'left-two-thirds' ); ?>><?php _e( 'Left Two Thirds' , 'visual-form-builder'); ?></option>
342
- <option value="right-two-thirds" <?php selected( $field->field_layout, 'right-two-thirds' ); ?>><?php _e( 'Right Two Thirds' , 'visual-form-builder'); ?></option>
343
- </optgroup>
344
- </select>
345
- </label>
346
- </p>
347
- <?php if ( !in_array( $field->field_type, array( 'radio', 'select', 'checkbox', 'time', 'address' ) ) ) : ?>
348
- <!-- Default Value -->
349
- <p class="description description-wide">
350
- <label for="edit-form-item-default-<?php echo $field->field_id; ?>">
351
- <?php _e( 'Default Value' , 'visual-form-builder'); ?>
352
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Default Value', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Set a default value that will be inserted automatically.', 'visual-form-builder' ); ?>">(?)</span>
353
- <br />
354
- <input type="text" value="<?php echo stripslashes( esc_attr( $field->field_default ) ); ?>" name="field_default-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-default-<?php echo $field->field_id; ?>" maxlength="255" />
355
- </label>
356
- </p>
357
- <?php elseif( in_array( $field->field_type, array( 'address' ) ) ) : ?>
358
- <!-- Default Country -->
359
- <p class="description description-wide">
360
- <label for="edit-form-item-default-<?php echo $field->field_id; ?>">
361
- <?php _e( 'Default Country' , 'visual-form-builder'); ?>
362
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Default Country', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Select the country you would like to be displayed by default.', 'visual-form-builder' ); ?>">(?)</span>
363
- <br />
364
- <select name="field_default-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-default-<?php echo $field->field_id; ?>">
365
- <?php
366
- foreach ( $this->countries as $country ) {
367
- echo '<option value="' . $country . '" ' . selected( $field->field_default, $country, 0 ) . '>' . $country . '</option>';
368
- }
369
- ?>
370
  </select>
371
- </label>
372
  </p>
373
- <?php endif; ?>
374
- <!-- CSS Classes -->
375
- <p class="description description-wide">
376
- <label for="edit-form-item-css-<?php echo $field->field_id; ?>">
377
- <?php _e( 'CSS Classes' , 'visual-form-builder'); ?>
378
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About CSS Classes', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'For each field, you can insert your own CSS class names which can be used in your own stylesheets.', 'visual-form-builder' ); ?>">(?)</span>
 
379
  <br />
380
- <input type="text" value="<?php echo stripslashes( esc_attr( $field->field_css ) ); ?>" name="field_css-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-css-<?php echo $field->field_id; ?>" maxlength="255" />
381
- </label>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
382
  </p>
383
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
384
  <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
385
  <?php endif; ?>
 
386
 
387
  <?php if ( !in_array( $field->field_type, array( 'verification', 'secret', 'submit' ) ) ) : ?>
388
  <!-- Delete link -->
52
  </dl>
53
 
54
  <div id="form-item-settings-<?php echo $field->field_id; ?>" class="menu-item-settings field-type-<?php echo $field->field_type; ?>" style="display: none;">
55
+ <?php if ( in_array( $field->field_type, array( 'fieldset', 'section', 'verification' ) ) ) : ?>
56
+
57
+ <p class="description description-wide">
58
+ <label for="edit-form-item-name-<?php echo $field->field_id; ?>"><?php echo ( in_array( $field->field_type, array( 'fieldset', 'verification' ) ) ) ? 'Legend' : 'Name'; ?>
59
+ <span class="vfb-tooltip" rel="<?php esc_attr_e( 'For Fieldsets, a Legend is simply the name of that group. Use general terms that describe the fields included in this Fieldset.', 'visual-form-builder' ); ?>" title="<?php esc_attr_e( 'About Legend', 'visual-form-builder' ); ?>">(?)</span>
60
+ <br />
61
+ <input type="text" value="<?php echo stripslashes( esc_attr( $field->field_name ) ); ?>" name="field_name-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-name-<?php echo $field->field_id; ?>" maxlength="255" />
62
+ </label>
63
+ </p>
64
+ <p class="description description-wide">
65
+ <label for="edit-form-item-css-<?php echo $field->field_id; ?>">
66
+ <?php _e( 'CSS Classes' , 'visual-form-builder'); ?>
67
+ <span class="vfb-tooltip" rel="<?php esc_attr_e( 'For each field, you can insert your own CSS class names which can be used in your own stylesheets.', 'visual-form-builder' ); ?>" title="<?php esc_attr_e( 'About CSS Classes', 'visual-form-builder' ); ?>">(?)</span>
68
+ <br />
69
+ <input type="text" value="<?php echo stripslashes( esc_attr( $field->field_css ) ); ?>" name="field_css-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-css-<?php echo $field->field_id; ?>" />
70
+ </label>
71
+ </p>
72
+
73
+ <?php elseif( $field->field_type == 'instructions' ) : ?>
74
+ <!-- Instructions -->
75
+ <p class="description description-wide">
76
+ <label for="edit-form-item-name-<?php echo $field->field_id; ?>">
77
+ <?php _e( 'Name' , 'visual-form-builder'); ?>
78
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Name', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( "A field's name is the most visible and direct way to describe what that field is for.", 'visual-form-builder' ); ?>">(?)</span>
79
  <br />
80
  <input type="text" value="<?php echo stripslashes( esc_attr( $field->field_name ) ); ?>" name="field_name-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-name-<?php echo $field->field_id; ?>" maxlength="255" />
81
+ </label>
82
+ </p>
83
+ <!-- Description -->
84
+ <p class="description description-wide">
85
+ <label for="edit-form-item-description-<?php echo $field->field_id; ?>">
86
+ <?php _e( 'Description (HTML tags allowed)', 'visual-form-builder' ); ?>
87
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Instructions Description', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'The Instructions field allows for long form explanations, typically seen at the beginning of Fieldsets or Sections. HTML tags are allowed.', 'visual-form-builder' ); ?>">(?)</span>
88
+ <br />
89
+ <textarea name="field_description-<?php echo $field->field_id; ?>" class="widefat edit-menu-item-description" cols="20" rows="3" id="edit-form-item-description-<?php echo $field->field_id; ?>" /><?php echo stripslashes( $field->field_description ); ?></textarea>
90
+ </label>
91
+ </p>
92
+ <!-- CSS Classes -->
93
+ <p class="description description-thin">
94
+ <label for="edit-form-item-css-<?php echo $field->field_id; ?>">
95
+ <?php _e( 'CSS Classes' , 'visual-form-builder-pro'); ?>
96
+ <span class="vfb-tooltip" rel="<?php esc_attr_e( 'For each field, you can insert your own CSS class names which can be used in your own stylesheets.', 'visual-form-builder-pro' ); ?>" title="<?php esc_attr_e( 'About CSS Classes', 'visual-form-builder-pro' ); ?>">(?)</span>
97
+ <br />
98
+ <input type="text" value="<?php echo stripslashes( esc_attr( $field->field_css ) ); ?>" name="field_css-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-css-<?php echo $field->field_id; ?>" />
99
+ </label>
100
+ </p>
101
+
102
+ <!-- Field Layout -->
103
+ <p class="description description-thin">
104
+ <label for="edit-form-item-layout">
105
+ <?php _e( 'Field Layout' , 'visual-form-builder-pro'); ?>
106
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Field Layout', 'visual-form-builder-pro' ); ?>" rel="<?php esc_attr_e( 'Used to create advanced layouts. Align fields side by side in various configurations.', 'visual-form-builder-pro' ); ?>">(?)</span>
107
+ <br />
108
+ <select name="field_layout-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-layout-<?php echo $field->field_id; ?>">
109
+
110
+ <option value="" <?php selected( $field->field_layout, '' ); ?>><?php _e( 'Default' , 'visual-form-builder-pro'); ?></option>
111
+ <optgroup label="------------">
112
+ <option value="left-half" <?php selected( $field->field_layout, 'left-half' ); ?>><?php _e( 'Left Half' , 'visual-form-builder-pro'); ?></option>
113
+ <option value="right-half" <?php selected( $field->field_layout, 'right-half' ); ?>><?php _e( 'Right Half' , 'visual-form-builder-pro'); ?></option>
114
+ </optgroup>
115
+ <optgroup label="------------">
116
+ <option value="left-third" <?php selected( $field->field_layout, 'left-third' ); ?>><?php _e( 'Left Third' , 'visual-form-builder-pro'); ?></option>
117
+ <option value="middle-third" <?php selected( $field->field_layout, 'middle-third' ); ?>><?php _e( 'Middle Third' , 'visual-form-builder-pro'); ?></option>
118
+ <option value="right-third" <?php selected( $field->field_layout, 'right-third' ); ?>><?php _e( 'Right Third' , 'visual-form-builder-pro'); ?></option>
119
+ </optgroup>
120
+ <optgroup label="------------">
121
+ <option value="left-two-thirds" <?php selected( $field->field_layout, 'left-two-thirds' ); ?>><?php _e( 'Left Two Thirds' , 'visual-form-builder-pro'); ?></option>
122
+ <option value="right-two-thirds" <?php selected( $field->field_layout, 'right-two-thirds' ); ?>><?php _e( 'Right Two Thirds' , 'visual-form-builder-pro'); ?></option>
123
+ </optgroup>
124
+ <?php apply_filters( 'vfb_admin_field_layout', $field->field_layout ); ?>
125
+ </select>
126
+ </label>
127
+ </p>
128
+
129
+ <?php else: ?>
130
+
131
+ <!-- Name -->
132
+ <p class="description description-wide">
133
+ <label for="edit-form-item-name-<?php echo $field->field_id; ?>">
134
+ <?php _e( 'Name' , 'visual-form-builder'); ?>
135
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Name', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( "A field's name is the most visible and direct way to describe what that field is for.", 'visual-form-builder' ); ?>">(?)</span>
136
+ <br />
137
+ <input type="text" value="<?php echo stripslashes( esc_attr( $field->field_name ) ); ?>" name="field_name-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-name-<?php echo $field->field_id; ?>" maxlength="255" />
138
+ </label>
139
+ </p>
140
+ <?php if ( $field->field_type == 'submit' ) : ?>
141
+ <!-- CSS Classes -->
142
  <p class="description description-wide">
143
  <label for="edit-form-item-css-<?php echo $field->field_id; ?>">
144
  <?php _e( 'CSS Classes' , 'visual-form-builder'); ?>
147
  <input type="text" value="<?php echo stripslashes( esc_attr( $field->field_css ) ); ?>" name="field_css-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-css-<?php echo $field->field_id; ?>" />
148
  </label>
149
  </p>
150
+ <?php elseif ( $field->field_type !== 'submit' ) : ?>
151
+ <!-- Description -->
 
 
 
 
 
 
 
 
 
152
  <p class="description description-wide">
153
  <label for="edit-form-item-description-<?php echo $field->field_id; ?>">
154
+ <?php _e( 'Description' , 'visual-form-builder'); ?>
155
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Description', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'A description is an optional piece of text that further explains the meaning of this field. Descriptions are displayed below the field. HTML tags are allowed.', 'visual-form-builder' ); ?>">(?)</span>
156
  <br />
157
  <textarea name="field_description-<?php echo $field->field_id; ?>" class="widefat edit-menu-item-description" cols="20" rows="3" id="edit-form-item-description-<?php echo $field->field_id; ?>" /><?php echo stripslashes( $field->field_description ); ?></textarea>
158
  </label>
159
  </p>
160
 
161
+ <?php
162
+ // Display the Options input only for radio, checkbox, and select fields
163
+ if ( in_array( $field->field_type, array( 'radio', 'checkbox', 'select' ) ) ) : ?>
164
+ <!-- Options -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  <p class="description description-wide">
166
+ <?php _e( 'Options' , 'visual-form-builder'); ?>
167
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Options', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'This property allows you to set predefined options to be selected by the user. Use the plus and minus buttons to add and delete options. At least one option must exist.', 'visual-form-builder' ); ?>">(?)</span>
168
+ <br />
 
 
 
 
 
169
  <?php
170
+ // If the options field isn't empty, unserialize and build array
171
+ if ( !empty( $field->field_options ) ) {
172
+ if ( is_serialized( $field->field_options ) )
173
+ $opts_vals = ( is_array( unserialize( $field->field_options ) ) ) ? unserialize( $field->field_options ) : explode( ',', unserialize( $field->field_options ) );
174
+ }
175
+ // Otherwise, present some default options
176
+ else
177
+ $opts_vals = array( 'Option 1', 'Option 2', 'Option 3' );
178
+
179
+ // Basic count to keep track of multiple options
180
+ $count = 1;
 
 
 
 
 
 
 
 
181
  ?>
182
+ <div class="vfb-cloned-options">
183
+ <?php foreach ( $opts_vals as $options ) : ?>
184
+ <div id="clone-<?php echo $field->field_id . '-' . $count; ?>" class="option">
185
+ <label for="edit-form-item-options-<?php echo $field->field_id . "-$count"; ?>" class="clonedOption">
186
+ <input type="radio" value="<?php echo esc_attr( $count ); ?>" name="field_default-<?php echo $field->field_id; ?>" <?php checked( $field->field_default, $count ); ?> />
187
+ <input type="text" value="<?php echo stripslashes( esc_attr( $options ) ); ?>" name="field_options-<?php echo $field->field_id; ?>[]" class="widefat" id="edit-form-item-options-<?php echo $field->field_id . "-$count"; ?>" />
188
+ </label>
 
 
 
 
 
 
 
 
 
 
189
 
190
+ <a href="#" class="deleteOption vfb-interface-icon vfb-interface-minus" title="Delete Option">
191
+ <?php _e( 'Delete', 'visual-form-builder' ); ?>
192
+ </a>
193
+ <span class="vfb-interface-icon vfb-interface-sort" title="<?php esc_attr_e( 'Drag and Drop to Sort Options', 'visual-form-builder-pro' ); ?>"></span>
194
+ </div>
 
 
 
 
195
  <?php
196
+ $count++;
197
+ endforeach;
 
198
  ?>
199
 
200
+ </div> <!-- .vfb-cloned-options -->
201
+ <div class="clear"></div>
202
+ <div class="vfb-add-options-group">
203
+ <a href="#" class="vfb-button vfb-add-option" title="Add Option">
204
+ <?php _e( 'Add Option', 'visual-form-builder' ); ?>
205
+ <span class="vfb-interface-icon vfb-interface-plus"></span>
206
+ </a>
207
+ </div>
208
+ </p>
209
+ <?php
210
+ // Unset the options for any following radio, checkboxes, or selects
211
+ unset( $opts_vals );
212
+ endif;
213
+ ?>
214
+
215
+ <?php if ( in_array( $field->field_type, array( 'file-upload' ) ) ) : ?>
216
+ <!-- File Upload Accepts -->
217
+ <p class="description description-wide">
218
+ <?php
219
+ $opts_vals = array( '' );
220
 
221
+ // If the options field isn't empty, unserialize and build array
222
+ if ( !empty( $field->field_options ) ) {
223
+ if ( is_serialized( $field->field_options ) )
224
+ $opts_vals = ( is_array( unserialize( $field->field_options ) ) ) ? unserialize( $field->field_options ) : unserialize( $field->field_options );
225
+ }
226
 
227
+ // Loop through the options
228
+ foreach ( $opts_vals as $options ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
229
  ?>
230
+ <label for="edit-form-item-options-<?php echo $field->field_id; ?>">
231
+ <?php _e( 'Accepted File Extensions' , 'visual-form-builder'); ?>
232
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Accepted File Extensions', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Control the types of files allowed. Enter extensions without periods and separate multiples using the pipe character ( | ).', 'visual-form-builder' ); ?>">(?)</span>
233
+ <br />
234
+ <input type="text" value="<?php echo stripslashes( esc_attr( $options ) ); ?>" name="field_options-<?php echo $field->field_id; ?>[]" class="widefat" id="edit-form-item-options-<?php echo $field->field_id; ?>" />
235
+ </label>
236
+ </p>
237
+ <?php
238
+ }
239
+ // Unset the options for any following radio, checkboxes, or selects
240
+ unset( $opts_vals );
241
+ endif;
242
+ ?>
243
+
244
+ <?php if ( in_array( $field->field_type, array( 'date' ) ) ) : ?>
245
+ <!-- Date Format -->
246
+ <p class="description description-wide">
247
+ <?php
248
+ $opts_vals = maybe_unserialize( $field->field_options );
249
+ $dateFormat = ( isset( $opts_vals['dateFormat'] ) ) ? $opts_vals['dateFormat'] : 'mm/dd/yy';
250
+ ?>
251
+ <label for="edit-form-item-date-dateFormat-<?php echo $field->field_id; ?>">
252
+ <?php _e( 'Date Format', 'visual-form-builder' ); ?>
253
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Date Format', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Set the date format for each date picker.', 'visual-form-builder' ); ?>">(?)</span>
254
+ <br />
255
+ <input type="text" value="<?php echo esc_attr( $dateFormat ); ?>" name="field_options-<?php echo $field->field_id; ?>[dateFormat]" class="widefat" id="edit-form-item-date-dateFormat-<?php echo $field->field_id; ?>" />
256
+ </label>
257
+ </p>
258
+ <?php
259
+ // Unset the options for any following radio, checkboxes, or selects
260
+ unset( $opts_vals );
261
+ endif;
262
+ ?>
263
+ <!-- Validation -->
264
+ <p class="description description-thin">
265
+ <label for="edit-form-item-validation">
266
+ <?php _e( 'Validation' , 'visual-form-builder'); ?>
267
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Validation', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Ensures user-entered data is formatted properly. For more information on Validation, refer to the Help tab at the top of this page.', 'visual-form-builder' ); ?>">(?)</span>
268
+ <br />
269
 
270
+ <?php if ( in_array( $field->field_type , array( 'text', 'time', 'number' ) ) ) : ?>
271
+ <select name="field_validation-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-validation-<?php echo $field->field_id; ?>">
272
+ <?php if ( $field->field_type == 'time' ) : ?>
273
+ <option value="time-12" <?php selected( $field->field_validation, 'time-12' ); ?>><?php _e( '12 Hour Format' , 'visual-form-builder'); ?></option>
274
+ <option value="time-24" <?php selected( $field->field_validation, 'time-24' ); ?>><?php _e( '24 Hour Format' , 'visual-form-builder'); ?></option>
275
+ <?php elseif ( in_array( $field->field_type, array( 'number' ) ) ) : ?>
276
+ <option value="number" <?php selected( $field->field_validation, 'number' ); ?>><?php _e( 'Number' , 'visual-form-builder'); ?></option>
277
+ <option value="digits" <?php selected( $field->field_validation, 'digits' ); ?>><?php _e( 'Digits' , 'visual-form-builder'); ?></option>
278
+ <?php else : ?>
279
+ <option value="" <?php selected( $field->field_validation, '' ); ?>><?php _e( 'None' , 'visual-form-builder'); ?></option>
280
+ <option value="email" <?php selected( $field->field_validation, 'email' ); ?>><?php _e( 'Email' , 'visual-form-builder'); ?></option>
281
+ <option value="url" <?php selected( $field->field_validation, 'url' ); ?>><?php _e( 'URL' , 'visual-form-builder'); ?></option>
282
+ <option value="date" <?php selected( $field->field_validation, 'date' ); ?>><?php _e( 'Date' , 'visual-form-builder'); ?></option>
283
+ <option value="number" <?php selected( $field->field_validation, 'number' ); ?>><?php _e( 'Number' , 'visual-form-builder'); ?></option>
284
+ <option value="digits" <?php selected( $field->field_validation, 'digits' ); ?>><?php _e( 'Digits' , 'visual-form-builder'); ?></option>
285
+ <option value="phone" <?php selected( $field->field_validation, 'phone' ); ?>><?php _e( 'Phone' , 'visual-form-builder'); ?></option>
286
+ <?php endif; ?>
287
+ </select>
288
+ <?php else :
289
+ $field_validation = '';
290
+
291
+ switch ( $field->field_type ) {
292
+ case 'email' :
293
+ case 'url' :
294
+ case 'phone' :
295
+ $field_validation = $field->field_type;
296
+ break;
297
+
298
+ case 'currency' :
299
+ $field_validation = 'number';
300
+ break;
301
+
302
+ case 'number' :
303
+ $field_validation = 'digits';
304
+ break;
305
+ }
306
+
307
+ ?>
308
+ <input type="text" class="widefat" name="field_validation-<?php echo $field->field_id; ?>" value="<?php echo $field_validation; ?>" readonly="readonly" />
309
+ <?php endif; ?>
310
 
311
+ </label>
312
+ </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
 
314
+ <!-- Required -->
315
+ <p class="field-link-target description description-thin">
316
+ <label for="edit-form-item-required">
317
+ <?php _e( 'Required' , 'visual-form-builder'); ?>
318
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Required', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Requires the field to be completed before the form is submitted. By default, all fields are set to No.', 'visual-form-builder' ); ?>">(?)</span>
319
+ <br />
320
+ <select name="field_required-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-required-<?php echo $field->field_id; ?>">
321
+ <option value="no" <?php selected( $field->field_required, 'no' ); ?>><?php _e( 'No' , 'visual-form-builder'); ?></option>
322
+ <option value="yes" <?php selected( $field->field_required, 'yes' ); ?>><?php _e( 'Yes' , 'visual-form-builder'); ?></option>
323
+ </select>
324
+ </label>
325
+ </p>
326
 
327
+ <?php if ( !in_array( $field->field_type, array( 'radio', 'checkbox', 'time' ) ) ) : ?>
328
+ <!-- Size -->
329
+ <p class="description description-thin">
330
+ <label for="edit-form-item-size">
331
+ <?php _e( 'Size' , 'visual-form-builder'); ?>
332
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Size', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Control the size of the field. By default, all fields are set to Medium.', 'visual-form-builder' ); ?>">(?)</span>
333
  <br />
334
+ <select name="field_size-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-size-<?php echo $field->field_id; ?>">
335
+ <option value="small" <?php selected( $field->field_size, 'small' ); ?>><?php _e( 'Small' , 'visual-form-builder'); ?></option>
336
+ <option value="medium" <?php selected( $field->field_size, 'medium' ); ?>><?php _e( 'Medium' , 'visual-form-builder'); ?></option>
337
+ <option value="large" <?php selected( $field->field_size, 'large' ); ?>><?php _e( 'Large' , 'visual-form-builder'); ?></option>
338
  </select>
339
  </label>
340
  </p>
341
 
342
+ <?php elseif ( in_array( $field->field_type, array( 'radio', 'checkbox', 'time' ) ) ) : ?>
343
+ <!-- Options Layout -->
344
+ <p class="description description-thin">
345
+ <label for="edit-form-item-size">
346
+ <?php _e( 'Options Layout' , 'visual-form-builder'); ?>
347
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Options Layout', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Control the layout of radio buttons or checkboxes. By default, options are arranged in One Column.', 'visual-form-builder' ); ?>">(?)</span>
348
+ <br />
349
+ <select name="field_size-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-size-<?php echo $field->field_id; ?>"<?php echo ( $field->field_type == 'time' ) ? ' disabled="disabled"' : ''; ?>>
350
+ <option value="" <?php selected( $field->field_size, '' ); ?>><?php _e( 'One Column' , 'visual-form-builder'); ?></option>
351
+ <option value="two-column" <?php selected( $field->field_size, 'two-column' ); ?>><?php _e( 'Two Columns' , 'visual-form-builder'); ?></option>
352
+ <option value="three-column" <?php selected( $field->field_size, 'three-column' ); ?>><?php _e( 'Three Columns' , 'visual-form-builder'); ?></option>
353
+ <option value="auto-column" <?php selected( $field->field_size, 'auto-column' ); ?>><?php _e( 'Auto Width' , 'visual-form-builder'); ?></option>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354
  </select>
355
+ </label>
356
  </p>
357
+
358
+ <?php endif; ?>
359
+ <!-- Field Layout -->
360
+ <p class="description description-thin">
361
+ <label for="edit-form-item-layout">
362
+ <?php _e( 'Field Layout' , 'visual-form-builder'); ?>
363
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Field Layout', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Used to create advanced layouts. Align fields side by side in various configurations.', 'visual-form-builder' ); ?>">(?)</span>
364
  <br />
365
+ <select name="field_layout-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-layout-<?php echo $field->field_id; ?>">
366
+
367
+ <option value="" <?php selected( $field->field_layout, '' ); ?>><?php _e( 'Default' , 'visual-form-builder'); ?></option>
368
+ <optgroup label="------------">
369
+ <option value="left-half" <?php selected( $field->field_layout, 'left-half' ); ?>><?php _e( 'Left Half' , 'visual-form-builder'); ?></option>
370
+ <option value="right-half" <?php selected( $field->field_layout, 'right-half' ); ?>><?php _e( 'Right Half' , 'visual-form-builder'); ?></option>
371
+ </optgroup>
372
+ <optgroup label="------------">
373
+ <option value="left-third" <?php selected( $field->field_layout, 'left-third' ); ?>><?php _e( 'Left Third' , 'visual-form-builder'); ?></option>
374
+ <option value="middle-third" <?php selected( $field->field_layout, 'middle-third' ); ?>><?php _e( 'Middle Third' , 'visual-form-builder'); ?></option>
375
+ <option value="right-third" <?php selected( $field->field_layout, 'right-third' ); ?>><?php _e( 'Right Third' , 'visual-form-builder'); ?></option>
376
+ </optgroup>
377
+ <optgroup label="------------">
378
+ <option value="left-two-thirds" <?php selected( $field->field_layout, 'left-two-thirds' ); ?>><?php _e( 'Left Two Thirds' , 'visual-form-builder'); ?></option>
379
+ <option value="right-two-thirds" <?php selected( $field->field_layout, 'right-two-thirds' ); ?>><?php _e( 'Right Two Thirds' , 'visual-form-builder'); ?></option>
380
+ </optgroup>
381
+ </select>
382
+ </label>
383
  </p>
384
+ <?php if ( !in_array( $field->field_type, array( 'radio', 'select', 'checkbox', 'time', 'address' ) ) ) : ?>
385
+ <!-- Default Value -->
386
+ <p class="description description-wide">
387
+ <label for="edit-form-item-default-<?php echo $field->field_id; ?>">
388
+ <?php _e( 'Default Value' , 'visual-form-builder'); ?>
389
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Default Value', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Set a default value that will be inserted automatically.', 'visual-form-builder' ); ?>">(?)</span>
390
+ <br />
391
+ <input type="text" value="<?php echo stripslashes( esc_attr( $field->field_default ) ); ?>" name="field_default-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-default-<?php echo $field->field_id; ?>" maxlength="255" />
392
+ </label>
393
+ </p>
394
+ <?php elseif( in_array( $field->field_type, array( 'address' ) ) ) : ?>
395
+ <!-- Default Country -->
396
+ <p class="description description-wide">
397
+ <label for="edit-form-item-default-<?php echo $field->field_id; ?>">
398
+ <?php _e( 'Default Country' , 'visual-form-builder'); ?>
399
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Default Country', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Select the country you would like to be displayed by default.', 'visual-form-builder' ); ?>">(?)</span>
400
+ <br />
401
+ <select name="field_default-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-default-<?php echo $field->field_id; ?>">
402
+ <?php
403
+ foreach ( $this->countries as $country ) {
404
+ echo '<option value="' . $country . '" ' . selected( $field->field_default, $country, 0 ) . '>' . $country . '</option>';
405
+ }
406
+ ?>
407
+ </select>
408
+ </label>
409
+ </p>
410
  <?php endif; ?>
411
+ <!-- CSS Classes -->
412
+ <p class="description description-wide">
413
+ <label for="edit-form-item-css-<?php echo $field->field_id; ?>">
414
+ <?php _e( 'CSS Classes' , 'visual-form-builder'); ?>
415
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About CSS Classes', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'For each field, you can insert your own CSS class names which can be used in your own stylesheets.', 'visual-form-builder' ); ?>">(?)</span>
416
+ <br />
417
+ <input type="text" value="<?php echo stripslashes( esc_attr( $field->field_css ) ); ?>" name="field_css-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-css-<?php echo $field->field_id; ?>" maxlength="255" />
418
+ </label>
419
+ </p>
420
+
421
  <?php endif; ?>
422
+ <?php endif; ?>
423
 
424
  <?php if ( !in_array( $field->field_type, array( 'verification', 'secret', 'submit' ) ) ) : ?>
425
  <!-- Delete link -->
includes/class-export.php CHANGED
@@ -223,10 +223,6 @@ class VisualFormBuilder_Export {
223
 
224
  $content_type = 'text/csv';
225
 
226
- // Return nothing if no entries found
227
- if ( !$entries )
228
- return;
229
-
230
  header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' );
231
  header( 'Content-Description: File Transfer' );
232
  header( 'Content-Disposition: attachment; filename=' . $filename );
223
 
224
  $content_type = 'text/csv';
225
 
 
 
 
 
226
  header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' );
227
  header( 'Content-Description: File Transfer' );
228
  header( 'Content-Disposition: attachment; filename=' . $filename );
includes/email.php CHANGED
@@ -16,360 +16,372 @@ if ( true == $required && !empty( $secret_field ) ) :
16
  endif;
17
 
18
  // Basic security check before moving any further
19
- if ( isset( $_POST['vfb-submit'] ) ) :
 
20
 
21
- // Set submitted action to display success message
22
- $this->submitted = true;
23
 
24
- // Tells us which form to get from the database
25
- $form_id = absint( $_POST['form_id'] );
26
 
27
- $skip_referrer_check = apply_filters( 'vfb_skip_referrer_check', false, $form_id );
 
28
 
29
- // Test if referral URL has been set
30
- if ( !$referrer )
31
- wp_die( __( 'Security check: referal URL does not appear to be set.' , 'visual-form-builder'), '', array( 'back_link' => true ) );
32
 
33
- // Allow referrer check to be skipped
34
- if ( !$skip_referrer_check ) :
35
- // Test if the referral URL matches what sent from WordPress
36
- if ( $wp_get_referer )
37
- wp_die( __( 'Security check: referal does not match this site.' , 'visual-form-builder'), '', array( 'back_link' => true ) );
38
- endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
- // Test if it's a known SPAM bot
41
- if ( $this->isBot() )
42
- wp_die( __( 'Security check: looks like you are a SPAM bot. If you think this is an error, please email the site owner.' , 'visual-form-builder' ), '', array( 'back_link' => true ) );
43
-
44
- // Query to get all forms
45
- $order = sanitize_sql_orderby( 'form_id DESC' );
46
- $form = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->form_table_name WHERE form_id = %d ORDER BY $order", $form_id ) );
47
-
48
- $form_settings = (object) array(
49
- 'form_title' => stripslashes( html_entity_decode( $form->form_title, ENT_QUOTES, 'UTF-8' ) ),
50
- 'form_subject' => stripslashes( html_entity_decode( $form->form_email_subject, ENT_QUOTES, 'UTF-8' ) ),
51
- 'form_to' => ( is_array( unserialize( $form->form_email_to ) ) ) ? unserialize( $form->form_email_to ) : explode( ',', unserialize( $form->form_email_to ) ),
52
- 'form_from' => stripslashes( $form->form_email_from ),
53
- 'form_from_name' => stripslashes( $form->form_email_from_name ),
54
- 'form_notification_setting' => stripslashes( $form->form_notification_setting ),
55
- 'form_notification_email_name' => stripslashes( $form->form_notification_email_name ),
56
- 'form_notification_email_from' => stripslashes( $form->form_notification_email_from ),
57
- 'form_notification_subject' => stripslashes( html_entity_decode( $form->form_notification_subject, ENT_QUOTES, 'UTF-8' ) ),
58
- 'form_notification_message' => stripslashes( $form->form_notification_message ),
59
- 'form_notification_entry' => stripslashes( $form->form_notification_entry )
60
- );
61
- // Allow the form settings to be filtered (ex: return $form_settings->'form_title' = 'Hello World';)
62
- $form_settings = (object) apply_filters_ref_array( 'vfb_email_form_settings', array( $form_settings, $form_id ) );
63
-
64
- // Sender name field ID
65
- $sender = $form->form_email_from_name_override;
66
-
67
- // Sender email field ID
68
- $email = $form->form_email_from_override;
69
-
70
- // Notifcation email field ID
71
- $notify = $form->form_notification_email;
72
-
73
- $reply_to_name = $form_settings->form_from_name;
74
- $reply_to_email = $form_settings->form_from;
75
-
76
- // Use field for sender name
77
- if ( !empty( $sender ) && isset( $_POST[ 'vfb-' . $sender ] ) ) {
78
- $form_settings->form_from_name = wp_kses_data( $_POST[ 'vfb-' . $sender ] );
79
- $reply_to_name = $form_settings->form_from_name;
80
- }
81
-
82
- // Use field for sender email
83
- if ( !empty( $email ) && isset( $_POST[ 'vfb-' . $email ] ) ) {
84
- $form_settings->form_from = sanitize_email( $_POST[ 'vfb-' . $email ] );
85
- $reply_to_email = $form_settings->form_from;
86
- }
87
-
88
- // Use field for copy email
89
- $copy_email = ( !empty( $notify ) ) ? sanitize_email( $_POST[ 'vfb-' . $notify ] ) : '';
90
-
91
- // Query to get all forms
92
- $order = sanitize_sql_orderby( 'field_sequence ASC' );
93
- $fields = $wpdb->get_results( $wpdb->prepare( "SELECT field_id, field_key, field_name, field_type, field_options, field_parent, field_required FROM $this->field_table_name WHERE form_id = %d ORDER BY $order", $form_id ) );
94
-
95
- // Setup counter for alt rows
96
- $i = $points = 0;
97
-
98
- // Setup HTML email vars
99
- $header = $body = $message = $footer = $html_email = $auto_response_email = $attachments = '';
100
-
101
- // Prepare the beginning of the content
102
- $header = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
103
- <html>
104
- <head>
105
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
106
- <title>HTML Email</title>
107
- </head>
108
- <body><table rules="all" style="border-color: #666;" cellpadding="10">' . "\n";
109
-
110
- // Loop through each form field and build the body of the message
111
- foreach ( $fields as $field ) :
112
- // Handle attachments
113
- if ( $field->field_type == 'file-upload' ) :
114
- $value = ( isset( $_FILES[ 'vfb-' . $field->field_id ] ) ) ? $_FILES[ 'vfb-' . $field->field_id ] : '';
115
-
116
- if ( $value['size'] > 0 ) :
117
- // 25MB is the max size allowed
118
- $size = apply_filters( 'vfb_max_file_size', 25 );
119
- $max_attach_size = $size * 1048576;
120
-
121
- // Display error if file size has been exceeded
122
- if ( $value['size'] > $max_attach_size )
123
- wp_die( sprintf( __( "File size exceeds %dMB. Please decrease the file size and try again.", 'visual-form-builder' ), $size ), '', array( 'back_link' => true ) );
124
-
125
- // Options array for the wp_handle_upload function. 'test_form' => false
126
- $upload_overrides = array( 'test_form' => false );
127
-
128
- // We need to include the file that runs the wp_handle_upload function
129
- require_once( ABSPATH . 'wp-admin/includes/file.php' );
130
-
131
- // Handle the upload using WP's wp_handle_upload function. Takes the posted file and an options array
132
- $uploaded_file = wp_handle_upload( $value, $upload_overrides );
133
-
134
- // If the wp_handle_upload call returned a local path for the image
135
- if ( isset( $uploaded_file['file'] ) ) :
136
- // Retrieve the file type from the file name. Returns an array with extension and mime type
137
- $wp_filetype = wp_check_filetype( basename( $uploaded_file['file'] ), null );
138
-
139
- // Return the current upload directory location
140
- $wp_upload_dir = wp_upload_dir();
141
-
142
- $media_upload = array(
143
- 'guid' => $wp_upload_dir['baseurl'] . _wp_relative_upload_path( $uploaded_file['file'] ),
144
- 'post_mime_type' => $wp_filetype['type'],
145
- 'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $uploaded_file['file'] ) ),
146
- 'post_content' => '',
147
- 'post_status' => 'inherit'
148
- );
149
-
150
- // Insert attachment into Media Library and get attachment ID
151
- $attach_id = wp_insert_attachment( $media_upload, $uploaded_file['file'] );
152
-
153
- // Include the file that runs wp_generate_attachment_metadata()
154
- require_once( ABSPATH . 'wp-admin/includes/image.php' );
155
-
156
- // Setup attachment metadata
157
- $attach_data = wp_generate_attachment_metadata( $attach_id, $uploaded_file['file'] );
158
-
159
- // Update the attachment metadata
160
- wp_update_attachment_metadata( $attach_id, $attach_data );
161
-
162
- $attachments[ 'vfb-' . $field->field_id ] = $uploaded_file['file'];
163
-
164
- $data[] = array(
165
- 'id' => $field->field_id,
166
- 'slug' => $field->field_key,
167
- 'name' => $field->field_name,
168
- 'type' => $field->field_type,
169
- 'options' => $field->field_options,
170
- 'parent_id' => $field->field_parent,
171
- 'value' => $uploaded_file['url']
172
- );
173
-
174
- $body .= sprintf(
175
- '<tr>
176
- <td><strong>%1$s: </strong></td>
177
- <td><a href="%2$s">%2$s</a></td>
178
- </tr>' . "\n",
179
- stripslashes( $field->field_name ),
180
- $uploaded_file['url']
181
- );
182
- endif;
183
- else :
184
- $value = ( isset( $_POST[ 'vfb-' . $field->field_id ] ) ) ? $_POST[ 'vfb-' . $field->field_id ] : '';
185
  $body .= sprintf(
186
  '<tr>
187
  <td><strong>%1$s: </strong></td>
188
- <td>%2$s</td>
189
  </tr>' . "\n",
190
  stripslashes( $field->field_name ),
191
- $value
192
  );
193
  endif;
194
-
195
- // Everything else
196
  else :
197
  $value = ( isset( $_POST[ 'vfb-' . $field->field_id ] ) ) ? $_POST[ 'vfb-' . $field->field_id ] : '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
 
199
- // If time field, build proper output
200
- if ( is_array( $value ) && $field->field_type == 'time' )
201
- $value = $this->build_array_form_item( $value, $field->field_type );
202
- // If address field, build proper output
203
- elseif ( is_array( $value ) && $field->field_type == 'address' )
204
- $value = $this->build_array_form_item( $value, $field->field_type );
205
- // If multiple values, build the list
206
- elseif ( is_array( $value ) )
207
- $value = $this->build_array_form_item( $value, $field->field_type );
208
- elseif ( 'radio' == $field->field_type )
209
- $value = wp_specialchars_decode( stripslashes( esc_html( $value ) ), ENT_QUOTES );
210
- // Lastly, handle single values
211
- else
212
- $value = html_entity_decode( stripslashes( esc_html( $value ) ), ENT_QUOTES, 'UTF-8' );
213
-
214
- // Setup spam catcher RegEx
215
- $exploits = '/(content-type|bcc:|cc:|document.cookie|onclick|onload|javascript|alert)/i';
216
- $profanity = '/(beastial|bestial|blowjob|clit|cock|cum|cunilingus|cunillingus|cunnilingus|cunt|ejaculate|fag|felatio|fellatio|fuck|fuk|fuks|gangbang|gangbanged|gangbangs|hotsex|jism|jiz|kock|kondum|kum|kunilingus|orgasim|orgasims|orgasm|orgasms|phonesex|phuk|phuq|porn|pussies|pussy|spunk|xxx)/i';
217
- $spamwords = '/(viagra|phentermine|tramadol|adipex|advai|alprazolam|ambien|ambian|amoxicillin|antivert|blackjack|backgammon|texas|holdem|poker|carisoprodol|ciara|ciprofloxacin|debt|dating|porn)/i';
218
-
219
- // Add up points for each spam hit
220
- if ( preg_match( $exploits, $value ) )
221
- $points += 2;
222
- elseif ( preg_match( $profanity, $value ) )
223
- $points += 1;
224
- elseif ( preg_match( $spamwords, $value ) )
225
- $points += 1;
226
-
227
- //Sanitize input
228
- $value = $this->sanitize_input( $value, $field->field_type );
229
- // Validate input
230
- $this->validate_input( $value, $field->field_name, $field->field_type, $field->field_required );
231
-
232
- $removed_field_types = array( 'verification', 'secret', 'submit' );
233
-
234
- // Don't add certain fields to the email
235
- if ( ! in_array( $field->field_type, $removed_field_types ) ) :
236
- if ( $field->field_type == 'fieldset' ) :
237
- $body .= sprintf(
238
- '<tr style="background-color:#393E40;color:white;font-size:14px;">
239
- <td colspan="2">%1$s</td>
240
- </tr>' . "\n",
241
- stripslashes( $field->field_name )
242
- );
243
- elseif ( $field->field_type == 'section' ) :
244
- $body .= sprintf(
245
- '<tr style="background-color:#6E7273;color:white;font-size:14px;">
246
- <td colspan="2">%1$s</td>
247
- </tr>' . "\n",
248
- stripslashes( $field->field_name )
249
- );
250
- else :
251
- // Convert new lines to break tags for textarea in html
252
- $display_value = ( 'textarea' == $field->field_type ) ? nl2br( $value ) : $value;
253
-
254
- $body .= sprintf(
255
- '<tr>
256
- <td><strong>%1$s: </strong></td>
257
- <td>%2$s</td>
258
- </tr>' . "\n",
259
- stripslashes( $field->field_name ),
260
- $display_value
261
- );
262
- endif;
263
  endif;
 
264
 
265
- $data[] = array(
266
- 'id' => $field->field_id,
267
- 'slug' => $field->field_key,
268
- 'name' => $field->field_name,
269
- 'type' => $field->field_type,
270
- 'options' => $field->field_options,
271
- 'parent_id' => $field->field_parent,
272
- 'value' => esc_html( $value )
273
- );
274
 
275
- endif;
276
 
277
- // If the user accumulates more than 4 points, it might be spam
278
- if ( $points > 4 )
279
- wp_die( __( 'Your responses look too much like spam and could not be sent at this time.', 'visual-form-builder' ), '', array( 'back_link' => true ) );
280
- endforeach;
281
 
282
- // Setup our entries data
283
- $entry = array(
284
- 'form_id' => $form_id,
285
- 'data' => serialize( $data ),
286
- 'subject' => $form_settings->form_subject,
287
- 'sender_name' => $form_settings->form_from_name,
288
- 'sender_email' => $form_settings->form_from,
289
- 'emails_to' => serialize( $form_settings->form_to ),
290
- 'date_submitted' => date_i18n( 'Y-m-d G:i:s' ),
291
- 'ip_address' => esc_html( $_SERVER['REMOTE_ADDR'] )
292
- );
293
 
294
- // Insert this data into the entries table
295
- $wpdb->insert( $this->entries_table_name, $entry );
296
 
297
- // Close out the content
298
- $footer .= '<tr>
299
- <td class="footer" height="61" align="left" valign="middle" colspan="2">
300
- <p style="font-size: 12px; font-weight: normal; margin: 0; line-height: 16px; padding: 0;">This email was built and sent using <a href="http://wordpress.org/extend/plugins/visual-form-builder/" style="font-size: 12px;">Visual Form Builder</a>.</p>
301
- </td>
302
- </tr>
303
- </table>
304
- </body>
305
- </html>' . "\n";
306
 
307
- // Build complete HTML email
308
- $message = $header . $body . $footer;
309
 
310
- // Wrap lines longer than 70 words to meet email standards
311
- $message = wordwrap( $message, 70 );
312
 
313
- // Decode HTML for message so it outputs properly
314
- $notify_message = ( $form_settings->form_notification_message !== '' ) ? html_entity_decode( $form_settings->form_notification_message ) : '';
315
 
316
- // Initialize header filter vars
317
- $header_from_name = stripslashes( $reply_to_name );
318
- $header_from = $reply_to_email;
319
- $header_content_type = 'text/html';
320
 
321
- // Either prepend the notification message to the submitted entry, or send by itself
322
- if ( $form_settings->form_notification_entry !== '' )
323
- $auto_response_email = $header . $notify_message . $body . $footer;
324
- else
325
- $auto_response_email = sprintf( '%1$s<table cellspacing="0" border="0" cellpadding="0" width="100%%"><tr><td colspan="2" class="mainbar" align="left" valign="top" width="600">%2$s</td></tr>%3$s', $header, $notify_message, $footer );
326
 
327
 
328
- // Build email headers
329
- $from_name = ( $header_from_name == '' ) ? 'WordPress' : $header_from_name;
330
 
331
- // Use the admin_email as the From email
332
- $from_email = get_site_option( 'admin_email' );
333
 
334
- // Get the site domain and get rid of www.
335
- $sitename = strtolower( $_SERVER['SERVER_NAME'] );
336
- if ( substr( $sitename, 0, 4 ) == 'www.' )
337
- $sitename = substr( $sitename, 4 );
338
 
339
- // Get the domain from the admin_email
340
- list( $user, $domain ) = explode( '@', $from_email );
341
 
342
- // If site domain and admin_email domain match, use admin_email, otherwise a same domain email must be created
343
- $from_email = ( $sitename == $domain ) ? $from_email : "wordpress@$sitename";
344
 
345
- $reply_to = "\"$from_name\" <$header_from>";
346
- $headers = "Sender: $from_email\r\n" . "From: $reply_to\r\n" . "Reply-To: $reply_to\r\n" . "Content-Type: $header_content_type; charset=\"" . get_option('blog_charset') . "\"\r\n";
347
 
348
- $form_subject = wp_specialchars_decode( $form_settings->form_subject, ENT_QUOTES );
349
- $notify_subject = wp_specialchars_decode( $form_settings->form_notification_subject, ENT_QUOTES );
350
 
351
- // Sanitize main emails_to
352
- $emails_to = array_map( 'sanitize_email', $form_settings->form_to );
353
 
354
- // Send the mail
355
- foreach ( $emails_to as $email ) {
356
- wp_mail( $email, $form_subject, $message, $headers, $attachments );
357
- }
358
 
359
- // Send auto-responder email
360
- if ( $form_settings->form_notification_setting !== '' ) :
361
 
362
- $attachments = ( $form_settings->form_notification_entry !== '' ) ? $attachments : '';
 
 
 
363
 
364
- // Reset headers for notification email
365
- $reply_name = stripslashes( $form_settings->form_notification_email_name );
366
- $reply_email = $form_settings->form_notification_email_from;
367
- $reply_to = "\"$reply_name\" <$reply_email>";
368
- $headers = "Sender: $from_email\r\n" . "From: $reply_to\r\n" . "Reply-To: $reply_to\r\n" . "Content-Type: $header_content_type; charset=\"" . get_option('blog_charset') . "\"\r\n";
369
 
370
- // Send the mail
371
- wp_mail( $copy_email, $notify_subject, $auto_response_email, $headers, $attachments );
372
 
373
- endif;
 
 
 
 
374
 
375
- endif;
 
 
 
16
  endif;
17
 
18
  // Basic security check before moving any further
19
+ if ( !isset( $_POST['vfb-submit'] ) )
20
+ return;
21
 
22
+ // Get global settings
23
+ $vfb_settings = get_option( 'vfb-settings' );
24
 
25
+ // Settings - Max Upload Size
26
+ $settings_max_upload = isset( $vfb_settings['max-upload-size'] ) ? $vfb_settings['max-upload-size'] : 25;
27
 
28
+ // Set submitted action to display success message
29
+ $this->submitted = true;
30
 
31
+ // Tells us which form to get from the database
32
+ $form_id = absint( $_POST['form_id'] );
 
33
 
34
+ $skip_referrer_check = apply_filters( 'vfb_skip_referrer_check', false, $form_id );
35
+
36
+ // Test if referral URL has been set
37
+ if ( !$referrer )
38
+ wp_die( __( 'Security check: referal URL does not appear to be set.' , 'visual-form-builder'), '', array( 'back_link' => true ) );
39
+
40
+ // Allow referrer check to be skipped
41
+ if ( !$skip_referrer_check ) :
42
+ // Test if the referral URL matches what sent from WordPress
43
+ if ( $wp_get_referer )
44
+ wp_die( __( 'Security check: referal does not match this site.' , 'visual-form-builder'), '', array( 'back_link' => true ) );
45
+ endif;
46
+
47
+ // Test if it's a known SPAM bot
48
+ if ( $this->isBot() )
49
+ wp_die( __( 'Security check: looks like you are a SPAM bot. If you think this is an error, please email the site owner.' , 'visual-form-builder' ), '', array( 'back_link' => true ) );
50
+
51
+ // Query to get all forms
52
+ $order = sanitize_sql_orderby( 'form_id DESC' );
53
+ $form = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->form_table_name WHERE form_id = %d ORDER BY $order", $form_id ) );
54
+
55
+ $form_settings = (object) array(
56
+ 'form_title' => stripslashes( html_entity_decode( $form->form_title, ENT_QUOTES, 'UTF-8' ) ),
57
+ 'form_subject' => stripslashes( html_entity_decode( $form->form_email_subject, ENT_QUOTES, 'UTF-8' ) ),
58
+ 'form_to' => ( is_array( unserialize( $form->form_email_to ) ) ) ? unserialize( $form->form_email_to ) : explode( ',', unserialize( $form->form_email_to ) ),
59
+ 'form_from' => stripslashes( $form->form_email_from ),
60
+ 'form_from_name' => stripslashes( $form->form_email_from_name ),
61
+ 'form_notification_setting' => stripslashes( $form->form_notification_setting ),
62
+ 'form_notification_email_name' => stripslashes( $form->form_notification_email_name ),
63
+ 'form_notification_email_from' => stripslashes( $form->form_notification_email_from ),
64
+ 'form_notification_subject' => stripslashes( html_entity_decode( $form->form_notification_subject, ENT_QUOTES, 'UTF-8' ) ),
65
+ 'form_notification_message' => stripslashes( $form->form_notification_message ),
66
+ 'form_notification_entry' => stripslashes( $form->form_notification_entry )
67
+ );
68
+ // Allow the form settings to be filtered (ex: return $form_settings->'form_title' = 'Hello World';)
69
+ $form_settings = (object) apply_filters_ref_array( 'vfb_email_form_settings', array( $form_settings, $form_id ) );
70
+
71
+ // Sender name field ID
72
+ $sender = $form->form_email_from_name_override;
73
+
74
+ // Sender email field ID
75
+ $email = $form->form_email_from_override;
76
+
77
+ // Notifcation email field ID
78
+ $notify = $form->form_notification_email;
79
+
80
+ $reply_to_name = $form_settings->form_from_name;
81
+ $reply_to_email = $form_settings->form_from;
82
+
83
+ // Use field for sender name
84
+ if ( !empty( $sender ) && isset( $_POST[ 'vfb-' . $sender ] ) ) {
85
+ $form_settings->form_from_name = wp_kses_data( $_POST[ 'vfb-' . $sender ] );
86
+ $reply_to_name = $form_settings->form_from_name;
87
+ }
88
+
89
+ // Use field for sender email
90
+ if ( !empty( $email ) && isset( $_POST[ 'vfb-' . $email ] ) ) {
91
+ $form_settings->form_from = sanitize_email( $_POST[ 'vfb-' . $email ] );
92
+ $reply_to_email = $form_settings->form_from;
93
+ }
94
+
95
+ // Use field for copy email
96
+ $copy_email = ( !empty( $notify ) ) ? sanitize_email( $_POST[ 'vfb-' . $notify ] ) : '';
97
+
98
+ // Query to get all forms
99
+ $order = sanitize_sql_orderby( 'field_sequence ASC' );
100
+ $fields = $wpdb->get_results( $wpdb->prepare( "SELECT field_id, field_key, field_name, field_type, field_options, field_parent, field_required FROM $this->field_table_name WHERE form_id = %d ORDER BY $order", $form_id ) );
101
+
102
+ // Setup counter for alt rows
103
+ $i = $points = 0;
104
+
105
+ // Setup HTML email vars
106
+ $header = $body = $message = $footer = $html_email = $auto_response_email = $attachments = '';
107
+
108
+ // Prepare the beginning of the content
109
+ $header = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
110
+ <html>
111
+ <head>
112
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
113
+ <title>HTML Email</title>
114
+ </head>
115
+ <body><table rules="all" style="border-color: #666;" cellpadding="10">' . "\n";
116
+
117
+ // Loop through each form field and build the body of the message
118
+ foreach ( $fields as $field ) :
119
+ // Handle attachments
120
+ if ( $field->field_type == 'file-upload' ) :
121
+ $value = ( isset( $_FILES[ 'vfb-' . $field->field_id ] ) ) ? $_FILES[ 'vfb-' . $field->field_id ] : '';
122
+
123
+ if ( $value['size'] > 0 ) :
124
+ // 25MB is the max size allowed
125
+ $size = apply_filters( 'vfb_max_file_size', $settings_max_upload );
126
+ $max_attach_size = $size * 1048576;
127
+
128
+ // Display error if file size has been exceeded
129
+ if ( $value['size'] > $max_attach_size )
130
+ wp_die( sprintf( __( "File size exceeds %dMB. Please decrease the file size and try again.", 'visual-form-builder' ), $size ), '', array( 'back_link' => true ) );
131
+
132
+ // Options array for the wp_handle_upload function. 'test_form' => false
133
+ $upload_overrides = array( 'test_form' => false );
134
+
135
+ // We need to include the file that runs the wp_handle_upload function
136
+ require_once( ABSPATH . 'wp-admin/includes/file.php' );
137
+
138
+ // Handle the upload using WP's wp_handle_upload function. Takes the posted file and an options array
139
+ $uploaded_file = wp_handle_upload( $value, $upload_overrides );
140
+
141
+ // If the wp_handle_upload call returned a local path for the image
142
+ if ( isset( $uploaded_file['file'] ) ) :
143
+ // Retrieve the file type from the file name. Returns an array with extension and mime type
144
+ $wp_filetype = wp_check_filetype( basename( $uploaded_file['file'] ), null );
145
+
146
+ // Return the current upload directory location
147
+ $wp_upload_dir = wp_upload_dir();
148
+
149
+ $media_upload = array(
150
+ 'guid' => $wp_upload_dir['baseurl'] . _wp_relative_upload_path( $uploaded_file['file'] ),
151
+ 'post_mime_type' => $wp_filetype['type'],
152
+ 'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $uploaded_file['file'] ) ),
153
+ 'post_content' => '',
154
+ 'post_status' => 'inherit'
155
+ );
156
+
157
+ // Insert attachment into Media Library and get attachment ID
158
+ $attach_id = wp_insert_attachment( $media_upload, $uploaded_file['file'] );
159
+
160
+ // Include the file that runs wp_generate_attachment_metadata()
161
+ require_once( ABSPATH . 'wp-admin/includes/image.php' );
162
+ require_once( ABSPATH . 'wp-admin/includes/media.php' );
163
+
164
+ // Setup attachment metadata
165
+ $attach_data = wp_generate_attachment_metadata( $attach_id, $uploaded_file['file'] );
166
+
167
+ // Update the attachment metadata
168
+ wp_update_attachment_metadata( $attach_id, $attach_data );
169
+
170
+ $attachments[ 'vfb-' . $field->field_id ] = $uploaded_file['file'];
171
+
172
+ $data[] = array(
173
+ 'id' => $field->field_id,
174
+ 'slug' => $field->field_key,
175
+ 'name' => $field->field_name,
176
+ 'type' => $field->field_type,
177
+ 'options' => $field->field_options,
178
+ 'parent_id' => $field->field_parent,
179
+ 'value' => $uploaded_file['url']
180
+ );
181
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  $body .= sprintf(
183
  '<tr>
184
  <td><strong>%1$s: </strong></td>
185
+ <td><a href="%2$s">%2$s</a></td>
186
  </tr>' . "\n",
187
  stripslashes( $field->field_name ),
188
+ $uploaded_file['url']
189
  );
190
  endif;
 
 
191
  else :
192
  $value = ( isset( $_POST[ 'vfb-' . $field->field_id ] ) ) ? $_POST[ 'vfb-' . $field->field_id ] : '';
193
+ $body .= sprintf(
194
+ '<tr>
195
+ <td><strong>%1$s: </strong></td>
196
+ <td>%2$s</td>
197
+ </tr>' . "\n",
198
+ stripslashes( $field->field_name ),
199
+ $value
200
+ );
201
+ endif;
202
+
203
+ // Everything else
204
+ else :
205
+ $value = ( isset( $_POST[ 'vfb-' . $field->field_id ] ) ) ? $_POST[ 'vfb-' . $field->field_id ] : '';
206
+
207
+ // If time field, build proper output
208
+ if ( is_array( $value ) && $field->field_type == 'time' )
209
+ $value = $this->build_array_form_item( $value, $field->field_type );
210
+ // If address field, build proper output
211
+ elseif ( is_array( $value ) && $field->field_type == 'address' )
212
+ $value = $this->build_array_form_item( $value, $field->field_type );
213
+ // If multiple values, build the list
214
+ elseif ( is_array( $value ) )
215
+ $value = $this->build_array_form_item( $value, $field->field_type );
216
+ elseif ( 'radio' == $field->field_type )
217
+ $value = wp_specialchars_decode( stripslashes( esc_html( $value ) ), ENT_QUOTES );
218
+ // Lastly, handle single values
219
+ else
220
+ $value = html_entity_decode( stripslashes( esc_html( $value ) ), ENT_QUOTES, 'UTF-8' );
221
+
222
+ // Setup spam catcher RegEx
223
+ $exploits = '/(content-type|bcc:|cc:|document.cookie|onclick|onload|javascript|alert)/i';
224
+ $profanity = '/(beastial|bestial|blowjob|clit|cock|cum|cunilingus|cunillingus|cunnilingus|cunt|ejaculate|fag|felatio|fellatio|fuck|fuk|fuks|gangbang|gangbanged|gangbangs|hotsex|jism|jiz|kock|kondum|kum|kunilingus|orgasim|orgasims|orgasm|orgasms|phonesex|phuk|phuq|porn|pussies|pussy|spunk|xxx)/i';
225
+ $spamwords = '/(viagra|phentermine|tramadol|adipex|advai|alprazolam|ambien|ambian|amoxicillin|antivert|blackjack|backgammon|holdem|poker|carisoprodol|ciara|ciprofloxacin|debt|dating|porn)/i';
226
+
227
+ // Add up points for each spam hit
228
+ if ( preg_match( $exploits, $value ) )
229
+ $points += 2;
230
+ elseif ( preg_match( $profanity, $value ) )
231
+ $points += 1;
232
+ elseif ( preg_match( $spamwords, $value ) )
233
+ $points += 1;
234
+
235
+ //Sanitize input
236
+ $value = $this->sanitize_input( $value, $field->field_type );
237
+ // Validate input
238
+ $this->validate_input( $value, $field->field_name, $field->field_type, $field->field_required );
239
+
240
+ $removed_field_types = array( 'verification', 'secret', 'submit' );
241
+
242
+ // Don't add certain fields to the email
243
+ if ( ! in_array( $field->field_type, $removed_field_types ) ) :
244
+ if ( $field->field_type == 'fieldset' ) :
245
+ $body .= sprintf(
246
+ '<tr style="background-color:#393E40;color:white;font-size:14px;">
247
+ <td colspan="2">%1$s</td>
248
+ </tr>' . "\n",
249
+ stripslashes( $field->field_name )
250
+ );
251
+ elseif ( $field->field_type == 'section' ) :
252
+ $body .= sprintf(
253
+ '<tr style="background-color:#6E7273;color:white;font-size:14px;">
254
+ <td colspan="2">%1$s</td>
255
+ </tr>' . "\n",
256
+ stripslashes( $field->field_name )
257
+ );
258
+ else :
259
+ // Convert new lines to break tags for textarea in html
260
+ $display_value = ( 'textarea' == $field->field_type ) ? nl2br( $value ) : $value;
261
 
262
+ $body .= sprintf(
263
+ '<tr>
264
+ <td><strong>%1$s: </strong></td>
265
+ <td>%2$s</td>
266
+ </tr>' . "\n",
267
+ stripslashes( $field->field_name ),
268
+ $display_value
269
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  endif;
271
+ endif;
272
 
273
+ $data[] = array(
274
+ 'id' => $field->field_id,
275
+ 'slug' => $field->field_key,
276
+ 'name' => $field->field_name,
277
+ 'type' => $field->field_type,
278
+ 'options' => $field->field_options,
279
+ 'parent_id' => $field->field_parent,
280
+ 'value' => esc_html( $value )
281
+ );
282
 
283
+ endif;
284
 
285
+ // If the user accumulates more than 4 points, it might be spam
286
+ if ( $points > 4 )
287
+ wp_die( __( 'Your responses look too much like spam and could not be sent at this time.', 'visual-form-builder' ), '', array( 'back_link' => true ) );
288
+ endforeach;
289
 
290
+ // Setup our entries data
291
+ $entry = array(
292
+ 'form_id' => $form_id,
293
+ 'data' => serialize( $data ),
294
+ 'subject' => $form_settings->form_subject,
295
+ 'sender_name' => $form_settings->form_from_name,
296
+ 'sender_email' => $form_settings->form_from,
297
+ 'emails_to' => serialize( $form_settings->form_to ),
298
+ 'date_submitted' => date_i18n( 'Y-m-d G:i:s' ),
299
+ 'ip_address' => esc_html( $_SERVER['REMOTE_ADDR'] )
300
+ );
301
 
302
+ // Insert this data into the entries table
303
+ $wpdb->insert( $this->entries_table_name, $entry );
304
 
305
+ // Close out the content
306
+ $footer .= '<tr>
307
+ <td class="footer" height="61" align="left" valign="middle" colspan="2">
308
+ <p style="font-size: 12px; font-weight: normal; margin: 0; line-height: 16px; padding: 0;">This email was built and sent using <a href="http://wordpress.org/extend/plugins/visual-form-builder/" style="font-size: 12px;">Visual Form Builder</a>.</p>
309
+ </td>
310
+ </tr>
311
+ </table>
312
+ </body>
313
+ </html>' . "\n";
314
 
315
+ // Build complete HTML email
316
+ $message = $header . $body . $footer;
317
 
318
+ // Wrap lines longer than 70 words to meet email standards
319
+ $message = wordwrap( $message, 70 );
320
 
321
+ // Decode HTML for message so it outputs properly
322
+ $notify_message = ( $form_settings->form_notification_message !== '' ) ? html_entity_decode( $form_settings->form_notification_message ) : '';
323
 
324
+ // Initialize header filter vars
325
+ $header_from_name = function_exists( 'mb_encode_mimeheader' ) ? mb_encode_mimeheader( stripslashes( $reply_to_name ) ) : stripslashes( $reply_to_name );
326
+ $header_from = $reply_to_email;
327
+ $header_content_type = 'text/html';
328
 
329
+ // Either prepend the notification message to the submitted entry, or send by itself
330
+ if ( $form_settings->form_notification_entry !== '' )
331
+ $auto_response_email = $header . $notify_message . $body . $footer;
332
+ else
333
+ $auto_response_email = sprintf( '%1$s<table cellspacing="0" border="0" cellpadding="0" width="100%%"><tr><td colspan="2" class="mainbar" align="left" valign="top" width="600">%2$s</td></tr>%3$s', $header, $notify_message, $footer );
334
 
335
 
336
+ // Build email headers
337
+ $from_name = ( $header_from_name == '' ) ? 'WordPress' : $header_from_name;
338
 
339
+ // Use the admin_email as the From email
340
+ $from_email = get_site_option( 'admin_email' );
341
 
342
+ // Get the site domain and get rid of www.
343
+ $sitename = strtolower( $_SERVER['SERVER_NAME'] );
344
+ if ( substr( $sitename, 0, 4 ) == 'www.' )
345
+ $sitename = substr( $sitename, 4 );
346
 
347
+ // Get the domain from the admin_email
348
+ list( $user, $domain ) = explode( '@', $from_email );
349
 
350
+ // If site domain and admin_email domain match, use admin_email, otherwise a same domain email must be created
351
+ $from_email = ( $sitename == $domain ) ? $from_email : "wordpress@$sitename";
352
 
353
+ // Settings - Sender Mail Header
354
+ $settings_sender_header = isset( $vfb_settings['sender-mail-header'] ) ? $vfb_settings['sender-mail-header'] : $from_email;
355
 
356
+ // Allow Sender email to be filtered
357
+ $from_email = apply_filters( 'vfb_sender_mail_header', $settings_sender_header, $form_id );
358
 
359
+ $reply_to = "\"$from_name\" <$header_from>";
360
+ $headers = "Sender: $from_email\r\n" . "From: $reply_to\r\n" . "Reply-To: $reply_to\r\n" . "Content-Type: $header_content_type; charset=\"" . get_option('blog_charset') . "\"\r\n";
361
 
362
+ $form_subject = wp_specialchars_decode( $form_settings->form_subject, ENT_QUOTES );
363
+ $notify_subject = wp_specialchars_decode( $form_settings->form_notification_subject, ENT_QUOTES );
 
 
364
 
365
+ // Sanitize main emails_to
366
+ $emails_to = array_map( 'sanitize_email', $form_settings->form_to );
367
 
368
+ // Send the mail
369
+ foreach ( $emails_to as $email ) {
370
+ wp_mail( $email, $form_subject, $message, $headers, $attachments );
371
+ }
372
 
373
+ // Send auto-responder email
374
+ if ( $form_settings->form_notification_setting !== '' ) :
 
 
 
375
 
376
+ $attachments = ( $form_settings->form_notification_entry !== '' ) ? $attachments : '';
 
377
 
378
+ // Reset headers for notification email
379
+ $reply_name = function_exists( 'mb_encode_mimeheader' ) ? mb_encode_mimeheader( stripslashes( $form_settings->form_notification_email_name ) ) : stripslashes( $form_settings->form_notification_email_name );
380
+ $reply_email = $form_settings->form_notification_email_from;
381
+ $reply_to = "\"$reply_name\" <$reply_email>";
382
+ $headers = "Sender: $from_email\r\n" . "From: $reply_to\r\n" . "Reply-To: $reply_to\r\n" . "Content-Type: $header_content_type; charset=\"" . get_option('blog_charset') . "\"\r\n";
383
 
384
+ // Send the mail
385
+ wp_mail( $copy_email, $notify_subject, $auto_response_email, $headers, $attachments );
386
+
387
+ endif;
includes/form-output.php CHANGED
@@ -1,6 +1,12 @@
1
  <?php
2
  global $wpdb;
3
 
 
 
 
 
 
 
4
  // Extract shortcode attributes, set defaults
5
  extract( shortcode_atts( array(
6
  'id' => ''
@@ -40,7 +46,7 @@ $verification = '';
40
  $label_alignment = ( $form->form_label_alignment !== '' ) ? esc_attr( " $form->form_label_alignment" ) : '';
41
 
42
  // Start form container
43
- $output .= '<div class="visual-form-builder-container">';
44
 
45
  $output .= sprintf(
46
  '<form id="%1$s-%2$d" class="visual-form-builder %3$s %4$s" method="post" enctype="multipart/form-data">
@@ -108,7 +114,7 @@ foreach ( $fields as $field ) :
108
  elseif ( $field_type == 'section' ) :
109
 
110
  $output .= sprintf(
111
- '<div id="%1$s" class="vfb-section-div %2$s"><h4>%3$s</h4>',
112
  $id_attr,
113
  $css,
114
  $field_name
@@ -124,8 +130,11 @@ foreach ( $fields as $field ) :
124
 
125
  if ( $field_type !== 'hidden' ) :
126
 
 
 
 
127
  $output .= sprintf(
128
- '<li class="vfb-item vfb-item-%1$s %2$s %3$s" id="item-%4$s"><label for="%4$s" class="vfb-desc">%5$s %6$s</label>',
129
  $field_type,
130
  $columns_choice,
131
  $layout,
@@ -139,7 +148,7 @@ foreach ( $fields as $field ) :
139
 
140
  if ( $field_type == 'verification' ) :
141
  $verification .= sprintf(
142
- '<fieldset class="vfb-fieldset vfb-fieldset-%1$d %2$s %3$s" id="item-%4$s"><div class="vfb-legend"><h3>%5$s</h3></div><ul class="vfb-section vfb-section-%1$d">',
143
  $count,
144
  esc_attr( $field->field_key ),
145
  $css,
@@ -173,7 +182,7 @@ foreach ( $fields as $field ) :
173
  endif;
174
 
175
  $verification .= sprintf(
176
- '<li class="vfb-item vfb-item-%1$s" %2$s><label for="%3$s" class="vfb-desc">%4$s%5$s</label>',
177
  $field_type,
178
  $logged_in_display,
179
  $id_attr,
@@ -190,7 +199,7 @@ foreach ( $fields as $field ) :
190
  $validation = '{digits:true,maxlength:2,minlength:2}';
191
 
192
  $verification_item = sprintf(
193
- '<input type="text" name="vfb-%1$d" id="%2$s" value="%3$s" class="vfb-text %4$s %5$s %6$s %7$s" />',
194
  $field_id,
195
  $id_attr,
196
  $logged_in_value,
@@ -235,7 +244,7 @@ foreach ( $fields as $field ) :
235
 
236
  $output .= ( !empty( $description ) ) ? sprintf( '<span class="vfb-span">%1$s<label>%2$s</label></span>', $form_item, $description ) : $form_item;
237
 
238
- break;
239
 
240
  case 'textarea' :
241
 
@@ -255,7 +264,7 @@ foreach ( $fields as $field ) :
255
 
256
  $output .= '</div>';
257
 
258
- break;
259
 
260
  case 'select' :
261
 
@@ -280,7 +289,7 @@ foreach ( $fields as $field ) :
280
 
281
  $output .= ( !empty( $description ) ) ? sprintf( '<span class="vfb-span"><label>%2$s</label></span>%1$s', $form_item, $description ) : $form_item;
282
 
283
- break;
284
 
285
  case 'radio' :
286
 
@@ -313,7 +322,7 @@ foreach ( $fields as $field ) :
313
 
314
  $output .= '<div style="clear:both"></div></div>';
315
 
316
- break;
317
 
318
  case 'checkbox' :
319
 
@@ -344,7 +353,7 @@ foreach ( $fields as $field ) :
344
 
345
  $output .= '<div style="clear:both"></div></div>';
346
 
347
- break;
348
 
349
  case 'address' :
350
 
@@ -379,7 +388,7 @@ foreach ( $fields as $field ) :
379
 
380
  $address_parts = apply_filters( 'vfb_address_labels', $address_parts, $form_id );
381
 
382
- $label_placement = apply_filters( 'vfb_address_labels_placement', true, $form_id );
383
 
384
  $placement_bottom = ( $label_placement ) ? '<label for="%2$s-%4$s">%5$s</label>' : '';
385
  $placement_top = ( !$label_placement ) ? '<label for="%2$s-%4$s">%5$s</label>' : '';
@@ -429,7 +438,7 @@ foreach ( $fields as $field ) :
429
 
430
  $output .= "<div>$address</div>";
431
 
432
- break;
433
 
434
  case 'date' :
435
  $options = maybe_unserialize( $field->field_options );
@@ -448,7 +457,7 @@ foreach ( $fields as $field ) :
448
 
449
  $output .= ( !empty( $description ) ) ? sprintf( '<span class="vfb-span">%1$s<label>%2$s</label></span>', $form_item, $description ) : $form_item;
450
 
451
- break;
452
 
453
  case 'time' :
454
 
@@ -505,7 +514,7 @@ foreach ( $fields as $field ) :
505
 
506
  $output .= '<div class="clear"></div>';
507
 
508
- break;
509
 
510
  case 'html' :
511
 
@@ -525,7 +534,7 @@ foreach ( $fields as $field ) :
525
 
526
  $output .= '</div>';
527
 
528
- break;
529
 
530
  case 'file-upload' :
531
 
@@ -547,17 +556,17 @@ foreach ( $fields as $field ) :
547
 
548
  $output .= ( !empty( $description ) ) ? sprintf( '<span class="vfb-span">%1$s<label>%2$s</label></span>', $form_item, $description ) : $form_item;
549
 
550
- break;
551
 
552
  case 'instructions' :
553
 
554
  $output .= wp_specialchars_decode( esc_html( stripslashes( $description ) ), ENT_QUOTES );
555
 
556
- break;
557
 
558
  case 'submit' :
559
  $submit = sprintf(
560
- '<li class="vfb-item vfb-item-submit" id="%2$s">
561
  <input type="submit" name="vfb-submit" id="%2$s" value="%3$s" class="vfb-submit %4$s" />
562
  </li>',
563
  $field_id,
@@ -566,7 +575,7 @@ foreach ( $fields as $field ) :
566
  $css
567
  );
568
 
569
- break;
570
 
571
  default:
572
  echo '';
@@ -584,12 +593,12 @@ $output .= '</ul>&nbsp;</fieldset>';
584
  if ( empty( $verification ) ) :
585
 
586
  $verification = sprintf(
587
- '<fieldset class="vfb-fieldset vfb-verification">
588
  <div class="vfb-legend"><h3>%1$s</h3></div>
589
  <ul class="vfb-section vfb-section-%2$d">
590
- <li class="vfb-item vfb-item-text">
591
  <label for="vfb-secret" class="vfb-desc">%3$s<span>*</span></label>
592
- <div><input type="text" name="vfb-secret" id="vfb-secret" class="vfb-text vfb-medium" /></div>
593
  </li>',
594
  __( 'Verification' , 'visual-form-builder'),
595
  $count,
@@ -601,7 +610,7 @@ endif;
601
  // Output our security test
602
  $output .= sprintf(
603
  $verification .
604
- '<li style="display:none;"><label for="vfb-spam">%1$s:</label><div><input name="vfb-spam" id="vfb-spam" /></div></li>
605
  %2$s</ul>
606
  </fieldset>',
607
  __( 'This box is for spam protection - <strong>please leave it blank</strong>' , 'visual-form-builder'),
1
  <?php
2
  global $wpdb;
3
 
4
+ // Get global settings
5
+ $vfb_settings = get_option( 'vfb-settings' );
6
+
7
+ // Settings - Place Address labels above fields
8
+ $settings_address_labels = isset( $vfb_settings['address-labels'] ) ? false : true;
9
+
10
  // Extract shortcode attributes, set defaults
11
  extract( shortcode_atts( array(
12
  'id' => ''
46
  $label_alignment = ( $form->form_label_alignment !== '' ) ? esc_attr( " $form->form_label_alignment" ) : '';
47
 
48
  // Start form container
49
+ $output .= sprintf( '<div id="vfb-form-%d" class="visual-form-builder-container">', $form_id );
50
 
51
  $output .= sprintf(
52
  '<form id="%1$s-%2$d" class="visual-form-builder %3$s %4$s" method="post" enctype="multipart/form-data">
114
  elseif ( $field_type == 'section' ) :
115
 
116
  $output .= sprintf(
117
+ '<div id="item-%1$s" class="vfb-section-div %2$s"><h4>%3$s</h4>',
118
  $id_attr,
119
  $css,
120
  $field_name
130
 
131
  if ( $field_type !== 'hidden' ) :
132
 
133
+ // Don't add for attribute for certain form items
134
+ $for = !in_array( $field_type, array( 'checkbox', 'radio', 'time', 'address', 'instructions' ) ) ? ' for="%4$s"' : '';
135
+
136
  $output .= sprintf(
137
+ '<li class="vfb-item vfb-item-%1$s %2$s %3$s" id="item-%4$s"><label for="' . $for . '" class="vfb-desc">%5$s %6$s</label>',
138
  $field_type,
139
  $columns_choice,
140
  $layout,
148
 
149
  if ( $field_type == 'verification' ) :
150
  $verification .= sprintf(
151
+ '<fieldset class="vfb-fieldset vfb-fieldset-%1$d %2$s %3$s" id="item-%4$s" style="display:block"><div class="vfb-legend"><h3>%5$s</h3></div><ul class="vfb-section vfb-section-%1$d">',
152
  $count,
153
  esc_attr( $field->field_key ),
154
  $css,
182
  endif;
183
 
184
  $verification .= sprintf(
185
+ '<li class="vfb-item vfb-item-%1$s" %2$s style="display:block"><label for="%3$s" class="vfb-desc">%4$s%5$s</label>',
186
  $field_type,
187
  $logged_in_display,
188
  $id_attr,
199
  $validation = '{digits:true,maxlength:2,minlength:2}';
200
 
201
  $verification_item = sprintf(
202
+ '<input type="text" name="vfb-%1$d" id="%2$s" value="%3$s" class="vfb-text %4$s %5$s %6$s %7$s" style="display:block" />',
203
  $field_id,
204
  $id_attr,
205
  $logged_in_value,
244
 
245
  $output .= ( !empty( $description ) ) ? sprintf( '<span class="vfb-span">%1$s<label>%2$s</label></span>', $form_item, $description ) : $form_item;
246
 
247
+ break;
248
 
249
  case 'textarea' :
250
 
264
 
265
  $output .= '</div>';
266
 
267
+ break;
268
 
269
  case 'select' :
270
 
289
 
290
  $output .= ( !empty( $description ) ) ? sprintf( '<span class="vfb-span"><label>%2$s</label></span>%1$s', $form_item, $description ) : $form_item;
291
 
292
+ break;
293
 
294
  case 'radio' :
295
 
322
 
323
  $output .= '<div style="clear:both"></div></div>';
324
 
325
+ break;
326
 
327
  case 'checkbox' :
328
 
353
 
354
  $output .= '<div style="clear:both"></div></div>';
355
 
356
+ break;
357
 
358
  case 'address' :
359
 
388
 
389
  $address_parts = apply_filters( 'vfb_address_labels', $address_parts, $form_id );
390
 
391
+ $label_placement = apply_filters( 'vfb_address_labels_placement', $settings_address_labels, $form_id );
392
 
393
  $placement_bottom = ( $label_placement ) ? '<label for="%2$s-%4$s">%5$s</label>' : '';
394
  $placement_top = ( !$label_placement ) ? '<label for="%2$s-%4$s">%5$s</label>' : '';
438
 
439
  $output .= "<div>$address</div>";
440
 
441
+ break;
442
 
443
  case 'date' :
444
  $options = maybe_unserialize( $field->field_options );
457
 
458
  $output .= ( !empty( $description ) ) ? sprintf( '<span class="vfb-span">%1$s<label>%2$s</label></span>', $form_item, $description ) : $form_item;
459
 
460
+ break;
461
 
462
  case 'time' :
463
 
514
 
515
  $output .= '<div class="clear"></div>';
516
 
517
+ break;
518
 
519
  case 'html' :
520
 
534
 
535
  $output .= '</div>';
536
 
537
+ break;
538
 
539
  case 'file-upload' :
540
 
556
 
557
  $output .= ( !empty( $description ) ) ? sprintf( '<span class="vfb-span">%1$s<label>%2$s</label></span>', $form_item, $description ) : $form_item;
558
 
559
+ break;
560
 
561
  case 'instructions' :
562
 
563
  $output .= wp_specialchars_decode( esc_html( stripslashes( $description ) ), ENT_QUOTES );
564
 
565
+ break;
566
 
567
  case 'submit' :
568
  $submit = sprintf(
569
+ '<li class="vfb-item vfb-item-submit" id="item-%2$s">
570
  <input type="submit" name="vfb-submit" id="%2$s" value="%3$s" class="vfb-submit %4$s" />
571
  </li>',
572
  $field_id,
575
  $css
576
  );
577
 
578
+ break;
579
 
580
  default:
581
  echo '';
593
  if ( empty( $verification ) ) :
594
 
595
  $verification = sprintf(
596
+ '<fieldset class="vfb-fieldset vfb-verification" style="display:block">
597
  <div class="vfb-legend"><h3>%1$s</h3></div>
598
  <ul class="vfb-section vfb-section-%2$d">
599
+ <li class="vfb-item vfb-item-text" style="display:block">
600
  <label for="vfb-secret" class="vfb-desc">%3$s<span>*</span></label>
601
+ <div><input type="text" name="vfb-secret" id="vfb-secret" class="vfb-text vfb-medium" style="display:block" /></div>
602
  </li>',
603
  __( 'Verification' , 'visual-form-builder'),
604
  $count,
610
  // Output our security test
611
  $output .= sprintf(
612
  $verification .
613
+ '<li style="display:none;"><label>%1$s:</label><div><input name="vfb-spam" /></div></li>
614
  %2$s</ul>
615
  </fieldset>',
616
  __( 'This box is for spam protection - <strong>please leave it blank</strong>' , 'visual-form-builder'),
js/vfb-validation.js CHANGED
@@ -20,6 +20,10 @@ jQuery(document).ready(function($) {
20
  });
21
  });
22
 
 
 
 
 
23
 
24
  // !Display jQuery UI date picker
25
  $( '.vfb-date-picker' ).each( function(){
20
  });
21
  });
22
 
23
+ // Force bullets to hide, but only if list-style-type isn't set
24
+ $( '.visual-form-builder li:not(.vfb-item-instructions li)' ).filter( function(){
25
+ return $( this ).css( 'list-style-type' ) !== 'none';
26
+ }).css( 'list-style', 'none' );
27
 
28
  // !Display jQuery UI date picker
29
  $( '.vfb-date-picker' ).each( function(){
js/vfb-validation.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(a){a(".visual-form-builder").each(function(){a(this).validate({rules:{"vfb-secret":{required:true,digits:true,maxlength:2}},errorPlacement:function(b,c){if(c.is(":radio")||c.is(":checkbox")){b.appendTo(c.parent().parent())}else{if(c.is(":password")){b.hide()}else{b.insertAfter(c)}}}})});a(".vfb-date-picker").each(function(){var b=a(this).attr("data-dp-dateFormat")?a(this).attr("data-dp-dateFormat"):"mm/dd/yy";a(this).datepicker({dateFormat:b})});a.validator.addMethod("phone",function(c,b){c=c.replace(/[\+\s\(\)\.\-\ ]/g,"");return this.optional(b)||c.length>9&&c.match(/^((\+)?[1-9]{1,2})?([-\s\.])?((\(\d{1,4}\))|\d{1,4})(([-\s\.])?[0-9]{1,12}){1,2}$/)},a.validator.format("Please enter a valid phone number. Most US/Canada and International formats accepted."))});
1
+ jQuery(document).ready(function(a){a(".visual-form-builder").each(function(){a(this).validate({rules:{"vfb-secret":{required:true,digits:true,maxlength:2}},errorPlacement:function(b,c){if(c.is(":radio")||c.is(":checkbox")){b.appendTo(c.parent().parent())}else{if(c.is(":password")){b.hide()}else{b.insertAfter(c)}}}})});a(".visual-form-builder li:not(.vfb-item-instructions li)").filter(function(){return a(this).css("list-style-type")!=="none"}).css("list-style","none");a(".vfb-date-picker").each(function(){var b=a(this).attr("data-dp-dateFormat")?a(this).attr("data-dp-dateFormat"):"mm/dd/yy";a(this).datepicker({dateFormat:b})});a.validator.addMethod("phone",function(c,b){c=c.replace(/[\+\s\(\)\.\-\ ]/g,"");return this.optional(b)||c.length>9&&c.match(/^((\+)?[1-9]{1,2})?([-\s\.])?((\(\d{1,4}\))|\d{1,4})(([-\s\.])?[0-9]{1,12}){1,2}$/)},a.validator.format("Please enter a valid phone number. Most US/Canada and International formats accepted."))});
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=G87A9
4
  Tags: form, forms, contact form, contact forms, form, forms, form to email, email form, email, input, validation, jquery, shortcode, form builder, contact form builder, form manager, form creator
5
  Requires at least: 3.5
6
  Tested up to: 3.6
7
- Stable tag: 2.7.7
8
  License: GPLv2 or later
9
 
10
  Build beautiful, fully functional contact forms in only a few minutes without writing PHP, CSS, or HTML.
@@ -130,6 +130,12 @@ Setting up SMTP will get you part of the way there. For most, it solves the prob
130
 
131
  If you find that emails are not being sent, you should first confirm that you have completed all of the details in the `Form Settings > Email section`. Next, be sure to set the Reply-To option to an email that exists on the same domain as your WordPress site.
132
 
 
 
 
 
 
 
133
  **Possible mod_security conflict**
134
 
135
  Some servers are overzealous in their restrictions on the $_POST object and will block anything with certain keywords. Check your server logs and look for any 403 Forbidden or 500 Internal Server errors. If you notice these errors when submitting a form, contact your host and find out if there are any restrictions.
@@ -231,6 +237,24 @@ function my_scripts_method() {
231
 
232
  == Changelog ==
233
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  **Version 2.7.7 — Jul 16, 2013**
235
 
236
  * Fix bug where confirmation function fails
@@ -575,6 +599,9 @@ function my_scripts_method() {
575
 
576
  == Upgrade Notice ==
577
 
 
 
 
578
  = 2.7.7 =
579
  Fix bug where confirmation function fails
580
 
4
  Tags: form, forms, contact form, contact forms, form, forms, form to email, email form, email, input, validation, jquery, shortcode, form builder, contact form builder, form manager, form creator
5
  Requires at least: 3.5
6
  Tested up to: 3.6
7
+ Stable tag: 2.7.8
8
  License: GPLv2 or later
9
 
10
  Build beautiful, fully functional contact forms in only a few minutes without writing PHP, CSS, or HTML.
130
 
131
  If you find that emails are not being sent, you should first confirm that you have completed all of the details in the `Form Settings > Email section`. Next, be sure to set the Reply-To option to an email that exists on the same domain as your WordPress site.
132
 
133
+ **Set the Sender email to an email that exists on the domain**
134
+
135
+ In addition to the Reply-To header, some hosts require that the Sender header is also set to an email that exists on the domain. By default, the Sender email is automatically set to either your admin email if the domain matches. If it does not match, then a local email address is created (wordpress@yoursitename.com).
136
+
137
+ To change this behavior to use an email that exists on the domain, you will need to set the Sender Mail Header option on the `Visual Form Builder > Settings` page.
138
+
139
  **Possible mod_security conflict**
140
 
141
  Some servers are overzealous in their restrictions on the $_POST object and will block anything with certain keywords. Check your server logs and look for any 403 Forbidden or 500 Internal Server errors. If you notice these errors when submitting a form, contact your host and find out if there are any restrictions.
237
 
238
  == Changelog ==
239
 
240
+ **Version 2.7.8 — Aug 13, 2013**
241
+
242
+ * Add settings page with options for popular filters
243
+ * Add vfb_sender_mail_header, vfb_show_version filters
244
+ * Add an ID attribute to the form container div
245
+ * Update CSS enqueue to only load when form exists on the page
246
+ * Update list of user agent strings to test against in vfb_blocked_spam_bots
247
+ * Update email from names to use mb_encode_mimeheader for proper encoding
248
+ * Update padding on select elements
249
+ * Update Instructions field to include CSS Classes and Field Layout options
250
+ * Update form output to force bullets to hide, but only if list-style-type isn't set
251
+ * Update form output to only display the "for" attribute for certain fields
252
+ * Update Export to always download a file, even if no results are found
253
+ * Fix bug when sorting and field sequence is not properly set
254
+ * Fix bug when uploading an audio or video file in WordPress 3.6
255
+ * Deprecate spam check for empty user agent
256
+ * Remove texas from spam words
257
+
258
  **Version 2.7.7 — Jul 16, 2013**
259
 
260
  * Fix bug where confirmation function fails
599
 
600
  == Upgrade Notice ==
601
 
602
+ = 2.7.8 =
603
+ Add settings page. Update CSS enqueue to only load when form exists on the page
604
+
605
  = 2.7.7 =
606
  Fix bug where confirmation function fails
607
 
uninstall.php CHANGED
@@ -1,19 +1,20 @@
1
  <?php
2
- if ( !defined( 'WP_UNINSTALL_PLUGIN' ) )
3
- exit();
4
 
5
- global $wpdb;
6
 
7
- $form_table = $wpdb->prefix . 'visual_form_builder_fields';
8
- $fields_table = $wpdb->prefix . 'visual_form_builder_forms';
9
- $entries_table = $wpdb->prefix . 'visual_form_builder_entries';
10
 
11
- $wpdb->query( "DROP TABLE IF EXISTS $form_table" );
12
- $wpdb->query( "DROP TABLE IF EXISTS $fields_table" );
13
- $wpdb->query( "DROP TABLE IF EXISTS $entries_table" );
14
 
15
- delete_option( 'vfb_db_version' );
16
- delete_option( 'visual-form-builder-screen-options' );
17
- delete_option( 'vfb_dashboard_widget_options' );
 
18
 
19
- $wpdb->query( "DELETE FROM " . $wpdb->prefix . "usermeta WHERE meta_key IN ( 'vfb-form-settings', 'vfb_entries_per_page', 'vfb_forms_per_page', 'managevisual-form-builder_page_vfb-entriescolumnshidden' )" );
1
  <?php
2
+ if ( !defined( 'WP_UNINSTALL_PLUGIN' ) )
3
+ exit();
4
 
5
+ global $wpdb;
6
 
7
+ $form_table = $wpdb->prefix . 'visual_form_builder_fields';
8
+ $fields_table = $wpdb->prefix . 'visual_form_builder_forms';
9
+ $entries_table = $wpdb->prefix . 'visual_form_builder_entries';
10
 
11
+ $wpdb->query( "DROP TABLE IF EXISTS $form_table" );
12
+ $wpdb->query( "DROP TABLE IF EXISTS $fields_table" );
13
+ $wpdb->query( "DROP TABLE IF EXISTS $entries_table" );
14
 
15
+ delete_option( 'vfb_db_version' );
16
+ delete_option( 'visual-form-builder-screen-options' );
17
+ delete_option( 'vfb_dashboard_widget_options' );
18
+ delete_option( 'vfb-settings' );
19
 
20
+ $wpdb->query( "DELETE FROM " . $wpdb->prefix . "usermeta WHERE meta_key IN ( 'vfb-form-settings', 'vfb_entries_per_page', 'vfb_forms_per_page', 'managevisual-form-builder_page_vfb-entriescolumnshidden' )" );
visual-form-builder.php CHANGED
@@ -4,11 +4,11 @@ Plugin Name: Visual Form Builder
4
  Description: Dynamically build forms using a simple interface. Forms include jQuery validation, a basic logic-based verification system, and entry tracking.
5
  Author: Matthew Muro
6
  Author URI: http://matthewmuro.com
7
- Version: 2.7.7
8
  */
9
 
10
  // Version number to output as meta tag
11
- define( 'VFB_VERSION', '2.7.7' );
12
 
13
  /*
14
  This program is free software; you can redistribute it and/or modify
@@ -174,7 +174,13 @@ class Visual_Form_Builder{
174
  * @since 2.7.5
175
  */
176
  public function add_meta_keyword() {
177
- echo sprintf( "\n<meta name='vfb-version' content='%s' />\n", VFB_VERSION );
 
 
 
 
 
 
178
  }
179
 
180
  /**
@@ -440,7 +446,7 @@ class Visual_Form_Builder{
440
  'option' => 'vfb_entries_per_page'
441
  ) );
442
 
443
- break;
444
 
445
  case $page_main :
446
 
@@ -457,7 +463,7 @@ class Visual_Form_Builder{
457
  ) );
458
  endif;
459
 
460
- break;
461
  }
462
  }
463
 
@@ -469,9 +475,9 @@ class Visual_Form_Builder{
469
  public function save_screen_options( $status, $option, $value ){
470
 
471
  if ( $option == 'vfb_entries_per_page' )
472
- return $value;
473
  elseif ( $option == 'vfb_forms_per_page' )
474
- return $value;
475
  }
476
 
477
  /**
@@ -689,9 +695,32 @@ class Visual_Form_Builder{
689
  * @since 1.0
690
  */
691
  public function css() {
 
 
 
692
  wp_register_style( 'vfb-jqueryui-css', apply_filters( 'vfb-date-picker-css', plugins_url( '/css/smoothness/jquery-ui-1.9.2.min.css', __FILE__ ) ) );
693
  wp_register_style( 'visual-form-builder-css', apply_filters( 'visual-form-builder-css', plugins_url( "/css/visual-form-builder$this->load_dev_files.css", __FILE__ ) ) );
694
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
695
  wp_enqueue_style( 'visual-form-builder-css' );
696
  wp_enqueue_style( 'vfb-jqueryui-css' );
697
  }
@@ -711,319 +740,334 @@ class Visual_Form_Builder{
711
  if ( !isset( $_REQUEST['action'] ) )
712
  return;
713
 
714
- if ( in_array( $_REQUEST['page'], array( 'visual-form-builder', 'vfb-add-new', 'vfb-entries' ) ) ) :
715
- switch ( $_REQUEST['action'] ) :
716
- case 'create_form' :
717
 
718
- check_admin_referer( 'create_form' );
719
-
720
- $form_key = sanitize_title( $_REQUEST['form_title'] );
721
- $form_title = esc_html( $_REQUEST['form_title'] );
722
- $form_from_name = esc_html( $_REQUEST['form_email_from_name'] );
723
- $form_subject = esc_html( $_REQUEST['form_email_subject'] );
724
- $form_from = esc_html( $_REQUEST['form_email_from'] );
725
- $form_to = serialize( $_REQUEST['form_email_to'] );
726
-
727
- $newdata = array(
728
- 'form_key' => $form_key,
729
- 'form_title' => $form_title,
730
- 'form_email_from_name' => $form_from_name,
731
- 'form_email_subject' => $form_subject,
732
- 'form_email_from' => $form_from,
733
- 'form_email_to' => $form_to,
734
- 'form_success_message' => '<p id="form_success">Your form was successfully submitted. Thank you for contacting us.</p>'
735
- );
 
 
 
736
 
737
- // Create the form
738
- $wpdb->insert( $this->form_table_name, $newdata );
739
 
740
- // Get form ID to add our first field
741
- $new_form_selected = $wpdb->insert_id;
742
 
743
- // Setup the initial fieldset
744
- $initial_fieldset = array(
745
- 'form_id' => $wpdb->insert_id,
746
- 'field_key' => 'fieldset',
747
- 'field_type' => 'fieldset',
748
- 'field_name' => 'Fieldset',
749
- 'field_sequence' => 0
750
- );
751
 
752
- // Add the first fieldset to get things started
753
- $wpdb->insert( $this->field_table_name, $initial_fieldset );
754
 
755
- $verification_fieldset = array(
756
- 'form_id' => $new_form_selected,
757
- 'field_key' => 'verification',
758
- 'field_type' => 'verification',
759
- 'field_name' => 'Verification',
760
- 'field_description' => '(This is for preventing spam)',
761
- 'field_sequence' => 1
762
- );
763
 
764
- // Insert the submit field
765
- $wpdb->insert( $this->field_table_name, $verification_fieldset );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
766
 
767
- $verify_fieldset_parent_id = $wpdb->insert_id;
 
 
 
 
 
 
 
 
 
 
 
768
 
769
- $secret = array(
770
- 'form_id' => $new_form_selected,
771
- 'field_key' => 'secret',
772
- 'field_type' => 'secret',
773
- 'field_name' => 'Please enter any two digits',
774
- 'field_description' => 'Example: 12',
775
- 'field_size' => 'medium',
776
- 'field_required' => 'yes',
777
- 'field_parent' => $verify_fieldset_parent_id,
778
- 'field_sequence' => 2
779
- );
780
 
781
- // Insert the submit field
782
- $wpdb->insert( $this->field_table_name, $secret );
 
783
 
784
- // Make the submit last in the sequence
785
- $submit = array(
786
- 'form_id' => $new_form_selected,
787
- 'field_key' => 'submit',
788
- 'field_type' => 'submit',
789
- 'field_name' => 'Submit',
790
- 'field_parent' => $verify_fieldset_parent_id,
791
- 'field_sequence' => 3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
792
  );
793
 
794
- // Insert the submit field
795
- $wpdb->insert( $this->field_table_name, $submit );
 
 
 
 
 
796
 
797
- // Redirect to keep the URL clean (use AJAX in the future?)
798
- wp_redirect( 'admin.php?page=visual-form-builder&form=' . $new_form_selected );
799
- exit();
800
 
801
  break;
802
 
803
- case 'update_form' :
 
804
 
805
- check_admin_referer( 'vfb_update_form' );
806
-
807
- $form_id = absint( $_REQUEST['form_id'] );
808
- $form_key = sanitize_title( $_REQUEST['form_title'], $form_id );
809
- $form_title = $_REQUEST['form_title'];
810
- $form_subject = $_REQUEST['form_email_subject'];
811
- $form_to = serialize( array_map( 'sanitize_email', $_REQUEST['form_email_to'] ) );
812
- $form_from = sanitize_email( $_REQUEST['form_email_from'] );
813
- $form_from_name = $_REQUEST['form_email_from_name'];
814
- $form_from_override = isset( $_REQUEST['form_email_from_override'] ) ? $_REQUEST['form_email_from_override'] : '';
815
- $form_from_name_override = isset( $_REQUEST['form_email_from_name_override'] ) ? $_REQUEST['form_email_from_name_override'] : '';
816
- $form_success_type = $_REQUEST['form_success_type'];
817
- $form_notification_setting = isset( $_REQUEST['form_notification_setting'] ) ? $_REQUEST['form_notification_setting'] : '';
818
- $form_notification_email_name = isset( $_REQUEST['form_notification_email_name'] ) ? $_REQUEST['form_notification_email_name'] : '';
819
- $form_notification_email_from = isset( $_REQUEST['form_notification_email_from'] ) ? sanitize_email( $_REQUEST['form_notification_email_from'] ) : '';
820
- $form_notification_email = isset( $_REQUEST['form_notification_email'] ) ? $_REQUEST['form_notification_email'] : '';
821
- $form_notification_subject = isset( $_REQUEST['form_notification_subject'] ) ? $_REQUEST['form_notification_subject'] : '';
822
- $form_notification_message = isset( $_REQUEST['form_notification_message'] ) ? wp_richedit_pre( $_REQUEST['form_notification_message'] ) : '';
823
- $form_notification_entry = isset( $_REQUEST['form_notification_entry'] ) ? $_REQUEST['form_notification_entry'] : '';
824
- $form_label_alignment = $_REQUEST['form_label_alignment'];
825
-
826
- // Add confirmation based on which type was selected
827
- switch ( $form_success_type ) {
828
- case 'text' :
829
- $form_success_message = wp_richedit_pre( $_REQUEST['form_success_message_text'] );
830
- break;
831
- case 'page' :
832
- $form_success_message = $_REQUEST['form_success_message_page'];
833
- break;
834
- case 'redirect' :
835
- $form_success_message = $_REQUEST['form_success_message_redirect'];
836
- break;
837
- }
838
-
839
- $newdata = array(
840
- 'form_key' => $form_key,
841
- 'form_title' => $form_title,
842
- 'form_email_subject' => $form_subject,
843
- 'form_email_to' => $form_to,
844
- 'form_email_from' => $form_from,
845
- 'form_email_from_name' => $form_from_name,
846
- 'form_email_from_override' => $form_from_override,
847
- 'form_email_from_name_override' => $form_from_name_override,
848
- 'form_success_type' => $form_success_type,
849
- 'form_success_message' => $form_success_message,
850
- 'form_notification_setting' => $form_notification_setting,
851
- 'form_notification_email_name' => $form_notification_email_name,
852
- 'form_notification_email_from' => $form_notification_email_from,
853
- 'form_notification_email' => $form_notification_email,
854
- 'form_notification_subject' => $form_notification_subject,
855
- 'form_notification_message' => $form_notification_message,
856
- 'form_notification_entry' => $form_notification_entry,
857
- 'form_label_alignment' => $form_label_alignment
858
- );
859
 
860
- $where = array( 'form_id' => $form_id );
861
-
862
- // Update form details
863
- $wpdb->update( $this->form_table_name, $newdata, $where );
864
-
865
- $field_ids = array();
866
-
867
- // Get max post vars, if available. Otherwise set to 1000
868
- $max_post_vars = ( ini_get( 'max_input_vars' ) ) ? intval( ini_get( 'max_input_vars' ) ) : 1000;
869
-
870
- // Set a message to be displayed if we've reached a limit
871
- if ( count( $_POST, COUNT_RECURSIVE ) > $max_post_vars )
872
- $this->post_max_vars = true;
873
-
874
- foreach ( $_REQUEST['field_id'] as $fields ) :
875
- $field_ids[] = $fields;
876
- endforeach;
877
-
878
- // Initialize field sequence
879
- $field_sequence = 0;
880
-
881
- // Loop through each field and update
882
- foreach ( $field_ids as $id ) :
883
- $id = absint( $id );
884
-
885
- $field_name = ( isset( $_REQUEST['field_name-' . $id] ) ) ? trim( $_REQUEST['field_name-' . $id] ) : '';
886
- $field_key = sanitize_key( sanitize_title( $field_name, $id ) );
887
- $field_desc = ( isset( $_REQUEST['field_description-' . $id] ) ) ? trim( $_REQUEST['field_description-' . $id] ) : '';
888
- $field_options = ( isset( $_REQUEST['field_options-' . $id] ) ) ? serialize( array_map( 'trim', $_REQUEST['field_options-' . $id] ) ) : '';
889
- $field_validation = ( isset( $_REQUEST['field_validation-' . $id] ) ) ? $_REQUEST['field_validation-' . $id] : '';
890
- $field_required = ( isset( $_REQUEST['field_required-' . $id] ) ) ? $_REQUEST['field_required-' . $id] : '';
891
- $field_size = ( isset( $_REQUEST['field_size-' . $id] ) ) ? $_REQUEST['field_size-' . $id] : '';
892
- $field_css = ( isset( $_REQUEST['field_css-' . $id] ) ) ? $_REQUEST['field_css-' . $id] : '';
893
- $field_layout = ( isset( $_REQUEST['field_layout-' . $id] ) ) ? $_REQUEST['field_layout-' . $id] : '';
894
- $field_default = ( isset( $_REQUEST['field_default-' . $id] ) ) ? trim( $_REQUEST['field_default-' . $id] ) : '';
895
-
896
- $field_data = array(
897
- 'field_key' => $field_key,
898
- 'field_name' => $field_name,
899
- 'field_description' => $field_desc,
900
- 'field_options' => $field_options,
901
- 'field_validation' => $field_validation,
902
- 'field_required' => $field_required,
903
- 'field_size' => $field_size,
904
- 'field_css' => $field_css,
905
- 'field_layout' => $field_layout,
906
- 'field_sequence' => $field_sequence,
907
- 'field_default' => $field_default
908
- );
909
-
910
- $where = array(
911
- 'form_id' => $form_id,
912
- 'field_id' => $id
913
- );
914
-
915
- // Update all fields
916
- $wpdb->update( $this->field_table_name, $field_data, $where );
917
-
918
- $field_sequence++;
919
- endforeach;
920
 
921
  break;
922
 
923
- case 'delete_form' :
924
- $id = absint( $_REQUEST['form'] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
925
 
926
- check_admin_referer( 'delete-form-' . $id );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
927
 
928
- // Delete form and all fields
929
- $wpdb->query( $wpdb->prepare( "DELETE FROM $this->form_table_name WHERE form_id = %d", $id ) );
930
- $wpdb->query( $wpdb->prepare( "DELETE FROM $this->field_table_name WHERE form_id = %d", $id ) );
931
- $wpdb->query( $wpdb->prepare( "DELETE FROM $this->entries_table_name WHERE form_id = %d", $id ) );
932
 
933
- // Redirect to keep the URL clean (use AJAX in the future?)
934
- wp_redirect( add_query_arg( 'action', 'deleted', 'admin.php?page=visual-form-builder' ) );
935
- exit();
936
 
937
- break;
 
938
 
939
- case 'copy_form' :
940
- $id = absint( $_REQUEST['form'] );
941
-
942
- check_admin_referer( 'copy-form-' . $id );
943
-
944
- // Get all fields and data for the request form
945
- $fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $this->field_table_name WHERE form_id = %d", $id ) );
946
- $forms = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $this->form_table_name WHERE form_id = %d", $id ) );
947
- $override = $wpdb->get_var( $wpdb->prepare( "SELECT form_email_from_override, form_email_from_name_override, form_notification_email FROM $this->form_table_name WHERE form_id = %d", $id ) );
948
- $from_name = $wpdb->get_var( null, 1 );
949
- $notify = $wpdb->get_var( null, 2 );
950
-
951
- // Copy this form and force the initial title to denote a copy
952
- foreach ( $forms as $form ) {
953
- $data = array(
954
- 'form_key' => sanitize_title( $form->form_key . ' copy' ),
955
- 'form_title' => $form->form_title . ' Copy',
956
- 'form_email_subject' => $form->form_email_subject,
957
- 'form_email_to' => $form->form_email_to,
958
- 'form_email_from' => $form->form_email_from,
959
- 'form_email_from_name' => $form->form_email_from_name,
960
- 'form_email_from_override' => $form->form_email_from_override,
961
- 'form_email_from_name_override' => $form->form_email_from_name_override,
962
- 'form_success_type' => $form->form_success_type,
963
- 'form_success_message' => $form->form_success_message,
964
- 'form_notification_setting' => $form->form_notification_setting,
965
- 'form_notification_email_name' => $form->form_notification_email_name,
966
- 'form_notification_email_from' => $form->form_notification_email_from,
967
- 'form_notification_email' => $form->form_notification_email,
968
- 'form_notification_subject' => $form->form_notification_subject,
969
- 'form_notification_message' => $form->form_notification_message,
970
- 'form_notification_entry' => $form->form_notification_entry,
971
- 'form_label_alignment' => $form->form_label_alignment
972
- );
973
-
974
- $wpdb->insert( $this->form_table_name, $data );
975
- }
976
-
977
- // Get form ID to add our first field
978
- $new_form_selected = $wpdb->insert_id;
979
-
980
- // Copy each field and data
981
- foreach ( $fields as $field ) {
982
- $data = array(
983
- 'form_id' => $new_form_selected,
984
- 'field_key' => $field->field_key,
985
- 'field_type' => $field->field_type,
986
- 'field_name' => $field->field_name,
987
- 'field_description' => $field->field_description,
988
- 'field_options' => $field->field_options,
989
- 'field_sequence' => $field->field_sequence,
990
- 'field_validation' => $field->field_validation,
991
- 'field_required' => $field->field_required,
992
- 'field_size' => $field->field_size,
993
- 'field_css' => $field->field_css,
994
- 'field_layout' => $field->field_layout,
995
- 'field_parent' => $field->field_parent
996
- );
997
-
998
- $wpdb->insert( $this->field_table_name, $data );
999
-
1000
- // If a parent field, save the old ID and the new ID to update new parent ID
1001
- if ( in_array( $field->field_type, array( 'fieldset', 'section', 'verification' ) ) )
1002
- $parents[ $field->field_id ] = $wpdb->insert_id;
1003
-
1004
- if ( $override == $field->field_id )
1005
- $wpdb->update( $this->form_table_name, array( 'form_email_from_override' => $wpdb->insert_id ), array( 'form_id' => $new_form_selected ) );
1006
-
1007
- if ( $from_name == $field->field_id )
1008
- $wpdb->update( $this->form_table_name, array( 'form_email_from_name_override' => $wpdb->insert_id ), array( 'form_id' => $new_form_selected ) );
1009
-
1010
- if ( $notify == $field->field_id )
1011
- $wpdb->update( $this->form_table_name, array( 'form_notification_email' => $wpdb->insert_id ), array( 'form_id' => $new_form_selected ) );
1012
- }
1013
-
1014
- // Loop through our parents and update them to their new IDs
1015
- foreach ( $parents as $k => $v ) {
1016
- $wpdb->update( $this->field_table_name, array( 'field_parent' => $v ), array( 'form_id' => $new_form_selected, 'field_parent' => $k ) );
1017
- }
1018
 
1019
  break;
1020
 
1021
- case 'trash_entry' :
1022
- $entry_id = absint( $_GET['entry'] );
1023
- $wpdb->update( $this->entries_table_name, array( 'entry_approved' => 'trash' ), array( 'entries_id' => $entry_id ) );
1024
  break;
1025
- endswitch;
1026
- endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
1027
  }
1028
 
1029
  /**
@@ -1036,21 +1080,26 @@ class Visual_Form_Builder{
1036
 
1037
  $data = array();
1038
 
1039
- foreach ( $_REQUEST['order'] as $k ) {
1040
- if ( 'root' !== $k['item_id'] ) {
1041
  $data[] = array(
1042
  'field_id' => $k['item_id'],
1043
  'parent' => $k['parent_id']
1044
  );
1045
- }
1046
- }
1047
 
1048
- foreach ( $data as $k => $v ) {
1049
  // Update each field with it's new sequence and parent ID
1050
- $update = $wpdb->update( $this->field_table_name, array( 'field_sequence' => $k, 'field_parent' => $v['parent'] ), array( 'field_id' => $v['field_id'] ) );
1051
- }
 
 
 
 
 
1052
 
1053
- wp_die();
1054
  }
1055
 
1056
  /**
@@ -1081,29 +1130,29 @@ class Visual_Form_Builder{
1081
  case 'radio' :
1082
  case 'checkbox' :
1083
  $field_options = serialize( array( 'Option 1', 'Option 2', 'Option 3' ) );
1084
- break;
1085
 
1086
  case 'email' :
1087
  case 'url' :
1088
  case 'phone' :
1089
  $field_validation = $field_type;
1090
- break;
1091
 
1092
  case 'currency' :
1093
  $field_validation = 'number';
1094
- break;
1095
 
1096
  case 'number' :
1097
  $field_validation = 'digits';
1098
- break;
1099
 
1100
  case 'time' :
1101
  $field_validation = 'time-12';
1102
- break;
1103
 
1104
  case 'file-upload' :
1105
  $field_options = serialize( array( 'png|jpe?g|gif' ) );
1106
- break;
1107
  }
1108
 
1109
 
@@ -1345,6 +1394,7 @@ class Visual_Form_Builder{
1345
  $current_pages[ 'vfb-add-new' ] = add_submenu_page( 'visual-form-builder', __( 'Add New Form', 'visual-form-builder' ), __( 'Add New Form', 'visual-form-builder' ), 'manage_options', 'vfb-add-new', array( &$this, 'admin_add_new' ) );
1346
  $current_pages[ 'vfb-entries' ] = add_submenu_page( 'visual-form-builder', __( 'Entries', 'visual-form-builder' ), __( 'Entries', 'visual-form-builder' ), 'manage_options', 'vfb-entries', array( &$this, 'admin_entries' ) );
1347
  $current_pages[ 'vfb-export' ] = add_submenu_page( 'visual-form-builder', __( 'Export', 'visual-form-builder' ), __( 'Export', 'visual-form-builder' ), 'manage_options', 'vfb-export', array( &$this, 'admin_export' ) );
 
1348
 
1349
  // All plugin page load hooks
1350
  foreach ( $current_pages as $key => $page ) :
@@ -1445,6 +1495,84 @@ class Visual_Form_Builder{
1445
  <?php
1446
  }
1447
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1448
  /**
1449
  * Builds the options settings page
1450
  *
@@ -1609,29 +1737,29 @@ class Visual_Form_Builder{
1609
  case 'email' :
1610
  if ( !is_email( $data ) )
1611
  wp_die( "<h1>$name</h1><br>" . __( 'Not a valid email address', 'visual-form-builder' ), '', array( 'back_link' => true ) );
1612
- break;
1613
 
1614
  case 'number' :
1615
  case 'currency' :
1616
  if ( !is_numeric( $data ) )
1617
  wp_die( "<h1>$name</h1><br>" . __( 'Not a valid number', 'visual-form-builder' ), '', array( 'back_link' => true ) );
1618
- break;
1619
 
1620
  case 'phone' :
1621
  if ( strlen( $data ) > 9 && preg_match( '/^((\+)?[1-9]{1,2})?([-\s\.])?((\(\d{1,4}\))|\d{1,4})(([-\s\.])?[0-9]{1,12}){1,2}$/', $data ) )
1622
  return true;
1623
  else
1624
  wp_die( "<h1>$name</h1><br>" . __( 'Not a valid phone number. Most US/Canada and International formats accepted.', 'visual-form-builder' ), '', array( 'back_link' => true ) );
1625
- break;
1626
 
1627
  case 'url' :
1628
  if ( !preg_match( '|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $data ) )
1629
  wp_die( "<h1>$name</h1><br>" . __( 'Not a valid URL.', 'visual-form-builder' ), '', array( 'back_link' => true ) );
1630
- break;
1631
 
1632
  default :
1633
  return true;
1634
- break;
1635
 
1636
  endswitch;
1637
  endif;
@@ -1647,32 +1775,32 @@ class Visual_Form_Builder{
1647
  switch( $type ) :
1648
  case 'text' :
1649
  return sanitize_text_field( $data );
1650
- break;
1651
 
1652
  case 'textarea' :
1653
  return wp_strip_all_tags( $data );
1654
- break;
1655
 
1656
  case 'email' :
1657
  return sanitize_email( $data );
1658
- break;
1659
 
1660
  case 'html' :
1661
  return wp_kses_data( force_balance_tags( $data ) );
1662
- break;
1663
 
1664
  case 'number' :
1665
  return floatval( $data );
1666
- break;
1667
 
1668
  case 'address' :
1669
  $allowed_html = array( 'br' => array() );
1670
  return wp_kses( $data, $allowed_html );
1671
- break;
1672
 
1673
  default :
1674
  return wp_kses_data( $data );
1675
- break;
1676
  endswitch;
1677
  endif;
1678
  }
@@ -1683,20 +1811,26 @@ class Visual_Form_Builder{
1683
  * @since 1.3
1684
  */
1685
  public function isBot() {
1686
- $bots = apply_filters( 'vfb_blocked_spam_bots', array( 'archiver', 'binlar', 'casper', 'checkprivacy', 'clshttp', 'cmsworldmap', 'comodo', 'curl', 'diavol', 'dotbot', 'email', 'extract', 'feedfinder', 'flicky', 'grab', 'harvest', 'httrack', 'ia_archiver', 'jakarta', 'kmccrew', 'libwww', 'loader', 'miner', 'nikto', 'nutch', 'planetwork', 'purebot', 'pycurl', 'python', 'scan', 'skygrid', 'sucker', 'turnit', 'vikspider', 'wget', 'winhttp', 'youda', 'zmeu', 'zune' ) );
 
 
 
 
 
 
 
1687
 
1688
  $isBot = false;
1689
 
1690
- $user_agent = wp_kses_data( $_SERVER['HTTP_USER_AGENT'] );
 
 
1691
 
1692
  foreach ( $bots as $bot ) {
1693
  if ( stripos( $user_agent, $bot ) !== false )
1694
  $isBot = true;
1695
  }
1696
 
1697
- if ( empty( $user_agent ) || $user_agent == ' ' )
1698
- $isBot = true;
1699
-
1700
  return $isBot;
1701
  }
1702
 
@@ -1777,6 +1911,34 @@ class Visual_Form_Builder{
1777
 
1778
  return $output;
1779
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1780
  }
1781
 
1782
  // The VFB widget
4
  Description: Dynamically build forms using a simple interface. Forms include jQuery validation, a basic logic-based verification system, and entry tracking.
5
  Author: Matthew Muro
6
  Author URI: http://matthewmuro.com
7
+ Version: 2.7.8
8
  */
9
 
10
  // Version number to output as meta tag
11
+ define( 'VFB_VERSION', '2.7.8' );
12
 
13
  /*
14
  This program is free software; you can redistribute it and/or modify
174
  * @since 2.7.5
175
  */
176
  public function add_meta_keyword() {
177
+ // Get global settings
178
+ $vfb_settings = get_option( 'vfb-settings' );
179
+
180
+ // Settings - Disable meta tag version
181
+ $settings_meta = isset( $vfb_settings['show-version'] ) ? '' : '<!-- <meta name="vfb" version="'. VFB_VERSION . '" /> -->' . "\n";
182
+
183
+ echo apply_filters( 'vfb_show_version', $settings_meta );
184
  }
185
 
186
  /**
446
  'option' => 'vfb_entries_per_page'
447
  ) );
448
 
449
+ break;
450
 
451
  case $page_main :
452
 
463
  ) );
464
  endif;
465
 
466
+ break;
467
  }
468
  }
469
 
475
  public function save_screen_options( $status, $option, $value ){
476
 
477
  if ( $option == 'vfb_entries_per_page' )
478
+ return $value;
479
  elseif ( $option == 'vfb_forms_per_page' )
480
+ return $value;
481
  }
482
 
483
  /**
695
  * @since 1.0
696
  */
697
  public function css() {
698
+
699
+ $vfb_settings = get_option( 'vfb-settings' );
700
+
701
  wp_register_style( 'vfb-jqueryui-css', apply_filters( 'vfb-date-picker-css', plugins_url( '/css/smoothness/jquery-ui-1.9.2.min.css', __FILE__ ) ) );
702
  wp_register_style( 'visual-form-builder-css', apply_filters( 'visual-form-builder-css', plugins_url( "/css/visual-form-builder$this->load_dev_files.css", __FILE__ ) ) );
703
 
704
+ // Settings - Disable CSS
705
+ if ( isset( $vfb_settings['disable-css'] ) )
706
+ return;
707
+
708
+ // Get active widgets
709
+ $widget = is_active_widget( false, false, 'vfb_widget' );
710
+
711
+ // If no widget is found, test for shortcode
712
+ if ( empty( $widget ) ) {
713
+ // If WordPress 3.6, use internal function. Otherwise, my own
714
+ if ( function_exists( 'has_shortcode' ) ) {
715
+ global $post;
716
+
717
+ if ( !has_shortcode( $post->post_content, 'vfb' ) )
718
+ return;
719
+ } elseif ( !$this->has_shortcode( 'vfb' ) ) {
720
+ return;
721
+ }
722
+ }
723
+
724
  wp_enqueue_style( 'visual-form-builder-css' );
725
  wp_enqueue_style( 'vfb-jqueryui-css' );
726
  }
740
  if ( !isset( $_REQUEST['action'] ) )
741
  return;
742
 
743
+ if ( !in_array( $_REQUEST['page'], array( 'visual-form-builder', 'vfb-add-new', 'vfb-entries', 'vfb-settings' ) ) )
744
+ return;
 
745
 
746
+ switch ( $_REQUEST['action'] ) :
747
+ case 'create_form' :
748
+
749
+ check_admin_referer( 'create_form' );
750
+
751
+ $form_key = sanitize_title( $_REQUEST['form_title'] );
752
+ $form_title = esc_html( $_REQUEST['form_title'] );
753
+ $form_from_name = esc_html( $_REQUEST['form_email_from_name'] );
754
+ $form_subject = esc_html( $_REQUEST['form_email_subject'] );
755
+ $form_from = esc_html( $_REQUEST['form_email_from'] );
756
+ $form_to = serialize( $_REQUEST['form_email_to'] );
757
+
758
+ $newdata = array(
759
+ 'form_key' => $form_key,
760
+ 'form_title' => $form_title,
761
+ 'form_email_from_name' => $form_from_name,
762
+ 'form_email_subject' => $form_subject,
763
+ 'form_email_from' => $form_from,
764
+ 'form_email_to' => $form_to,
765
+ 'form_success_message' => '<p id="form_success">Your form was successfully submitted. Thank you for contacting us.</p>'
766
+ );
767
 
768
+ // Create the form
769
+ $wpdb->insert( $this->form_table_name, $newdata );
770
 
771
+ // Get form ID to add our first field
772
+ $new_form_selected = $wpdb->insert_id;
773
 
774
+ // Setup the initial fieldset
775
+ $initial_fieldset = array(
776
+ 'form_id' => $wpdb->insert_id,
777
+ 'field_key' => 'fieldset',
778
+ 'field_type' => 'fieldset',
779
+ 'field_name' => 'Fieldset',
780
+ 'field_sequence' => 0
781
+ );
782
 
783
+ // Add the first fieldset to get things started
784
+ $wpdb->insert( $this->field_table_name, $initial_fieldset );
785
 
786
+ $verification_fieldset = array(
787
+ 'form_id' => $new_form_selected,
788
+ 'field_key' => 'verification',
789
+ 'field_type' => 'verification',
790
+ 'field_name' => 'Verification',
791
+ 'field_description' => '(This is for preventing spam)',
792
+ 'field_sequence' => 1
793
+ );
794
 
795
+ // Insert the submit field
796
+ $wpdb->insert( $this->field_table_name, $verification_fieldset );
797
+
798
+ $verify_fieldset_parent_id = $wpdb->insert_id;
799
+
800
+ $secret = array(
801
+ 'form_id' => $new_form_selected,
802
+ 'field_key' => 'secret',
803
+ 'field_type' => 'secret',
804
+ 'field_name' => 'Please enter any two digits',
805
+ 'field_description' => 'Example: 12',
806
+ 'field_size' => 'medium',
807
+ 'field_required' => 'yes',
808
+ 'field_parent' => $verify_fieldset_parent_id,
809
+ 'field_sequence' => 2
810
+ );
811
 
812
+ // Insert the submit field
813
+ $wpdb->insert( $this->field_table_name, $secret );
814
+
815
+ // Make the submit last in the sequence
816
+ $submit = array(
817
+ 'form_id' => $new_form_selected,
818
+ 'field_key' => 'submit',
819
+ 'field_type' => 'submit',
820
+ 'field_name' => 'Submit',
821
+ 'field_parent' => $verify_fieldset_parent_id,
822
+ 'field_sequence' => 3
823
+ );
824
 
825
+ // Insert the submit field
826
+ $wpdb->insert( $this->field_table_name, $submit );
 
 
 
 
 
 
 
 
 
827
 
828
+ // Redirect to keep the URL clean (use AJAX in the future?)
829
+ wp_redirect( 'admin.php?page=visual-form-builder&form=' . $new_form_selected );
830
+ exit();
831
 
832
+ break;
833
+
834
+ case 'update_form' :
835
+
836
+ check_admin_referer( 'vfb_update_form' );
837
+
838
+ $form_id = absint( $_REQUEST['form_id'] );
839
+ $form_key = sanitize_title( $_REQUEST['form_title'], $form_id );
840
+ $form_title = $_REQUEST['form_title'];
841
+ $form_subject = $_REQUEST['form_email_subject'];
842
+ $form_to = serialize( array_map( 'sanitize_email', $_REQUEST['form_email_to'] ) );
843
+ $form_from = sanitize_email( $_REQUEST['form_email_from'] );
844
+ $form_from_name = $_REQUEST['form_email_from_name'];
845
+ $form_from_override = isset( $_REQUEST['form_email_from_override'] ) ? $_REQUEST['form_email_from_override'] : '';
846
+ $form_from_name_override = isset( $_REQUEST['form_email_from_name_override'] ) ? $_REQUEST['form_email_from_name_override'] : '';
847
+ $form_success_type = $_REQUEST['form_success_type'];
848
+ $form_notification_setting = isset( $_REQUEST['form_notification_setting'] ) ? $_REQUEST['form_notification_setting'] : '';
849
+ $form_notification_email_name = isset( $_REQUEST['form_notification_email_name'] ) ? $_REQUEST['form_notification_email_name'] : '';
850
+ $form_notification_email_from = isset( $_REQUEST['form_notification_email_from'] ) ? sanitize_email( $_REQUEST['form_notification_email_from'] ) : '';
851
+ $form_notification_email = isset( $_REQUEST['form_notification_email'] ) ? $_REQUEST['form_notification_email'] : '';
852
+ $form_notification_subject = isset( $_REQUEST['form_notification_subject'] ) ? $_REQUEST['form_notification_subject'] : '';
853
+ $form_notification_message = isset( $_REQUEST['form_notification_message'] ) ? wp_richedit_pre( $_REQUEST['form_notification_message'] ) : '';
854
+ $form_notification_entry = isset( $_REQUEST['form_notification_entry'] ) ? $_REQUEST['form_notification_entry'] : '';
855
+ $form_label_alignment = $_REQUEST['form_label_alignment'];
856
+
857
+ // Add confirmation based on which type was selected
858
+ switch ( $form_success_type ) {
859
+ case 'text' :
860
+ $form_success_message = wp_richedit_pre( $_REQUEST['form_success_message_text'] );
861
+ break;
862
+ case 'page' :
863
+ $form_success_message = $_REQUEST['form_success_message_page'];
864
+ break;
865
+ case 'redirect' :
866
+ $form_success_message = $_REQUEST['form_success_message_redirect'];
867
+ break;
868
+ }
869
+
870
+ $newdata = array(
871
+ 'form_key' => $form_key,
872
+ 'form_title' => $form_title,
873
+ 'form_email_subject' => $form_subject,
874
+ 'form_email_to' => $form_to,
875
+ 'form_email_from' => $form_from,
876
+ 'form_email_from_name' => $form_from_name,
877
+ 'form_email_from_override' => $form_from_override,
878
+ 'form_email_from_name_override' => $form_from_name_override,
879
+ 'form_success_type' => $form_success_type,
880
+ 'form_success_message' => $form_success_message,
881
+ 'form_notification_setting' => $form_notification_setting,
882
+ 'form_notification_email_name' => $form_notification_email_name,
883
+ 'form_notification_email_from' => $form_notification_email_from,
884
+ 'form_notification_email' => $form_notification_email,
885
+ 'form_notification_subject' => $form_notification_subject,
886
+ 'form_notification_message' => $form_notification_message,
887
+ 'form_notification_entry' => $form_notification_entry,
888
+ 'form_label_alignment' => $form_label_alignment
889
+ );
890
+
891
+ $where = array( 'form_id' => $form_id );
892
+
893
+ // Update form details
894
+ $wpdb->update( $this->form_table_name, $newdata, $where );
895
+
896
+ $field_ids = array();
897
+
898
+ // Get max post vars, if available. Otherwise set to 1000
899
+ $max_post_vars = ( ini_get( 'max_input_vars' ) ) ? intval( ini_get( 'max_input_vars' ) ) : 1000;
900
+
901
+ // Set a message to be displayed if we've reached a limit
902
+ if ( count( $_POST, COUNT_RECURSIVE ) > $max_post_vars )
903
+ $this->post_max_vars = true;
904
+
905
+ foreach ( $_REQUEST['field_id'] as $fields ) :
906
+ $field_ids[] = $fields;
907
+ endforeach;
908
+
909
+ // Initialize field sequence
910
+ $field_sequence = 0;
911
+
912
+ // Loop through each field and update
913
+ foreach ( $field_ids as $id ) :
914
+ $id = absint( $id );
915
+
916
+ $field_name = ( isset( $_REQUEST['field_name-' . $id] ) ) ? trim( $_REQUEST['field_name-' . $id] ) : '';
917
+ $field_key = sanitize_key( sanitize_title( $field_name, $id ) );
918
+ $field_desc = ( isset( $_REQUEST['field_description-' . $id] ) ) ? trim( $_REQUEST['field_description-' . $id] ) : '';
919
+ $field_options = ( isset( $_REQUEST['field_options-' . $id] ) ) ? serialize( array_map( 'trim', $_REQUEST['field_options-' . $id] ) ) : '';
920
+ $field_validation = ( isset( $_REQUEST['field_validation-' . $id] ) ) ? $_REQUEST['field_validation-' . $id] : '';
921
+ $field_required = ( isset( $_REQUEST['field_required-' . $id] ) ) ? $_REQUEST['field_required-' . $id] : '';
922
+ $field_size = ( isset( $_REQUEST['field_size-' . $id] ) ) ? $_REQUEST['field_size-' . $id] : '';
923
+ $field_css = ( isset( $_REQUEST['field_css-' . $id] ) ) ? $_REQUEST['field_css-' . $id] : '';
924
+ $field_layout = ( isset( $_REQUEST['field_layout-' . $id] ) ) ? $_REQUEST['field_layout-' . $id] : '';
925
+ $field_default = ( isset( $_REQUEST['field_default-' . $id] ) ) ? trim( $_REQUEST['field_default-' . $id] ) : '';
926
+
927
+ $field_data = array(
928
+ 'field_key' => $field_key,
929
+ 'field_name' => $field_name,
930
+ 'field_description' => $field_desc,
931
+ 'field_options' => $field_options,
932
+ 'field_validation' => $field_validation,
933
+ 'field_required' => $field_required,
934
+ 'field_size' => $field_size,
935
+ 'field_css' => $field_css,
936
+ 'field_layout' => $field_layout,
937
+ 'field_sequence' => $field_sequence,
938
+ 'field_default' => $field_default
939
  );
940
 
941
+ $where = array(
942
+ 'form_id' => $form_id,
943
+ 'field_id' => $id
944
+ );
945
+
946
+ // Update all fields
947
+ $wpdb->update( $this->field_table_name, $field_data, $where );
948
 
949
+ $field_sequence++;
950
+ endforeach;
 
951
 
952
  break;
953
 
954
+ case 'delete_form' :
955
+ $id = absint( $_REQUEST['form'] );
956
 
957
+ check_admin_referer( 'delete-form-' . $id );
958
+
959
+ // Delete form and all fields
960
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $this->form_table_name WHERE form_id = %d", $id ) );
961
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $this->field_table_name WHERE form_id = %d", $id ) );
962
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $this->entries_table_name WHERE form_id = %d", $id ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
963
 
964
+ // Redirect to keep the URL clean (use AJAX in the future?)
965
+ wp_redirect( add_query_arg( 'action', 'deleted', 'admin.php?page=visual-form-builder' ) );
966
+ exit();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
967
 
968
  break;
969
 
970
+ case 'copy_form' :
971
+ $id = absint( $_REQUEST['form'] );
972
+
973
+ check_admin_referer( 'copy-form-' . $id );
974
+
975
+ // Get all fields and data for the request form
976
+ $fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $this->field_table_name WHERE form_id = %d", $id ) );
977
+ $forms = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $this->form_table_name WHERE form_id = %d", $id ) );
978
+ $override = $wpdb->get_var( $wpdb->prepare( "SELECT form_email_from_override, form_email_from_name_override, form_notification_email FROM $this->form_table_name WHERE form_id = %d", $id ) );
979
+ $from_name = $wpdb->get_var( null, 1 );
980
+ $notify = $wpdb->get_var( null, 2 );
981
+
982
+ // Copy this form and force the initial title to denote a copy
983
+ foreach ( $forms as $form ) {
984
+ $data = array(
985
+ 'form_key' => sanitize_title( $form->form_key . ' copy' ),
986
+ 'form_title' => $form->form_title . ' Copy',
987
+ 'form_email_subject' => $form->form_email_subject,
988
+ 'form_email_to' => $form->form_email_to,
989
+ 'form_email_from' => $form->form_email_from,
990
+ 'form_email_from_name' => $form->form_email_from_name,
991
+ 'form_email_from_override' => $form->form_email_from_override,
992
+ 'form_email_from_name_override' => $form->form_email_from_name_override,
993
+ 'form_success_type' => $form->form_success_type,
994
+ 'form_success_message' => $form->form_success_message,
995
+ 'form_notification_setting' => $form->form_notification_setting,
996
+ 'form_notification_email_name' => $form->form_notification_email_name,
997
+ 'form_notification_email_from' => $form->form_notification_email_from,
998
+ 'form_notification_email' => $form->form_notification_email,
999
+ 'form_notification_subject' => $form->form_notification_subject,
1000
+ 'form_notification_message' => $form->form_notification_message,
1001
+ 'form_notification_entry' => $form->form_notification_entry,
1002
+ 'form_label_alignment' => $form->form_label_alignment
1003
+ );
1004
+
1005
+ $wpdb->insert( $this->form_table_name, $data );
1006
+ }
1007
+
1008
+ // Get form ID to add our first field
1009
+ $new_form_selected = $wpdb->insert_id;
1010
 
1011
+ // Copy each field and data
1012
+ foreach ( $fields as $field ) {
1013
+ $data = array(
1014
+ 'form_id' => $new_form_selected,
1015
+ 'field_key' => $field->field_key,
1016
+ 'field_type' => $field->field_type,
1017
+ 'field_name' => $field->field_name,
1018
+ 'field_description' => $field->field_description,
1019
+ 'field_options' => $field->field_options,
1020
+ 'field_sequence' => $field->field_sequence,
1021
+ 'field_validation' => $field->field_validation,
1022
+ 'field_required' => $field->field_required,
1023
+ 'field_size' => $field->field_size,
1024
+ 'field_css' => $field->field_css,
1025
+ 'field_layout' => $field->field_layout,
1026
+ 'field_parent' => $field->field_parent
1027
+ );
1028
 
1029
+ $wpdb->insert( $this->field_table_name, $data );
 
 
 
1030
 
1031
+ // If a parent field, save the old ID and the new ID to update new parent ID
1032
+ if ( in_array( $field->field_type, array( 'fieldset', 'section', 'verification' ) ) )
1033
+ $parents[ $field->field_id ] = $wpdb->insert_id;
1034
 
1035
+ if ( $override == $field->field_id )
1036
+ $wpdb->update( $this->form_table_name, array( 'form_email_from_override' => $wpdb->insert_id ), array( 'form_id' => $new_form_selected ) );
1037
 
1038
+ if ( $from_name == $field->field_id )
1039
+ $wpdb->update( $this->form_table_name, array( 'form_email_from_name_override' => $wpdb->insert_id ), array( 'form_id' => $new_form_selected ) );
1040
+
1041
+ if ( $notify == $field->field_id )
1042
+ $wpdb->update( $this->form_table_name, array( 'form_notification_email' => $wpdb->insert_id ), array( 'form_id' => $new_form_selected ) );
1043
+ }
1044
+
1045
+ // Loop through our parents and update them to their new IDs
1046
+ foreach ( $parents as $k => $v ) {
1047
+ $wpdb->update( $this->field_table_name, array( 'field_parent' => $v ), array( 'form_id' => $new_form_selected, 'field_parent' => $k ) );
1048
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1049
 
1050
  break;
1051
 
1052
+ case 'trash_entry' :
1053
+ $entry_id = absint( $_GET['entry'] );
1054
+ $wpdb->update( $this->entries_table_name, array( 'entry_approved' => 'trash' ), array( 'entries_id' => $entry_id ) );
1055
  break;
1056
+
1057
+ case 'vfb_settings' :
1058
+
1059
+ check_admin_referer( 'vfb-update-settings' );
1060
+
1061
+ $data = array();
1062
+
1063
+ foreach ( $_POST['vfb-settings'] as $key => $val ) {
1064
+ $data[ $key ] = esc_html( $val );
1065
+ }
1066
+
1067
+ update_option( 'vfb-settings', $data );
1068
+
1069
+ break;
1070
+ endswitch;
1071
  }
1072
 
1073
  /**
1080
 
1081
  $data = array();
1082
 
1083
+ foreach ( $_REQUEST['order'] as $k ) :
1084
+ if ( 'root' !== $k['item_id'] && !empty( $k['item_id'] ) ) :
1085
  $data[] = array(
1086
  'field_id' => $k['item_id'],
1087
  'parent' => $k['parent_id']
1088
  );
1089
+ endif;
1090
+ endforeach;
1091
 
1092
+ foreach ( $data as $k => $v ) :
1093
  // Update each field with it's new sequence and parent ID
1094
+ $wpdb->update( $this->field_table_name, array(
1095
+ 'field_sequence' => $k,
1096
+ 'field_parent' => $v['parent'] ),
1097
+ array( 'field_id' => $v['field_id'] ),
1098
+ '%d'
1099
+ );
1100
+ endforeach;
1101
 
1102
+ die(1);
1103
  }
1104
 
1105
  /**
1130
  case 'radio' :
1131
  case 'checkbox' :
1132
  $field_options = serialize( array( 'Option 1', 'Option 2', 'Option 3' ) );
1133
+ break;
1134
 
1135
  case 'email' :
1136
  case 'url' :
1137
  case 'phone' :
1138
  $field_validation = $field_type;
1139
+ break;
1140
 
1141
  case 'currency' :
1142
  $field_validation = 'number';
1143
+ break;
1144
 
1145
  case 'number' :
1146
  $field_validation = 'digits';
1147
+ break;
1148
 
1149
  case 'time' :
1150
  $field_validation = 'time-12';
1151
+ break;
1152
 
1153
  case 'file-upload' :
1154
  $field_options = serialize( array( 'png|jpe?g|gif' ) );
1155
+ break;
1156
  }
1157
 
1158
 
1394
  $current_pages[ 'vfb-add-new' ] = add_submenu_page( 'visual-form-builder', __( 'Add New Form', 'visual-form-builder' ), __( 'Add New Form', 'visual-form-builder' ), 'manage_options', 'vfb-add-new', array( &$this, 'admin_add_new' ) );
1395
  $current_pages[ 'vfb-entries' ] = add_submenu_page( 'visual-form-builder', __( 'Entries', 'visual-form-builder' ), __( 'Entries', 'visual-form-builder' ), 'manage_options', 'vfb-entries', array( &$this, 'admin_entries' ) );
1396
  $current_pages[ 'vfb-export' ] = add_submenu_page( 'visual-form-builder', __( 'Export', 'visual-form-builder' ), __( 'Export', 'visual-form-builder' ), 'manage_options', 'vfb-export', array( &$this, 'admin_export' ) );
1397
+ $current_pages[ 'vfb-settings' ] = add_submenu_page( 'visual-form-builder', __( 'Settings', 'visual-form-builder' ), __( 'Settings', 'visual-form-builder' ), 'manage_options', 'vfb-settings', array( &$this, 'admin_settings' ) );
1398
 
1399
  // All plugin page load hooks
1400
  foreach ( $current_pages as $key => $page ) :
1495
  <?php
1496
  }
1497
 
1498
+ /**
1499
+ * admin_settings function.
1500
+ *
1501
+ * @access public
1502
+ * @return void
1503
+ */
1504
+ public function admin_settings() {
1505
+
1506
+ $vfb_settings = get_option( 'vfb-settings' );
1507
+ ?>
1508
+ <div class="wrap">
1509
+ <?php screen_icon( 'themes' ); ?>
1510
+ <h2><?php _e( 'Settings', 'visual-form-builder' ); ?></h2>
1511
+ <form id="vfb-settings" method="post">
1512
+ <input name="action" type="hidden" value="vfb_settings" />
1513
+ <?php wp_nonce_field( 'vfb-update-settings' ); ?>
1514
+ <h3><?php _e( 'Global Settings', 'visual-form-builder' ); ?></h3>
1515
+ <p><?php _e( 'These settings will affect all forms on your site.', 'visual-form-builder' ); ?></p>
1516
+ <table class="form-table">
1517
+ <?php
1518
+ $disable = array(
1519
+ 'disable-css' => __( 'Disable CSS', 'visual-form-builder' ), // visual-form-builder-css
1520
+ 'address-labels' => __( 'Place Address labels above fields', 'visual-form-builder' ), // vfb_address_labels_placement
1521
+ 'show-version' => __( 'Disable meta tag version', 'visual-form-builder' ), // vfb_show_version
1522
+ );
1523
+
1524
+ foreach ( $disable as $key => $title ) :
1525
+
1526
+ $vfb_settings[ $key ] = isset( $vfb_settings[ $key ] ) ? $vfb_settings[ $key ] : '';
1527
+ ?>
1528
+ <tr valign="top">
1529
+ <th scope="row"><label for="vfb-settings-<?php echo $key; ?>"><?php echo $title; ?></label></th>
1530
+ <td>
1531
+ <?php $vfb_settings[ $key ] = isset( $vfb_settings[ $key ] ) ? $vfb_settings[ $key ] : 0; ?>
1532
+ <input type="checkbox" name="vfb-settings[<?php echo $key; ?>]" id="vfb-settings-<?php echo $key; ?>" value="1" <?php checked( $vfb_settings[ $key ], 1 ); ?> />
1533
+ </td>
1534
+ </tr>
1535
+ <?php endforeach; ?>
1536
+
1537
+ <tr valign="top">
1538
+ <th scope="row"><label for="vfb-settings-max-upload-size"><?php _e( 'Max Upload Size', 'visual-form-builder' ); ?></label></th>
1539
+ <td>
1540
+ <?php $vfb_settings['max-upload-size'] = isset( $vfb_settings['max-upload-size'] ) ? $vfb_settings['max-upload-size'] : '25'; ?>
1541
+ <input type="number" name="vfb-settings[max-upload-size]" id="vfb-settings-max-upload-size" value="<?php echo $vfb_settings['max-upload-size']; ?>" class="small-text" /> MB
1542
+ </td>
1543
+ </tr>
1544
+
1545
+ <tr valign="top">
1546
+ <th scope="row"><label for="vfb-settings-sender-mail-header"><?php _e( 'Sender Mail Header', 'visual-form-builder' ); ?></label></th>
1547
+ <td>
1548
+ <?php
1549
+ // Use the admin_email as the From email
1550
+ $from_email = get_site_option( 'admin_email' );
1551
+
1552
+ // Get the site domain and get rid of www.
1553
+ $sitename = strtolower( $_SERVER['SERVER_NAME'] );
1554
+ if ( substr( $sitename, 0, 4 ) == 'www.' )
1555
+ $sitename = substr( $sitename, 4 );
1556
+
1557
+ // Get the domain from the admin_email
1558
+ list( $user, $domain ) = explode( '@', $from_email );
1559
+
1560
+ // If site domain and admin_email domain match, use admin_email, otherwise a same domain email must be created
1561
+ $from_email = ( $sitename == $domain ) ? $from_email : "wordpress@$sitename";
1562
+
1563
+ $vfb_settings['sender-mail-header'] = isset( $vfb_settings['sender-mail-header'] ) ? $vfb_settings['sender-mail-header'] : $from_email;
1564
+ ?>
1565
+ <input type="text" name="vfb-settings[sender-mail-header]" id="vfb-settings-sender-mail-header" value="<?php echo $vfb_settings['sender-mail-header']; ?>" class="regular-text" />
1566
+ </td>
1567
+ </tr>
1568
+ </table>
1569
+
1570
+ <?php submit_button( __( 'Save', 'visual-form-builder' ), 'primary', 'submit', false ); ?>
1571
+ </form>
1572
+ </div>
1573
+ <?php
1574
+ }
1575
+
1576
  /**
1577
  * Builds the options settings page
1578
  *
1737
  case 'email' :
1738
  if ( !is_email( $data ) )
1739
  wp_die( "<h1>$name</h1><br>" . __( 'Not a valid email address', 'visual-form-builder' ), '', array( 'back_link' => true ) );
1740
+ break;
1741
 
1742
  case 'number' :
1743
  case 'currency' :
1744
  if ( !is_numeric( $data ) )
1745
  wp_die( "<h1>$name</h1><br>" . __( 'Not a valid number', 'visual-form-builder' ), '', array( 'back_link' => true ) );
1746
+ break;
1747
 
1748
  case 'phone' :
1749
  if ( strlen( $data ) > 9 && preg_match( '/^((\+)?[1-9]{1,2})?([-\s\.])?((\(\d{1,4}\))|\d{1,4})(([-\s\.])?[0-9]{1,12}){1,2}$/', $data ) )
1750
  return true;
1751
  else
1752
  wp_die( "<h1>$name</h1><br>" . __( 'Not a valid phone number. Most US/Canada and International formats accepted.', 'visual-form-builder' ), '', array( 'back_link' => true ) );
1753
+ break;
1754
 
1755
  case 'url' :
1756
  if ( !preg_match( '|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $data ) )
1757
  wp_die( "<h1>$name</h1><br>" . __( 'Not a valid URL.', 'visual-form-builder' ), '', array( 'back_link' => true ) );
1758
+ break;
1759
 
1760
  default :
1761
  return true;
1762
+ break;
1763
 
1764
  endswitch;
1765
  endif;
1775
  switch( $type ) :
1776
  case 'text' :
1777
  return sanitize_text_field( $data );
1778
+ break;
1779
 
1780
  case 'textarea' :
1781
  return wp_strip_all_tags( $data );
1782
+ break;
1783
 
1784
  case 'email' :
1785
  return sanitize_email( $data );
1786
+ break;
1787
 
1788
  case 'html' :
1789
  return wp_kses_data( force_balance_tags( $data ) );
1790
+ break;
1791
 
1792
  case 'number' :
1793
  return floatval( $data );
1794
+ break;
1795
 
1796
  case 'address' :
1797
  $allowed_html = array( 'br' => array() );
1798
  return wp_kses( $data, $allowed_html );
1799
+ break;
1800
 
1801
  default :
1802
  return wp_kses_data( $data );
1803
+ break;
1804
  endswitch;
1805
  endif;
1806
  }
1811
  * @since 1.3
1812
  */
1813
  public function isBot() {
1814
+ $bots = apply_filters( 'vfb_blocked_spam_bots', array(
1815
+ '<', '>', '&lt;', '%0A', '%0D', '%27', '%3C', '%3E', '%00', 'href',
1816
+ 'binlar', 'casper', 'cmsworldmap', 'comodo', 'diavol',
1817
+ 'dotbot', 'feedfinder', 'flicky', 'ia_archiver', 'jakarta',
1818
+ 'kmccrew', 'nutch', 'planetwork', 'purebot', 'pycurl',
1819
+ 'skygrid', 'sucker', 'turnit', 'vikspider', 'zmeu',
1820
+ )
1821
+ );
1822
 
1823
  $isBot = false;
1824
 
1825
+ $user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? wp_kses_data( $_SERVER['HTTP_USER_AGENT'] ) : '';
1826
+
1827
+ do_action( 'vfb_isBot', $user_agent, $bots );
1828
 
1829
  foreach ( $bots as $bot ) {
1830
  if ( stripos( $user_agent, $bot ) !== false )
1831
  $isBot = true;
1832
  }
1833
 
 
 
 
1834
  return $isBot;
1835
  }
1836
 
1911
 
1912
  return $output;
1913
  }
1914
+
1915
+ /**
1916
+ * Check whether the content contains the specified shortcode
1917
+ *
1918
+ * @access public
1919
+ * @param string $shortcode (default: '')
1920
+ * @return void
1921
+ */
1922
+ function has_shortcode($shortcode = '') {
1923
+
1924
+ $post_to_check = get_post(get_the_ID());
1925
+
1926
+ // false because we have to search through the post content first
1927
+ $found = false;
1928
+
1929
+ // if no short code was provided, return false
1930
+ if (!$shortcode) {
1931
+ return $found;
1932
+ }
1933
+ // check the post content for the short code
1934
+ if ( stripos($post_to_check->post_content, '[' . $shortcode) !== false ) {
1935
+ // we have found the short code
1936
+ $found = true;
1937
+ }
1938
+
1939
+ // return our final results
1940
+ return $found;
1941
+ }
1942
  }
1943
 
1944
  // The VFB widget